Chromium Code Reviews| Index: src/interpreter/bytecode-generator.cc |
| diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc |
| index 7c7f23eb6d8eb5def098fd17493ab58cc358cdab..8bb90b89c23d7dd5332cc8512e261b72f36600b6 100644 |
| --- a/src/interpreter/bytecode-generator.cc |
| +++ b/src/interpreter/bytecode-generator.cc |
| @@ -191,6 +191,26 @@ Handle<BytecodeArray> BytecodeGenerator::MakeBytecode(CompilationInfo* info) { |
| void BytecodeGenerator::MakeBytecodeBody() { |
| + // Build the arguments object if it is used. |
| + VisitArgumentsObject(scope()->arguments()); |
| + |
| + // Build assignment to {.this_function} variable if it is used. |
| + VisitThisFunctionVariable(scope()->this_function_var()); |
| + |
| + // Build assignment to {new.target} variable if it is used. |
| + VisitNewTargetVariable(scope()->new_target_var()); |
| + |
| + // TODO(rmcilroy): Emit tracing call if requested to do so. |
| + if (FLAG_trace) { |
| + UNIMPLEMENTED(); |
| + } |
| + |
| + // Visit illegal re-declaration and bail out if it exists. |
| + if (scope()->HasIllegalRedeclaration()) { |
| + Visit(scope()->GetIllegalRedeclaration()); |
| + return; |
| + } |
| + |
| // Visit declarations within the function scope. |
| VisitDeclarations(scope()->declarations()); |
| @@ -1382,6 +1402,44 @@ void BytecodeGenerator::VisitSetHomeObject(Register value, Register home_object, |
| } |
| +void BytecodeGenerator::VisitArgumentsObject(Variable* arguments) { |
| + if (arguments == NULL) return; |
|
Michael Starzinger
2015/10/21 18:42:17
nit: s/NULL/nullptr/
rmcilroy
2015/10/22 15:19:52
Done.
|
| + |
| + DCHECK(arguments->IsContextSlot() || arguments->IsStackAllocated()); |
| + |
| + // Allocate and initialize a new arguments object and assign to the |
| + // {arguments} variable. |
| + bool use_strict = |
| + is_strict(language_mode()) || !info()->has_simple_parameters(); |
| + builder()->CreateArguments(use_strict); |
| + VisitVariableAssignment(arguments, FeedbackVectorSlot::Invalid()); |
| +} |
| + |
| + |
| +void BytecodeGenerator::VisitThisFunctionVariable(Variable* this_function_var) { |
| + if (this_function_var == nullptr) return; |
| + |
| + // TODO(rmcilroy): Remove once we have tests which exercise this code path. |
| + UNIMPLEMENTED(); |
| + |
| + // Store the closure we were called with in the this_function_var. |
| + builder()->LoadAccumulatorWithRegister(Register::function_closure()); |
| + VisitVariableAssignment(this_function_var, FeedbackVectorSlot::Invalid()); |
| +} |
| + |
| + |
| +void BytecodeGenerator::VisitNewTargetVariable(Variable* new_target_var) { |
| + if (new_target_var == nullptr) return; |
| + |
| + // TODO(rmcilroy): Remove once we have tests which exercise this code path. |
| + UNIMPLEMENTED(); |
| + |
| + // Store the closure we were called with in the this_function_var. |
| + builder()->CallRuntime(Runtime::kGetOriginalConstructor, Register(), 0); |
| + VisitVariableAssignment(new_target_var, FeedbackVectorSlot::Invalid()); |
| +} |
| + |
| + |
| void BytecodeGenerator::VisitFunctionClosureForContext() { |
| Scope* closure_scope = execution_context()->scope()->ClosureScope(); |
| if (closure_scope->is_script_scope() || |