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 5767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5778 // Fix kind and retry. | 5778 // Fix kind and retry. |
5779 __ inc(edx); | 5779 __ inc(edx); |
5780 __ mov(ecx, FieldOperand(ebx, Cell::kValueOffset)); | 5780 __ mov(ecx, FieldOperand(ebx, Cell::kValueOffset)); |
5781 if (FLAG_debug_code) { | 5781 if (FLAG_debug_code) { |
5782 Handle<Map> allocation_site_map = | 5782 Handle<Map> allocation_site_map = |
5783 masm->isolate()->factory()->allocation_site_map(); | 5783 masm->isolate()->factory()->allocation_site_map(); |
5784 __ cmp(FieldOperand(ecx, 0), Immediate(allocation_site_map)); | 5784 __ cmp(FieldOperand(ecx, 0), Immediate(allocation_site_map)); |
5785 __ Assert(equal, kExpectedAllocationSiteInCell); | 5785 __ Assert(equal, kExpectedAllocationSiteInCell); |
5786 } | 5786 } |
5787 | 5787 |
5788 // Save the resulting elements kind in type info | 5788 // Save the resulting elements kind in type info. We can't just store r3 |
5789 __ SmiTag(edx); | 5789 // in the AllocationSite::transition_info field because elements kind is |
5790 __ mov(FieldOperand(ecx, AllocationSite::kTransitionInfoOffset), edx); | 5790 // restricted to a portion of the field...upper bits need to be left alone. |
5791 __ SmiUntag(edx); | 5791 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
| 5792 __ add(FieldOperand(ecx, AllocationSite::kTransitionInfoOffset), |
| 5793 Immediate(Smi::FromInt(kFastElementsKindPackedToHoley))); |
5792 | 5794 |
5793 __ bind(&normal_sequence); | 5795 __ bind(&normal_sequence); |
5794 int last_index = GetSequenceIndexFromFastElementsKind( | 5796 int last_index = GetSequenceIndexFromFastElementsKind( |
5795 TERMINAL_FAST_ELEMENTS_KIND); | 5797 TERMINAL_FAST_ELEMENTS_KIND); |
5796 for (int i = 0; i <= last_index; ++i) { | 5798 for (int i = 0; i <= last_index; ++i) { |
5797 Label next; | 5799 Label next; |
5798 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); | 5800 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); |
5799 __ cmp(edx, kind); | 5801 __ cmp(edx, kind); |
5800 __ j(not_equal, &next); | 5802 __ j(not_equal, &next); |
5801 ArraySingleArgumentConstructorStub stub(kind); | 5803 ArraySingleArgumentConstructorStub stub(kind); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5922 Label no_info; | 5924 Label no_info; |
5923 // If the type cell is undefined, or contains anything other than an | 5925 // If the type cell is undefined, or contains anything other than an |
5924 // AllocationSite, call an array constructor that doesn't use AllocationSites. | 5926 // AllocationSite, call an array constructor that doesn't use AllocationSites. |
5925 __ cmp(ebx, Immediate(undefined_sentinel)); | 5927 __ cmp(ebx, Immediate(undefined_sentinel)); |
5926 __ j(equal, &no_info); | 5928 __ j(equal, &no_info); |
5927 __ mov(edx, FieldOperand(ebx, Cell::kValueOffset)); | 5929 __ mov(edx, FieldOperand(ebx, Cell::kValueOffset)); |
5928 __ cmp(FieldOperand(edx, 0), Immediate( | 5930 __ cmp(FieldOperand(edx, 0), Immediate( |
5929 masm->isolate()->factory()->allocation_site_map())); | 5931 masm->isolate()->factory()->allocation_site_map())); |
5930 __ j(not_equal, &no_info); | 5932 __ j(not_equal, &no_info); |
5931 | 5933 |
| 5934 // Only look at the lower 16 bits of the transition info. |
5932 __ mov(edx, FieldOperand(edx, AllocationSite::kTransitionInfoOffset)); | 5935 __ mov(edx, FieldOperand(edx, AllocationSite::kTransitionInfoOffset)); |
5933 __ SmiUntag(edx); | 5936 __ SmiUntag(edx); |
| 5937 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
| 5938 __ and_(edx, Immediate(AllocationSite::ElementsKindBits::kMask)); |
5934 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 5939 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
5935 | 5940 |
5936 __ bind(&no_info); | 5941 __ bind(&no_info); |
5937 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 5942 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
5938 } | 5943 } |
5939 | 5944 |
5940 | 5945 |
5941 void InternalArrayConstructorStub::GenerateCase( | 5946 void InternalArrayConstructorStub::GenerateCase( |
5942 MacroAssembler* masm, ElementsKind kind) { | 5947 MacroAssembler* masm, ElementsKind kind) { |
5943 Label not_zero_case, not_one_case; | 5948 Label not_zero_case, not_one_case; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6024 __ bind(&fast_elements_case); | 6029 __ bind(&fast_elements_case); |
6025 GenerateCase(masm, FAST_ELEMENTS); | 6030 GenerateCase(masm, FAST_ELEMENTS); |
6026 } | 6031 } |
6027 | 6032 |
6028 | 6033 |
6029 #undef __ | 6034 #undef __ |
6030 | 6035 |
6031 } } // namespace v8::internal | 6036 } } // namespace v8::internal |
6032 | 6037 |
6033 #endif // V8_TARGET_ARCH_IA32 | 6038 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |