Changeset 195581 in webkit
- Timestamp:
- Jan 25, 2016 9:43:11 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r195579 r195581 1 2016-01-25 Skachkov Oleksandr <gskachkov@gmail.com> 2 3 [ES6] Arrow function syntax. Arrow function specific features. Lexical bind "arguments" 4 https://bugs.webkit.org/show_bug.cgi?id=145132 5 6 Reviewed by Saam Barati. 7 8 * js/arrowfunction-lexical-bind-arguments-non-strict-expected.txt: Added. 9 * js/arrowfunction-lexical-bind-arguments-non-strict.html: Added. 10 * js/arrowfunction-lexical-bind-arguments-strict-expected.txt: Added. 11 * js/arrowfunction-lexical-bind-arguments-strict.html: Added. 12 * js/script-tests/arrowfunction-lexical-bind-arguments-non-strict.js: Added. 13 * js/script-tests/arrowfunction-lexical-bind-arguments-strict.js: Added. 14 1 15 2016-01-25 Simon Fraser <simon.fraser@apple.com> 2 16 -
trunk/Source/JavaScriptCore/ChangeLog
r195578 r195581 1 2016-01-25 Skachkov Oleksandr <gskachkov@gmail.com> 2 3 [ES6] Arrow function syntax. Arrow function specific features. Lexical bind "arguments" 4 https://bugs.webkit.org/show_bug.cgi?id=145132 5 6 Reviewed by Saam Barati. 7 8 Added support of ES6 arrow function specific feature, lexical bind of arguments. 9 http://www.ecma-international.org/ecma-262/6.0/#sec-arrow-function-definitions-runtime-semantics-evaluation 10 'arguments' variable in arrow function must resolve to a binding in a lexically enclosing environment. 11 In srict mode it points to arguments object, and in non-stric mode it points to arguments object or varible 12 with name 'arguments' if it was declared. 13 14 * bytecompiler/BytecodeGenerator.cpp: 15 (JSC::BytecodeGenerator::BytecodeGenerator): 16 * parser/Parser.h: 17 (JSC::Scope::Scope): 18 (JSC::Scope::setSourceParseMode): 19 (JSC::Scope::isArrowFunction): 20 (JSC::Scope::collectFreeVariables): 21 (JSC::Scope::setIsArrowFunction): 22 * tests/es6.yaml: 23 * tests/stress/arrowfunction-lexical-bind-arguments-non-strict-1.js: Added. 24 * tests/stress/arrowfunction-lexical-bind-arguments-non-strict-2.js: Added. 25 * tests/stress/arrowfunction-lexical-bind-arguments-strict.js: Added. 26 1 27 2016-01-25 Benjamin Poulain <bpoulain@apple.com> 2 28 -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r195439 r195581 244 244 245 245 bool shouldCaptureAllOfTheThings = m_shouldEmitDebugHooks || codeBlock->usesEval(); 246 bool needsArguments = functionNode->usesArguments() || codeBlock->usesEval();246 bool needsArguments = (functionNode->usesArguments() || codeBlock->usesEval() || (functionNode->usesArrowFunction() && !codeBlock->isArrowFunction())); 247 247 248 248 // Generator never provides "arguments". "arguments" reference will be resolved in an upper generator function scope. … … 509 509 } 510 510 } 511 512 if (!haveParameterNamedArguments) { 511 512 // Do not create arguments variable in case of Arrow function. Value will be loaded from parent scope 513 if (!haveParameterNamedArguments && !m_codeBlock->isArrowFunction()) { 513 514 createVariable( 514 515 propertyNames().arguments, varKind(propertyNames().arguments.impl()), functionSymbolTable); 516 515 517 m_needToInitializeArguments = true; 516 518 } -
trunk/Source/JavaScriptCore/parser/Parser.h
r195484 r195581 171 171 , m_isFunction(isFunction) 172 172 , m_isGenerator(isGenerator) 173 , m_isArrowFunction(false) 173 174 , m_isLexicalScope(false) 174 175 , m_isFunctionBoundary(false) … … 192 193 , m_isFunction(rhs.m_isFunction) 193 194 , m_isGenerator(rhs.m_isGenerator) 195 , m_isArrowFunction(rhs.m_isArrowFunction) 194 196 , m_isLexicalScope(rhs.m_isLexicalScope) 195 197 , m_isFunctionBoundary(rhs.m_isFunctionBoundary) … … 258 260 case SourceParseMode::SetterMode: 259 261 case SourceParseMode::MethodMode: 262 setIsFunction(); 263 break; 264 260 265 case SourceParseMode::ArrowFunctionMode: 261 setIs Function();266 setIsArrowFunction(); 262 267 break; 263 268 … … 447 452 void setNeedsFullActivation() { m_needsFullActivation = true; } 448 453 bool needsFullActivation() const { return m_needsFullActivation; } 454 bool isArrowFunction() { return m_isArrowFunction; } 449 455 450 456 bool hasDirectSuper() { return m_hasDirectSuper; } … … 465 471 466 472 // "arguments" reference should be resolved at function boudary. 467 if (nestedScope->isFunctionBoundary() && nestedScope->hasArguments() && impl == m_vm->propertyNames->arguments.impl() )473 if (nestedScope->isFunctionBoundary() && nestedScope->hasArguments() && impl == m_vm->propertyNames->arguments.impl() && !nestedScope->isArrowFunction()) 468 474 continue; 469 475 … … 581 587 m_hasArguments = false; 582 588 } 589 590 void setIsArrowFunction() 591 { 592 setIsFunction(); 593 m_isArrowFunction = true; 594 } 583 595 584 596 void setIsModule() … … 598 610 bool m_isFunction : 1; 599 611 bool m_isGenerator : 1; 612 bool m_isArrowFunction : 1; 600 613 bool m_isLexicalScope : 1; 601 614 bool m_isFunctionBoundary : 1; -
trunk/Source/JavaScriptCore/tests/es6.yaml
r195480 r195581 746 746 cmd: runES6 :normal 747 747 - path: es6/arrow_functions_lexical_arguments_binding.js 748 cmd: runES6 : fail748 cmd: runES6 :normal 749 749 - path: es6/arrow_functions_lexical_new.target_binding.js 750 750 cmd: runES6 :normal -
trunk/Source/WebInspectorUI/ChangeLog
r195566 r195581 1 2016-01-25 Skachkov Oleksandr <gskachkov@gmail.com> 2 3 [ES6] Arrow function syntax. Arrow function specific features. Lexical bind "arguments" 4 https://bugs.webkit.org/show_bug.cgi?id=145132 5 6 Reviewed by Saam Barati. 7 8 Current patch is implementing lexical bind of arguments, so in this callback we need 9 to return to ordinary function. 10 11 * UserInterface/Base/Object.js: 12 (WebInspector.Object.singleFireEventListener.let.wrappedCallback): 13 (WebInspector.Object.singleFireEventListener): 14 1 15 2016-01-25 Saam barati <sbarati@apple.com> 2 16 -
trunk/Source/WebInspectorUI/UserInterface/Base/Object.js
r195442 r195581 59 59 static singleFireEventListener(eventType, listener, thisObject) 60 60 { 61 let wrappedCallback = () =>{61 let wrappedCallback = function() { 62 62 this.removeEventListener(eventType, wrappedCallback, null); 63 63 listener.apply(thisObject, arguments); 64 } ;64 }.bind(this); 65 65 66 66 this.addEventListener(eventType, wrappedCallback, null);
Note: See TracChangeset
for help on using the changeset viewer.