Index: src/interpreter/bytecode-generator.cc |
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc |
index e2ef3ea199ad1d0c5ce45c9c61cf7f663cd5a711..1fe15926a1b38dd7866871332cfeed1f215d82cb 100644 |
--- a/src/interpreter/bytecode-generator.cc |
+++ b/src/interpreter/bytecode-generator.cc |
@@ -898,6 +898,7 @@ void BytecodeGenerator::VisitVariableDeclaration(VariableDeclaration* decl) { |
->LoadLiteral(variable->raw_name()) |
.StoreAccumulatorInRegister(name) |
.CallRuntime(Runtime::kDeclareEvalVar, name); |
+ |
break; |
} |
case VariableLocation::MODULE: |
@@ -2190,18 +2191,31 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) { |
LhsKind assign_type = Property::GetAssignType(property); |
// Evaluate LHS expression. |
+ Register lhs_name = register_allocator()->NewRegister(); |
+ |
switch (assign_type) { |
case VARIABLE: |
+ if (true || FLAG_type_profile) { |
+ 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 (true || FLAG_type_profile) { |
+ builder()->LoadLiteral(name).StoreAccumulatorInRegister(lhs_name); |
+ } |
break; |
} |
case KEYED_PROPERTY: { |
object = VisitForRegisterValue(property->obj()); |
key = VisitForRegisterValue(property->key()); |
+ if (true || FLAG_type_profile) { |
+ builder()->StoreAccumulatorInRegister(lhs_name); |
+ } |
break; |
} |
case NAMED_SUPER_PROPERTY: { |
@@ -2214,6 +2228,9 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) { |
builder() |
->LoadLiteral(property->key()->AsLiteral()->AsRawPropertyName()) |
.StoreAccumulatorInRegister(super_property_args[2]); |
+ if (true || FLAG_type_profile) { |
+ builder()->StoreAccumulatorInRegister(lhs_name); |
+ } |
break; |
} |
case KEYED_SUPER_PROPERTY: { |
@@ -2224,6 +2241,10 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) { |
VisitForRegisterValue(super_property->home_object(), |
super_property_args[1]); |
VisitForRegisterValue(property->key(), super_property_args[2]); |
+ if (true || FLAG_type_profile) { |
+ builder()->StoreAccumulatorInRegister(lhs_name); |
+ } |
+ |
break; |
} |
} |
@@ -2312,6 +2333,17 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) { |
break; |
} |
} |
+ |
+ // Value is in accumulator. |
+ if (FLAG_type_profile) { |
+ Register value = register_allocator()->NewRegister(); |
+ builder()->StoreAccumulatorInRegister(value); |
+ |
+ FeedbackSlot collect_type_feedback_slot = expr->CollectTypeProfileSlot(); |
+ |
+ builder()->CollectTypeProfile(lhs_name, value, |
+ feedback_index(collect_type_feedback_slot)); |
+ } |
} |
void BytecodeGenerator::VisitYield(Yield* expr) { |