Revision: 19653
Author:   [email protected]
Date:     Tue Mar  4 13:14:47 2014 UTC
Log:      Merged r19594 into 3.24 branch.

Fix handling of constant global variable assignments.

BUG=347904
LOG=N
[email protected]

Review URL: https://codereview.chromium.org/186623002
http://code.google.com/p/v8/source/detail?r=19653

Added:
 /branches/3.24/test/mjsunit/regress/regress-347904.js
Modified:
 /branches/3.24/src/hydrogen.cc
 /branches/3.24/src/version.cc

=======================================
--- /dev/null
+++ /branches/3.24/test/mjsunit/regress/regress-347904.js Tue Mar 4 13:14:47 2014 UTC
@@ -0,0 +1,12 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --stress-runs=2
+
+var v = /abc/;
+function f() {
+  v = 1578221999;
+};
+%OptimizeFunctionOnNextCall(f);
+f();
=======================================
--- /branches/3.24/src/hydrogen.cc      Fri Feb 28 13:18:40 2014 UTC
+++ /branches/3.24/src/hydrogen.cc      Tue Mar  4 13:14:47 2014 UTC
@@ -5840,18 +5840,27 @@
     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());
=======================================
--- /branches/3.24/src/version.cc       Mon Mar  3 09:38:07 2014 UTC
+++ /branches/3.24/src/version.cc       Tue Mar  4 13:14:47 2014 UTC
@@ -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

--
--
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