Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 2504553003: [es6] Perform the IsConstructor test in GetSuperConstructor. (Closed)
Patch Set: address comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2485 matching lines...) Expand 10 before | Expand all | Expand 10 after
2496 int const feedback_slot_index = feedback_index(expr->CallFeedbackICSlot()); 2496 int const feedback_slot_index = feedback_index(expr->CallFeedbackICSlot());
2497 builder()->Call(callee, args, feedback_slot_index, call_type, 2497 builder()->Call(callee, args, feedback_slot_index, call_type,
2498 expr->tail_call_mode()); 2498 expr->tail_call_mode());
2499 } 2499 }
2500 2500
2501 void BytecodeGenerator::VisitCallSuper(Call* expr) { 2501 void BytecodeGenerator::VisitCallSuper(Call* expr) {
2502 RegisterAllocationScope register_scope(this); 2502 RegisterAllocationScope register_scope(this);
2503 SuperCallReference* super = expr->expression()->AsSuperCallReference(); 2503 SuperCallReference* super = expr->expression()->AsSuperCallReference();
2504 2504
2505 // Prepare the constructor to the super call. 2505 // Prepare the constructor to the super call.
2506 Register this_function = VisitForRegisterValue(super->this_function_var()); 2506 VisitForAccumulatorValue(super->this_function_var());
2507 builder()->CallRuntime(Runtime::kInlineGetSuperConstructor, this_function); 2507 Register constructor = register_allocator()->NewRegister();
2508 2508 builder()->GetSuperConstructor(constructor);
2509 Register constructor = this_function; // Re-use dead this_function register.
2510 builder()->StoreAccumulatorInRegister(constructor);
2511 2509
2512 ZoneList<Expression*>* args = expr->arguments(); 2510 ZoneList<Expression*>* args = expr->arguments();
2513 2511
2514 // When a super call contains a spread, a CallSuper AST node is only created 2512 // When a super call contains a spread, a CallSuper AST node is only created
2515 // if there is exactly one spread, and it is the last argument. 2513 // if there is exactly one spread, and it is the last argument.
2516 if (!args->is_empty() && args->last()->IsSpread()) { 2514 if (!args->is_empty() && args->last()->IsSpread()) {
2517 RegisterList args_regs = 2515 RegisterList args_regs =
2518 register_allocator()->NewRegisterList(args->length() + 2); 2516 register_allocator()->NewRegisterList(args->length() + 2);
2519 builder()->MoveRegister(constructor, args_regs[0]); 2517 builder()->MoveRegister(constructor, args_regs[0]);
2520 VisitForRegisterValue(super->new_target_var(), args_regs[1]); 2518 VisitForRegisterValue(super->new_target_var(), args_regs[1]);
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
3231 } 3229 }
3232 3230
3233 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { 3231 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() {
3234 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict 3232 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict
3235 : Runtime::kStoreKeyedToSuper_Sloppy; 3233 : Runtime::kStoreKeyedToSuper_Sloppy;
3236 } 3234 }
3237 3235
3238 } // namespace interpreter 3236 } // namespace interpreter
3239 } // namespace internal 3237 } // namespace internal
3240 } // namespace v8 3238 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698