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

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

Issue 2504553003: [es6] Perform the IsConstructor test in GetSuperConstructor. (Closed)
Patch Set: rebase and git cl format 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 2489 matching lines...) Expand 10 before | Expand all | Expand 10 after
2500 int const feedback_slot_index = feedback_index(expr->CallFeedbackICSlot()); 2500 int const feedback_slot_index = feedback_index(expr->CallFeedbackICSlot());
2501 builder()->Call(callee, args, feedback_slot_index, call_type, 2501 builder()->Call(callee, args, feedback_slot_index, call_type,
2502 expr->tail_call_mode()); 2502 expr->tail_call_mode());
2503 } 2503 }
2504 2504
2505 void BytecodeGenerator::VisitCallSuper(Call* expr) { 2505 void BytecodeGenerator::VisitCallSuper(Call* expr) {
2506 RegisterAllocationScope register_scope(this); 2506 RegisterAllocationScope register_scope(this);
2507 SuperCallReference* super = expr->expression()->AsSuperCallReference(); 2507 SuperCallReference* super = expr->expression()->AsSuperCallReference();
2508 2508
2509 // Prepare the constructor to the super call. 2509 // Prepare the constructor to the super call.
2510 Register this_function = VisitForRegisterValue(super->this_function_var()); 2510 VisitForAccumulatorValue(super->this_function_var());
2511 builder()->CallRuntime(Runtime::kInlineGetSuperConstructor, this_function); 2511 Register constructor = register_allocator()->NewRegister();
2512 2512 builder()->GetSuperConstructor(constructor);
2513 Register constructor = this_function; // Re-use dead this_function register.
2514 builder()->StoreAccumulatorInRegister(constructor);
2515 2513
2516 ZoneList<Expression*>* args = expr->arguments(); 2514 ZoneList<Expression*>* args = expr->arguments();
2517 2515
2518 // When a super call contains a spread, a CallSuper AST node is only created 2516 // When a super call contains a spread, a CallSuper AST node is only created
2519 // if there is exactly one spread, and it is the last argument. 2517 // if there is exactly one spread, and it is the last argument.
2520 if (!args->is_empty() && args->last()->IsSpread()) { 2518 if (!args->is_empty() && args->last()->IsSpread()) {
2521 RegisterList args_regs = register_allocator()->NewGrowableRegisterList(); 2519 RegisterList args_regs = register_allocator()->NewGrowableRegisterList();
2522 Register constructor_arg = 2520 Register constructor_arg =
2523 register_allocator()->GrowRegisterList(&args_regs); 2521 register_allocator()->GrowRegisterList(&args_regs);
2524 builder()->MoveRegister(constructor, constructor_arg); 2522 builder()->MoveRegister(constructor, constructor_arg);
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
3285 } 3283 }
3286 3284
3287 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { 3285 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() {
3288 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict 3286 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict
3289 : Runtime::kStoreKeyedToSuper_Sloppy; 3287 : Runtime::kStoreKeyedToSuper_Sloppy;
3290 } 3288 }
3291 3289
3292 } // namespace interpreter 3290 } // namespace interpreter
3293 } // namespace internal 3291 } // namespace internal
3294 } // namespace v8 3292 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698