From 28040489d744e0c5d475a88663056c9040ed5320 Mon Sep 17 00:00:00 2001 From: Teng-Hui Zhu Date: Wed, 10 Nov 2010 15:31:59 -0800 Subject: Merge WebKit at r71558: Initial merge by git. Change-Id: Ib345578fa29df7e4bc72b4f00e4a6fddcb754c4c --- JavaScriptCore/runtime/Identifier.cpp | 4 +- JavaScriptCore/runtime/JSImmediate.h | 94 ----------------------------------- JavaScriptCore/runtime/JSObject.h | 2 +- JavaScriptCore/runtime/JSString.h | 2 +- JavaScriptCore/runtime/JSZombie.cpp | 2 +- JavaScriptCore/runtime/Lookup.cpp | 2 +- 6 files changed, 6 insertions(+), 100 deletions(-) (limited to 'JavaScriptCore/runtime') diff --git a/JavaScriptCore/runtime/Identifier.cpp b/JavaScriptCore/runtime/Identifier.cpp index d375eff..d4069ba 100644 --- a/JavaScriptCore/runtime/Identifier.cpp +++ b/JavaScriptCore/runtime/Identifier.cpp @@ -101,7 +101,7 @@ struct IdentifierCStringTranslator { { size_t length = strlen(c); UChar* d; - StringImpl* r = StringImpl::createUninitialized(length, d).releaseRef(); + StringImpl* r = StringImpl::createUninitialized(length, d).leakRef(); for (size_t i = 0; i != length; i++) d[i] = static_cast(c[i]); // use unsigned char to zero-extend instead of sign-extend r->setHash(hash); @@ -160,7 +160,7 @@ struct IdentifierUCharBufferTranslator { static void translate(StringImpl*& location, const UCharBuffer& buf, unsigned hash) { UChar* d; - StringImpl* r = StringImpl::createUninitialized(buf.length, d).releaseRef(); + StringImpl* r = StringImpl::createUninitialized(buf.length, d).leakRef(); for (unsigned i = 0; i != buf.length; i++) d[i] = buf.s[i]; r->setHash(hash); diff --git a/JavaScriptCore/runtime/JSImmediate.h b/JavaScriptCore/runtime/JSImmediate.h index ffa446e..68ba75c 100644 --- a/JavaScriptCore/runtime/JSImmediate.h +++ b/JavaScriptCore/runtime/JSImmediate.h @@ -39,7 +39,6 @@ namespace JSC { class ExecState; class JSCell; - class JSFastMath; class JSGlobalData; class JSObject; class UString; @@ -133,7 +132,6 @@ namespace JSC { private: friend class JIT; friend class JSValue; - friend class JSFastMath; friend class JSInterfaceJIT; friend class SpecializedThunkJIT; friend JSValue jsNumber(ExecState* exec, double d); @@ -563,98 +561,6 @@ namespace JSC { return JSImmediate::getTruncatedUInt32(asValue()); } - class JSFastMath { - public: - static ALWAYS_INLINE bool canDoFastBitwiseOperations(JSValue v1, JSValue v2) - { - return JSImmediate::areBothImmediateIntegerNumbers(v1, v2); - } - - static ALWAYS_INLINE JSValue equal(JSValue v1, JSValue v2) - { - ASSERT(canDoFastBitwiseOperations(v1, v2)); - return jsBoolean(v1 == v2); - } - - static ALWAYS_INLINE JSValue notEqual(JSValue v1, JSValue v2) - { - ASSERT(canDoFastBitwiseOperations(v1, v2)); - return jsBoolean(v1 != v2); - } - - static ALWAYS_INLINE JSValue andImmediateNumbers(JSValue v1, JSValue v2) - { - ASSERT(canDoFastBitwiseOperations(v1, v2)); - return JSImmediate::makeValue(JSImmediate::rawValue(v1) & JSImmediate::rawValue(v2)); - } - - static ALWAYS_INLINE JSValue xorImmediateNumbers(JSValue v1, JSValue v2) - { - ASSERT(canDoFastBitwiseOperations(v1, v2)); - return JSImmediate::makeValue((JSImmediate::rawValue(v1) ^ JSImmediate::rawValue(v2)) | JSImmediate::TagTypeNumber); - } - - static ALWAYS_INLINE JSValue orImmediateNumbers(JSValue v1, JSValue v2) - { - ASSERT(canDoFastBitwiseOperations(v1, v2)); - return JSImmediate::makeValue(JSImmediate::rawValue(v1) | JSImmediate::rawValue(v2)); - } - - static ALWAYS_INLINE bool canDoFastRshift(JSValue v1, JSValue v2) - { - return JSImmediate::areBothImmediateIntegerNumbers(v1, v2); - } - - static ALWAYS_INLINE bool canDoFastUrshift(JSValue v1, JSValue v2) - { - return JSImmediate::areBothImmediateIntegerNumbers(v1, v2) && !(JSImmediate::rawValue(v1) & JSImmediate::signBit); - } - - static ALWAYS_INLINE JSValue rightShiftImmediateNumbers(JSValue val, JSValue shift) - { - ASSERT(canDoFastRshift(val, shift) || canDoFastUrshift(val, shift)); - return JSImmediate::makeValue(static_cast(static_cast(static_cast(JSImmediate::rawValue(val)) >> ((JSImmediate::rawValue(shift) >> JSImmediate::IntegerPayloadShift) & 0x1f))) | JSImmediate::TagTypeNumber); - } - - static ALWAYS_INLINE bool canDoFastAdditiveOperations(JSValue v) - { - // Number is non-negative and an operation involving two of these can't overflow. - // Checking for allowed negative numbers takes more time than it's worth on SunSpider. - return (JSImmediate::rawValue(v) & (JSImmediate::TagTypeNumber + (JSImmediate::signBit | (JSImmediate::signBit >> 1)))) == JSImmediate::TagTypeNumber; - } - - static ALWAYS_INLINE bool canDoFastAdditiveOperations(JSValue v1, JSValue v2) - { - // Number is non-negative and an operation involving two of these can't overflow. - // Checking for allowed negative numbers takes more time than it's worth on SunSpider. - return canDoFastAdditiveOperations(v1) && canDoFastAdditiveOperations(v2); - } - - static ALWAYS_INLINE JSValue addImmediateNumbers(JSValue v1, JSValue v2) - { - ASSERT(canDoFastAdditiveOperations(v1, v2)); - return JSImmediate::makeValue(JSImmediate::rawValue(v1) + JSImmediate::rawValue(v2) - JSImmediate::TagTypeNumber); - } - - static ALWAYS_INLINE JSValue subImmediateNumbers(JSValue v1, JSValue v2) - { - ASSERT(canDoFastAdditiveOperations(v1, v2)); - return JSImmediate::makeValue(JSImmediate::rawValue(v1) - JSImmediate::rawValue(v2) + JSImmediate::TagTypeNumber); - } - - static ALWAYS_INLINE JSValue incImmediateNumber(JSValue v) - { - ASSERT(canDoFastAdditiveOperations(v)); - return JSImmediate::makeValue(JSImmediate::rawValue(v) + (1 << JSImmediate::IntegerPayloadShift)); - } - - static ALWAYS_INLINE JSValue decImmediateNumber(JSValue v) - { - ASSERT(canDoFastAdditiveOperations(v)); - return JSImmediate::makeValue(JSImmediate::rawValue(v) - (1 << JSImmediate::IntegerPayloadShift)); - } - }; - } // namespace JSC #endif // USE(JSVALUE64) diff --git a/JavaScriptCore/runtime/JSObject.h b/JavaScriptCore/runtime/JSObject.h index 8981469..f484ce4 100644 --- a/JavaScriptCore/runtime/JSObject.h +++ b/JavaScriptCore/runtime/JSObject.h @@ -340,7 +340,7 @@ inline void JSObject::setPrototype(JSValue prototype) inline void JSObject::setStructure(NonNullPassRefPtr structure) { m_structure->deref(); - m_structure = structure.releaseRef(); // ~JSObject balances this ref() + m_structure = structure.leakRef(); // ~JSObject balances this ref() } inline Structure* JSObject::inheritorID() diff --git a/JavaScriptCore/runtime/JSString.h b/JavaScriptCore/runtime/JSString.h index 4d81a2f..51b9f2d 100644 --- a/JavaScriptCore/runtime/JSString.h +++ b/JavaScriptCore/runtime/JSString.h @@ -216,7 +216,7 @@ namespace JSC { , m_length(rope->length()) , m_fiberCount(1) { - m_other.m_fibers[0] = rope.releaseRef(); + m_other.m_fibers[0] = rope.leakRef(); } // This constructor constructs a new string by concatenating s1 & s2. // This should only be called with fiberCount <= 3. diff --git a/JavaScriptCore/runtime/JSZombie.cpp b/JavaScriptCore/runtime/JSZombie.cpp index 22aabb9..8a36bda 100644 --- a/JavaScriptCore/runtime/JSZombie.cpp +++ b/JavaScriptCore/runtime/JSZombie.cpp @@ -37,7 +37,7 @@ Structure* JSZombie::leakedZombieStructure() { static Structure* structure = 0; if (!structure) { Structure::startIgnoringLeaks(); - structure = Structure::create(jsNull(), TypeInfo(UnspecifiedType), 0).releaseRef(); + structure = Structure::create(jsNull(), TypeInfo(UnspecifiedType), 0).leakRef(); Structure::stopIgnoringLeaks(); } return structure; diff --git a/JavaScriptCore/runtime/Lookup.cpp b/JavaScriptCore/runtime/Lookup.cpp index 07416af..dac1c94 100644 --- a/JavaScriptCore/runtime/Lookup.cpp +++ b/JavaScriptCore/runtime/Lookup.cpp @@ -34,7 +34,7 @@ void HashTable::createTable(JSGlobalData* globalData) const for (int i = 0; i < compactSize; ++i) entries[i].setKey(0); for (int i = 0; values[i].key; ++i) { - StringImpl* identifier = Identifier::add(globalData, values[i].key).releaseRef(); + StringImpl* identifier = Identifier::add(globalData, values[i].key).leakRef(); int hashIndex = identifier->existingHash() & compactHashSizeMask; HashEntry* entry = &entries[hashIndex]; -- cgit v1.1