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/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/compilation-dependencies.h" | 6 #include "src/compilation-dependencies.h" |
7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/js-typed-lowering.h" | 9 #include "src/compiler/js-typed-lowering.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 Type* const target_type = NodeProperties::GetType(target); | 1391 Type* const target_type = NodeProperties::GetType(target); |
1392 Node* const new_target = NodeProperties::GetValueInput(node, 1); | 1392 Node* const new_target = NodeProperties::GetValueInput(node, 1); |
1393 Node* const effect = NodeProperties::GetEffectInput(node); | 1393 Node* const effect = NodeProperties::GetEffectInput(node); |
1394 // TODO(turbofan): Add support for NewTarget passed to JSCreate. | 1394 // TODO(turbofan): Add support for NewTarget passed to JSCreate. |
1395 if (target != new_target) return NoChange(); | 1395 if (target != new_target) return NoChange(); |
1396 // Extract constructor function. | 1396 // Extract constructor function. |
1397 if (target_type->IsConstant() && | 1397 if (target_type->IsConstant() && |
1398 target_type->AsConstant()->Value()->IsJSFunction()) { | 1398 target_type->AsConstant()->Value()->IsJSFunction()) { |
1399 Handle<JSFunction> constructor = | 1399 Handle<JSFunction> constructor = |
1400 Handle<JSFunction>::cast(target_type->AsConstant()->Value()); | 1400 Handle<JSFunction>::cast(target_type->AsConstant()->Value()); |
1401 // Check that function is a constructor. | 1401 DCHECK(constructor->IsConstructor()); |
1402 if (!constructor->IsConstructor()) return NoChange(); | |
1403 // Force completion of inobject slack tracking before | 1402 // Force completion of inobject slack tracking before |
1404 // generating code to finalize the instance size. | 1403 // generating code to finalize the instance size. |
1405 if (constructor->IsInobjectSlackTrackingInProgress()) { | 1404 if (constructor->IsInobjectSlackTrackingInProgress()) { |
1406 constructor->CompleteInobjectSlackTracking(); | 1405 constructor->CompleteInobjectSlackTracking(); |
1407 } | 1406 } |
1408 | 1407 |
1409 // TODO(bmeurer): We fall back to the runtime in case we cannot inline | 1408 // TODO(bmeurer): We fall back to the runtime in case we cannot inline |
1410 // the allocation here, which is sort of expensive. We should think about | 1409 // the allocation here, which is sort of expensive. We should think about |
1411 // a soft fallback to some NewObjectCodeStub. | 1410 // a soft fallback to some NewObjectCodeStub. |
1412 if (IsAllocationInlineable(constructor)) { | 1411 if (IsAllocationInlineable(constructor)) { |
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2620 } | 2619 } |
2621 | 2620 |
2622 | 2621 |
2623 CompilationDependencies* JSTypedLowering::dependencies() const { | 2622 CompilationDependencies* JSTypedLowering::dependencies() const { |
2624 return dependencies_; | 2623 return dependencies_; |
2625 } | 2624 } |
2626 | 2625 |
2627 } // namespace compiler | 2626 } // namespace compiler |
2628 } // namespace internal | 2627 } // namespace internal |
2629 } // namespace v8 | 2628 } // namespace v8 |
OLD | NEW |