Reviewers: danno,

Description:
Merged r13386 into 3.15 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/11859026/

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

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 0e6ea00058f299ab0966d2e5055e1a70f6da9858..c1245b2fb697d915be97941dc73b6b3dc647478d 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -801,6 +801,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 161e6542d9a59e32934a18e2b5a739363557f630..7225791cd7c5fe0894f42c10a904fcd2dbb65805 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -2823,6 +2823,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 97306a165963da9aff7824321404240b0bb2b5b2..bdca43ed520f348e1fbdc8f53fab0d56d87bc348 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -7493,7 +7493,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 5339507d7c2b0c2eebaae134d29ff92180c7abb7..567598c7667997330a1d6d9583961c12d2f3dadc 100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     15
 #define BUILD_NUMBER      11
-#define PATCH_LEVEL       8
+#define PATCH_LEVEL       9
 // 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