Title: [180732] trunk/Source/_javascript_Core
Revision
180732
Author
[email protected]
Date
2015-02-26 23:26:23 -0800 (Thu, 26 Feb 2015)

Log Message

Unreviewed, roll out r180723. It broke a bunch of tests.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::constLocal):
* bytecompiler/BytecodeGenerator.h:
* bytecompiler/NodesCodegen.cpp:
(JSC::ConstDeclNode::emitCodeSingle):
* tests/stress/const-arguments.js: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (180731 => 180732)


--- trunk/Source/_javascript_Core/ChangeLog	2015-02-27 07:04:17 UTC (rev 180731)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-02-27 07:26:23 UTC (rev 180732)
@@ -1,29 +1,13 @@
 2015-02-26  Filip Pizlo  <[email protected]>
 
-        BytecodeGenerator::constLocal() behaves identically to BytecodeGenerator::local() for the purposes of its one caller
-        https://bugs.webkit.org/show_bug.cgi?id=142071
+        Unreviewed, roll out r180723. It broke a bunch of tests.
 
-        Rubber stamped by Benjamin Poulain.
-        
-        The only behavioral differences between constLocal() and local() are:
-        
-        - constLocal() doesn't have a special case for "this" that overrides other checks like the
-          shouldOptimizeLocals() check.  But the one user of constLocal() is for the "const x"
-          _expression_, and "const this" doesn't parse.
-
-        - constLocal() won't createArgumentsIfNecessary() for "arguments".  But it's harmless if
-          it does, since its one user assigns to the local.
-
-        So, we can remove constLocal() and make its one caller use local() instead.
-
         * bytecompiler/BytecodeGenerator.cpp:
-        (JSC::BytecodeGenerator::constLocal): Deleted.
+        (JSC::BytecodeGenerator::constLocal):
         * bytecompiler/BytecodeGenerator.h:
         * bytecompiler/NodesCodegen.cpp:
         (JSC::ConstDeclNode::emitCodeSingle):
-        * tests/stress/const-arguments.js: Added.
-        (foo):
-        (check):
+        * tests/stress/const-arguments.js: Removed.
 
 2015-02-26  Mark Lam  <[email protected]>
 

Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp (180731 => 180732)


--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2015-02-27 07:04:17 UTC (rev 180731)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.cpp	2015-02-27 07:26:23 UTC (rev 180732)
@@ -1214,6 +1214,24 @@
     return Local(local, entry.getAttributes(), isArguments ? Local::SpecialLocal : Local::NormalLocal);
 }
 
+Local BytecodeGenerator::constLocal(const Identifier& property)
+{
+    if (m_codeType != FunctionCode)
+        return Local();
+
+    SymbolTableEntry entry = symbolTable().get(property.impl());
+    if (entry.isNull())
+        return Local();
+
+    RegisterID* local = createLazyRegisterIfNecessary(&registerFor(entry.getIndex()));
+
+    bool isArguments = property == propertyNames().arguments;
+    if (isCaptured(local->index()) && m_lexicalEnvironmentRegister)
+        return Local();
+
+    return Local(local, entry.getAttributes(), isArguments ? Local::SpecialLocal : Local::NormalLocal);
+}
+
 void BytecodeGenerator::emitCheckHasInstance(RegisterID* dst, RegisterID* value, RegisterID* base, Label* target)
 {
     size_t begin = instructions().size();

Modified: trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h (180731 => 180732)


--- trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h	2015-02-27 07:04:17 UTC (rev 180731)
+++ trunk/Source/_javascript_Core/bytecompiler/BytecodeGenerator.h	2015-02-27 07:26:23 UTC (rev 180732)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, 2009, 2012-2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2009, 2012, 2013, 2014 Apple Inc. All rights reserved.
  * Copyright (C) 2008 Cameron Zwarich <[email protected]>
  * Copyright (C) 2012 Igalia, S.L.
  *
@@ -286,6 +286,7 @@
         CaptureMode captureMode(int operand) { return isCaptured(operand) ? IsCaptured : NotCaptured; }
         
         Local local(const Identifier&);
+        Local constLocal(const Identifier&);
 
         // Returns the register storing "this"
         RegisterID* thisRegister() { return &m_thisRegister; }

Modified: trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp (180731 => 180732)


--- trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp	2015-02-27 07:04:17 UTC (rev 180731)
+++ trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp	2015-02-27 07:26:23 UTC (rev 180732)
@@ -1,7 +1,7 @@
 /*
 *  Copyright (C) 1999-2002 Harri Porten ([email protected])
 *  Copyright (C) 2001 Peter Kelly ([email protected])
-*  Copyright (C) 2003-2009, 2012-2013, 2015 Apple Inc. All rights reserved.
+*  Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012, 2013 Apple Inc. All rights reserved.
 *  Copyright (C) 2007 Cameron Zwarich ([email protected])
 *  Copyright (C) 2007 Maks Orlovich
 *  Copyright (C) 2007 Eric Seidel <[email protected]>
@@ -1695,7 +1695,7 @@
 RegisterID* ConstDeclNode::emitCodeSingle(BytecodeGenerator& generator)
 {
     // FIXME: This code does not match the behavior of const in Firefox.
-    if (Local local = generator.local(m_ident)) {
+    if (Local local = generator.constLocal(m_ident)) {
         if (!m_init)
             return local.get();
 

Deleted: trunk/Source/_javascript_Core/tests/stress/const-arguments.js (180731 => 180732)


--- trunk/Source/_javascript_Core/tests/stress/const-arguments.js	2015-02-27 07:04:17 UTC (rev 180731)
+++ trunk/Source/_javascript_Core/tests/stress/const-arguments.js	2015-02-27 07:26:23 UTC (rev 180732)
@@ -1,16 +0,0 @@
-function foo() {
-    const arguments = 52;
-    return arguments;
-}
-
-noInline(foo);
-
-function check(result, expected)
-{
-    if (result !== expected)
-        throw new Error("Bad result at i = " + i + ": " + result + " (expected " + expected + ")");
-}
-
-for (var i = 0; i < 10000; ++i)
-    check(foo(), 52);
-
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to