OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 ? ObjectLiteral::kFastElements | 1561 ? ObjectLiteral::kFastElements |
1562 : ObjectLiteral::kNoFlags; | 1562 : ObjectLiteral::kNoFlags; |
1563 flags |= expr->has_function() | 1563 flags |= expr->has_function() |
1564 ? ObjectLiteral::kHasFunction | 1564 ? ObjectLiteral::kHasFunction |
1565 : ObjectLiteral::kNoFlags; | 1565 : ObjectLiteral::kNoFlags; |
1566 __ Push(Smi::FromInt(flags)); | 1566 __ Push(Smi::FromInt(flags)); |
1567 int properties_count = constant_properties->length() / 2; | 1567 int properties_count = constant_properties->length() / 2; |
1568 if (expr->depth() > 1) { | 1568 if (expr->depth() > 1) { |
1569 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); | 1569 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); |
1570 } else if (flags != ObjectLiteral::kFastElements || | 1570 } else if (flags != ObjectLiteral::kFastElements || |
1571 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { | 1571 properties_count > |
| 1572 FastCloneShallowObjectStub::MaximumClonedProperties()) { |
1572 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); | 1573 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); |
1573 } else { | 1574 } else { |
1574 FastCloneShallowObjectStub stub(properties_count); | 1575 FastCloneShallowObjectStub stub(properties_count); |
1575 __ CallStub(&stub); | 1576 __ CallStub(&stub); |
1576 } | 1577 } |
1577 | 1578 |
1578 // If result_saved is true the result is on top of the stack. If | 1579 // If result_saved is true the result is on top of the stack. If |
1579 // result_saved is false the result is in rax. | 1580 // result_saved is false the result is in rax. |
1580 bool result_saved = false; | 1581 bool result_saved = false; |
1581 | 1582 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1688 constant_elements_values->map() == heap->fixed_cow_array_map()) { | 1689 constant_elements_values->map() == heap->fixed_cow_array_map()) { |
1689 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot | 1690 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot |
1690 // change, so it's possible to specialize the stub in advance. | 1691 // change, so it's possible to specialize the stub in advance. |
1691 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1); | 1692 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1); |
1692 FastCloneShallowArrayStub stub( | 1693 FastCloneShallowArrayStub stub( |
1693 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, | 1694 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, |
1694 length); | 1695 length); |
1695 __ CallStub(&stub); | 1696 __ CallStub(&stub); |
1696 } else if (expr->depth() > 1) { | 1697 } else if (expr->depth() > 1) { |
1697 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); | 1698 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); |
1698 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 1699 } else if (length > FastCloneShallowArrayStub::MaximumClonedLength()) { |
1699 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); | 1700 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); |
1700 } else { | 1701 } else { |
1701 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || | 1702 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
1702 FLAG_smi_only_arrays); | 1703 FLAG_smi_only_arrays); |
1703 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot | 1704 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot |
1704 // change, so it's possible to specialize the stub in advance. | 1705 // change, so it's possible to specialize the stub in advance. |
1705 FastCloneShallowArrayStub::Mode mode = has_constant_fast_elements | 1706 FastCloneShallowArrayStub::Mode mode = has_constant_fast_elements |
1706 ? FastCloneShallowArrayStub::CLONE_ELEMENTS | 1707 ? FastCloneShallowArrayStub::CLONE_ELEMENTS |
1707 : FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; | 1708 : FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
1708 FastCloneShallowArrayStub stub(mode, length); | 1709 FastCloneShallowArrayStub stub(mode, length); |
(...skipping 2851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4560 *context_length = 0; | 4561 *context_length = 0; |
4561 return previous_; | 4562 return previous_; |
4562 } | 4563 } |
4563 | 4564 |
4564 | 4565 |
4565 #undef __ | 4566 #undef __ |
4566 | 4567 |
4567 } } // namespace v8::internal | 4568 } } // namespace v8::internal |
4568 | 4569 |
4569 #endif // V8_TARGET_ARCH_X64 | 4570 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |