| 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 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 Type* const target_type = NodeProperties::GetType(target); | 1366 Type* const target_type = NodeProperties::GetType(target); |
| 1367 Node* const new_target = NodeProperties::GetValueInput(node, 1); | 1367 Node* const new_target = NodeProperties::GetValueInput(node, 1); |
| 1368 Node* const effect = NodeProperties::GetEffectInput(node); | 1368 Node* const effect = NodeProperties::GetEffectInput(node); |
| 1369 // TODO(turbofan): Add support for NewTarget passed to JSCreate. | 1369 // TODO(turbofan): Add support for NewTarget passed to JSCreate. |
| 1370 if (target != new_target) return NoChange(); | 1370 if (target != new_target) return NoChange(); |
| 1371 // Extract constructor function. | 1371 // Extract constructor function. |
| 1372 if (target_type->IsConstant() && | 1372 if (target_type->IsConstant() && |
| 1373 target_type->AsConstant()->Value()->IsJSFunction()) { | 1373 target_type->AsConstant()->Value()->IsJSFunction()) { |
| 1374 Handle<JSFunction> constructor = | 1374 Handle<JSFunction> constructor = |
| 1375 Handle<JSFunction>::cast(target_type->AsConstant()->Value()); | 1375 Handle<JSFunction>::cast(target_type->AsConstant()->Value()); |
| 1376 // Check that function is a constructor. | 1376 DCHECK(constructor->IsConstructor()); |
| 1377 if (!constructor->IsConstructor()) return NoChange(); | |
| 1378 // Force completion of inobject slack tracking before | 1377 // Force completion of inobject slack tracking before |
| 1379 // generating code to finalize the instance size. | 1378 // generating code to finalize the instance size. |
| 1380 if (constructor->IsInobjectSlackTrackingInProgress()) { | 1379 if (constructor->IsInobjectSlackTrackingInProgress()) { |
| 1381 constructor->CompleteInobjectSlackTracking(); | 1380 constructor->CompleteInobjectSlackTracking(); |
| 1382 } | 1381 } |
| 1383 | 1382 |
| 1384 // TODO(bmeurer): We fall back to the runtime in case we cannot inline | 1383 // TODO(bmeurer): We fall back to the runtime in case we cannot inline |
| 1385 // the allocation here, which is sort of expensive. We should think about | 1384 // the allocation here, which is sort of expensive. We should think about |
| 1386 // a soft fallback to some NewObjectCodeStub. | 1385 // a soft fallback to some NewObjectCodeStub. |
| 1387 if (IsAllocationInlineable(constructor)) { | 1386 if (IsAllocationInlineable(constructor)) { |
| (...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2470 } | 2469 } |
| 2471 | 2470 |
| 2472 | 2471 |
| 2473 CompilationDependencies* JSTypedLowering::dependencies() const { | 2472 CompilationDependencies* JSTypedLowering::dependencies() const { |
| 2474 return dependencies_; | 2473 return dependencies_; |
| 2475 } | 2474 } |
| 2476 | 2475 |
| 2477 } // namespace compiler | 2476 } // namespace compiler |
| 2478 } // namespace internal | 2477 } // namespace internal |
| 2479 } // namespace v8 | 2478 } // namespace v8 |
| OLD | NEW |