| 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 | 5623 |
| 5625 if (FLAG_debug_code) { | 5624 if (FLAG_debug_code) { |
| 5626 __ ldr(r5, FieldMemOperand(r5, 0)); | 5625 __ ldr(r5, FieldMemOperand(r2, 0)); |
| 5627 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); | 5626 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); |
| 5628 __ Assert(eq, kExpectedAllocationSiteInCell); | 5627 __ Assert(eq, kExpectedAllocationSite); |
| 5629 __ ldr(r5, FieldMemOperand(r2, Cell::kValueOffset)); | |
| 5630 } | 5628 } |
| 5631 | 5629 |
| 5632 // Save the resulting elements kind in type info. We can't just store r3 | 5630 // 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 | 5631 // 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. | 5632 // restricted to a portion of the field...upper bits need to be left alone. |
| 5635 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); | 5633 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
| 5636 __ ldr(r4, FieldMemOperand(r5, AllocationSite::kTransitionInfoOffset)); | 5634 __ ldr(r4, FieldMemOperand(r2, AllocationSite::kTransitionInfoOffset)); |
| 5637 __ add(r4, r4, Operand(Smi::FromInt(kFastElementsKindPackedToHoley))); | 5635 __ add(r4, r4, Operand(Smi::FromInt(kFastElementsKindPackedToHoley))); |
| 5638 __ str(r4, FieldMemOperand(r5, AllocationSite::kTransitionInfoOffset)); | 5636 __ str(r4, FieldMemOperand(r2, AllocationSite::kTransitionInfoOffset)); |
| 5639 | 5637 |
| 5640 __ bind(&normal_sequence); | 5638 __ bind(&normal_sequence); |
| 5641 int last_index = GetSequenceIndexFromFastElementsKind( | 5639 int last_index = GetSequenceIndexFromFastElementsKind( |
| 5642 TERMINAL_FAST_ELEMENTS_KIND); | 5640 TERMINAL_FAST_ELEMENTS_KIND); |
| 5643 for (int i = 0; i <= last_index; ++i) { | 5641 for (int i = 0; i <= last_index; ++i) { |
| 5644 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); | 5642 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); |
| 5645 __ cmp(r3, Operand(kind)); | 5643 __ cmp(r3, Operand(kind)); |
| 5646 ArraySingleArgumentConstructorStub stub(kind); | 5644 ArraySingleArgumentConstructorStub stub(kind); |
| 5647 __ TailCallStub(&stub, eq); | 5645 __ TailCallStub(&stub, eq); |
| 5648 } | 5646 } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5752 __ ldr(r3, FieldMemOperand(r2, 0)); | 5750 __ ldr(r3, FieldMemOperand(r2, 0)); |
| 5753 __ cmp(r3, Operand(cell_map)); | 5751 __ cmp(r3, Operand(cell_map)); |
| 5754 __ Assert(eq, kExpectedPropertyCellInRegisterEbx); | 5752 __ Assert(eq, kExpectedPropertyCellInRegisterEbx); |
| 5755 __ bind(&okay_here); | 5753 __ bind(&okay_here); |
| 5756 } | 5754 } |
| 5757 | 5755 |
| 5758 Label no_info; | 5756 Label no_info; |
| 5759 // Get the elements kind and case on that. | 5757 // Get the elements kind and case on that. |
| 5760 __ CompareRoot(r2, Heap::kUndefinedValueRootIndex); | 5758 __ CompareRoot(r2, Heap::kUndefinedValueRootIndex); |
| 5761 __ b(eq, &no_info); | 5759 __ b(eq, &no_info); |
| 5762 __ ldr(r3, FieldMemOperand(r2, Cell::kValueOffset)); | 5760 __ ldr(r2, FieldMemOperand(r2, Cell::kValueOffset)); |
| 5763 | 5761 |
| 5764 // If the type cell is undefined, or contains anything other than an | 5762 // If the type cell is undefined, or contains anything other than an |
| 5765 // AllocationSite, call an array constructor that doesn't use AllocationSites. | 5763 // AllocationSite, call an array constructor that doesn't use AllocationSites. |
| 5766 __ ldr(r4, FieldMemOperand(r3, 0)); | 5764 __ ldr(r4, FieldMemOperand(r2, 0)); |
| 5767 __ CompareRoot(r4, Heap::kAllocationSiteMapRootIndex); | 5765 __ CompareRoot(r4, Heap::kAllocationSiteMapRootIndex); |
| 5768 __ b(ne, &no_info); | 5766 __ b(ne, &no_info); |
| 5769 | 5767 |
| 5770 __ ldr(r3, FieldMemOperand(r3, AllocationSite::kTransitionInfoOffset)); | 5768 __ ldr(r3, FieldMemOperand(r2, AllocationSite::kTransitionInfoOffset)); |
| 5771 __ SmiUntag(r3); | 5769 __ SmiUntag(r3); |
| 5772 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); | 5770 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
| 5773 __ and_(r3, r3, Operand(AllocationSite::ElementsKindBits::kMask)); | 5771 __ and_(r3, r3, Operand(AllocationSite::ElementsKindBits::kMask)); |
| 5774 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 5772 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
| 5775 | 5773 |
| 5776 __ bind(&no_info); | 5774 __ bind(&no_info); |
| 5777 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 5775 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
| 5778 } | 5776 } |
| 5779 | 5777 |
| 5780 | 5778 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5851 __ bind(&fast_elements_case); | 5849 __ bind(&fast_elements_case); |
| 5852 GenerateCase(masm, FAST_ELEMENTS); | 5850 GenerateCase(masm, FAST_ELEMENTS); |
| 5853 } | 5851 } |
| 5854 | 5852 |
| 5855 | 5853 |
| 5856 #undef __ | 5854 #undef __ |
| 5857 | 5855 |
| 5858 } } // namespace v8::internal | 5856 } } // namespace v8::internal |
| 5859 | 5857 |
| 5860 #endif // V8_TARGET_ARCH_ARM | 5858 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |