| OLD | NEW |
| 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 3188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3199 Node* local_context = NewNode(op, GetFunctionClosureForContext()); | 3199 Node* local_context = NewNode(op, GetFunctionClosureForContext()); |
| 3200 | 3200 |
| 3201 return local_context; | 3201 return local_context; |
| 3202 } | 3202 } |
| 3203 | 3203 |
| 3204 | 3204 |
| 3205 Node* AstGraphBuilder::BuildArgumentsObject(Variable* arguments) { | 3205 Node* AstGraphBuilder::BuildArgumentsObject(Variable* arguments) { |
| 3206 if (arguments == nullptr) return nullptr; | 3206 if (arguments == nullptr) return nullptr; |
| 3207 | 3207 |
| 3208 // Allocate and initialize a new arguments object. | 3208 // Allocate and initialize a new arguments object. |
| 3209 CreateArgumentsParameters::Type type = | 3209 CreateArgumentsType type = |
| 3210 is_strict(language_mode()) || !info()->has_simple_parameters() | 3210 is_strict(language_mode()) || !info()->has_simple_parameters() |
| 3211 ? CreateArgumentsParameters::kUnmappedArguments | 3211 ? CreateArgumentsType::kUnmappedArguments |
| 3212 : CreateArgumentsParameters::kMappedArguments; | 3212 : CreateArgumentsType::kMappedArguments; |
| 3213 const Operator* op = javascript()->CreateArguments(type, 0); | 3213 const Operator* op = javascript()->CreateArguments(type); |
| 3214 Node* object = NewNode(op, GetFunctionClosure()); | 3214 Node* object = NewNode(op, GetFunctionClosure()); |
| 3215 PrepareFrameState(object, BailoutId::None()); | 3215 PrepareFrameState(object, BailoutId::None()); |
| 3216 | 3216 |
| 3217 // Assign the object to the {arguments} variable. This should never lazy | 3217 // Assign the object to the {arguments} variable. This should never lazy |
| 3218 // deopt, so it is fine to send invalid bailout id. | 3218 // deopt, so it is fine to send invalid bailout id. |
| 3219 DCHECK(arguments->IsContextSlot() || arguments->IsStackAllocated()); | 3219 DCHECK(arguments->IsContextSlot() || arguments->IsStackAllocated()); |
| 3220 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 3220 FrameStateBeforeAndAfter states(this, BailoutId::None()); |
| 3221 BuildVariableAssignment(arguments, object, Token::ASSIGN, VectorSlotPair(), | 3221 BuildVariableAssignment(arguments, object, Token::ASSIGN, VectorSlotPair(), |
| 3222 BailoutId::None(), states); | 3222 BailoutId::None(), states); |
| 3223 return object; | 3223 return object; |
| 3224 } | 3224 } |
| 3225 | 3225 |
| 3226 | 3226 |
| 3227 Node* AstGraphBuilder::BuildRestArgumentsArray(Variable* rest, int index) { | 3227 Node* AstGraphBuilder::BuildRestArgumentsArray(Variable* rest, int index) { |
| 3228 if (rest == nullptr) return nullptr; | 3228 if (rest == nullptr) return nullptr; |
| 3229 | 3229 |
| 3230 // Allocate and initialize a new arguments object. | 3230 // Allocate and initialize a new arguments object. |
| 3231 CreateArgumentsParameters::Type type = CreateArgumentsParameters::kRestArray; | 3231 CreateArgumentsType type = CreateArgumentsType::kRestParameter; |
| 3232 const Operator* op = javascript()->CreateArguments(type, index); | 3232 const Operator* op = javascript()->CreateArguments(type); |
| 3233 Node* object = NewNode(op, GetFunctionClosure()); | 3233 Node* object = NewNode(op, GetFunctionClosure()); |
| 3234 PrepareFrameState(object, BailoutId::None()); | 3234 PrepareFrameState(object, BailoutId::None()); |
| 3235 | 3235 |
| 3236 // Assign the object to the {rest} variable. This should never lazy | 3236 // Assign the object to the {rest} variable. This should never lazy |
| 3237 // deopt, so it is fine to send invalid bailout id. | 3237 // deopt, so it is fine to send invalid bailout id. |
| 3238 DCHECK(rest->IsContextSlot() || rest->IsStackAllocated()); | 3238 DCHECK(rest->IsContextSlot() || rest->IsStackAllocated()); |
| 3239 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 3239 FrameStateBeforeAndAfter states(this, BailoutId::None()); |
| 3240 BuildVariableAssignment(rest, object, Token::ASSIGN, VectorSlotPair(), | 3240 BuildVariableAssignment(rest, object, Token::ASSIGN, VectorSlotPair(), |
| 3241 BailoutId::None(), states); | 3241 BailoutId::None(), states); |
| 3242 return object; | 3242 return object; |
| (...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4361 // Phi does not exist yet, introduce one. | 4361 // Phi does not exist yet, introduce one. |
| 4362 value = NewPhi(inputs, value, control); | 4362 value = NewPhi(inputs, value, control); |
| 4363 value->ReplaceInput(inputs - 1, other); | 4363 value->ReplaceInput(inputs - 1, other); |
| 4364 } | 4364 } |
| 4365 return value; | 4365 return value; |
| 4366 } | 4366 } |
| 4367 | 4367 |
| 4368 } // namespace compiler | 4368 } // namespace compiler |
| 4369 } // namespace internal | 4369 } // namespace internal |
| 4370 } // namespace v8 | 4370 } // namespace v8 |
| OLD | NEW |