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

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

Issue 2504553003: [es6] Perform the IsConstructor test in GetSuperConstructor. (Closed)
Patch Set: rebase 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
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2495 matching lines...) Expand 10 before | Expand all | Expand 10 after
2506 int const feedback_slot_index = feedback_index(expr->CallFeedbackICSlot()); 2506 int const feedback_slot_index = feedback_index(expr->CallFeedbackICSlot());
2507 builder()->Call(callee, args, feedback_slot_index, call_type, 2507 builder()->Call(callee, args, feedback_slot_index, call_type,
2508 expr->tail_call_mode()); 2508 expr->tail_call_mode());
2509 } 2509 }
2510 2510
2511 void BytecodeGenerator::VisitCallSuper(Call* expr) { 2511 void BytecodeGenerator::VisitCallSuper(Call* expr) {
2512 RegisterAllocationScope register_scope(this); 2512 RegisterAllocationScope register_scope(this);
2513 SuperCallReference* super = expr->expression()->AsSuperCallReference(); 2513 SuperCallReference* super = expr->expression()->AsSuperCallReference();
2514 2514
2515 // Prepare the constructor to the super call. 2515 // Prepare the constructor to the super call.
2516 Register this_function = VisitForRegisterValue(super->this_function_var()); 2516 VisitForAccumulatorValue(super->this_function_var());
2517 builder()->CallRuntime(Runtime::kInlineGetSuperConstructor, this_function); 2517 Register constructor = register_allocator()->NewRegister();
2518 2518 builder()->GetSuperConstructor(constructor);
2519 Register constructor = this_function; // Re-use dead this_function register.
2520 builder()->StoreAccumulatorInRegister(constructor);
2521 2519
2522 ZoneList<Expression*>* args = expr->arguments(); 2520 ZoneList<Expression*>* args = expr->arguments();
2523 2521
2524 // When a super call contains a spread, a CallSuper AST node is only created 2522 // When a super call contains a spread, a CallSuper AST node is only created
2525 // if there is exactly one spread, and it is the last argument. 2523 // if there is exactly one spread, and it is the last argument.
2526 if (!args->is_empty() && args->last()->IsSpread()) { 2524 if (!args->is_empty() && args->last()->IsSpread()) {
2527 RegisterList args_regs = register_allocator()->NewGrowableRegisterList(); 2525 RegisterList args_regs = register_allocator()->NewGrowableRegisterList();
2528 Register constructor_arg = 2526 Register constructor_arg =
2529 register_allocator()->GrowRegisterList(&args_regs); 2527 register_allocator()->GrowRegisterList(&args_regs);
2530 builder()->MoveRegister(constructor, constructor_arg); 2528 builder()->MoveRegister(constructor, constructor_arg);
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
3291 } 3289 }
3292 3290
3293 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { 3291 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() {
3294 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict 3292 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict
3295 : Runtime::kStoreKeyedToSuper_Sloppy; 3293 : Runtime::kStoreKeyedToSuper_Sloppy;
3296 } 3294 }
3297 3295
3298 } // namespace interpreter 3296 } // namespace interpreter
3299 } // namespace internal 3297 } // namespace internal
3300 } // namespace v8 3298 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698