| 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/code-stubs.h" | 6 #include "src/code-stubs.h" |
| 7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
| 8 #include "src/compiler/js-generic-lowering.h" | 8 #include "src/compiler/js-generic-lowering.h" |
| 9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
| 10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 } else { | 656 } else { |
| 657 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags())); | 657 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags())); |
| 658 ReplaceWithRuntimeCall(node, Runtime::kCreateArrayLiteral); | 658 ReplaceWithRuntimeCall(node, Runtime::kCreateArrayLiteral); |
| 659 } | 659 } |
| 660 } | 660 } |
| 661 | 661 |
| 662 | 662 |
| 663 void JSGenericLowering::LowerJSCreateLiteralObject(Node* node) { | 663 void JSGenericLowering::LowerJSCreateLiteralObject(Node* node) { |
| 664 CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op()); | 664 CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op()); |
| 665 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); | 665 CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); |
| 666 int const length = Handle<FixedArray>::cast(p.constant())->length(); | 666 // Constants are pairs, see ObjectLiteral::properties_count(). |
| 667 int const length = Handle<FixedArray>::cast(p.constant())->length() / 2; |
| 667 node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.index())); | 668 node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.index())); |
| 668 node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant())); | 669 node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant())); |
| 669 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags())); | 670 node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags())); |
| 670 | 671 |
| 671 // Use the FastCloneShallowObjectStub only for shallow boilerplates without | 672 // Use the FastCloneShallowObjectStub only for shallow boilerplates without |
| 672 // elements up to the number of properties that the stubs can handle. | 673 // elements up to the number of properties that the stubs can handle. |
| 673 if ((p.flags() & ObjectLiteral::kShallowProperties) != 0 && | 674 if ((p.flags() & ObjectLiteral::kShallowProperties) != 0 && |
| 674 length <= FastCloneShallowObjectStub::kMaximumClonedProperties) { | 675 length <= FastCloneShallowObjectStub::kMaximumClonedProperties) { |
| 675 Callable callable = CodeFactory::FastCloneShallowObject(isolate(), length); | 676 Callable callable = CodeFactory::FastCloneShallowObject(isolate(), length); |
| 676 ReplaceWithStubCall(node, callable, flags); | 677 ReplaceWithStubCall(node, callable, flags); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 } | 864 } |
| 864 | 865 |
| 865 | 866 |
| 866 MachineOperatorBuilder* JSGenericLowering::machine() const { | 867 MachineOperatorBuilder* JSGenericLowering::machine() const { |
| 867 return jsgraph()->machine(); | 868 return jsgraph()->machine(); |
| 868 } | 869 } |
| 869 | 870 |
| 870 } // namespace compiler | 871 } // namespace compiler |
| 871 } // namespace internal | 872 } // namespace internal |
| 872 } // namespace v8 | 873 } // namespace v8 |
| OLD | NEW |