| 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/compiler.h" | 7 #include "src/compiler.h" |
| 8 #include "src/compiler/ast-loop-assignment-analyzer.h" | 8 #include "src/compiler/ast-loop-assignment-analyzer.h" |
| 9 #include "src/compiler/control-builders.h" | 9 #include "src/compiler/control-builders.h" |
| 10 #include "src/compiler/js-type-feedback.h" | 10 #include "src/compiler/js-type-feedback.h" |
| (...skipping 3133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3144 Node* local_context = NewNode(op, scope_info, GetFunctionClosureForContext()); | 3144 Node* local_context = NewNode(op, scope_info, GetFunctionClosureForContext()); |
| 3145 | 3145 |
| 3146 return local_context; | 3146 return local_context; |
| 3147 } | 3147 } |
| 3148 | 3148 |
| 3149 | 3149 |
| 3150 Node* AstGraphBuilder::BuildArgumentsObject(Variable* arguments) { | 3150 Node* AstGraphBuilder::BuildArgumentsObject(Variable* arguments) { |
| 3151 if (arguments == NULL) return NULL; | 3151 if (arguments == NULL) return NULL; |
| 3152 | 3152 |
| 3153 // Allocate and initialize a new arguments object. | 3153 // Allocate and initialize a new arguments object. |
| 3154 Node* callee = GetFunctionClosure(); | |
| 3155 CreateArgumentsParameters::Type type = | 3154 CreateArgumentsParameters::Type type = |
| 3156 is_strict(language_mode()) || !info()->has_simple_parameters() | 3155 is_strict(language_mode()) || !info()->has_simple_parameters() |
| 3157 ? CreateArgumentsParameters::kUnmappedArguments | 3156 ? CreateArgumentsParameters::kUnmappedArguments |
| 3158 : CreateArgumentsParameters::kMappedArguments; | 3157 : CreateArgumentsParameters::kMappedArguments; |
| 3159 const Operator* op = javascript()->CreateArguments(type, 0); | 3158 const Operator* op = javascript()->CreateArguments(type, 0); |
| 3160 Node* object = NewNode(op, callee); | 3159 Node* object = NewNode(op, GetFunctionClosure()); |
| 3160 PrepareFrameState(object, BailoutId::None()); |
| 3161 | 3161 |
| 3162 // Assign the object to the arguments variable. | 3162 // Assign the object to the {arguments} variable. This should never lazy |
| 3163 // deopt, so it is fine to send invalid bailout id. |
| 3163 DCHECK(arguments->IsContextSlot() || arguments->IsStackAllocated()); | 3164 DCHECK(arguments->IsContextSlot() || arguments->IsStackAllocated()); |
| 3164 // This should never lazy deopt, so it is fine to send invalid bailout id. | |
| 3165 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 3165 FrameStateBeforeAndAfter states(this, BailoutId::None()); |
| 3166 BuildVariableAssignment(arguments, object, Token::ASSIGN, VectorSlotPair(), | 3166 BuildVariableAssignment(arguments, object, Token::ASSIGN, VectorSlotPair(), |
| 3167 BailoutId::None(), states); | 3167 BailoutId::None(), states); |
| 3168 return object; | 3168 return object; |
| 3169 } | 3169 } |
| 3170 | 3170 |
| 3171 | 3171 |
| 3172 Node* AstGraphBuilder::BuildThisFunctionVariable(Variable* this_function_var) { | 3172 Node* AstGraphBuilder::BuildThisFunctionVariable(Variable* this_function_var) { |
| 3173 if (this_function_var == nullptr) return nullptr; | 3173 if (this_function_var == nullptr) return nullptr; |
| 3174 | 3174 |
| 3175 // Retrieve the closure we were called with. | 3175 // Retrieve the closure we were called with. |
| 3176 Node* this_function = GetFunctionClosure(); | 3176 Node* this_function = GetFunctionClosure(); |
| 3177 | 3177 |
| 3178 // Assign the object to the {.this_function} variable. | 3178 // Assign the object to the {.this_function} variable. This should never lazy |
| 3179 // deopt, so it is fine to send invalid bailout id. |
| 3179 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 3180 FrameStateBeforeAndAfter states(this, BailoutId::None()); |
| 3180 BuildVariableAssignment(this_function_var, this_function, Token::INIT_CONST, | 3181 BuildVariableAssignment(this_function_var, this_function, Token::INIT_CONST, |
| 3181 VectorSlotPair(), BailoutId::None(), states); | 3182 VectorSlotPair(), BailoutId::None(), states); |
| 3182 return this_function; | 3183 return this_function; |
| 3183 } | 3184 } |
| 3184 | 3185 |
| 3185 | 3186 |
| 3186 Node* AstGraphBuilder::BuildNewTargetVariable(Variable* new_target_var) { | 3187 Node* AstGraphBuilder::BuildNewTargetVariable(Variable* new_target_var) { |
| 3187 if (new_target_var == nullptr) return nullptr; | 3188 if (new_target_var == nullptr) return nullptr; |
| 3188 | 3189 |
| 3189 // Retrieve the original constructor in case we are called as a constructor. | 3190 // Retrieve the original constructor in case we are called as a constructor. |
| 3190 const Operator* op = | 3191 const Operator* op = |
| 3191 javascript()->CallRuntime(Runtime::kGetOriginalConstructor, 0); | 3192 javascript()->CallRuntime(Runtime::kGetOriginalConstructor, 0); |
| 3192 Node* object = NewNode(op); | 3193 Node* object = NewNode(op); |
| 3193 | 3194 |
| 3194 // Assign the object to the {new.target} variable. | 3195 // Assign the object to the {new.target} variable. This should never lazy |
| 3196 // deopt, so it is fine to send invalid bailout id. |
| 3195 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 3197 FrameStateBeforeAndAfter states(this, BailoutId::None()); |
| 3196 BuildVariableAssignment(new_target_var, object, Token::INIT_CONST, | 3198 BuildVariableAssignment(new_target_var, object, Token::INIT_CONST, |
| 3197 VectorSlotPair(), BailoutId::None(), states); | 3199 VectorSlotPair(), BailoutId::None(), states); |
| 3198 return object; | 3200 return object; |
| 3199 } | 3201 } |
| 3200 | 3202 |
| 3201 | 3203 |
| 3202 Node* AstGraphBuilder::BuildHoleCheckSilent(Node* value, Node* for_hole, | 3204 Node* AstGraphBuilder::BuildHoleCheckSilent(Node* value, Node* for_hole, |
| 3203 Node* not_hole) { | 3205 Node* not_hole) { |
| 3204 Node* the_hole = jsgraph()->TheHoleConstant(); | 3206 Node* the_hole = jsgraph()->TheHoleConstant(); |
| (...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4254 // Phi does not exist yet, introduce one. | 4256 // Phi does not exist yet, introduce one. |
| 4255 value = NewPhi(inputs, value, control); | 4257 value = NewPhi(inputs, value, control); |
| 4256 value->ReplaceInput(inputs - 1, other); | 4258 value->ReplaceInput(inputs - 1, other); |
| 4257 } | 4259 } |
| 4258 return value; | 4260 return value; |
| 4259 } | 4261 } |
| 4260 | 4262 |
| 4261 } // namespace compiler | 4263 } // namespace compiler |
| 4262 } // namespace internal | 4264 } // namespace internal |
| 4263 } // namespace v8 | 4265 } // namespace v8 |
| OLD | NEW |