Reviewers: ulan,
Description:
Fix parallel recompilation wrt transition maps dependency.
R=u...@chromium.org
BUG=
Please review this at https://chromiumcodereview.appspot.com/15896038/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/arm/lithium-codegen-arm.h
M src/arm/lithium-codegen-arm.cc
M src/hydrogen-instructions.h
M src/hydrogen.cc
M src/ia32/lithium-codegen-ia32.h
M src/ia32/lithium-codegen-ia32.cc
M src/mips/lithium-codegen-mips.h
M src/mips/lithium-codegen-mips.cc
M src/x64/lithium-codegen-x64.h
M src/x64/lithium-codegen-x64.cc
A + test/mjsunit/parallel-invalidate-transition-map.js
Index: src/arm/lithium-codegen-arm.cc
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
index
d1d4fe053461b5bcce44db6d49b28046145de0ca..0904b0cb2f612b4331d7ae3cba5a309fe9c1d7e6
100644
--- a/src/arm/lithium-codegen-arm.cc
+++ b/src/arm/lithium-codegen-arm.cc
@@ -89,10 +89,6 @@ void LCodeGen::FinishCode(Handle<Code> code) {
PopulateDeoptimizationData(code);
info()->CommitDependentMaps(code);
- for (int i = 0 ; i < transition_maps_.length(); i++) {
- transition_maps_.at(i)->AddDependentCode(
- DependentCode::kTransitionGroup, code);
- }
if (graph()->depends_on_empty_array_proto_elements()) {
isolate()->initial_object_prototype()->map()->AddDependentCode(
DependentCode::kElementsCantBeAddedGroup, code);
@@ -4282,9 +4278,6 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField*
instr) {
}
if (!transition.is_null()) {
- if (transition->CanBeDeprecated()) {
- transition_maps_.Add(transition, info()->zone());
- }
__ mov(scratch, Operand(transition));
__ str(scratch, FieldMemOperand(object, HeapObject::kMapOffset));
if (instr->hydrogen()->NeedsWriteBarrierForMap()) {
Index: src/arm/lithium-codegen-arm.h
diff --git a/src/arm/lithium-codegen-arm.h b/src/arm/lithium-codegen-arm.h
index
45e4af68902f7ea27e44382920e9c39d5fd9e57a..a22d19243a7c59e1e1634419f0862a6a4048c300
100644
--- a/src/arm/lithium-codegen-arm.h
+++ b/src/arm/lithium-codegen-arm.h
@@ -56,7 +56,6 @@ class LCodeGen BASE_EMBEDDED {
deoptimizations_(4, info->zone()),
deopt_jump_table_(4, info->zone()),
deoptimization_literals_(8, info->zone()),
- transition_maps_(0, info->zone()),
inlined_function_count_(0),
scope_(info->scope()),
status_(UNUSED),
@@ -409,7 +408,6 @@ class LCodeGen BASE_EMBEDDED {
ZoneList<LEnvironment*> deoptimizations_;
ZoneList<Deoptimizer::JumpTableEntry> deopt_jump_table_;
ZoneList<Handle<Object> > deoptimization_literals_;
- ZoneList<Handle<Map> > transition_maps_;
int inlined_function_count_;
Scope* const scope_;
Status status_;
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index
6b9ff0c5a71b41329422963f2b5e62c8fec3f8bd..813e43dbac9926146b80361a7d8f5e0430fe720e
100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -5689,6 +5689,7 @@ class HStoreNamedField: public
HTemplateInstruction<2> {
= Representation::Tagged())
: access_(access),
field_representation_(field_representation),
+ transition_(),
transition_unique_id_(),
new_space_dominator_(NULL) {
SetOperandAt(0, obj);
@@ -5720,7 +5721,13 @@ class HStoreNamedField: public
HTemplateInstruction<2> {
HObjectAccess access() const { return access_; }
Handle<Map> transition() const { return transition_; }
UniqueValueId transition_unique_id() const { return
transition_unique_id_; }
- void set_transition(Handle<Map> map) { transition_ = map; }
+ void SetTransition(Handle<Map> map, CompilationInfo* info) {
+ ASSERT(transition_.is_null()); // Only set once.
+ if (map->CanBeDeprecated()) {
+ map->AddDependentCompilationInfo(DependentCode::kTransitionGroup,
info);
+ }
+ transition_ = map;
+ }
HValue* new_space_dominator() const { return new_space_dominator_; }
bool NeedsWriteBarrier() {
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index
42f5dad0668234cec796fa43dd7c886caced038d..381e6df2b07f273c1d5a2130093634b050df9f2d
100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -6254,7 +6254,7 @@ HInstruction*
HOptimizedGraphBuilder::BuildStoreNamedField(
if (transition_to_field) {
Handle<Map> transition(lookup->GetTransitionMapFromMap(*map));
- instr->set_transition(transition);
+ instr->SetTransition(transition, top_info());
// TODO(fschneider): Record the new map type of the object in the IR to
// enable elimination of redundant checks after the transition store.
instr->SetGVNFlag(kChangesMaps);
Index: src/ia32/lithium-codegen-ia32.cc
diff --git a/src/ia32/lithium-codegen-ia32.cc
b/src/ia32/lithium-codegen-ia32.cc
index
5d1f46d065634bc7381850bddca5bf9c0362a740..7b0c63077a77e50ae0c74ab5162d7b3630192000
100644
--- a/src/ia32/lithium-codegen-ia32.cc
+++ b/src/ia32/lithium-codegen-ia32.cc
@@ -111,10 +111,6 @@ void LCodeGen::FinishCode(Handle<Code> code) {
}
info()->CommitDependentMaps(code);
- for (int i = 0 ; i < transition_maps_.length(); i++) {
- transition_maps_.at(i)->AddDependentCode(
- DependentCode::kTransitionGroup, code);
- }
if (graph()->depends_on_empty_array_proto_elements()) {
isolate()->initial_object_prototype()->map()->AddDependentCode(
DependentCode::kElementsCantBeAddedGroup, code);
@@ -4308,9 +4304,6 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField*
instr) {
}
if (!transition.is_null()) {
- if (transition->CanBeDeprecated()) {
- transition_maps_.Add(transition, info()->zone());
- }
if (!instr->hydrogen()->NeedsWriteBarrierForMap()) {
__ mov(FieldOperand(object, HeapObject::kMapOffset), transition);
} else {
Index: src/ia32/lithium-codegen-ia32.h
diff --git a/src/ia32/lithium-codegen-ia32.h
b/src/ia32/lithium-codegen-ia32.h
index
70ecf5c556c3209f34c7bb85d2efc42ceb41843f..33f0eda5a2e5de4ff2bea2325082c0dc9edbae33
100644
--- a/src/ia32/lithium-codegen-ia32.h
+++ b/src/ia32/lithium-codegen-ia32.h
@@ -58,7 +58,6 @@ class LCodeGen BASE_EMBEDDED {
deoptimizations_(4, info->zone()),
jump_table_(4, info->zone()),
deoptimization_literals_(8, info->zone()),
- transition_maps_(0, info->zone()),
inlined_function_count_(0),
scope_(info->scope()),
status_(UNUSED),
@@ -408,7 +407,6 @@ class LCodeGen BASE_EMBEDDED {
ZoneList<LEnvironment*> deoptimizations_;
ZoneList<Deoptimizer::JumpTableEntry> jump_table_;
ZoneList<Handle<Object> > deoptimization_literals_;
- ZoneList<Handle<Map> > transition_maps_;
int inlined_function_count_;
Scope* const scope_;
Status status_;
Index: src/mips/lithium-codegen-mips.cc
diff --git a/src/mips/lithium-codegen-mips.cc
b/src/mips/lithium-codegen-mips.cc
index
fa97ee420158b82a18dcf3c320a57d3125c2d62a..658d3552914815435399ab0f07db86cc81e53ed6
100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -89,10 +89,6 @@ void LCodeGen::FinishCode(Handle<Code> code) {
PopulateDeoptimizationData(code);
info()->CommitDependentMaps(code);
- for (int i = 0 ; i < transition_maps_.length(); i++) {
- transition_maps_.at(i)->AddDependentCode(
- DependentCode::kTransitionGroup, code);
- }
if (graph()->depends_on_empty_array_proto_elements()) {
isolate()->initial_object_prototype()->map()->AddDependentCode(
DependentCode::kElementsCantBeAddedGroup, code);
@@ -3972,9 +3968,6 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField*
instr) {
}
if (!transition.is_null()) {
- if (transition->CanBeDeprecated()) {
- transition_maps_.Add(transition, info()->zone());
- }
__ li(scratch, Operand(transition));
__ sw(scratch, FieldMemOperand(object, HeapObject::kMapOffset));
if (instr->hydrogen()->NeedsWriteBarrierForMap()) {
Index: src/mips/lithium-codegen-mips.h
diff --git a/src/mips/lithium-codegen-mips.h
b/src/mips/lithium-codegen-mips.h
index
d96755cc46cbf4b4380b377d16a2ec52eabc2ae8..ee013834b4b37c4c69c2c66780b7a2a6113ad4c6
100644
--- a/src/mips/lithium-codegen-mips.h
+++ b/src/mips/lithium-codegen-mips.h
@@ -55,7 +55,6 @@ class LCodeGen BASE_EMBEDDED {
deoptimizations_(4, info->zone()),
deopt_jump_table_(4, info->zone()),
deoptimization_literals_(8, info->zone()),
- transition_maps_(0, info->zone()),
inlined_function_count_(0),
scope_(info->scope()),
status_(UNUSED),
@@ -411,7 +410,6 @@ class LCodeGen BASE_EMBEDDED {
ZoneList<LEnvironment*> deoptimizations_;
ZoneList<Deoptimizer::JumpTableEntry> deopt_jump_table_;
ZoneList<Handle<Object> > deoptimization_literals_;
- ZoneList<Handle<Map> > transition_maps_;
int inlined_function_count_;
Scope* const scope_;
Status status_;
Index: src/x64/lithium-codegen-x64.cc
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
index
2d6e4cba33c6ebf86ea0877451657cc7325fcdd5..26cce633751134b55859c271ef5c30031fa285fe
100644
--- a/src/x64/lithium-codegen-x64.cc
+++ b/src/x64/lithium-codegen-x64.cc
@@ -94,10 +94,6 @@ void LCodeGen::FinishCode(Handle<Code> code) {
PopulateDeoptimizationData(code);
info()->CommitDependentMaps(code);
- for (int i = 0 ; i < transition_maps_.length(); i++) {
- transition_maps_.at(i)->AddDependentCode(
- DependentCode::kTransitionGroup, code);
- }
if (graph()->depends_on_empty_array_proto_elements()) {
isolate()->initial_object_prototype()->map()->AddDependentCode(
DependentCode::kElementsCantBeAddedGroup, code);
@@ -4001,9 +3997,6 @@ void LCodeGen::DoStoreNamedField(LStoreNamedField*
instr) {
}
if (!transition.is_null()) {
- if (transition->CanBeDeprecated()) {
- transition_maps_.Add(transition, info()->zone());
- }
if (!instr->hydrogen()->NeedsWriteBarrierForMap()) {
__ Move(FieldOperand(object, HeapObject::kMapOffset), transition);
} else {
Index: src/x64/lithium-codegen-x64.h
diff --git a/src/x64/lithium-codegen-x64.h b/src/x64/lithium-codegen-x64.h
index
462a7c591dead645d248845d562de1bcfa2f0860..c3f99c4f42644f4c906270d5401b4939490478e5
100644
--- a/src/x64/lithium-codegen-x64.h
+++ b/src/x64/lithium-codegen-x64.h
@@ -57,7 +57,6 @@ class LCodeGen BASE_EMBEDDED {
deoptimizations_(4, info->zone()),
jump_table_(4, info->zone()),
deoptimization_literals_(8, info->zone()),
- transition_maps_(0, info->zone()),
inlined_function_count_(0),
scope_(info->scope()),
status_(UNUSED),
@@ -361,7 +360,6 @@ class LCodeGen BASE_EMBEDDED {
ZoneList<LEnvironment*> deoptimizations_;
ZoneList<Deoptimizer::JumpTableEntry> jump_table_;
ZoneList<Handle<Object> > deoptimization_literals_;
- ZoneList<Handle<Map> > transition_maps_;
int inlined_function_count_;
Scope* const scope_;
Status status_;
Index: test/mjsunit/parallel-invalidate-transition-map.js
diff --git a/test/mjsunit/compiler/parallel-proto-change.js
b/test/mjsunit/parallel-invalidate-transition-map.js
similarity index 73%
copy from test/mjsunit/compiler/parallel-proto-change.js
copy to test/mjsunit/parallel-invalidate-transition-map.js
index
aa1ac6de90952c3a0f5e2e3ea28c4f1d1dcdd9f1..42a266f556e6ea0f75a83ad453a6d96ce11c81f0
100644
--- a/test/mjsunit/compiler/parallel-proto-change.js
+++ b/test/mjsunit/parallel-invalidate-transition-map.js
@@ -25,26 +25,32 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --allow-natives-syntax
+// Flags: --track-fields --track-double-fields --allow-natives-syntax
// Flags: --parallel-recompilation --parallel-recompilation-delay=50
function assertUnoptimized(fun) {
assertTrue(%GetOptimizationStatus(fun) != 1);
}
-function f(foo) { return foo.bar(); }
+function new_object() {
+ var o = {};
+ o.a = 1;
+ o.b = 2;
+ return o;
+}
+
+function add_field(obj) {
+ obj.c = 3;
+}
-var o = {};
-o.__proto__ = { __proto__: { bar: function() { return 1; } } };
+add_field(new_object());
+add_field(new_object());
+%OptimizeFunctionOnNextCall(add_field, "parallel");
-assertEquals(1, f(o));
-assertEquals(1, f(o));
+var o = new_object();
+add_field(o); // Trigger optimization.
+assertUnoptimized(add_field); // Not yet optimized.
+o.c = 2.2; // Invalidate transition map.
+%CompleteOptimization(add_field); // Conclude optimization with...
+assertUnoptimized(add_field); // ... bailing out due to map
dependency.
-%OptimizeFunctionOnNextCall(f, "parallel");
-assertEquals(1, f(o)); // Trigger optimization.
-assertUnoptimized(f); // Optimization not yet done.
-// Change the prototype chain during optimization to trigger map
invalidation.
-o.__proto__.__proto__ = { bar: function() { return 2; } };
-%CompleteOptimization(f); // Conclude optimization with...
-assertUnoptimized(f); // ... bailing out due to map dependency.
-assertEquals(2, f(o));
--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.