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

Unified Diff: src/interpreter/bytecode-generator.cc

Issue 1664593003: [Interpreter] Adds support for rest parameters to interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixes comments. Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/bytecode-generator.h ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-generator.cc
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index 4ef0506a12388cf0f534058b33b98e21f3689169..28074fd197577841d1fa378f1db253309f67c592 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -583,11 +583,10 @@ void BytecodeGenerator::MakeBytecodeBody() {
// Build the arguments object if it is used.
VisitArgumentsObject(scope()->arguments());
- // TODO(mythria): Build rest arguments array if it is used.
+ // Build rest arguments array if it is used.
int rest_index;
- if (scope()->rest_parameter(&rest_index)) {
- UNIMPLEMENTED();
- }
+ Variable* rest_parameter = scope()->rest_parameter(&rest_index);
+ VisitRestArgumentsArray(rest_parameter, rest_index);
// Build assignment to {.this_function} variable if it is used.
VisitThisFunctionVariable(scope()->this_function_var());
@@ -2423,6 +2422,15 @@ void BytecodeGenerator::VisitArgumentsObject(Variable* variable) {
VisitVariableAssignment(variable, FeedbackVectorSlot::Invalid());
}
+void BytecodeGenerator::VisitRestArgumentsArray(Variable* rest, int index) {
+ if (rest == nullptr) return;
+
+ // Allocate and initialize a new arguments object and assign to the {rest}
+ // variable.
+ builder()->CreateRestArguments(index);
+ DCHECK(rest->IsContextSlot() || rest->IsStackAllocated());
+ VisitVariableAssignment(rest, FeedbackVectorSlot::Invalid());
+}
void BytecodeGenerator::VisitThisFunctionVariable(Variable* variable) {
if (variable == nullptr) return;
« no previous file with comments | « src/interpreter/bytecode-generator.h ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698