Chromium Code Reviews| Index: src/interpreter/bytecode-generator.cc |
| diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc |
| index f67e7b927c28e4a9502c50b1ae98b1c652d48cf9..0fb45d0c44147a84eaab7aef99fb4084ba4c98c6 100644 |
| --- a/src/interpreter/bytecode-generator.cc |
| +++ b/src/interpreter/bytecode-generator.cc |
| @@ -1091,8 +1091,39 @@ void BytecodeGenerator::VisitBreakStatement(BreakStatement* stmt) { |
| void BytecodeGenerator::VisitReturnStatement(ReturnStatement* stmt) { |
| builder()->SetStatementPosition(stmt); |
| + |
| + Register position; |
| + Register name; |
| + if (stmt->HasTypeProfileSlot()) { |
| + position = register_allocator()->NewRegister(); |
| + |
| + builder() |
| + ->LoadLiteral(Smi::FromInt(stmt->position())) |
| + .StoreAccumulatorInRegister(position); |
|
rmcilroy
2017/03/20 10:02:46
Any reason you need to store position as a registe
Franzi
2017/03/20 15:38:39
Done. Using kImm because for the global(?) return
|
| + |
| + name = register_allocator()->NewRegister(); |
| + |
| + if (stmt->expression()->IsVariableProxy()) { |
| + builder() |
| + ->LoadLiteral( |
| + stmt->expression()->AsVariableProxy()->var()->raw_name()) |
| + .StoreAccumulatorInRegister(name); |
| + } else { |
| + // Use a dummy string for now. |
| + builder() |
| + ->LoadLiteral(ast_string_constants()->return_string()) |
| + .StoreAccumulatorInRegister(name); |
| + } |
|
rmcilroy
2017/03/20 10:02:46
As I remember, the plan was to remove the need for
Franzi
2017/03/20 15:38:39
Done.
|
| + } |
| + |
| VisitForAccumulatorValue(stmt->expression()); |
| + if (stmt->HasTypeProfileSlot()) { |
| + FeedbackSlot collect_type_feedback_slot = stmt->TypeProfileSlot(); |
| + builder()->CollectTypeProfile(position, name, |
| + feedback_index(collect_type_feedback_slot)); |
| + } |
| + |
| if (stmt->is_async_return()) { |
| execution_control()->AsyncReturnAccumulator(); |
| } else { |
| @@ -2212,8 +2243,15 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) { |
| // Evaluate LHS expression. |
| Register lhs_name; |
| + Register position; |
| + |
| if (expr->HasTypeProfileSlot()) { |
| lhs_name = register_allocator()->NewRegister(); |
| + position = register_allocator()->NewRegister(); |
| + |
| + builder() |
| + ->LoadLiteral(Smi::FromInt(expr->position())) |
| + .StoreAccumulatorInRegister(position); |
| } |
| switch (assign_type) { |
| @@ -2358,10 +2396,10 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) { |
| } |
| // Value is in accumulator. |
| - if (expr->HasTypeProfileSlot()) { |
| + if (false && expr->HasTypeProfileSlot()) { |
|
Michael Starzinger
2017/03/20 09:29:26
nit: Looks like a left-over. If it is intentional
Franzi
2017/03/20 15:38:39
Done.
|
| FeedbackSlot collect_type_feedback_slot = expr->TypeProfileSlot(); |
| - builder()->CollectTypeProfile(lhs_name, |
| + builder()->CollectTypeProfile(position, lhs_name, |
| feedback_index(collect_type_feedback_slot)); |
| } |
| } |