diff options
author | Kristian Monsen <kristianm@google.com> | 2010-07-30 10:46:49 +0100 |
---|---|---|
committer | Kristian Monsen <kristianm@google.com> | 2010-08-04 13:01:34 +0100 |
commit | 0617145a89917ae7735fe1c9538688ab9a577df5 (patch) | |
tree | 56206078694427c37ed7bdf27eb5221398b833c0 /JavaScriptCore/runtime | |
parent | ef1adcdfc805d4d13103f6f15cc5b4d96828a60f (diff) | |
download | external_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.zip external_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.tar.gz external_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.tar.bz2 |
Merge WebKit at r64264 : Initial merge by git.
Change-Id: Ic42bef02efef8217a0f84c47176a9c617c28d1f1
Diffstat (limited to 'JavaScriptCore/runtime')
-rw-r--r-- | JavaScriptCore/runtime/JSByteArray.h | 27 | ||||
-rw-r--r-- | JavaScriptCore/runtime/JSGlobalData.h | 3 | ||||
-rw-r--r-- | JavaScriptCore/runtime/JSGlobalObject.cpp | 12 | ||||
-rw-r--r-- | JavaScriptCore/runtime/RegExp.cpp | 3 | ||||
-rw-r--r-- | JavaScriptCore/runtime/TimeoutChecker.h | 1 |
5 files changed, 21 insertions, 25 deletions
diff --git a/JavaScriptCore/runtime/JSByteArray.h b/JavaScriptCore/runtime/JSByteArray.h index 5b7adcf..e9a6c64 100644 --- a/JavaScriptCore/runtime/JSByteArray.h +++ b/JavaScriptCore/runtime/JSByteArray.h @@ -45,25 +45,18 @@ namespace JSC { void setIndex(unsigned i, int value) { ASSERT(canAccessIndex(i)); - if (value & ~0xFF) { - if (value < 0) - value = 0; - else - value = 255; - } m_storage->data()[i] = static_cast<unsigned char>(value); } - + void setIndex(unsigned i, double value) { ASSERT(canAccessIndex(i)); - if (!(value > 0)) // Clamp NaN to 0 - value = 0; - else if (value > 255) - value = 255; - m_storage->data()[i] = static_cast<unsigned char>(value + 0.5); + // The largest integer value that a double can represent without loss of precision + // is 2^53. long long is the smallest integral type that gives correct results + // when casting numbers larger than 2^31 from a value of type double. + m_storage->data()[i] = static_cast<unsigned char>(static_cast<long long>(value)); } - + void setIndex(ExecState* exec, unsigned i, JSValue value) { double byteValue = value.toNumber(exec); @@ -75,7 +68,7 @@ namespace JSC { JSByteArray(ExecState* exec, NonNullPassRefPtr<Structure>, WTF::ByteArray* storage, const JSC::ClassInfo* = &s_defaultInfo); static PassRefPtr<Structure> createStructure(JSValue prototype); - + virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); virtual bool getOwnPropertySlot(JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&); virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); @@ -86,7 +79,7 @@ namespace JSC { virtual const ClassInfo* classInfo() const { return m_classInfo; } static const ClassInfo s_defaultInfo; - + size_t length() const { return m_storage->length(); } WTF::ByteArray* storage() const { return m_storage.get(); } @@ -100,7 +93,7 @@ namespace JSC { private: enum VPtrStealingHackType { VPtrStealingHack }; - JSByteArray(VPtrStealingHackType) + JSByteArray(VPtrStealingHackType) : JSObject(createStructure(jsNull())) , m_classInfo(0) { @@ -109,7 +102,7 @@ namespace JSC { RefPtr<WTF::ByteArray> m_storage; const ClassInfo* m_classInfo; }; - + JSByteArray* asByteArray(JSValue value); inline JSByteArray* asByteArray(JSValue value) { diff --git a/JavaScriptCore/runtime/JSGlobalData.h b/JavaScriptCore/runtime/JSGlobalData.h index 23b6b21..63f9ad8 100644 --- a/JavaScriptCore/runtime/JSGlobalData.h +++ b/JavaScriptCore/runtime/JSGlobalData.h @@ -41,6 +41,7 @@ #include "Terminator.h" #include "TimeoutChecker.h" #include "WeakRandom.h" +#include <wtf/BumpPointerAllocator.h> #include <wtf/Forward.h> #include <wtf/HashMap.h> #include <wtf/RefCounted.h> @@ -219,6 +220,8 @@ namespace JSC { RegExpCache* m_regExpCache; + BumpPointerAllocator m_regexAllocator; + #ifndef NDEBUG ThreadIdentifier exclusiveThread; #endif diff --git a/JavaScriptCore/runtime/JSGlobalObject.cpp b/JavaScriptCore/runtime/JSGlobalObject.cpp index 69e09c1..c317e13 100644 --- a/JavaScriptCore/runtime/JSGlobalObject.cpp +++ b/JavaScriptCore/runtime/JSGlobalObject.cpp @@ -291,12 +291,12 @@ void JSGlobalObject::reset(JSValue prototype) putDirectFunctionWithoutTransition(Identifier(exec, "Date"), dateConstructor, DontEnum); putDirectFunctionWithoutTransition(Identifier(exec, "RegExp"), d()->regExpConstructor, DontEnum); putDirectFunctionWithoutTransition(Identifier(exec, "Error"), d()->errorConstructor, DontEnum); - putDirectFunctionWithoutTransition(Identifier(exec, "EvalError"), d()->evalErrorConstructor); - putDirectFunctionWithoutTransition(Identifier(exec, "RangeError"), d()->rangeErrorConstructor); - putDirectFunctionWithoutTransition(Identifier(exec, "ReferenceError"), d()->referenceErrorConstructor); - putDirectFunctionWithoutTransition(Identifier(exec, "SyntaxError"), d()->syntaxErrorConstructor); - putDirectFunctionWithoutTransition(Identifier(exec, "TypeError"), d()->typeErrorConstructor); - putDirectFunctionWithoutTransition(Identifier(exec, "URIError"), d()->URIErrorConstructor); + putDirectFunctionWithoutTransition(Identifier(exec, "EvalError"), d()->evalErrorConstructor, DontEnum); + putDirectFunctionWithoutTransition(Identifier(exec, "RangeError"), d()->rangeErrorConstructor, DontEnum); + putDirectFunctionWithoutTransition(Identifier(exec, "ReferenceError"), d()->referenceErrorConstructor, DontEnum); + putDirectFunctionWithoutTransition(Identifier(exec, "SyntaxError"), d()->syntaxErrorConstructor, DontEnum); + putDirectFunctionWithoutTransition(Identifier(exec, "TypeError"), d()->typeErrorConstructor, DontEnum); + putDirectFunctionWithoutTransition(Identifier(exec, "URIError"), d()->URIErrorConstructor, DontEnum); // Set global values. GlobalPropertyInfo staticGlobals[] = { diff --git a/JavaScriptCore/runtime/RegExp.cpp b/JavaScriptCore/runtime/RegExp.cpp index d8b217d..59e3f35 100644 --- a/JavaScriptCore/runtime/RegExp.cpp +++ b/JavaScriptCore/runtime/RegExp.cpp @@ -85,8 +85,7 @@ void RegExp::compile(JSGlobalData* globalData) #if ENABLE(YARR_JIT) Yarr::jitCompileRegex(globalData, m_regExpJITCode, m_pattern, m_numSubpatterns, m_constructionError, ignoreCase(), multiline()); #else - UNUSED_PARAM(globalData); - m_regExpBytecode.set(Yarr::byteCompileRegex(m_pattern, m_numSubpatterns, m_constructionError, ignoreCase(), multiline())); + m_regExpBytecode = Yarr::byteCompileRegex(m_pattern, m_numSubpatterns, m_constructionError, &globalData->m_regexAllocator, ignoreCase(), multiline()); #endif } diff --git a/JavaScriptCore/runtime/TimeoutChecker.h b/JavaScriptCore/runtime/TimeoutChecker.h index 18bc36b..71ce169 100644 --- a/JavaScriptCore/runtime/TimeoutChecker.h +++ b/JavaScriptCore/runtime/TimeoutChecker.h @@ -44,6 +44,7 @@ namespace JSC { TimeoutChecker(); void setTimeoutInterval(unsigned timeoutInterval) { m_timeoutInterval = timeoutInterval; } + unsigned timeoutInterval() const { return m_timeoutInterval; } unsigned ticksUntilNextCheck() { return m_ticksUntilNextCheck; } |