Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 1321993004: Vector ICs: ObjectLiteral refactoring for Oracle feedback (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE, turned off flag. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index 7b9e3662afaaf3ce5c2286995e28482e3aa1cfbf..52d4a470f6f52955c6c916b3b973017e17a5b05b 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -1570,7 +1570,6 @@ void AstGraphBuilder::VisitClassLiteralContents(ClassLiteral* expr) {
environment()->Push(proto);
// Create nodes to store method values into the literal.
- int store_slot_index = 0;
for (int i = 0; i < expr->properties()->length(); i++) {
ObjectLiteral::Property* property = expr->properties()->at(i);
environment()->Push(property->is_static() ? literal : proto);
@@ -1593,9 +1592,8 @@ void AstGraphBuilder::VisitClassLiteralContents(ClassLiteral* expr) {
Node* value = environment()->Pop();
Node* key = environment()->Pop();
Node* receiver = environment()->Pop();
- VectorSlotPair feedback = CreateVectorSlotPair(
- expr->SlotForHomeObject(property->value(), &store_slot_index));
- BuildSetHomeObject(value, receiver, property->value(), feedback);
+
+ BuildSetHomeObject(value, receiver, property);
switch (property->kind()) {
case ObjectLiteral::Property::CONSTANT:
@@ -1638,10 +1636,9 @@ void AstGraphBuilder::VisitClassLiteralContents(ClassLiteral* expr) {
DCHECK_NOT_NULL(expr->class_variable_proxy());
Variable* var = expr->class_variable_proxy()->var();
FrameStateBeforeAndAfter states(this, BailoutId::None());
- VectorSlotPair feedback =
- CreateVectorSlotPair(FLAG_vector_stores && var->IsUnallocated()
- ? expr->GetNthSlot(store_slot_index++)
- : FeedbackVectorICSlot::Invalid());
+ VectorSlotPair feedback = CreateVectorSlotPair(
+ expr->NeedsProxySlot() ? expr->ProxySlot()
+ : FeedbackVectorICSlot::Invalid());
BuildVariableAssignment(var, literal, Token::INIT_CONST, feedback,
BailoutId::None(), states);
}
@@ -1720,7 +1717,6 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
// Create nodes to store computed values into the literal.
int property_index = 0;
- int store_slot_index = 0;
AccessorTable accessor_table(zone());
for (; property_index < expr->properties()->length(); property_index++) {
ObjectLiteral::Property* property = expr->properties()->at(property_index);
@@ -1744,17 +1740,12 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
Node* value = environment()->Pop();
Handle<Name> name = key->AsPropertyName();
VectorSlotPair feedback =
- FLAG_vector_stores
- ? CreateVectorSlotPair(expr->GetNthSlot(store_slot_index++))
- : VectorSlotPair();
+ CreateVectorSlotPair(property->GetSlot(0));
Node* store = BuildNamedStore(literal, name, value, feedback,
TypeFeedbackId::None());
states.AddToNode(store, key->id(),
OutputFrameStateCombine::Ignore());
- VectorSlotPair home_feedback = CreateVectorSlotPair(
- expr->SlotForHomeObject(property->value(), &store_slot_index));
- BuildSetHomeObject(value, literal, property->value(),
- home_feedback);
+ BuildSetHomeObject(value, literal, property, 1);
} else {
VisitForEffect(property->value());
}
@@ -1773,9 +1764,7 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
Node* set_property = NewNode(op, receiver, key, value, language);
// SetProperty should not lazy deopt on an object literal.
PrepareFrameState(set_property, BailoutId::None());
- VectorSlotPair home_feedback = CreateVectorSlotPair(
- expr->SlotForHomeObject(property->value(), &store_slot_index));
- BuildSetHomeObject(value, receiver, property->value(), home_feedback);
+ BuildSetHomeObject(value, receiver, property);
}
break;
}
@@ -1794,12 +1783,12 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
}
case ObjectLiteral::Property::GETTER:
if (property->emit_store()) {
- accessor_table.lookup(key)->second->getter = property->value();
+ accessor_table.lookup(key)->second->getter = property;
}
break;
case ObjectLiteral::Property::SETTER:
if (property->emit_store()) {
- accessor_table.lookup(key)->second->setter = property->value();
+ accessor_table.lookup(key)->second->setter = property;
}
break;
}
@@ -1810,16 +1799,8 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
for (AccessorTable::Iterator it = accessor_table.begin();
it != accessor_table.end(); ++it) {
VisitForValue(it->first);
- VisitForValueOrNull(it->second->getter);
- VectorSlotPair feedback_getter = CreateVectorSlotPair(
- expr->SlotForHomeObject(it->second->getter, &store_slot_index));
- BuildSetHomeObject(environment()->Top(), literal, it->second->getter,
- feedback_getter);
- VisitForValueOrNull(it->second->setter);
- VectorSlotPair feedback_setter = CreateVectorSlotPair(
- expr->SlotForHomeObject(it->second->setter, &store_slot_index));
- BuildSetHomeObject(environment()->Top(), literal, it->second->setter,
- feedback_setter);
+ VisitObjectLiteralAccessor(literal, it->second->getter);
+ VisitObjectLiteralAccessor(literal, it->second->setter);
Node* setter = environment()->Pop();
Node* getter = environment()->Pop();
Node* name = environment()->Pop();
@@ -1864,9 +1845,7 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
Node* value = environment()->Pop();
Node* key = environment()->Pop();
Node* receiver = environment()->Pop();
- VectorSlotPair feedback = CreateVectorSlotPair(
- expr->SlotForHomeObject(property->value(), &store_slot_index));
- BuildSetHomeObject(value, receiver, property->value(), feedback);
+ BuildSetHomeObject(value, receiver, property);
switch (property->kind()) {
case ObjectLiteral::Property::CONSTANT:
case ObjectLiteral::Property::COMPUTED:
@@ -1907,14 +1886,21 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
NewNode(op, literal);
}
- // Verify that compilation exactly consumed the number of store ic slots that
- // the ObjectLiteral node had to offer.
- DCHECK(!FLAG_vector_stores || store_slot_index == expr->slot_count());
-
ast_context()->ProduceValue(environment()->Pop());
}
+void AstGraphBuilder::VisitObjectLiteralAccessor(
+ Node* home_object, ObjectLiteralProperty* property) {
+ if (property == nullptr) {
+ VisitForValueOrNull(nullptr);
+ } else {
+ VisitForValue(property->value());
+ BuildSetHomeObject(environment()->Top(), home_object, property);
+ }
+}
+
+
void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
Node* closure = GetFunctionClosure();
@@ -3808,11 +3794,14 @@ Node* AstGraphBuilder::BuildToObject(Node* input, BailoutId bailout_id) {
Node* AstGraphBuilder::BuildSetHomeObject(Node* value, Node* home_object,
- Expression* expr,
- const VectorSlotPair& feedback) {
+ ObjectLiteralProperty* property,
+ int slot_number) {
+ Expression* expr = property->value();
if (!FunctionLiteral::NeedsHomeObject(expr)) return value;
Handle<Name> name = isolate()->factory()->home_object_symbol();
FrameStateBeforeAndAfter states(this, BailoutId::None());
+ VectorSlotPair feedback =
+ CreateVectorSlotPair(property->GetSlot(slot_number));
Node* store = BuildNamedStore(value, name, home_object, feedback,
TypeFeedbackId::None());
states.AddToNode(store, BailoutId::None(), OutputFrameStateCombine::Ignore());
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698