| 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/ast/compile-time-value.h" | 7 #include "src/ast/compile-time-value.h" |
| 8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/compilation-info.h" | 10 #include "src/compilation-info.h" |
| (...skipping 3262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3273 builder()->LoadAccumulatorWithRegister(Register::function_closure()); | 3273 builder()->LoadAccumulatorWithRegister(Register::function_closure()); |
| 3274 VisitVariableAssignment(variable, Token::INIT, FeedbackVectorSlot::Invalid()); | 3274 VisitVariableAssignment(variable, Token::INIT, FeedbackVectorSlot::Invalid()); |
| 3275 } | 3275 } |
| 3276 | 3276 |
| 3277 void BytecodeGenerator::VisitNewTargetVariable(Variable* variable) { | 3277 void BytecodeGenerator::VisitNewTargetVariable(Variable* variable) { |
| 3278 if (variable == nullptr) return; | 3278 if (variable == nullptr) return; |
| 3279 | 3279 |
| 3280 // Store the new target we were called with in the given variable. | 3280 // Store the new target we were called with in the given variable. |
| 3281 builder()->LoadAccumulatorWithRegister(Register::new_target()); | 3281 builder()->LoadAccumulatorWithRegister(Register::new_target()); |
| 3282 VisitVariableAssignment(variable, Token::INIT, FeedbackVectorSlot::Invalid()); | 3282 VisitVariableAssignment(variable, Token::INIT, FeedbackVectorSlot::Invalid()); |
| 3283 |
| 3284 // TODO(mstarzinger): The <new.target> register is not set by the deoptimizer |
| 3285 // and we need to make sure {BytecodeRegisterOptimizer} flushes its state |
| 3286 // before a local variable containing the <new.target> is used. Using a label |
| 3287 // as below flushes the entire pipeline, we should be more specific here. |
| 3288 BytecodeLabel flush_state_label; |
| 3289 builder()->Bind(&flush_state_label); |
| 3283 } | 3290 } |
| 3284 | 3291 |
| 3285 void BytecodeGenerator::VisitFunctionClosureForContext() { | 3292 void BytecodeGenerator::VisitFunctionClosureForContext() { |
| 3286 AccumulatorResultScope accumulator_execution_result(this); | 3293 AccumulatorResultScope accumulator_execution_result(this); |
| 3287 DeclarationScope* closure_scope = | 3294 DeclarationScope* closure_scope = |
| 3288 execution_context()->scope()->GetClosureScope(); | 3295 execution_context()->scope()->GetClosureScope(); |
| 3289 if (closure_scope->is_script_scope() || | 3296 if (closure_scope->is_script_scope() || |
| 3290 closure_scope->is_module_scope()) { | 3297 closure_scope->is_module_scope()) { |
| 3291 // Contexts nested in the native context have a canonical empty function as | 3298 // Contexts nested in the native context have a canonical empty function as |
| 3292 // their closure, not the anonymous closure containing the global code. | 3299 // their closure, not the anonymous closure containing the global code. |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3386 return execution_context()->scope()->language_mode(); | 3393 return execution_context()->scope()->language_mode(); |
| 3387 } | 3394 } |
| 3388 | 3395 |
| 3389 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3396 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
| 3390 return TypeFeedbackVector::GetIndex(slot); | 3397 return TypeFeedbackVector::GetIndex(slot); |
| 3391 } | 3398 } |
| 3392 | 3399 |
| 3393 } // namespace interpreter | 3400 } // namespace interpreter |
| 3394 } // namespace internal | 3401 } // namespace internal |
| 3395 } // namespace v8 | 3402 } // namespace v8 |
| OLD | NEW |