| 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 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1554 __ movq(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1554 __ movq(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1555 __ push(FieldOperand(rdi, JSFunction::kLiteralsOffset)); | 1555 __ push(FieldOperand(rdi, JSFunction::kLiteralsOffset)); |
| 1556 __ Push(Smi::FromInt(expr->literal_index())); | 1556 __ Push(Smi::FromInt(expr->literal_index())); |
| 1557 __ Push(constant_properties); | 1557 __ Push(constant_properties); |
| 1558 int flags = expr->fast_elements() | 1558 int flags = expr->fast_elements() |
| 1559 ? ObjectLiteral::kFastElements | 1559 ? ObjectLiteral::kFastElements |
| 1560 : ObjectLiteral::kNoFlags; | 1560 : ObjectLiteral::kNoFlags; |
| 1561 flags |= expr->has_function() | 1561 flags |= expr->has_function() |
| 1562 ? ObjectLiteral::kHasFunction | 1562 ? ObjectLiteral::kHasFunction |
| 1563 : ObjectLiteral::kNoFlags; | 1563 : ObjectLiteral::kNoFlags; |
| 1564 |
| 1565 if (FLAG_track_allocation_sites && !IsOneTimeCode()) { |
| 1566 // Don't track global arrays that are never re-created |
| 1567 flags |= ObjectLiteral::kAllocationSiteInfoAllowed; |
| 1568 } |
| 1569 |
| 1564 __ Push(Smi::FromInt(flags)); | 1570 __ Push(Smi::FromInt(flags)); |
| 1565 int properties_count = constant_properties->length() / 2; | 1571 int properties_count = constant_properties->length() / 2; |
| 1566 if (expr->depth() > 1) { | 1572 if (expr->depth() > 1) { |
| 1567 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); | 1573 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); |
| 1568 } else if (flags != ObjectLiteral::kFastElements || | 1574 } else if (flags != ObjectLiteral::kFastElements || |
| 1569 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { | 1575 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { |
| 1570 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); | 1576 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); |
| 1571 } else { | 1577 } else { |
| 1572 FastCloneShallowObjectStub stub(properties_count); | 1578 FastCloneShallowObjectStub stub(properties_count); |
| 1573 __ CallStub(&stub); | 1579 __ CallStub(&stub); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1670 int length = subexprs->length(); | 1676 int length = subexprs->length(); |
| 1671 Handle<FixedArray> constant_elements = expr->constant_elements(); | 1677 Handle<FixedArray> constant_elements = expr->constant_elements(); |
| 1672 ASSERT_EQ(2, constant_elements->length()); | 1678 ASSERT_EQ(2, constant_elements->length()); |
| 1673 ElementsKind constant_elements_kind = | 1679 ElementsKind constant_elements_kind = |
| 1674 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); | 1680 static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value()); |
| 1675 bool has_constant_fast_elements = | 1681 bool has_constant_fast_elements = |
| 1676 IsFastObjectElementsKind(constant_elements_kind); | 1682 IsFastObjectElementsKind(constant_elements_kind); |
| 1677 Handle<FixedArrayBase> constant_elements_values( | 1683 Handle<FixedArrayBase> constant_elements_values( |
| 1678 FixedArrayBase::cast(constant_elements->get(1))); | 1684 FixedArrayBase::cast(constant_elements->get(1))); |
| 1679 | 1685 |
| 1686 AllocationSiteMode allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
| 1687 int flags = ArrayLiteral::kNoFlags; |
| 1688 if (FLAG_track_allocation_sites && !IsOneTimeCode()) { |
| 1689 // Don't track global arrays that are never re-created |
| 1690 flags |= ArrayLiteral::kAllocationSiteInfoAllowed; |
| 1691 allocation_site_mode = TRACK_ALLOCATION_SITE; |
| 1692 } |
| 1693 |
| 1694 ASSERT(((flags & ArrayLiteral::kAllocationSiteInfoAllowed) && |
| 1695 (allocation_site_mode == TRACK_ALLOCATION_SITE)) || |
| 1696 (((flags & ArrayLiteral::kAllocationSiteInfoAllowed) == 0) && |
| 1697 (allocation_site_mode == DONT_TRACK_ALLOCATION_SITE))); |
| 1698 |
| 1680 __ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1699 __ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1681 __ push(FieldOperand(rbx, JSFunction::kLiteralsOffset)); | 1700 __ push(FieldOperand(rbx, JSFunction::kLiteralsOffset)); |
| 1682 __ Push(Smi::FromInt(expr->literal_index())); | 1701 __ Push(Smi::FromInt(expr->literal_index())); |
| 1683 __ Push(constant_elements); | 1702 __ Push(constant_elements); |
| 1684 Heap* heap = isolate()->heap(); | 1703 Heap* heap = isolate()->heap(); |
| 1685 if (has_constant_fast_elements && | 1704 if (has_constant_fast_elements && |
| 1686 constant_elements_values->map() == heap->fixed_cow_array_map()) { | 1705 constant_elements_values->map() == heap->fixed_cow_array_map()) { |
| 1687 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot | 1706 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot |
| 1688 // change, so it's possible to specialize the stub in advance. | 1707 // change, so it's possible to specialize the stub in advance. |
| 1689 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1); | 1708 __ IncrementCounter(isolate()->counters()->cow_arrays_created_stub(), 1); |
| 1690 FastCloneShallowArrayStub stub( | 1709 FastCloneShallowArrayStub stub( |
| 1691 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, | 1710 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, |
| 1692 DONT_TRACK_ALLOCATION_SITE, | 1711 DONT_TRACK_ALLOCATION_SITE, |
| 1693 length); | 1712 length); |
| 1694 __ CallStub(&stub); | 1713 __ CallStub(&stub); |
| 1695 } else if (expr->depth() > 1) { | 1714 } else if (expr->depth() > 1) { |
| 1696 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); | 1715 __ Push(Smi::FromInt(flags)); |
| 1716 __ CallRuntime(Runtime::kCreateArrayLiteral, 4); |
| 1697 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { | 1717 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
| 1698 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); | 1718 __ Push(Smi::FromInt(flags)); |
| 1719 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 4); |
| 1699 } else { | 1720 } else { |
| 1700 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || | 1721 ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) || |
| 1701 FLAG_smi_only_arrays); | 1722 FLAG_smi_only_arrays); |
| 1702 FastCloneShallowArrayStub::Mode mode = | 1723 FastCloneShallowArrayStub::Mode mode = |
| 1703 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; | 1724 FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS; |
| 1704 AllocationSiteMode allocation_site_mode = FLAG_track_allocation_sites | |
| 1705 ? TRACK_ALLOCATION_SITE : DONT_TRACK_ALLOCATION_SITE; | |
| 1706 | 1725 |
| 1707 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot | 1726 // If the elements are already FAST_*_ELEMENTS, the boilerplate cannot |
| 1708 // change, so it's possible to specialize the stub in advance. | 1727 // change, so it's possible to specialize the stub in advance. |
| 1709 if (has_constant_fast_elements) { | 1728 if (has_constant_fast_elements) { |
| 1710 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; | 1729 mode = FastCloneShallowArrayStub::CLONE_ELEMENTS; |
| 1711 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; | 1730 allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
| 1712 } | 1731 } |
| 1713 | 1732 |
| 1714 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); | 1733 FastCloneShallowArrayStub stub(mode, allocation_site_mode, length); |
| 1715 __ CallStub(&stub); | 1734 __ CallStub(&stub); |
| (...skipping 2810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4526 *context_length = 0; | 4545 *context_length = 0; |
| 4527 return previous_; | 4546 return previous_; |
| 4528 } | 4547 } |
| 4529 | 4548 |
| 4530 | 4549 |
| 4531 #undef __ | 4550 #undef __ |
| 4532 | 4551 |
| 4533 } } // namespace v8::internal | 4552 } } // namespace v8::internal |
| 4534 | 4553 |
| 4535 #endif // V8_TARGET_ARCH_X64 | 4554 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |