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

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 1543253002: Basic TurboFan support for rest arguments. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Code 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 unified diff | Download patch
« no previous file with comments | « src/ast/ast-numbering.cc ('k') | src/compiler/js-generic-lowering.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.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/compiler/ast-loop-assignment-analyzer.h" 9 #include "src/compiler/ast-loop-assignment-analyzer.h"
10 #include "src/compiler/control-builders.h" 10 #include "src/compiler/control-builders.h"
(...skipping 3211 matching lines...) Expand 10 before | Expand all | Expand 10 after
3222 FrameStateBeforeAndAfter states(this, BailoutId::None()); 3222 FrameStateBeforeAndAfter states(this, BailoutId::None());
3223 BuildVariableAssignment(arguments, object, Token::ASSIGN, VectorSlotPair(), 3223 BuildVariableAssignment(arguments, object, Token::ASSIGN, VectorSlotPair(),
3224 BailoutId::None(), states); 3224 BailoutId::None(), states);
3225 return object; 3225 return object;
3226 } 3226 }
3227 3227
3228 3228
3229 Node* AstGraphBuilder::BuildRestArgumentsArray(Variable* rest, int index) { 3229 Node* AstGraphBuilder::BuildRestArgumentsArray(Variable* rest, int index) {
3230 if (rest == NULL) return NULL; 3230 if (rest == NULL) return NULL;
3231 3231
3232 // TODO(mvstanton): Handle rest arguments. 3232 // Allocate and initialize a new arguments object.
3233 SetStackOverflow(); 3233 CreateArgumentsParameters::Type type = CreateArgumentsParameters::kRestArray;
3234 return jsgraph()->UndefinedConstant(); 3234 const Operator* op = javascript()->CreateArguments(type, index);
3235 Node* object = NewNode(op, GetFunctionClosure());
3236 PrepareFrameState(object, BailoutId::None());
3237
3238 // Assign the object to the {rest} variable. This should never lazy
3239 // deopt, so it is fine to send invalid bailout id.
3240 DCHECK(rest->IsContextSlot() || rest->IsStackAllocated());
3241 FrameStateBeforeAndAfter states(this, BailoutId::None());
3242 BuildVariableAssignment(rest, object, Token::ASSIGN, VectorSlotPair(),
3243 BailoutId::None(), states);
3244 return object;
3235 } 3245 }
3236 3246
3237 3247
3238 Node* AstGraphBuilder::BuildThisFunctionVariable(Variable* this_function_var) { 3248 Node* AstGraphBuilder::BuildThisFunctionVariable(Variable* this_function_var) {
3239 if (this_function_var == nullptr) return nullptr; 3249 if (this_function_var == nullptr) return nullptr;
3240 3250
3241 // Retrieve the closure we were called with. 3251 // Retrieve the closure we were called with.
3242 Node* this_function = GetFunctionClosure(); 3252 Node* this_function = GetFunctionClosure();
3243 3253
3244 // Assign the object to the {.this_function} variable. This should never lazy 3254 // Assign the object to the {.this_function} variable. This should never lazy
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after
4346 // Phi does not exist yet, introduce one. 4356 // Phi does not exist yet, introduce one.
4347 value = NewPhi(inputs, value, control); 4357 value = NewPhi(inputs, value, control);
4348 value->ReplaceInput(inputs - 1, other); 4358 value->ReplaceInput(inputs - 1, other);
4349 } 4359 }
4350 return value; 4360 return value;
4351 } 4361 }
4352 4362
4353 } // namespace compiler 4363 } // namespace compiler
4354 } // namespace internal 4364 } // namespace internal
4355 } // namespace v8 4365 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast-numbering.cc ('k') | src/compiler/js-generic-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698