Reviewers: Jakob,

Description:
Merged r19594 into 3.24 branch.

Fix handling of constant global variable assignments.

BUG=347904
LOG=N
[email protected]

Please review this at https://codereview.chromium.org/186623002/

SVN Base: https://v8.googlecode.com/svn/branches/3.24

Affected files (+23, -21 lines):
  M src/hydrogen.cc
  M src/version.cc
  A + test/mjsunit/regress/regress-347904.js
  A + test/test262ptestcfg.py


Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index ccaa0ecc228602b7ca72161547df508bc85fe3d2..7ee8180cca926e3c1bfcc07b1730142a75a009ed 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -5840,18 +5840,27 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment(
     Handle<GlobalObject> global(current_info()->global_object());
     Handle<PropertyCell> cell(global->GetPropertyCell(&lookup));
     if (cell->type()->IsConstant()) {
-      IfBuilder builder(this);
-      HValue* constant = Add<HConstant>(cell->type()->AsConstant());
-      if (cell->type()->AsConstant()->IsNumber()) {
-        builder.If<HCompareNumericAndBranch>(value, constant, Token::EQ);
+      Handle<Object> constant = cell->type()->AsConstant();
+      if (value->IsConstant()) {
+        HConstant* c_value = HConstant::cast(value);
+        if (!constant.is_identical_to(c_value->handle(isolate()))) {
+          Add<HDeoptimize>("Constant global variable assignment",
+                           Deoptimizer::EAGER);
+        }
       } else {
-        builder.If<HCompareObjectEqAndBranch>(value, constant);
+        HValue* c_constant = Add<HConstant>(constant);
+        IfBuilder builder(this);
+        if (constant->IsNumber()) {
+ builder.If<HCompareNumericAndBranch>(value, c_constant, Token::EQ);
+        } else {
+          builder.If<HCompareObjectEqAndBranch>(value, c_constant);
+        }
+        builder.Then();
+        builder.Else();
+        Add<HDeoptimize>("Constant global variable assignment",
+                         Deoptimizer::EAGER);
+        builder.End();
       }
-      builder.Then();
-      builder.Else();
-      Add<HDeoptimize>("Constant global variable assignment",
-                       Deoptimizer::EAGER);
-      builder.End();
     }
     HInstruction* instr =
         Add<HStoreGlobalCell>(value, cell, lookup.GetPropertyDetails());
Index: src/version.cc
diff --git a/src/version.cc b/src/version.cc
index 716dd86fdc7f605347179345bea1d31fd013ce14..d7ae59423408a3ddedaba4b6d600cd18262dcd93 100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     24
 #define BUILD_NUMBER      35
-#define PATCH_LEVEL       10
+#define PATCH_LEVEL       11
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
 #define IS_CANDIDATE_VERSION 0
Index: test/mjsunit/regress/regress-347904.js
diff --git a/test/mjsunit/regress/regress-347909.js b/test/mjsunit/regress/regress-347904.js
similarity index 62%
copy from test/mjsunit/regress/regress-347909.js
copy to test/mjsunit/regress/regress-347904.js
index 90a8e6a759eab76afef1dc968c814bd9d324b147..1a27b054a4b89b8e8841c9311f1c155aea7ce4d7 100644
--- a/test/mjsunit/regress/regress-347909.js
+++ b/test/mjsunit/regress/regress-347904.js
@@ -2,18 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

-// Flags: --allow-natives-syntax
+// Flags: --allow-natives-syntax --stress-runs=2

-var a = {y:1.5};
-a.y = 0;
-var b = a.y;
-a.y = {};
-var d = 1;
+var v = /abc/;
 function f() {
-  d = 0;
-  return {y: b};
-}
-f();
-f();
+  v = 1578221999;
+};
 %OptimizeFunctionOnNextCall(f);
 f();
Index: test/test262ptestcfg.py
diff --git a/test/test262/testcfg.py b/test/test262ptestcfg.py
similarity index 100%
copy from test/test262/testcfg.py
copy to test/test262ptestcfg.py


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to