OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/interpreter/bytecode-generator.h" | 5 #include "src/interpreter/bytecode-generator.h" |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/interpreter/control-flow-builders.h" | 8 #include "src/interpreter/control-flow-builders.h" |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 #include "src/parser.h" | 10 #include "src/parser.h" |
(...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2034 VisitVariableAssignment(variable, FeedbackVectorSlot::Invalid()); | 2034 VisitVariableAssignment(variable, FeedbackVectorSlot::Invalid()); |
2035 } | 2035 } |
2036 | 2036 |
2037 | 2037 |
2038 void BytecodeGenerator::VisitThisFunctionVariable(Variable* variable) { | 2038 void BytecodeGenerator::VisitThisFunctionVariable(Variable* variable) { |
2039 if (variable == nullptr) return; | 2039 if (variable == nullptr) return; |
2040 | 2040 |
2041 // TODO(rmcilroy): Remove once we have tests which exercise this code path. | 2041 // TODO(rmcilroy): Remove once we have tests which exercise this code path. |
2042 UNIMPLEMENTED(); | 2042 UNIMPLEMENTED(); |
2043 | 2043 |
2044 // Store the closure we were called with in the this_function_var. | 2044 // Store the closure we were called with in the given variable. |
2045 builder()->LoadAccumulatorWithRegister(Register::function_closure()); | 2045 builder()->LoadAccumulatorWithRegister(Register::function_closure()); |
2046 VisitVariableAssignment(variable, FeedbackVectorSlot::Invalid()); | 2046 VisitVariableAssignment(variable, FeedbackVectorSlot::Invalid()); |
2047 } | 2047 } |
2048 | 2048 |
2049 | 2049 |
2050 void BytecodeGenerator::VisitNewTargetVariable(Variable* variable) { | 2050 void BytecodeGenerator::VisitNewTargetVariable(Variable* variable) { |
2051 if (variable == nullptr) return; | 2051 if (variable == nullptr) return; |
2052 | 2052 |
2053 // Store the closure we were called with in the this_function_var. | 2053 // Store the new target we were called with in the given variable. |
2054 builder()->CallRuntime(Runtime::kGetOriginalConstructor, Register(), 0); | 2054 builder()->CallRuntime(Runtime::kGetNewTarget, Register(), 0); |
2055 VisitVariableAssignment(variable, FeedbackVectorSlot::Invalid()); | 2055 VisitVariableAssignment(variable, FeedbackVectorSlot::Invalid()); |
2056 } | 2056 } |
2057 | 2057 |
2058 | 2058 |
2059 void BytecodeGenerator::VisitFunctionClosureForContext() { | 2059 void BytecodeGenerator::VisitFunctionClosureForContext() { |
2060 AccumulatorResultScope accumulator_execution_result(this); | 2060 AccumulatorResultScope accumulator_execution_result(this); |
2061 Scope* closure_scope = execution_context()->scope()->ClosureScope(); | 2061 Scope* closure_scope = execution_context()->scope()->ClosureScope(); |
2062 if (closure_scope->is_script_scope() || | 2062 if (closure_scope->is_script_scope() || |
2063 closure_scope->is_module_scope()) { | 2063 closure_scope->is_module_scope()) { |
2064 // Contexts nested in the native context have a canonical empty function as | 2064 // Contexts nested in the native context have a canonical empty function as |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2160 } | 2160 } |
2161 | 2161 |
2162 | 2162 |
2163 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 2163 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
2164 return info()->feedback_vector()->GetIndex(slot); | 2164 return info()->feedback_vector()->GetIndex(slot); |
2165 } | 2165 } |
2166 | 2166 |
2167 } // namespace interpreter | 2167 } // namespace interpreter |
2168 } // namespace internal | 2168 } // namespace internal |
2169 } // namespace v8 | 2169 } // namespace v8 |
OLD | NEW |