Title: [213792] releases/WebKitGTK/webkit-2.16
Revision
213792
Author
[email protected]
Date
2017-03-13 02:37:14 -0700 (Mon, 13 Mar 2017)

Log Message

Merge r213165 - Use of arguments in arrow function is slow
https://bugs.webkit.org/show_bug.cgi?id=168829

Reviewed by Saam Barati.

JSTests:

* microbenchmarks/arrowfunciton-direct-arguments.js: Added.
(fn):
* microbenchmarks/arrowfunciton-reference-arguments.js: Added.
(fn):

Source/_javascript_Core:

Current patch improves performance access to arguments within arrow functuion
by preventing create arguments variable within arrow function, also allow to cache
arguments variable. Before arguments variable always have Dynamic resolve type, after
patch it can be ClosureVar, that increase performance of access to arguments variable
in 9 times inside of the arrow function.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
* runtime/JSScope.cpp:
(JSC::abstractAccess):

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.16/JSTests/ChangeLog (213791 => 213792)


--- releases/WebKitGTK/webkit-2.16/JSTests/ChangeLog	2017-03-13 09:33:36 UTC (rev 213791)
+++ releases/WebKitGTK/webkit-2.16/JSTests/ChangeLog	2017-03-13 09:37:14 UTC (rev 213792)
@@ -1,3 +1,15 @@
+2017-02-28  Oleksandr Skachkov  <[email protected]>
+
+        Use of arguments in arrow function is slow
+        https://bugs.webkit.org/show_bug.cgi?id=168829
+
+        Reviewed by Saam Barati.
+
+        * microbenchmarks/arrowfunciton-direct-arguments.js: Added.
+        (fn):
+        * microbenchmarks/arrowfunciton-reference-arguments.js: Added.
+        (fn):
+
 2017-03-08  Yusuke Suzuki  <[email protected]>
 
         [GTK] JSC test stress/arity-check-ftl-throw.js.ftl-no-cjit-validate-sampling-profiler crashing on GTK bot

Added: releases/WebKitGTK/webkit-2.16/JSTests/microbenchmarks/arrowfunciton-direct-arguments.js (0 => 213792)


--- releases/WebKitGTK/webkit-2.16/JSTests/microbenchmarks/arrowfunciton-direct-arguments.js	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.16/JSTests/microbenchmarks/arrowfunciton-direct-arguments.js	2017-03-13 09:37:14 UTC (rev 213792)
@@ -0,0 +1,7 @@
+var fn = function() {
+    return () => arguments[0];
+}(1);
+
+for (var i = 0; i < 100000; i++) {
+    if(fn(2) !== 1) throw 0; 
+}

Added: releases/WebKitGTK/webkit-2.16/JSTests/microbenchmarks/arrowfunciton-reference-arguments.js (0 => 213792)


--- releases/WebKitGTK/webkit-2.16/JSTests/microbenchmarks/arrowfunciton-reference-arguments.js	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.16/JSTests/microbenchmarks/arrowfunciton-reference-arguments.js	2017-03-13 09:37:14 UTC (rev 213792)
@@ -0,0 +1,10 @@
+var fn = function() {
+    var args = arguments;
+    return () => args[0];
+}(1);
+
+noInline(fn);
+
+for (var i = 0; i < 10000; i++) {
+    if(fn(2) !== 1) throw 0;
+}
\ No newline at end of file

Modified: releases/WebKitGTK/webkit-2.16/Source/_javascript_Core/ChangeLog (213791 => 213792)


--- releases/WebKitGTK/webkit-2.16/Source/_javascript_Core/ChangeLog	2017-03-13 09:33:36 UTC (rev 213791)
+++ releases/WebKitGTK/webkit-2.16/Source/_javascript_Core/ChangeLog	2017-03-13 09:37:14 UTC (rev 213792)
@@ -1,3 +1,21 @@
+2017-02-28  Oleksandr Skachkov  <[email protected]>
+
+        Use of arguments in arrow function is slow
+        https://bugs.webkit.org/show_bug.cgi?id=168829
+
+        Reviewed by Saam Barati.
+
+        Current patch improves performance access to arguments within arrow functuion
+        by preventing create arguments variable within arrow function, also allow to cache 
+        arguments variable. Before arguments variable always have Dynamic resolve type, after 
+        patch it can be ClosureVar, that increase performance of access to arguments variable
+        in 9 times inside of the arrow function. 
+
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::BytecodeGenerator):
+        * runtime/JSScope.cpp:
+        (JSC::abstractAccess):
+
 2017-03-08  Yusuke Suzuki  <[email protected]>
 
         [GTK] JSC test stress/arity-check-ftl-throw.js.ftl-no-cjit-validate-sampling-profiler crashing on GTK bot

Modified: releases/WebKitGTK/webkit-2.16/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (213791 => 213792)


--- releases/WebKitGTK/webkit-2.16/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2017-03-13 09:33:36 UTC (rev 213791)
+++ releases/WebKitGTK/webkit-2.16/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2017-03-13 09:37:14 UTC (rev 213792)
@@ -270,7 +270,7 @@
     bool shouldCaptureSomeOfTheThings = m_shouldEmitDebugHooks || functionNode->needsActivation() || containsArrowOrEvalButNotInArrowBlock;
 
     bool shouldCaptureAllOfTheThings = m_shouldEmitDebugHooks || codeBlock->usesEval();
-    bool needsArguments = (functionNode->usesArguments() || codeBlock->usesEval() || (functionNode->usesArrowFunction() && !codeBlock->isArrowFunction() && isArgumentsUsedInInnerArrowFunction()));
+    bool needsArguments = ((functionNode->usesArguments() && !codeBlock->isArrowFunction()) || codeBlock->usesEval() || (functionNode->usesArrowFunction() && !codeBlock->isArrowFunction() && isArgumentsUsedInInnerArrowFunction()));
 
     if (isGeneratorOrAsyncFunctionBodyParseMode(parseMode)) {
         // Generator and AsyncFunction never provides "arguments". "arguments" reference will be resolved in an upper generator function scope.

Modified: releases/WebKitGTK/webkit-2.16/Source/_javascript_Core/runtime/JSScope.cpp (213791 => 213792)


--- releases/WebKitGTK/webkit-2.16/Source/_javascript_Core/runtime/JSScope.cpp	2017-03-13 09:33:36 UTC (rev 213791)
+++ releases/WebKitGTK/webkit-2.16/Source/_javascript_Core/runtime/JSScope.cpp	2017-03-13 09:37:14 UTC (rev 213792)
@@ -52,11 +52,6 @@
 {
     if (scope->isJSLexicalEnvironment()) {
         JSLexicalEnvironment* lexicalEnvironment = jsCast<JSLexicalEnvironment*>(scope);
-        if (ident == exec->propertyNames().arguments) {
-            // We know the property will be at this lexical environment scope, but we don't know how to cache it.
-            op = ResolveOp(Dynamic, 0, 0, 0, 0, 0);
-            return true;
-        }
 
         SymbolTable* symbolTable = lexicalEnvironment->symbolTable();
         {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to