Revision: 11024
Author: [email protected]
Date: Tue Mar 13 07:45:03 2012
Log: Always create HArgumentsObject on function entry.
We do not know if we are going to need it and creating it lazyly might
cause us to insert it at the block that does not dominate all uses.
[email protected]
TEST=mjsunit/compiler/inline-arguments.js
Review URL: https://chromiumcodereview.appspot.com/9692046
http://code.google.com/p/v8/source/detail?r=11024
Modified:
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/hydrogen.h
/branches/bleeding_edge/test/mjsunit/compiler/inline-arguments.js
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Tue Mar 13 05:11:46 2012
+++ /branches/bleeding_edge/src/hydrogen.cc Tue Mar 13 07:45:03 2012
@@ -2613,6 +2613,10 @@
AddInstruction(undefined_constant);
graph_->set_undefined_constant(undefined_constant);
+ HArgumentsObject* object = new(zone()) HArgumentsObject;
+ AddInstruction(object);
+ graph()->SetArgumentsObject(object);
+
// Set the initial values of parameters including "this". "This" has
// parameter index 0.
ASSERT_EQ(scope->num_parameters() + 1, environment()->parameter_count());
@@ -2640,11 +2644,6 @@
return Bailout("context-allocated arguments");
}
- if (!graph()->HasArgumentsObject()) {
- HArgumentsObject* object = new(zone()) HArgumentsObject;
- AddInstruction(object);
- graph()->SetArgumentsObject(object);
- }
environment()->Bind(scope->arguments(),
graph()->GetArgumentsObject());
}
@@ -5339,11 +5338,6 @@
// If the function uses arguments object create and bind one.
if (function->scope()->arguments() != NULL) {
ASSERT(function->scope()->arguments()->IsStackAllocated());
- if (!graph()->HasArgumentsObject()) {
- HArgumentsObject* object = new(zone()) HArgumentsObject;
- AddInstruction(object);
- graph()->SetArgumentsObject(object);
- }
environment()->Bind(function->scope()->arguments(),
graph()->GetArgumentsObject());
}
=======================================
--- /branches/bleeding_edge/src/hydrogen.h Tue Mar 13 05:11:46 2012
+++ /branches/bleeding_edge/src/hydrogen.h Tue Mar 13 07:45:03 2012
@@ -293,7 +293,6 @@
HArgumentsObject* GetArgumentsObject() const {
return arguments_object_.get();
}
- bool HasArgumentsObject() const { return arguments_object_.is_set(); }
void SetArgumentsObject(HArgumentsObject* object) {
arguments_object_.set(object);
=======================================
--- /branches/bleeding_edge/test/mjsunit/compiler/inline-arguments.js Mon
Mar 12 05:49:41 2012
+++ /branches/bleeding_edge/test/mjsunit/compiler/inline-arguments.js Tue
Mar 13 07:45:03 2012
@@ -54,3 +54,29 @@
return Function.prototype.apply.call(this, receiver, args);
};
a.Z(4,5,6);
+
+
+// Ensure that HArgumentsObject is inserted in a correct place
+// and dominates all uses.
+function F1() { }
+function F2() { F1.apply(this, arguments); }
+function F3(x, y) {
+ if (x) {
+ F2(y);
+ }
+}
+
+function F31() {
+ return F1.apply(this, arguments);
+}
+
+function F4() {
+ F3(true, false);
+ return F31(1);
+}
+
+F4(1);
+F4(1);
+F4(1);
+%OptimizeFunctionOnNextCall(F4);
+F4(1);
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev