| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 5575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5586 // Fix kind and retry (only if we have an allocation site in the cell). | 5586 // Fix kind and retry (only if we have an allocation site in the cell). |
| 5587 __ incl(rdx); | 5587 __ incl(rdx); |
| 5588 __ movq(rcx, FieldOperand(rbx, Cell::kValueOffset)); | 5588 __ movq(rcx, FieldOperand(rbx, Cell::kValueOffset)); |
| 5589 if (FLAG_debug_code) { | 5589 if (FLAG_debug_code) { |
| 5590 Handle<Map> allocation_site_map = | 5590 Handle<Map> allocation_site_map = |
| 5591 masm->isolate()->factory()->allocation_site_map(); | 5591 masm->isolate()->factory()->allocation_site_map(); |
| 5592 __ Cmp(FieldOperand(rcx, 0), allocation_site_map); | 5592 __ Cmp(FieldOperand(rcx, 0), allocation_site_map); |
| 5593 __ Assert(equal, kExpectedAllocationSiteInCell); | 5593 __ Assert(equal, kExpectedAllocationSiteInCell); |
| 5594 } | 5594 } |
| 5595 | 5595 |
| 5596 // Save the resulting elements kind in type info | 5596 // Save the resulting elements kind in type info. We can't just store r3 |
| 5597 __ Integer32ToSmi(rdx, rdx); | 5597 // in the AllocationSite::transition_info field because elements kind is |
| 5598 __ movq(FieldOperand(rcx, AllocationSite::kTransitionInfoOffset), rdx); | 5598 // restricted to a portion of the field...upper bits need to be left alone. |
| 5599 __ SmiToInteger32(rdx, rdx); | 5599 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
| 5600 __ SmiAddConstant(FieldOperand(rcx, AllocationSite::kTransitionInfoOffset), |
| 5601 Smi::FromInt(kFastElementsKindPackedToHoley)); |
| 5600 | 5602 |
| 5601 __ bind(&normal_sequence); | 5603 __ bind(&normal_sequence); |
| 5602 int last_index = GetSequenceIndexFromFastElementsKind( | 5604 int last_index = GetSequenceIndexFromFastElementsKind( |
| 5603 TERMINAL_FAST_ELEMENTS_KIND); | 5605 TERMINAL_FAST_ELEMENTS_KIND); |
| 5604 for (int i = 0; i <= last_index; ++i) { | 5606 for (int i = 0; i <= last_index; ++i) { |
| 5605 Label next; | 5607 Label next; |
| 5606 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); | 5608 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); |
| 5607 __ cmpl(rdx, Immediate(kind)); | 5609 __ cmpl(rdx, Immediate(kind)); |
| 5608 __ j(not_equal, &next); | 5610 __ j(not_equal, &next); |
| 5609 ArraySingleArgumentConstructorStub stub(kind); | 5611 ArraySingleArgumentConstructorStub stub(kind); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5731 Label no_info; | 5733 Label no_info; |
| 5732 // If the type cell is undefined, or contains anything other than an | 5734 // If the type cell is undefined, or contains anything other than an |
| 5733 // AllocationSite, call an array constructor that doesn't use AllocationSites. | 5735 // AllocationSite, call an array constructor that doesn't use AllocationSites. |
| 5734 __ Cmp(rbx, undefined_sentinel); | 5736 __ Cmp(rbx, undefined_sentinel); |
| 5735 __ j(equal, &no_info); | 5737 __ j(equal, &no_info); |
| 5736 __ movq(rdx, FieldOperand(rbx, Cell::kValueOffset)); | 5738 __ movq(rdx, FieldOperand(rbx, Cell::kValueOffset)); |
| 5737 __ Cmp(FieldOperand(rdx, 0), | 5739 __ Cmp(FieldOperand(rdx, 0), |
| 5738 masm->isolate()->factory()->allocation_site_map()); | 5740 masm->isolate()->factory()->allocation_site_map()); |
| 5739 __ j(not_equal, &no_info); | 5741 __ j(not_equal, &no_info); |
| 5740 | 5742 |
| 5743 // Only look at the lower 16 bits of the transition info. |
| 5741 __ movq(rdx, FieldOperand(rdx, AllocationSite::kTransitionInfoOffset)); | 5744 __ movq(rdx, FieldOperand(rdx, AllocationSite::kTransitionInfoOffset)); |
| 5742 __ SmiToInteger32(rdx, rdx); | 5745 __ SmiToInteger32(rdx, rdx); |
| 5746 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
| 5747 __ and_(rdx, Immediate(AllocationSite::ElementsKindBits::kMask)); |
| 5743 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 5748 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
| 5744 | 5749 |
| 5745 __ bind(&no_info); | 5750 __ bind(&no_info); |
| 5746 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 5751 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
| 5747 } | 5752 } |
| 5748 | 5753 |
| 5749 | 5754 |
| 5750 void InternalArrayConstructorStub::GenerateCase( | 5755 void InternalArrayConstructorStub::GenerateCase( |
| 5751 MacroAssembler* masm, ElementsKind kind) { | 5756 MacroAssembler* masm, ElementsKind kind) { |
| 5752 Label not_zero_case, not_one_case; | 5757 Label not_zero_case, not_one_case; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5835 __ bind(&fast_elements_case); | 5840 __ bind(&fast_elements_case); |
| 5836 GenerateCase(masm, FAST_ELEMENTS); | 5841 GenerateCase(masm, FAST_ELEMENTS); |
| 5837 } | 5842 } |
| 5838 | 5843 |
| 5839 | 5844 |
| 5840 #undef __ | 5845 #undef __ |
| 5841 | 5846 |
| 5842 } } // namespace v8::internal | 5847 } } // namespace v8::internal |
| 5843 | 5848 |
| 5844 #endif // V8_TARGET_ARCH_X64 | 5849 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |