Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1021)

Side by Side Diff: src/mips/code-stubs-mips.cc

Issue 140963004: Array constructor shouldn't require a Cell, just an AllocationSite. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Code comments. Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 5792
5794 if (FLAG_debug_code) { 5793 if (FLAG_debug_code) {
5795 __ lw(t1, FieldMemOperand(t1, 0)); 5794 __ lw(t1, FieldMemOperand(a2, 0));
5796 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); 5795 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex);
5797 __ Assert(eq, kExpectedAllocationSiteInCell, t1, Operand(at)); 5796 __ Assert(eq, kExpectedAllocationSite, t1, Operand(at));
5798 __ lw(t1, FieldMemOperand(a2, Cell::kValueOffset));
5799 } 5797 }
5800 5798
5801 // Save the resulting elements kind in type info. We can't just store a3 5799 // 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 5800 // 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. 5801 // restricted to a portion of the field...upper bits need to be left alone.
5804 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); 5802 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0);
5805 __ lw(t0, FieldMemOperand(t1, AllocationSite::kTransitionInfoOffset)); 5803 __ lw(t0, FieldMemOperand(a2, AllocationSite::kTransitionInfoOffset));
5806 __ Addu(t0, t0, Operand(Smi::FromInt(kFastElementsKindPackedToHoley))); 5804 __ Addu(t0, t0, Operand(Smi::FromInt(kFastElementsKindPackedToHoley)));
5807 __ sw(t0, FieldMemOperand(t1, AllocationSite::kTransitionInfoOffset)); 5805 __ sw(t0, FieldMemOperand(a2, AllocationSite::kTransitionInfoOffset));
5808 5806
5809 5807
5810 __ bind(&normal_sequence); 5808 __ bind(&normal_sequence);
5811 int last_index = GetSequenceIndexFromFastElementsKind( 5809 int last_index = GetSequenceIndexFromFastElementsKind(
5812 TERMINAL_FAST_ELEMENTS_KIND); 5810 TERMINAL_FAST_ELEMENTS_KIND);
5813 for (int i = 0; i <= last_index; ++i) { 5811 for (int i = 0; i <= last_index; ++i) {
5814 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); 5812 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
5815 ArraySingleArgumentConstructorStub stub(kind); 5813 ArraySingleArgumentConstructorStub stub(kind);
5816 __ TailCallStub(&stub, eq, a3, Operand(kind)); 5814 __ TailCallStub(&stub, eq, a3, Operand(kind));
5817 } 5815 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
5922 __ lw(a3, FieldMemOperand(a2, 0)); 5920 __ lw(a3, FieldMemOperand(a2, 0));
5923 __ Assert(eq, kExpectedPropertyCellInRegisterA2, 5921 __ Assert(eq, kExpectedPropertyCellInRegisterA2,
5924 a3, Operand(cell_map)); 5922 a3, Operand(cell_map));
5925 __ bind(&okay_here); 5923 __ bind(&okay_here);
5926 } 5924 }
5927 5925
5928 Label no_info; 5926 Label no_info;
5929 // Get the elements kind and case on that. 5927 // Get the elements kind and case on that.
5930 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); 5928 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
5931 __ Branch(&no_info, eq, a2, Operand(at)); 5929 __ Branch(&no_info, eq, a2, Operand(at));
5932 __ lw(a3, FieldMemOperand(a2, Cell::kValueOffset)); 5930 __ lw(a2, FieldMemOperand(a2, Cell::kValueOffset));
5933 5931
5934 // If the type cell is undefined, or contains anything other than an 5932 // If the type cell is undefined, or contains anything other than an
5935 // AllocationSite, call an array constructor that doesn't use AllocationSites. 5933 // AllocationSite, call an array constructor that doesn't use AllocationSites.
5936 __ lw(t0, FieldMemOperand(a3, 0)); 5934 __ lw(t0, FieldMemOperand(a2, 0));
5937 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex); 5935 __ LoadRoot(at, Heap::kAllocationSiteMapRootIndex);
5938 __ Branch(&no_info, ne, t0, Operand(at)); 5936 __ Branch(&no_info, ne, t0, Operand(at));
5939 5937
5940 __ lw(a3, FieldMemOperand(a3, AllocationSite::kTransitionInfoOffset)); 5938 __ lw(a3, FieldMemOperand(a2, AllocationSite::kTransitionInfoOffset));
5941 __ SmiUntag(a3); 5939 __ SmiUntag(a3);
5942 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0); 5940 STATIC_ASSERT(AllocationSite::ElementsKindBits::kShift == 0);
5943 __ And(a3, a3, Operand(AllocationSite::ElementsKindBits::kMask)); 5941 __ And(a3, a3, Operand(AllocationSite::ElementsKindBits::kMask));
5944 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE); 5942 GenerateDispatchToArrayStub(masm, DONT_OVERRIDE);
5945 5943
5946 __ bind(&no_info); 5944 __ bind(&no_info);
5947 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES); 5945 GenerateDispatchToArrayStub(masm, DISABLE_ALLOCATION_SITES);
5948 } 5946 }
5949 5947
5950 5948
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
6020 __ bind(&fast_elements_case); 6018 __ bind(&fast_elements_case);
6021 GenerateCase(masm, FAST_ELEMENTS); 6019 GenerateCase(masm, FAST_ELEMENTS);
6022 } 6020 }
6023 6021
6024 6022
6025 #undef __ 6023 #undef __
6026 6024
6027 } } // namespace v8::internal 6025 } } // namespace v8::internal
6028 6026
6029 #endif // V8_TARGET_ARCH_MIPS 6027 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698