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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
193 } | 193 } |
194 | 194 |
195 | 195 |
196 static void InitializeArrayConstructorDescriptor( | 196 static void InitializeArrayConstructorDescriptor( |
197 Isolate* isolate, | 197 Isolate* isolate, |
198 CodeStubInterfaceDescriptor* descriptor, | 198 CodeStubInterfaceDescriptor* descriptor, |
199 int constant_stack_parameter_count) { | 199 int constant_stack_parameter_count) { |
200 // register state | 200 // register state |
201 // r0 -- number of arguments | 201 // r0 -- number of arguments |
202 // r1 -- function | 202 // r1 -- function |
203 // r2 -- type info cell with elements kind | 203 // r2 -- allocation site with elements kind |
204 static Register registers_variable_args[] = { r1, r2, r0 }; | 204 static Register registers_variable_args[] = { r1, r2, r0 }; |
205 static Register registers_no_args[] = { r1, r2 }; | 205 static Register registers_no_args[] = { r1, r2 }; |
206 | 206 |
207 if (constant_stack_parameter_count == 0) { | 207 if (constant_stack_parameter_count == 0) { |
208 descriptor->register_param_count_ = 2; | 208 descriptor->register_param_count_ = 2; |
209 descriptor->register_params_ = registers_no_args; | 209 descriptor->register_params_ = registers_no_args; |
210 } else { | 210 } else { |
211 // stack param count needs (constructor pointer, and single argument) | 211 // stack param count needs (constructor pointer, and single argument) |
212 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; | 212 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; |
213 descriptor->stack_parameter_count_ = r0; | 213 descriptor->stack_parameter_count_ = r0; |
(...skipping 5359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5573 // If we reached this point there is a problem. | 5573 // If we reached this point there is a problem. |
5574 __ Abort(kUnexpectedElementsKindInArrayConstructor); | 5574 __ Abort(kUnexpectedElementsKindInArrayConstructor); |
5575 } else { | 5575 } else { |
5576 UNREACHABLE(); | 5576 UNREACHABLE(); |
5577 } | 5577 } |
5578 } | 5578 } |
5579 | 5579 |
5580 | 5580 |
5581 static void CreateArrayDispatchOneArgument(MacroAssembler* masm, | 5581 static void CreateArrayDispatchOneArgument(MacroAssembler* masm, |
5582 AllocationSiteOverrideMode mode) { | 5582 AllocationSiteOverrideMode mode) { |
5583 // r2 - type info cell (if mode != DISABLE_ALLOCATION_SITES) | 5583 // r2 - allocation site (if mode != DISABLE_ALLOCATION_SITES) |
5584 // r3 - kind (if mode != DISABLE_ALLOCATION_SITES) | 5584 // r3 - kind (if mode != DISABLE_ALLOCATION_SITES) |
5585 // r0 - number of arguments | 5585 // r0 - number of arguments |
5586 // r1 - constructor? | 5586 // r1 - constructor? |
5587 // sp[0] - last argument | 5587 // sp[0] - last argument |
5588 Label normal_sequence; | 5588 Label normal_sequence; |
5589 if (mode == DONT_OVERRIDE) { | 5589 if (mode == DONT_OVERRIDE) { |
5590 ASSERT(FAST_SMI_ELEMENTS == 0); | 5590 ASSERT(FAST_SMI_ELEMENTS == 0); |
5591 ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); | 5591 ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); |
5592 ASSERT(FAST_ELEMENTS == 2); | 5592 ASSERT(FAST_ELEMENTS == 2); |
5593 ASSERT(FAST_HOLEY_ELEMENTS == 3); | 5593 ASSERT(FAST_HOLEY_ELEMENTS == 3); |
(...skipping 19 matching lines...) Expand all Loading... | |
5613 __ TailCallStub(&stub_holey); | 5613 __ TailCallStub(&stub_holey); |
5614 | 5614 |
5615 __ bind(&normal_sequence); | 5615 __ bind(&normal_sequence); |
5616 ArraySingleArgumentConstructorStub stub(initial, | 5616 ArraySingleArgumentConstructorStub stub(initial, |
5617 DISABLE_ALLOCATION_SITES); | 5617 DISABLE_ALLOCATION_SITES); |
5618 __ TailCallStub(&stub); | 5618 __ TailCallStub(&stub); |
5619 } else if (mode == DONT_OVERRIDE) { | 5619 } else if (mode == DONT_OVERRIDE) { |
5620 // We are going to create a holey array, but our kind is non-holey. | 5620 // We are going to create a holey array, but our kind is non-holey. |
5621 // Fix kind and retry (only if we have an allocation site in the cell). | 5621 // Fix kind and retry (only if we have an allocation site in the cell). |
5622 __ add(r3, r3, Operand(1)); | 5622 __ add(r3, r3, Operand(1)); |
5623 __ ldr(r5, FieldMemOperand(r2, Cell::kValueOffset)); | |
5624 | |
5625 if (FLAG_debug_code) { | |
5626 __ ldr(r5, FieldMemOperand(r5, 0)); | |
5627 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); | |
Benedikt Meurer
2014/01/20 12:24:22
Can we please keep this check?
mvstanton
2014/01/20 13:36:11
Sure thing, done for all platforms.
| |
5628 __ Assert(eq, kExpectedAllocationSiteInCell); | |
5629 __ ldr(r5, FieldMemOperand(r2, Cell::kValueOffset)); | |
5630 } | |
5631 | 5623 |
5632 // Save the resulting elements kind in type info. We can't just store r3 | 5624 // Save the resulting elements kind in type info. We can't just store r3 |
5633 // in the AllocationSite::transition_info field because elements kind is | 5625 // in the AllocationSite::transition_info field because elements kind is |
5634 // restricted to a portion of the field...upper bits need to be left alone. | 5626 // restricted to a portion of the field...upper bits need to be left alone. |
5635 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); | 5627 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
5636 __ ldr(r4, FieldMemOperand(r5, AllocationSite::kTransitionInfoOffset)); | 5628 __ ldr(r4, FieldMemOperand(r2, AllocationSite::kTransitionInfoOffset)); |
5637 __ add(r4, r4, Operand(Smi::FromInt(kFastElementsKindPackedToHoley))); | 5629 __ add(r4, r4, Operand(Smi::FromInt(kFastElementsKindPackedToHoley))); |
5638 __ str(r4, FieldMemOperand(r5, AllocationSite::kTransitionInfoOffset)); | 5630 __ str(r4, FieldMemOperand(r2, AllocationSite::kTransitionInfoOffset)); |
5639 | 5631 |
5640 __ bind(&normal_sequence); | 5632 __ bind(&normal_sequence); |
5641 int last_index = GetSequenceIndexFromFastElementsKind( | 5633 int last_index = GetSequenceIndexFromFastElementsKind( |
5642 TERMINAL_FAST_ELEMENTS_KIND); | 5634 TERMINAL_FAST_ELEMENTS_KIND); |
5643 for (int i = 0; i <= last_index; ++i) { | 5635 for (int i = 0; i <= last_index; ++i) { |
5644 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); | 5636 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); |
5645 __ cmp(r3, Operand(kind)); | 5637 __ cmp(r3, Operand(kind)); |
5646 ArraySingleArgumentConstructorStub stub(kind); | 5638 ArraySingleArgumentConstructorStub stub(kind); |
5647 __ TailCallStub(&stub, eq); | 5639 __ TailCallStub(&stub, eq); |
5648 } | 5640 } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5752 __ ldr(r3, FieldMemOperand(r2, 0)); | 5744 __ ldr(r3, FieldMemOperand(r2, 0)); |
5753 __ cmp(r3, Operand(cell_map)); | 5745 __ cmp(r3, Operand(cell_map)); |
5754 __ Assert(eq, kExpectedPropertyCellInRegisterEbx); | 5746 __ Assert(eq, kExpectedPropertyCellInRegisterEbx); |
5755 __ bind(&okay_here); | 5747 __ bind(&okay_here); |
5756 } | 5748 } |
5757 | 5749 |
5758 Label no_info; | 5750 Label no_info; |
5759 // Get the elements kind and case on that. | 5751 // Get the elements kind and case on that. |
5760 __ CompareRoot(r2, Heap::kUndefinedValueRootIndex); | 5752 __ CompareRoot(r2, Heap::kUndefinedValueRootIndex); |
5761 __ b(eq, &no_info); | 5753 __ b(eq, &no_info); |
5762 __ ldr(r3, FieldMemOperand(r2, Cell::kValueOffset)); | 5754 __ ldr(r2, FieldMemOperand(r2, Cell::kValueOffset)); |
5763 | 5755 |
5764 // If the type cell is undefined, or contains anything other than an | 5756 // If the type cell is undefined, or contains anything other than an |
5765 // AllocationSite, call an array constructor that doesn't use AllocationSites. | 5757 // AllocationSite, call an array constructor that doesn't use AllocationSites. |
5766 __ ldr(r4, FieldMemOperand(r3, 0)); | 5758 __ ldr(r4, FieldMemOperand(r2, 0)); |
5767 __ CompareRoot(r4, Heap::kAllocationSiteMapRootIndex); | 5759 __ CompareRoot(r4, Heap::kAllocationSiteMapRootIndex); |
5768 __ b(ne, &no_info); | 5760 __ b(ne, &no_info); |
5769 | 5761 |
5770 __ ldr(r3, FieldMemOperand(r3, AllocationSite::kTransitionInfoOffset)); | 5762 __ ldr(r3, FieldMemOperand(r2, AllocationSite::kTransitionInfoOffset)); |
5771 __ SmiUntag(r3); | 5763 __ SmiUntag(r3); |
5772 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); | 5764 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
5773 __ and_(r3, r3, Operand(AllocationSite::ElementsKindBits::kMask)); | 5765 __ and_(r3, r3, Operand(AllocationSite::ElementsKindBits::kMask)); |
5774 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 5766 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
5775 | 5767 |
5776 __ bind(&no_info); | 5768 __ bind(&no_info); |
5777 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 5769 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
5778 } | 5770 } |
5779 | 5771 |
5780 | 5772 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5851 __ bind(&fast_elements_case); | 5843 __ bind(&fast_elements_case); |
5852 GenerateCase(masm, FAST_ELEMENTS); | 5844 GenerateCase(masm, FAST_ELEMENTS); |
5853 } | 5845 } |
5854 | 5846 |
5855 | 5847 |
5856 #undef __ | 5848 #undef __ |
5857 | 5849 |
5858 } } // namespace v8::internal | 5850 } } // namespace v8::internal |
5859 | 5851 |
5860 #endif // V8_TARGET_ARCH_ARM | 5852 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |