Changeset 209030 in webkit
- Timestamp:
- Nov 28, 2016 3:23:40 PM (7 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r209028 r209030 1 2016-11-28 Mark Lam <mark.lam@apple.com> 2 3 Fix exception scope verification failures in runtime/Operations.cpp/h. 4 https://bugs.webkit.org/show_bug.cgi?id=165046 5 6 Reviewed by Saam Barati. 7 8 Also switched to using returning { } instead of JSValue(). 9 10 * runtime/Operations.cpp: 11 (JSC::jsAddSlowCase): 12 (JSC::jsIsObjectTypeOrNull): 13 * runtime/Operations.h: 14 (JSC::jsStringFromRegisterArray): 15 (JSC::jsStringFromArguments): 16 (JSC::jsLess): 17 (JSC::jsLessEq): 18 1 19 2016-11-28 Mark Lam <mark.lam@apple.com> 2 20 -
trunk/Source/JavaScriptCore/runtime/Operations.cpp
r206386 r209030 47 47 auto scope = DECLARE_THROW_SCOPE(vm); 48 48 JSValue p1 = v1.toPrimitive(callFrame); 49 RETURN_IF_EXCEPTION(scope, JSValue());49 RETURN_IF_EXCEPTION(scope, { }); 50 50 JSValue p2 = v2.toPrimitive(callFrame); 51 RETURN_IF_EXCEPTION(scope, JSValue());51 RETURN_IF_EXCEPTION(scope, { }); 52 52 53 if (p1.isString()) 54 return jsString(callFrame, asString(p1), p2.toString(callFrame)); 53 if (p1.isString()) { 54 JSString* p2String = p2.toString(callFrame); 55 RETURN_IF_EXCEPTION(scope, { }); 56 scope.release(); 57 return jsString(callFrame, asString(p1), p2String); 58 } 55 59 56 if (p2.isString()) 57 return jsString(callFrame, p1.toString(callFrame), asString(p2)); 60 if (p2.isString()) { 61 JSString* p1String = p1.toString(callFrame); 62 RETURN_IF_EXCEPTION(scope, { }); 63 scope.release(); 64 return jsString(callFrame, p1String, asString(p2)); 65 } 58 66 59 return jsNumber(p1.toNumber(callFrame) + p2.toNumber(callFrame)); 67 double p1Number = p1.toNumber(callFrame); 68 RETURN_IF_EXCEPTION(scope, { }); 69 scope.release(); 70 return jsNumber(p1Number + p2.toNumber(callFrame)); 60 71 } 61 72 … … 97 108 bool jsIsObjectTypeOrNull(CallFrame* callFrame, JSValue v) 98 109 { 110 VM& vm = callFrame->vm(); 99 111 if (!v.isCell()) 100 112 return v.isNull(); … … 104 116 return false; 105 117 if (type >= ObjectType) { 106 if (asObject(v)->structure( callFrame->vm())->masqueradesAsUndefined(callFrame->lexicalGlobalObject()))118 if (asObject(v)->structure(vm)->masqueradesAsUndefined(callFrame->lexicalGlobalObject())) 107 119 return false; 108 120 CallData callData; 109 121 JSObject* object = asObject(v); 110 if (object->methodTable( callFrame->vm())->getCallData(object, callData) != CallType::None)122 if (object->methodTable(vm)->getCallData(object, callData) != CallType::None) 111 123 return false; 112 124 } -
trunk/Source/JavaScriptCore/runtime/Operations.h
r206525 r209030 127 127 for (unsigned i = 0; i < count; ++i) { 128 128 JSValue v = strings[-static_cast<int>(i)].jsValue(); 129 if (!ropeBuilder.append(v.toString(exec))) 129 JSString* string = v.toString(exec); 130 RETURN_IF_EXCEPTION(scope, { }); 131 if (!ropeBuilder.append(string)) 130 132 return throwOutOfMemoryError(exec, scope); 131 133 } … … 139 141 auto scope = DECLARE_THROW_SCOPE(*vm); 140 142 JSRopeString::RopeBuilder ropeBuilder(*vm); 141 ropeBuilder.append(thisValue.toString(exec)); 143 JSString* str = thisValue.toString(exec); 144 RETURN_IF_EXCEPTION(scope, { }); 145 ropeBuilder.append(str); 142 146 143 147 for (unsigned i = 0; i < exec->argumentCount(); ++i) { 144 148 JSValue v = exec->argument(i); 145 if (!ropeBuilder.append(v.toString(exec))) 149 JSString* str = v.toString(exec); 150 RETURN_IF_EXCEPTION(scope, { }); 151 if (UNLIKELY(!ropeBuilder.append(str))) 146 152 return throwOutOfMemoryError(exec, scope); 147 153 } … … 156 162 ALWAYS_INLINE bool jsLess(CallFrame* callFrame, JSValue v1, JSValue v2) 157 163 { 164 VM& vm = callFrame->vm(); 165 auto scope = DECLARE_THROW_SCOPE(vm); 166 158 167 if (v1.isInt32() && v2.isInt32()) 159 168 return v1.asInt32() < v2.asInt32(); … … 173 182 if (leftFirst) { 174 183 wasNotString1 = v1.getPrimitiveNumber(callFrame, n1, p1); 184 RETURN_IF_EXCEPTION(scope, false); 175 185 wasNotString2 = v2.getPrimitiveNumber(callFrame, n2, p2); 176 186 } else { 177 187 wasNotString2 = v2.getPrimitiveNumber(callFrame, n2, p2); 178 wasNotString1 = v1.getPrimitiveNumber(callFrame, n1, p1); 179 } 188 RETURN_IF_EXCEPTION(scope, false); 189 wasNotString1 = v1.getPrimitiveNumber(callFrame, n1, p1); 190 } 191 RETURN_IF_EXCEPTION(scope, false); 180 192 181 193 if (wasNotString1 | wasNotString2) … … 190 202 ALWAYS_INLINE bool jsLessEq(CallFrame* callFrame, JSValue v1, JSValue v2) 191 203 { 204 VM& vm = callFrame->vm(); 205 auto scope = DECLARE_THROW_SCOPE(vm); 206 192 207 if (v1.isInt32() && v2.isInt32()) 193 208 return v1.asInt32() <= v2.asInt32(); … … 207 222 if (leftFirst) { 208 223 wasNotString1 = v1.getPrimitiveNumber(callFrame, n1, p1); 224 RETURN_IF_EXCEPTION(scope, false); 209 225 wasNotString2 = v2.getPrimitiveNumber(callFrame, n2, p2); 210 226 } else { 211 227 wasNotString2 = v2.getPrimitiveNumber(callFrame, n2, p2); 212 wasNotString1 = v1.getPrimitiveNumber(callFrame, n1, p1); 213 } 228 RETURN_IF_EXCEPTION(scope, false); 229 wasNotString1 = v1.getPrimitiveNumber(callFrame, n1, p1); 230 } 231 RETURN_IF_EXCEPTION(scope, false); 214 232 215 233 if (wasNotString1 | wasNotString2)
Note: See TracChangeset
for help on using the changeset viewer.