OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/js-create-lowering.h" | 5 #include "src/compiler/js-create-lowering.h" |
6 | 6 |
7 #include "src/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/compilation-dependencies.h" | 9 #include "src/compilation-dependencies.h" |
10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 } | 224 } |
225 | 225 |
226 Reduction JSCreateLowering::ReduceJSCreate(Node* node) { | 226 Reduction JSCreateLowering::ReduceJSCreate(Node* node) { |
227 DCHECK_EQ(IrOpcode::kJSCreate, node->opcode()); | 227 DCHECK_EQ(IrOpcode::kJSCreate, node->opcode()); |
228 Node* const target = NodeProperties::GetValueInput(node, 0); | 228 Node* const target = NodeProperties::GetValueInput(node, 0); |
229 Type* const target_type = NodeProperties::GetType(target); | 229 Type* const target_type = NodeProperties::GetType(target); |
230 Node* const new_target = NodeProperties::GetValueInput(node, 1); | 230 Node* const new_target = NodeProperties::GetValueInput(node, 1); |
231 Type* const new_target_type = NodeProperties::GetType(new_target); | 231 Type* const new_target_type = NodeProperties::GetType(new_target); |
232 Node* const effect = NodeProperties::GetEffectInput(node); | 232 Node* const effect = NodeProperties::GetEffectInput(node); |
233 // Extract constructor and original constructor function. | 233 // Extract constructor and original constructor function. |
234 if (target_type->IsConstant() && | 234 if (target_type->IsHeapConstant() && new_target_type->IsHeapConstant() && |
235 new_target_type->IsConstant() && | 235 new_target_type->AsHeapConstant()->Value()->IsJSFunction()) { |
236 new_target_type->AsConstant()->Value()->IsJSFunction()) { | |
237 Handle<JSFunction> constructor = | 236 Handle<JSFunction> constructor = |
238 Handle<JSFunction>::cast(target_type->AsConstant()->Value()); | 237 Handle<JSFunction>::cast(target_type->AsHeapConstant()->Value()); |
239 Handle<JSFunction> original_constructor = | 238 Handle<JSFunction> original_constructor = |
240 Handle<JSFunction>::cast(new_target_type->AsConstant()->Value()); | 239 Handle<JSFunction>::cast(new_target_type->AsHeapConstant()->Value()); |
241 DCHECK(constructor->IsConstructor()); | 240 DCHECK(constructor->IsConstructor()); |
242 DCHECK(original_constructor->IsConstructor()); | 241 DCHECK(original_constructor->IsConstructor()); |
243 | 242 |
244 // Check if we can inline the allocation. | 243 // Check if we can inline the allocation. |
245 if (IsAllocationInlineable(constructor, original_constructor)) { | 244 if (IsAllocationInlineable(constructor, original_constructor)) { |
246 // Force completion of inobject slack tracking before | 245 // Force completion of inobject slack tracking before |
247 // generating code to finalize the instance size. | 246 // generating code to finalize the instance size. |
248 original_constructor->CompleteInobjectSlackTrackingIfActive(); | 247 original_constructor->CompleteInobjectSlackTrackingIfActive(); |
249 | 248 |
250 // Compute instance size from initial map of {original_constructor}. | 249 // Compute instance size from initial map of {original_constructor}. |
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1305 return jsgraph()->simplified(); | 1304 return jsgraph()->simplified(); |
1306 } | 1305 } |
1307 | 1306 |
1308 MachineOperatorBuilder* JSCreateLowering::machine() const { | 1307 MachineOperatorBuilder* JSCreateLowering::machine() const { |
1309 return jsgraph()->machine(); | 1308 return jsgraph()->machine(); |
1310 } | 1309 } |
1311 | 1310 |
1312 } // namespace compiler | 1311 } // namespace compiler |
1313 } // namespace internal | 1312 } // namespace internal |
1314 } // namespace v8 | 1313 } // namespace v8 |
OLD | NEW |