Revision: 18388
Author: [email protected]
Date: Fri Dec 20 12:12:41 2013 UTC
Log: Improve load elimination handling of transitioning stores.
BUG=
[email protected]
Review URL: https://codereview.chromium.org/106973005
http://code.google.com/p/v8/source/detail?r=18388
Modified:
/branches/bleeding_edge/src/hydrogen-load-elimination.cc
/branches/bleeding_edge/test/mjsunit/compiler/load-elimination.js
=======================================
--- /branches/bleeding_edge/src/hydrogen-load-elimination.cc Thu Nov 28
15:27:42 2013 UTC
+++ /branches/bleeding_edge/src/hydrogen-load-elimination.cc Fri Dec 20
12:12:41 2013 UTC
@@ -43,7 +43,6 @@
class HFieldApproximation : public ZoneObject {
public: // Just a data blob.
HValue* object_;
- HLoadNamedField* last_load_;
HValue* last_value_;
HFieldApproximation* next_;
@@ -52,7 +51,6 @@
if (this == NULL) return NULL;
HFieldApproximation* copy = new(zone) HFieldApproximation();
copy->object_ = this->object_;
- copy->last_load_ = this->last_load_;
copy->last_value_ = this->last_value_;
copy->next_ = this->next_->Copy(zone);
return copy;
@@ -197,7 +195,6 @@
if (approx->last_value_ == NULL) {
// Load is not redundant. Fill out a new entry.
- approx->last_load_ = instr;
approx->last_value_ = instr;
return instr;
} else {
@@ -217,12 +214,14 @@
HValue* object = instr->object()->ActualValue();
HValue* value = instr->value();
- // Kill non-equivalent may-alias entries.
- KillFieldInternal(object, field, value);
if (instr->has_transition()) {
- // A transition store alters the map of the object.
- // TODO(titzer): remember the new map (a constant) for the object.
+ // A transition introduces a new field and alters the map of the
object.
+ // Since the field in the object is new, it cannot alias existing
entries.
+ // TODO(titzer): introduce a constant for the new map and remember
it.
KillFieldInternal(object, FieldOf(JSObject::kMapOffset), NULL);
+ } else {
+ // Kill non-equivalent may-alias entries.
+ KillFieldInternal(object, field, value);
}
HFieldApproximation* approx = FindOrCreate(object, field);
@@ -231,7 +230,6 @@
return NULL;
} else {
// The store is not redundant. Update the entry.
- approx->last_load_ = NULL;
approx->last_value_ = value;
return instr;
}
@@ -314,7 +312,6 @@
// Insert the entry at the head of the list.
approx->object_ = object;
- approx->last_load_ = NULL;
approx->last_value_ = NULL;
approx->next_ = fields_[field];
fields_[field] = approx;
@@ -397,7 +394,6 @@
PrintF(" field %d: ", i);
for (HFieldApproximation* a = fields_[i]; a != NULL; a = a->next_) {
PrintF("[o%d =", a->object_->id());
- if (a->last_load_ != NULL) PrintF(" L%d", a->last_load_->id());
if (a->last_value_ != NULL) PrintF(" v%d", a->last_value_->id());
PrintF("] ");
}
=======================================
--- /branches/bleeding_edge/test/mjsunit/compiler/load-elimination.js Tue
Sep 17 15:32:21 2013 UTC
+++ /branches/bleeding_edge/test/mjsunit/compiler/load-elimination.js Fri
Dec 20 12:12:41 2013 UTC
@@ -34,6 +34,9 @@
this.y = y;
return this;
}
+
+function C() {
+}
function test_load() {
var a = new B(1, 2);
@@ -63,6 +66,22 @@
b.x = 7;
return f + g + h + a.x;
}
+
+function test_transitioning_store1() {
+ var a = new B(2, 3);
+ var f = a.x, g = a.y;
+ var b = new B(3, 4);
+ return a.x + a.y;
+}
+
+function test_transitioning_store2() {
+ var b = new C();
+ var a = new B(-1, 5);
+ var f = a.x, g = a.y;
+ b.x = 9;
+ b.y = 11;
+ return a.x + a.y;
+}
function killall() {
try { } catch(e) { }
@@ -102,5 +121,7 @@
test(4, test_load);
test(22, test_store_load);
test(8, test_nonaliasing_store1);
+test(5, test_transitioning_store1);
+test(4, test_transitioning_store2);
test(22, test_store_load_kill);
test(7, test_store_store);
--
--
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.