Reviewers: Jakob,
Description:
Fix environment of the optimized version of the _SetValueOf intrinsic.
[email protected]
BUG=
Please review this at https://codereview.chromium.org/158723006/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+17, -7 lines):
M src/hydrogen.cc
A + test/mjsunit/regress/setvalueof-deopt.js
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index
46e1b18aa6afe466a94cbc6d8aca7532bfe36168..c2656f3b52e8522d32b086eb6cbe41717f8856bb
100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -10374,14 +10374,23 @@ void
HOptimizedGraphBuilder::GenerateSetValueOf(CallRuntime* call) {
Add<HStoreNamedField>(object,
HObjectAccess::ForObservableJSObjectOffset(JSValue::kValueOffset),
value);
+ if (!ast_context()->IsEffect()) {
+ Push(value);
+ }
Add<HSimulate>(call->id(), FIXED_SIMULATE);
}
if_objectisvalue.Else();
{
// Nothing to do in this case.
+ if (!ast_context()->IsEffect()) {
+ Push(value);
+ }
Add<HSimulate>(call->id(), FIXED_SIMULATE);
}
if_objectisvalue.End();
+ if (!ast_context()->IsEffect()) {
+ Drop(1);
+ }
return ast_context()->ReturnValue(value);
}
Index: test/mjsunit/regress/setvalueof-deopt.js
diff --git a/test/mjsunit/recursive-store-opt.js
b/test/mjsunit/regress/setvalueof-deopt.js
similarity index 91%
copy from test/mjsunit/recursive-store-opt.js
copy to test/mjsunit/regress/setvalueof-deopt.js
index
fb2649248dbabc642f864f671d0ce2273ad44bd7..8c42c8a20baa0845d8450d699e62cd98d7d39c08
100644
--- a/test/mjsunit/recursive-store-opt.js
+++ b/test/mjsunit/regress/setvalueof-deopt.js
@@ -27,15 +27,16 @@
// Flags: --allow-natives-syntax
-function g() {
- this.x = this;
+function g(x, y) {
+ return y;
}
-function f() {
- return new g();
+function f(deopt) {
+ return g(%_SetValueOf(1, 1), deopt + 0);
}
-f();
-f();
+f(0);
+f(0);
+f(0);
%OptimizeFunctionOnNextCall(f);
-f();
+assertEquals("result0", f("result"));
--
--
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.