Reviewers: danno,

Description:
Merged r13386 into 3.14 branch.

Fix arguments materialization for inlined apply().

[email protected]
BUG=v8:2489
TEST=mjsunit/regress/regress-2489


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

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

Affected files:
  M src/hydrogen-instructions.h
  M src/hydrogen-instructions.cc
  M src/hydrogen.cc
  M src/version.cc
  A + test/mjsunit/regress/regress-2489.js


Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index 939b4f49748e3ea9acd0c7b6594d1e70e74071ff..79550f3eac3ffb3dbeb523558a1032f317d6b5b2 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -725,6 +725,13 @@ void HClassOfTestAndBranch::PrintDataTo(StringStream* stream) {
 }


+void HWrapReceiver::PrintDataTo(StringStream* stream) {
+  receiver()->PrintNameTo(stream);
+  stream->Add(" ");
+  function()->PrintNameTo(stream);
+}
+
+
 void HAccessArgumentsAt::PrintDataTo(StringStream* stream) {
   arguments()->PrintNameTo(stream);
   stream->Add("[");
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index 9e6344cd5f5e08035f65ae5e702558629090238b..346dcd64ca522156fb3b3ed8189a783064a3fab1 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -2760,6 +2760,8 @@ class HWrapReceiver: public HTemplateInstruction<2> {

   virtual HValue* Canonicalize();

+  virtual void PrintDataTo(StringStream* stream);
+
   DECLARE_CONCRETE_INSTRUCTION(WrapReceiver)
 };

Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 374e54c97389e448721421ca80898aeb6d42df1d..8393e51f9e42f76898b6a501083f0c4df952a179 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -7502,7 +7502,10 @@ bool HGraphBuilder::TryCallApply(Call* expr) {
     return true;
   } else {
     // We are inside inlined function and we know exactly what is inside
-    // arguments object.
+    // arguments object. But we need to be able to materialize at deopt.
+    // TODO(mstarzinger): For now we just ensure arguments are pushed
+    // right after HEnterInlined, but we could be smarter about this.
+    EnsureArgumentsArePushedForAccess();
     HValue* context = environment()->LookupContext();

     HValue* wrapped_receiver =
Index: src/version.cc
diff --git a/src/version.cc b/src/version.cc
index 35a172b18b1bb9fa4bb0a1134362da853c82a994..7c9858b149b389274b4604aaa2ae73e76dcda8e4 100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     14
 #define BUILD_NUMBER      5
-#define PATCH_LEVEL       3
+#define PATCH_LEVEL       4
 // 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-2489.js
diff --git a/test/mjsunit/regress/regress-sqrt.js b/test/mjsunit/regress/regress-2489.js
similarity index 83%
copy from test/mjsunit/regress/regress-sqrt.js
copy to test/mjsunit/regress/regress-2489.js
index f2a7e55242cbcdfb281f8e05c465000c98b5a8bc..882c4f794a88e24d1d64e86a466b27c39f51e625 100644
--- a/test/mjsunit/regress/regress-sqrt.js
+++ b/test/mjsunit/regress/regress-2489.js
@@ -1,4 +1,4 @@
-// Copyright 2012 the V8 project authors. All rights reserved.
+// Copyright 2013 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -27,21 +27,24 @@

 // Flags: --allow-natives-syntax

-// Check that Math.sqrt returns the same value regardless of being
-// optimized or not.
+"use strict";

-function f(x) {
-  return Math.sqrt(x);
+function f(a, b) {
+  return g("c", "d");
 }

-var x = 7.0506280066499245e-233;
+function g(a, b) {
+  g.constructor.apply(this, arguments);
+}

-var a = f(x);
+g.constructor = function(a, b) {
+  assertEquals("c", a);
+  assertEquals("d", b);
+}

-f(0.1);
-f(0.2);
+f("a", "b");
+f("a", "b");
 %OptimizeFunctionOnNextCall(f);
-
-var b = f(x);
-
-assertEquals(a, b);
+f("a", "b");
+g.x = "deopt";
+f("a", "b");


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to