Changeset 34170 in webkit for trunk/JavaScriptCore/kjs/JSImmediate.h
- Timestamp:
- May 28, 2008, 2:47:29 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/JSImmediate.h
r34149 r34170 119 119 } 120 120 121 static ALWAYS_INLINE bool canDoFastAdditiveOperations(const JSValue* v) 122 { 123 // Number is positive and an operation involving two of these can't overflow. 124 // Checking for allowed negative numbers takes more time than it's worth on SunSpider. 125 return (reinterpret_cast<uintptr_t>(v) & (NumberType + (3 << 30))) == NumberType; 126 } 127 128 static ALWAYS_INLINE JSValue* addImmediateNumbers(const JSValue* v1, const JSValue* v2) 129 { 130 ASSERT(canDoFastAdditiveOperations(v1)); 131 ASSERT(canDoFastAdditiveOperations(v2)); 132 return reinterpret_cast<JSValue*>(reinterpret_cast<uintptr_t>(v1) + (reinterpret_cast<uintptr_t>(v2) & ~NumberType)); 133 } 134 135 static ALWAYS_INLINE JSValue* subImmediateNumbers(const JSValue* v1, const JSValue* v2) 136 { 137 ASSERT(canDoFastAdditiveOperations(v1)); 138 ASSERT(canDoFastAdditiveOperations(v2)); 139 return reinterpret_cast<JSValue*>(reinterpret_cast<uintptr_t>(v1) - (reinterpret_cast<uintptr_t>(v2) & ~NumberType)); 140 } 141 121 142 static double toDouble(const JSValue*); 122 143 static bool toBoolean(const JSValue*);
Note:
See TracChangeset
for help on using the changeset viewer.