Changeset 262165 in webkit
- Timestamp:
- May 26, 2020 3:16:10 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r262100 r262165 1 2020-05-26 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 IteratorClose should suppress GetMethod errors 4 https://bugs.webkit.org/show_bug.cgi?id=212378 5 6 Reviewed by Keith Miller. 7 8 * stress/custom-iterators.js: 9 * stress/iterator-return-abrupt-lookup-builtins.js: Added. 10 * test262/expectations.yaml: Mark 4 test cases as passing. 11 1 12 2020-05-23 Caio Lima <ticaiolima@gmail.com> 2 13 -
trunk/JSTests/stress/custom-iterators.js
r260323 r262165 136 136 } 137 137 } catch (e) { 138 if (String(e) !== "Error: looking up return.")138 if (String(e) !== "Error: Terminate iteration.") 139 139 throw e; 140 140 } -
trunk/JSTests/test262/expectations.yaml
r262088 r262165 3259 3259 test/language/statements/for-await-of/async-func-decl-dstr-array-elem-target-simple-strict.js: 3260 3260 strict mode: 'Test262: This statement should not be evaluated.' 3261 test/language/statements/for-await-of/iterator-close-throw-get-method-abrupt.js:3262 default: 'Test262:AsyncTestFailure:Test262Error: Test262Error: Expected SameValue(«function Object() {'3263 strict mode: 'Test262:AsyncTestFailure:Test262Error: Test262Error: Expected SameValue(«function Object() {'3264 3261 test/language/statements/for-await-of/let-array-with-newline.js: 3265 3262 default: 'Test262: This statement should not be evaluated.' … … 3476 3473 default: 'Test262: This statement should not be evaluated.' 3477 3474 strict mode: 'Test262: This statement should not be evaluated.' 3478 test/language/statements/for-of/iterator-close-throw-get-method-abrupt.js:3479 default: 'Test262Error: Expected a Test262Error but got a Object'3480 strict mode: 'Test262Error: Expected a Test262Error but got a Object'3481 3475 test/language/statements/for-of/let-array-with-newline.js: 3482 3476 default: 'Test262: This statement should not be evaluated.' -
trunk/Source/JavaScriptCore/ChangeLog
r262161 r262165 1 2020-05-26 Alexey Shvayka <shvaikalesh@gmail.com> 2 3 IteratorClose should suppress GetMethod errors 4 https://bugs.webkit.org/show_bug.cgi?id=212378 5 6 Reviewed by Keith Miller. 7 8 This patch implements recent spec change [1] that prevents "return" method lookup error 9 from overriding outer exception, aligning JSC with V8 and SpiderMonkey. 10 11 It is accomplished by moving pushTry() before emitGetById() in BytecodeGenerator.cpp 12 (covered by test262 suite) and removal of RETURN_IF_EXCEPTION in IteratorOperations.cpp 13 (added a stress test). 14 15 Before this patch, JSC partly implemented the spec change [1] by suppressing TypeError 16 if "return" method of iterator was not callable. 17 18 BytecodeGenerator::emitDelegateYield() is intentionally left unchanged. 19 Also, this patch utilizes emitIteratorGenericClose() to avoid code duplication. 20 for/of microbenchmarks are neutral. 21 22 [1]: https://github.com/tc39/ecma262/pull/1408 23 24 * bytecompiler/BytecodeGenerator.cpp: 25 (JSC::BytecodeGenerator::emitGenericEnumeration): 26 (JSC::BytecodeGenerator::emitEnumeration): 27 * runtime/IteratorOperations.cpp: 28 (JSC::iteratorClose): 29 1 30 2020-05-26 Mark Lam <mark.lam@apple.com> 2 31 -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r262083 r262165 4083 4083 restoreScopeRegister(); 4084 4084 4085 Ref<Label> finallyDone = newLabel();4086 4087 RefPtr<RegisterID> returnMethod = emitGetById(newTemporary(), iterator.get(), propertyNames().returnKeyword);4088 emitJumpIfTrue(emitIsUndefined(newTemporary(), returnMethod.get()), finallyDone.get());4089 4090 4085 Ref<Label> returnCallTryStart = newLabel(); 4091 4086 emitLabel(returnCallTryStart.get()); 4092 4087 TryData* returnCallTryData = pushTry(returnCallTryStart.get(), catchLabel.get(), HandlerType::SynthesizedCatch); 4093 4088 4094 CallArguments returnArguments(*this, nullptr); 4095 move(returnArguments.thisRegister(), iterator.get()); 4096 emitCall(value.get(), returnMethod.get(), NoExpectedFunction, returnArguments, node->divot(), node->divotStart(), node->divotEnd(), DebuggableCall::No); 4097 4098 if (isForAwait) 4099 emitAwait(value.get()); 4100 4101 emitJumpIfTrue(emitIsObject(newTemporary(), value.get()), finallyDone.get()); 4102 emitThrowTypeError("Iterator result interface is not an object."_s); 4103 4104 emitLabel(finallyDone.get()); 4089 emitIteratorGenericClose(iterator.get(), node, shouldEmitAwait); 4090 Ref<Label> finallyDone = newEmittedLabel(); 4105 4091 emitFinallyCompletion(finallyContext, endCatchLabel.get()); 4106 4092 … … 4239 4225 restoreScopeRegister(); 4240 4226 4241 Ref<Label> finallyDone = newLabel();4242 4243 RefPtr<RegisterID> returnMethod = emitGetById(newTemporary(), iterator.get(), propertyNames().returnKeyword);4244 emitJumpIfTrue(emitIsUndefined(newTemporary(), returnMethod.get()), finallyDone.get());4245 4246 4227 Ref<Label> returnCallTryStart = newLabel(); 4247 4228 emitLabel(returnCallTryStart.get()); 4248 4229 TryData* returnCallTryData = pushTry(returnCallTryStart.get(), catchLabel.get(), HandlerType::SynthesizedCatch); 4249 4230 4250 CallArguments returnArguments(*this, nullptr); 4251 move(returnArguments.thisRegister(), iterator.get()); 4252 emitCall(value.get(), returnMethod.get(), NoExpectedFunction, returnArguments, node->divot(), node->divotStart(), node->divotEnd(), DebuggableCall::No); 4253 4254 emitJumpIfTrue(emitIsObject(newTemporary(), value.get()), finallyDone.get()); 4255 emitThrowTypeError("Iterator result interface is not an object."_s); 4256 4257 emitLabel(finallyDone.get()); 4231 emitIteratorGenericClose(iterator.get(), node, EmitAwait::No); 4232 Ref<Label> finallyDone = newEmittedLabel(); 4258 4233 emitFinallyCompletion(finallyContext, endCatchLabel.get()); 4259 4234 -
trunk/Source/JavaScriptCore/runtime/IteratorOperations.cpp
r261755 r262165 94 94 catchScope.clearException(); 95 95 } 96 96 97 JSValue returnFunction = iterationRecord.iterator.get(globalObject, vm.propertyNames->returnKeyword); 97 RETURN_IF_EXCEPTION(throwScope, void()); 98 99 if (returnFunction.isUndefined()) { 98 if (UNLIKELY(throwScope.exception()) || returnFunction.isUndefined()) { 100 99 if (exception) 101 100 throwException(globalObject, throwScope, exception);
Note: See TracChangeset
for help on using the changeset viewer.