Chromium Code Reviews

Unified Diff: src/ast.cc

Issue 1161623002: VectorICs: allocating slots for store ics in ast nodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ports. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« src/ast.h ('K') | « src/ast.h ('k') | src/ast-numbering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.cc
diff --git a/src/ast.cc b/src/ast.cc
index a73c61382322b4c793dc7c399038b6766e482bfa..18961eddfecaa3bea243a27185c5d31b098d54d1 100644
--- a/src/ast.cc
+++ b/src/ast.cc
@@ -121,16 +121,73 @@ FeedbackVectorRequirements VariableProxy::ComputeFeedbackRequirements(
}
+static int GetStoreICSlots(Expression* expr) {
+ int ic_slots = 0;
+ if (FLAG_vector_stores) {
+ Property* property = expr->AsProperty();
+ LhsKind assign_type = Property::GetAssignType(property);
+ if ((assign_type == VARIABLE &&
+ expr->AsVariableProxy()->var()->IsUnallocated()) ||
+ assign_type == NAMED_PROPERTY || assign_type == KEYED_PROPERTY) {
+ ic_slots++;
+ }
+ }
+ return ic_slots;
+}
+
+
+static Code::Kind GetStoreICKind(Expression* expr) {
+ LhsKind assign_type = Property::GetAssignType(expr->AsProperty());
+ return assign_type == KEYED_PROPERTY ? Code::KEYED_STORE_IC : Code::STORE_IC;
+}
+
+
+FeedbackVectorRequirements ForEachStatement::ComputeFeedbackRequirements(
+ Isolate* isolate, const ICSlotCache* cache) {
+ int ic_slots = GetStoreICSlots(each());
+ return FeedbackVectorRequirements(0, ic_slots);
+}
+
+
+Code::Kind ForEachStatement::FeedbackICSlotKind(int index) {
+ return GetStoreICKind(each());
+}
+
+
Assignment::Assignment(Zone* zone, Token::Value op, Expression* target,
Expression* value, int pos)
: Expression(zone, pos),
- bit_field_(IsUninitializedField::encode(false) |
- KeyTypeField::encode(ELEMENT) |
- StoreModeField::encode(STANDARD_STORE) |
- TokenField::encode(op)),
+ bit_field_(
+ IsUninitializedField::encode(false) | KeyTypeField::encode(ELEMENT) |
+ StoreModeField::encode(STANDARD_STORE) | TokenField::encode(op)),
target_(target),
value_(value),
- binary_operation_(NULL) {}
+ binary_operation_(NULL),
+ slot_(FeedbackVectorICSlot::Invalid()) {}
+
+
+FeedbackVectorRequirements Assignment::ComputeFeedbackRequirements(
+ Isolate* isolate, const ICSlotCache* cache) {
+ int ic_slots = GetStoreICSlots(target());
+ return FeedbackVectorRequirements(0, ic_slots);
+}
+
+
+Code::Kind Assignment::FeedbackICSlotKind(int index) {
+ return GetStoreICKind(target());
+}
+
+
+FeedbackVectorRequirements CountOperation::ComputeFeedbackRequirements(
+ Isolate* isolate, const ICSlotCache* cache) {
+ int ic_slots = GetStoreICSlots(expression());
+ return FeedbackVectorRequirements(0, ic_slots);
+}
+
+
+Code::Kind CountOperation::FeedbackICSlotKind(int index) {
+ return GetStoreICKind(expression());
+}
Token::Value Assignment::binary_op() const {
@@ -253,6 +310,46 @@ bool ObjectLiteral::Property::emit_store() {
}
+FeedbackVectorRequirements ObjectLiteral::ComputeFeedbackRequirements(
+ Isolate* isolate, const ICSlotCache* cache) {
+ if (!FLAG_vector_stores) return FeedbackVectorRequirements(0, 0);
+
Jakob Kummerow 2015/05/27 13:24:35 As discussed, this is kind of brittle, but hard to
mvstanton 2015/05/27 14:00:18 Good idea, done.
+ int ic_slots = 0;
+ for (int i = 0; i < properties()->length(); i++) {
+ ObjectLiteral::Property* property = properties()->at(i);
+ if (property->IsCompileTimeValue()) continue;
+
+ Expression* value = property->value();
+ if (property->is_computed_name() &&
+ property->kind() != ObjectLiteral::Property::PROTOTYPE) {
+ if (FunctionLiteral::NeedsHomeObject(value)) ic_slots++;
+ } else if (property->emit_store()) {
+ if (property->kind() == ObjectLiteral::Property::MATERIALIZED_LITERAL ||
+ property->kind() == ObjectLiteral::Property::COMPUTED) {
+ Literal* key = property->key()->AsLiteral();
+ if (key->value()->IsInternalizedString()) ic_slots++;
+ if (FunctionLiteral::NeedsHomeObject(value)) ic_slots++;
+ } else if (property->kind() == ObjectLiteral::Property::GETTER ||
+ property->kind() == ObjectLiteral::Property::SETTER) {
+ // We might need a slot for the home object.
+ if (FunctionLiteral::NeedsHomeObject(value)) ic_slots++;
+ }
+ }
+ }
+
+ return FeedbackVectorRequirements(0, ic_slots);
+}
+
+
+FeedbackVectorICSlot ObjectLiteral::SlotForHomeObject(Expression* value,
+ int* slot_index) const {
+ if (FLAG_vector_stores && FunctionLiteral::NeedsHomeObject(value)) {
+ return GetNthSlot(*slot_index++);
Jakob Kummerow 2015/05/27 13:24:35 I'm pretty sure this moves the pointer instead of
mvstanton 2015/05/27 14:00:18 Heh-heh. :p Fixed, thanks!
+ }
+ return FeedbackVectorICSlot::Invalid();
+}
+
+
void ObjectLiteral::CalculateEmitStore(Zone* zone) {
const auto GETTER = ObjectLiteral::Property::GETTER;
const auto SETTER = ObjectLiteral::Property::SETTER;
@@ -590,7 +687,10 @@ void Expression::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) {
bool Call::IsUsingCallFeedbackICSlot(Isolate* isolate) const {
CallType call_type = GetCallType(isolate);
- if (IsUsingCallFeedbackSlot(isolate) || call_type == POSSIBLY_EVAL_CALL) {
+ if (call_type == POSSIBLY_EVAL_CALL) {
+ return false;
+ }
+ if (call_type == SUPER_CALL && !FLAG_vector_stores) {
return false;
}
return true;
@@ -599,7 +699,7 @@ bool Call::IsUsingCallFeedbackICSlot(Isolate* isolate) const {
bool Call::IsUsingCallFeedbackSlot(Isolate* isolate) const {
// SuperConstructorCall uses a CallConstructStub, which wants
- // a Slot, not an IC slot.
+ // a Slot, in addition to any IC slots requested elsewhere.
return GetCallType(isolate) == SUPER_CALL;
}
@@ -608,8 +708,6 @@ FeedbackVectorRequirements Call::ComputeFeedbackRequirements(
Isolate* isolate, const ICSlotCache* cache) {
int ic_slots = IsUsingCallFeedbackICSlot(isolate) ? 1 : 0;
int slots = IsUsingCallFeedbackSlot(isolate) ? 1 : 0;
- // A Call uses either a slot or an IC slot.
- DCHECK((ic_slots & slots) == 0);
return FeedbackVectorRequirements(slots, ic_slots);
}
« src/ast.h ('K') | « src/ast.h ('k') | src/ast-numbering.cc » ('j') | no next file with comments »

Powered by Google App Engine