Index: src/interpreter/bytecode-generator.cc |
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc |
index 27abb13472cd7bb4b5d4ab7940c19fcd22d7872f..af78a3983600190b2c6f74c789c38382a39d6af6 100644 |
--- a/src/interpreter/bytecode-generator.cc |
+++ b/src/interpreter/bytecode-generator.cc |
@@ -2214,18 +2214,34 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) { |
LhsKind assign_type = Property::GetAssignType(property); |
// Evaluate LHS expression. |
+ Register lhs_name; |
Yang
2017/03/09 10:28:27
Do we have a plan to use a better way to identify
Franzi
2017/03/10 12:14:29
I'm only passing the name so that I can understand
|
+ if (expr->HasCollectTypeProfileSlot()) { |
+ lhs_name = register_allocator()->NewRegister(); |
+ } |
+ |
switch (assign_type) { |
case VARIABLE: |
+ if (expr->HasCollectTypeProfileSlot()) { |
+ builder() |
+ ->LoadLiteral(expr->target()->AsVariableProxy()->var()->raw_name()) |
+ .StoreAccumulatorInRegister(lhs_name); |
+ } |
// Nothing to do to evaluate variable assignment LHS. |
break; |
case NAMED_PROPERTY: { |
object = VisitForRegisterValue(property->obj()); |
name = property->key()->AsLiteral()->AsRawPropertyName(); |
+ if (expr->HasCollectTypeProfileSlot()) { |
+ builder()->LoadLiteral(name).StoreAccumulatorInRegister(lhs_name); |
+ } |
break; |
} |
case KEYED_PROPERTY: { |
object = VisitForRegisterValue(property->obj()); |
key = VisitForRegisterValue(property->key()); |
+ if (expr->HasCollectTypeProfileSlot()) { |
+ builder()->StoreAccumulatorInRegister(lhs_name); |
+ } |
break; |
} |
case NAMED_SUPER_PROPERTY: { |
@@ -2238,6 +2254,9 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) { |
builder() |
->LoadLiteral(property->key()->AsLiteral()->AsRawPropertyName()) |
.StoreAccumulatorInRegister(super_property_args[2]); |
+ if (expr->HasCollectTypeProfileSlot()) { |
+ builder()->StoreAccumulatorInRegister(lhs_name); |
+ } |
break; |
} |
case KEYED_SUPER_PROPERTY: { |
@@ -2248,6 +2267,10 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) { |
VisitForRegisterValue(super_property->home_object(), |
super_property_args[1]); |
VisitForRegisterValue(property->key(), super_property_args[2]); |
+ if (expr->HasCollectTypeProfileSlot()) { |
+ builder()->StoreAccumulatorInRegister(lhs_name); |
+ } |
+ |
break; |
} |
} |
@@ -2336,6 +2359,14 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) { |
break; |
} |
} |
+ |
+ // Value is in accumulator. |
+ if (expr->HasCollectTypeProfileSlot()) { |
+ FeedbackSlot collect_type_feedback_slot = expr->CollectTypeProfileSlot(); |
+ |
+ builder()->CollectTypeProfile(lhs_name, |
+ feedback_index(collect_type_feedback_slot)); |
+ } |
} |
void BytecodeGenerator::VisitYield(Yield* expr) { |