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

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

Issue 1676883002: [runtime] Optimize and unify rest parameters. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months 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/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/interpreter/bytecode-register-allocator.h" 9 #include "src/interpreter/bytecode-register-allocator.h"
10 #include "src/interpreter/control-flow-builders.h" 10 #include "src/interpreter/control-flow-builders.h"
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 } 580 }
581 581
582 582
583 void BytecodeGenerator::MakeBytecodeBody() { 583 void BytecodeGenerator::MakeBytecodeBody() {
584 // Build the arguments object if it is used. 584 // Build the arguments object if it is used.
585 VisitArgumentsObject(scope()->arguments()); 585 VisitArgumentsObject(scope()->arguments());
586 586
587 // Build rest arguments array if it is used. 587 // Build rest arguments array if it is used.
588 int rest_index; 588 int rest_index;
589 Variable* rest_parameter = scope()->rest_parameter(&rest_index); 589 Variable* rest_parameter = scope()->rest_parameter(&rest_index);
590 VisitRestArgumentsArray(rest_parameter, rest_index); 590 VisitRestArgumentsArray(rest_parameter);
591 591
592 // Build assignment to {.this_function} variable if it is used. 592 // Build assignment to {.this_function} variable if it is used.
593 VisitThisFunctionVariable(scope()->this_function_var()); 593 VisitThisFunctionVariable(scope()->this_function_var());
594 594
595 // Build assignment to {new.target} variable if it is used. 595 // Build assignment to {new.target} variable if it is used.
596 VisitNewTargetVariable(scope()->new_target_var()); 596 VisitNewTargetVariable(scope()->new_target_var());
597 597
598 // TODO(rmcilroy): Emit tracing call if requested to do so. 598 // TODO(rmcilroy): Emit tracing call if requested to do so.
599 if (FLAG_trace) { 599 if (FLAG_trace) {
600 UNIMPLEMENTED(); 600 UNIMPLEMENTED();
(...skipping 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after
2597 // Allocate and initialize a new arguments object and assign to the 2597 // Allocate and initialize a new arguments object and assign to the
2598 // {arguments} variable. 2598 // {arguments} variable.
2599 CreateArgumentsType type = 2599 CreateArgumentsType type =
2600 is_strict(language_mode()) || !info()->has_simple_parameters() 2600 is_strict(language_mode()) || !info()->has_simple_parameters()
2601 ? CreateArgumentsType::kUnmappedArguments 2601 ? CreateArgumentsType::kUnmappedArguments
2602 : CreateArgumentsType::kMappedArguments; 2602 : CreateArgumentsType::kMappedArguments;
2603 builder()->CreateArguments(type); 2603 builder()->CreateArguments(type);
2604 VisitVariableAssignment(variable, FeedbackVectorSlot::Invalid()); 2604 VisitVariableAssignment(variable, FeedbackVectorSlot::Invalid());
2605 } 2605 }
2606 2606
2607 void BytecodeGenerator::VisitRestArgumentsArray(Variable* rest, int index) { 2607 void BytecodeGenerator::VisitRestArgumentsArray(Variable* rest) {
2608 if (rest == nullptr) return; 2608 if (rest == nullptr) return;
2609 2609
2610 // Allocate and initialize a new arguments object and assign to the {rest} 2610 // Allocate and initialize a new rest parameter and assign to the {rest}
2611 // variable. 2611 // variable.
2612 builder()->CreateRestArguments(index); 2612 builder()->CreateArguments(CreateArgumentsType::kRestParameter);
2613 DCHECK(rest->IsContextSlot() || rest->IsStackAllocated()); 2613 DCHECK(rest->IsContextSlot() || rest->IsStackAllocated());
2614 VisitVariableAssignment(rest, FeedbackVectorSlot::Invalid()); 2614 VisitVariableAssignment(rest, FeedbackVectorSlot::Invalid());
2615 } 2615 }
2616 2616
2617 void BytecodeGenerator::VisitThisFunctionVariable(Variable* variable) { 2617 void BytecodeGenerator::VisitThisFunctionVariable(Variable* variable) {
2618 if (variable == nullptr) return; 2618 if (variable == nullptr) return;
2619 2619
2620 // TODO(rmcilroy): Remove once we have tests which exercise this code path. 2620 // TODO(rmcilroy): Remove once we have tests which exercise this code path.
2621 UNIMPLEMENTED(); 2621 UNIMPLEMENTED();
2622 2622
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
2709 } 2709 }
2710 2710
2711 2711
2712 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 2712 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
2713 return info()->feedback_vector()->GetIndex(slot); 2713 return info()->feedback_vector()->GetIndex(slot);
2714 } 2714 }
2715 2715
2716 } // namespace interpreter 2716 } // namespace interpreter
2717 } // namespace internal 2717 } // namespace internal
2718 } // namespace v8 2718 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698