| 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 2486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2497 int const feedback_slot_index = feedback_index(expr->CallFeedbackICSlot()); | 2497 int const feedback_slot_index = feedback_index(expr->CallFeedbackICSlot()); |
| 2498 builder()->Call(callee, args, feedback_slot_index, call_type, | 2498 builder()->Call(callee, args, feedback_slot_index, call_type, |
| 2499 expr->tail_call_mode()); | 2499 expr->tail_call_mode()); |
| 2500 } | 2500 } |
| 2501 | 2501 |
| 2502 void BytecodeGenerator::VisitCallSuper(Call* expr) { | 2502 void BytecodeGenerator::VisitCallSuper(Call* expr) { |
| 2503 RegisterAllocationScope register_scope(this); | 2503 RegisterAllocationScope register_scope(this); |
| 2504 SuperCallReference* super = expr->expression()->AsSuperCallReference(); | 2504 SuperCallReference* super = expr->expression()->AsSuperCallReference(); |
| 2505 | 2505 |
| 2506 // Prepare the constructor to the super call. | 2506 // Prepare the constructor to the super call. |
| 2507 Register this_function = VisitForRegisterValue(super->this_function_var()); | 2507 VisitForAccumulatorValue(super->this_function_var()); |
| 2508 builder()->CallRuntime(Runtime::kInlineGetSuperConstructor, this_function); | 2508 Register constructor = register_allocator()->NewRegister(); |
| 2509 | 2509 builder()->GetSuperConstructor(constructor); |
| 2510 Register constructor = this_function; // Re-use dead this_function register. | |
| 2511 builder()->StoreAccumulatorInRegister(constructor); | |
| 2512 | 2510 |
| 2513 ZoneList<Expression*>* args = expr->arguments(); | 2511 ZoneList<Expression*>* args = expr->arguments(); |
| 2514 | 2512 |
| 2515 // When a super call contains a spread, a CallSuper AST node is only created | 2513 // When a super call contains a spread, a CallSuper AST node is only created |
| 2516 // if there is exactly one spread, and it is the last argument. | 2514 // if there is exactly one spread, and it is the last argument. |
| 2517 if (!args->is_empty() && args->last()->IsSpread()) { | 2515 if (!args->is_empty() && args->last()->IsSpread()) { |
| 2518 RegisterList args_regs = | 2516 RegisterList args_regs = |
| 2519 register_allocator()->NewRegisterList(args->length() + 2); | 2517 register_allocator()->NewRegisterList(args->length() + 2); |
| 2520 builder()->MoveRegister(constructor, args_regs[0]); | 2518 builder()->MoveRegister(constructor, args_regs[0]); |
| 2521 VisitArguments(args, args_regs, 2); | 2519 VisitArguments(args, args_regs, 2); |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3260 } | 3258 } |
| 3261 | 3259 |
| 3262 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { | 3260 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { |
| 3263 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict | 3261 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict |
| 3264 : Runtime::kStoreKeyedToSuper_Sloppy; | 3262 : Runtime::kStoreKeyedToSuper_Sloppy; |
| 3265 } | 3263 } |
| 3266 | 3264 |
| 3267 } // namespace interpreter | 3265 } // namespace interpreter |
| 3268 } // namespace internal | 3266 } // namespace internal |
| 3269 } // namespace v8 | 3267 } // namespace v8 |
| OLD | NEW |