Chromium Code Reviews| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 } | 194 } |
| 195 | 195 |
| 196 | 196 |
| 197 static void InitializeArrayConstructorDescriptor( | 197 static void InitializeArrayConstructorDescriptor( |
| 198 Isolate* isolate, | 198 Isolate* isolate, |
| 199 CodeStubInterfaceDescriptor* descriptor, | 199 CodeStubInterfaceDescriptor* descriptor, |
| 200 int constant_stack_parameter_count) { | 200 int constant_stack_parameter_count) { |
| 201 // register state | 201 // register state |
| 202 // a0 -- number of arguments | 202 // a0 -- number of arguments |
| 203 // a1 -- function | 203 // a1 -- function |
| 204 // a2 -- type info cell with elements kind | 204 // a2 -- allocation site with elements kind |
| 205 static Register registers_variable_args[] = { a1, a2, a0 }; | 205 static Register registers_variable_args[] = { a1, a2, a0 }; |
| 206 static Register registers_no_args[] = { a1, a2 }; | 206 static Register registers_no_args[] = { a1, a2 }; |
| 207 | 207 |
| 208 if (constant_stack_parameter_count == 0) { | 208 if (constant_stack_parameter_count == 0) { |
| 209 descriptor->register_param_count_ = 2; | 209 descriptor->register_param_count_ = 2; |
| 210 descriptor->register_params_ = registers_no_args; | 210 descriptor->register_params_ = registers_no_args; |
| 211 } else { | 211 } else { |
| 212 // stack param count needs (constructor pointer, and single argument) | 212 // stack param count needs (constructor pointer, and single argument) |
| 213 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; | 213 descriptor->handler_arguments_mode_ = PASS_ARGUMENTS; |
| 214 descriptor->stack_parameter_count_ = a0; | 214 descriptor->stack_parameter_count_ = a0; |
| (...skipping 5528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5743 // If we reached this point there is a problem. | 5743 // If we reached this point there is a problem. |
| 5744 __ Abort(kUnexpectedElementsKindInArrayConstructor); | 5744 __ Abort(kUnexpectedElementsKindInArrayConstructor); |
| 5745 } else { | 5745 } else { |
| 5746 UNREACHABLE(); | 5746 UNREACHABLE(); |
| 5747 } | 5747 } |
| 5748 } | 5748 } |
| 5749 | 5749 |
| 5750 | 5750 |
| 5751 static void CreateArrayDispatchOneArgument(MacroAssembler* masm, | 5751 static void CreateArrayDispatchOneArgument(MacroAssembler* masm, |
| 5752 AllocationSiteOverrideMode mode) { | 5752 AllocationSiteOverrideMode mode) { |
| 5753 // a2 - type info cell (if mode != DISABLE_ALLOCATION_SITES) | 5753 // a2 - allocation site (if mode != DISABLE_ALLOCATION_SITES) |
| 5754 // a3 - kind (if mode != DISABLE_ALLOCATION_SITES) | 5754 // a3 - kind (if mode != DISABLE_ALLOCATION_SITES) |
| 5755 // a0 - number of arguments | 5755 // a0 - number of arguments |
| 5756 // a1 - constructor? | 5756 // a1 - constructor? |
| 5757 // sp[0] - last argument | 5757 // sp[0] - last argument |
| 5758 Label normal_sequence; | 5758 Label normal_sequence; |
| 5759 if (mode == DONT_OVERRIDE) { | 5759 if (mode == DONT_OVERRIDE) { |
| 5760 ASSERT(FAST_SMI_ELEMENTS == 0); | 5760 ASSERT(FAST_SMI_ELEMENTS == 0); |
| 5761 ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); | 5761 ASSERT(FAST_HOLEY_SMI_ELEMENTS == 1); |
| 5762 ASSERT(FAST_ELEMENTS == 2); | 5762 ASSERT(FAST_ELEMENTS == 2); |
| 5763 ASSERT(FAST_HOLEY_ELEMENTS == 3); | 5763 ASSERT(FAST_HOLEY_ELEMENTS == 3); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 5782 __ TailCallStub(&stub_holey); | 5782 __ TailCallStub(&stub_holey); |
| 5783 | 5783 |
| 5784 __ bind(&normal_sequence); | 5784 __ bind(&normal_sequence); |
| 5785 ArraySingleArgumentConstructorStub stub(initial, | 5785 ArraySingleArgumentConstructorStub stub(initial, |
| 5786 DISABLE_ALLOCATION_SITES); | 5786 DISABLE_ALLOCATION_SITES); |
| 5787 __ TailCallStub(&stub); | 5787 __ TailCallStub(&stub); |
| 5788 } else if (mode == DONT_OVERRIDE) { | 5788 } else if (mode == DONT_OVERRIDE) { |
| 5789 // We are going to create a holey array, but our kind is non-holey. | 5789 // We are going to create a holey array, but our kind is non-holey. |
| 5790 // Fix kind and retry (only if we have an allocation site in the cell). | 5790 // Fix kind and retry (only if we have an allocation site in the cell). |
| 5791 __ Addu(a3, a3, Operand(1)); | 5791 __ Addu(a3, a3, Operand(1)); |
| 5792 __ lw(t1, FieldMemOperand(a2, Cell::kValueOffset)); | |
| 5793 | |
| 5794 if (FLAG_debug_code) { | |
| 5795 __ lw(t1, FieldMemOperand(t1, 0)); | |
| 5796 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); | |
|
Benedikt Meurer
2014/01/20 12:24:22
Same.
| |
| 5797 __ Assert(eq, kExpectedAllocationSiteInCell, t1, Operand(at)); | |
| 5798 __ lw(t1, FieldMemOperand(a2, Cell::kValueOffset)); | |
| 5799 } | |
| 5800 | 5792 |
| 5801 // Save the resulting elements kind in type info. We can't just store a3 | 5793 // Save the resulting elements kind in type info. We can't just store a3 |
| 5802 // in the AllocationSite::transition_info field because elements kind is | 5794 // in the AllocationSite::transition_info field because elements kind is |
| 5803 // restricted to a portion of the field...upper bits need to be left alone. | 5795 // restricted to a portion of the field...upper bits need to be left alone. |
| 5804 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); | 5796 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
| 5805 __ lw(t0, FieldMemOperand(t1, AllocationSite::kTransitionInfoOffset)); | 5797 __ lw(t0, FieldMemOperand(a2, AllocationSite::kTransitionInfoOffset)); |
| 5806 __ Addu(t0, t0, Operand(Smi::FromInt(kFastElementsKindPackedToHoley))); | 5798 __ Addu(t0, t0, Operand(Smi::FromInt(kFastElementsKindPackedToHoley))); |
| 5807 __ sw(t0, FieldMemOperand(t1, AllocationSite::kTransitionInfoOffset)); | 5799 __ sw(t0, FieldMemOperand(a2, AllocationSite::kTransitionInfoOffset)); |
| 5808 | 5800 |
| 5809 | 5801 |
| 5810 __ bind(&normal_sequence); | 5802 __ bind(&normal_sequence); |
| 5811 int last_index = GetSequenceIndexFromFastElementsKind( | 5803 int last_index = GetSequenceIndexFromFastElementsKind( |
| 5812 TERMINAL_FAST_ELEMENTS_KIND); | 5804 TERMINAL_FAST_ELEMENTS_KIND); |
| 5813 for (int i = 0; i <= last_index; ++i) { | 5805 for (int i = 0; i <= last_index; ++i) { |
| 5814 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); | 5806 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); |
| 5815 ArraySingleArgumentConstructorStub stub(kind); | 5807 ArraySingleArgumentConstructorStub stub(kind); |
| 5816 __ TailCallStub(&stub, eq, a3, Operand(kind)); | 5808 __ TailCallStub(&stub, eq, a3, Operand(kind)); |
| 5817 } | 5809 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5922 __ lw(a3, FieldMemOperand(a2, 0)); | 5914 __ lw(a3, FieldMemOperand(a2, 0)); |
| 5923 __ Assert(eq, kExpectedPropertyCellInRegisterA2, | 5915 __ Assert(eq, kExpectedPropertyCellInRegisterA2, |
| 5924 a3, Operand(cell_map)); | 5916 a3, Operand(cell_map)); |
| 5925 __ bind(&okay_here); | 5917 __ bind(&okay_here); |
| 5926 } | 5918 } |
| 5927 | 5919 |
| 5928 Label no_info; | 5920 Label no_info; |
| 5929 // Get the elements kind and case on that. | 5921 // Get the elements kind and case on that. |
| 5930 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 5922 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 5931 __ Branch(&no_info, eq, a2, Operand(at)); | 5923 __ Branch(&no_info, eq, a2, Operand(at)); |
| 5932 __ lw(a3, FieldMemOperand(a2, Cell::kValueOffset)); | 5924 __ lw(a2, FieldMemOperand(a2, Cell::kValueOffset)); |
| 5933 | 5925 |
| 5934 // If the type cell is undefined, or contains anything other than an | 5926 // If the type cell is undefined, or contains anything other than an |
| 5935 // AllocationSite, call an array constructor that doesn't use AllocationSites. | 5927 // AllocationSite, call an array constructor that doesn't use AllocationSites. |
| 5936 __ lw(t0, FieldMemOperand(a3, 0)); | 5928 __ lw(t0, FieldMemOperand(a2, 0)); |
| 5937 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); | 5929 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); |
| 5938 __ Branch(&no_info, ne, t0, Operand(at)); | 5930 __ Branch(&no_info, ne, t0, Operand(at)); |
| 5939 | 5931 |
| 5940 __ lw(a3, FieldMemOperand(a3, AllocationSite::kTransitionInfoOffset)); | 5932 __ lw(a3, FieldMemOperand(a2, AllocationSite::kTransitionInfoOffset)); |
| 5941 __ SmiUntag(a3); | 5933 __ SmiUntag(a3); |
| 5942 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); | 5934 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); |
| 5943 __ And(a3, a3, Operand(AllocationSite::ElementsKindBits::kMask)); | 5935 __ And(a3, a3, Operand(AllocationSite::ElementsKindBits::kMask)); |
| 5944 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); | 5936 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); |
| 5945 | 5937 |
| 5946 __ bind(&no_info); | 5938 __ bind(&no_info); |
| 5947 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); | 5939 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); |
| 5948 } | 5940 } |
| 5949 | 5941 |
| 5950 | 5942 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6020 __ bind(&fast_elements_case); | 6012 __ bind(&fast_elements_case); |
| 6021 GenerateCase(masm, FAST_ELEMENTS); | 6013 GenerateCase(masm, FAST_ELEMENTS); |
| 6022 } | 6014 } |
| 6023 | 6015 |
| 6024 | 6016 |
| 6025 #undef __ | 6017 #undef __ |
| 6026 | 6018 |
| 6027 } } // namespace v8::internal | 6019 } } // namespace v8::internal |
| 6028 | 6020 |
| 6029 #endif // V8_TARGET_ARCH_MIPS | 6021 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |