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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 ASSERT(masm->has_frame()); | 136 ASSERT(masm->has_frame()); |
137 masm->set_has_frame(false); | 137 masm->set_has_frame(false); |
138 } | 138 } |
139 | 139 |
140 // ------------------------------------------------------------------------- | 140 // ------------------------------------------------------------------------- |
141 // Code generators | 141 // Code generators |
142 | 142 |
143 #define __ ACCESS_MASM(masm) | 143 #define __ ACCESS_MASM(masm) |
144 | 144 |
145 void ElementsTransitionGenerator::GenerateMapChangeElementsTransition( | 145 void ElementsTransitionGenerator::GenerateMapChangeElementsTransition( |
146 MacroAssembler* masm) { | 146 MacroAssembler* masm, AllocationSiteMode mode, |
| 147 Label* allocation_site_info_found) { |
147 // ----------- S t a t e ------------- | 148 // ----------- S t a t e ------------- |
148 // -- a0 : value | 149 // -- a0 : value |
149 // -- a1 : key | 150 // -- a1 : key |
150 // -- a2 : receiver | 151 // -- a2 : receiver |
151 // -- ra : return address | 152 // -- ra : return address |
152 // -- a3 : target map, scratch for subsequent call | 153 // -- a3 : target map, scratch for subsequent call |
153 // -- t0 : scratch (elements) | 154 // -- t0 : scratch (elements) |
154 // ----------------------------------- | 155 // ----------------------------------- |
| 156 if (mode == TRACK_ALLOCATION_SITE) { |
| 157 ASSERT(allocation_site_info_found != NULL); |
| 158 masm->TestJSArrayForAllocationSiteInfo(a2, t0, |
| 159 allocation_site_info_found); |
| 160 } |
| 161 |
155 // Set transitioned map. | 162 // Set transitioned map. |
156 __ sw(a3, FieldMemOperand(a2, HeapObject::kMapOffset)); | 163 __ sw(a3, FieldMemOperand(a2, HeapObject::kMapOffset)); |
157 __ RecordWriteField(a2, | 164 __ RecordWriteField(a2, |
158 HeapObject::kMapOffset, | 165 HeapObject::kMapOffset, |
159 a3, | 166 a3, |
160 t5, | 167 t5, |
161 kRAHasNotBeenSaved, | 168 kRAHasNotBeenSaved, |
162 kDontSaveFPRegs, | 169 kDontSaveFPRegs, |
163 EMIT_REMEMBERED_SET, | 170 EMIT_REMEMBERED_SET, |
164 OMIT_SMI_CHECK); | 171 OMIT_SMI_CHECK); |
165 } | 172 } |
166 | 173 |
167 | 174 |
168 void ElementsTransitionGenerator::GenerateSmiToDouble( | 175 void ElementsTransitionGenerator::GenerateSmiToDouble( |
169 MacroAssembler* masm, Label* fail) { | 176 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { |
170 // ----------- S t a t e ------------- | 177 // ----------- S t a t e ------------- |
171 // -- a0 : value | 178 // -- a0 : value |
172 // -- a1 : key | 179 // -- a1 : key |
173 // -- a2 : receiver | 180 // -- a2 : receiver |
174 // -- ra : return address | 181 // -- ra : return address |
175 // -- a3 : target map, scratch for subsequent call | 182 // -- a3 : target map, scratch for subsequent call |
176 // -- t0 : scratch (elements) | 183 // -- t0 : scratch (elements) |
177 // ----------------------------------- | 184 // ----------------------------------- |
178 Label loop, entry, convert_hole, gc_required, only_change_map, done; | 185 Label loop, entry, convert_hole, gc_required, only_change_map, done; |
179 bool fpu_supported = CpuFeatures::IsSupported(FPU); | 186 bool fpu_supported = CpuFeatures::IsSupported(FPU); |
180 | 187 |
181 Register scratch = t6; | 188 Register scratch = t6; |
182 | 189 |
183 if (FLAG_track_allocation_sites) { | 190 if (mode == TRACK_ALLOCATION_SITE) { |
184 masm->TestJSArrayForAllocationSiteInfo(a2, t0, fail); | 191 masm->TestJSArrayForAllocationSiteInfo(a2, t0, fail); |
185 } | 192 } |
186 | 193 |
187 // Check for empty arrays, which only require a map transition and no changes | 194 // Check for empty arrays, which only require a map transition and no changes |
188 // to the backing store. | 195 // to the backing store. |
189 __ lw(t0, FieldMemOperand(a2, JSObject::kElementsOffset)); | 196 __ lw(t0, FieldMemOperand(a2, JSObject::kElementsOffset)); |
190 __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex); | 197 __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex); |
191 __ Branch(&only_change_map, eq, at, Operand(t0)); | 198 __ Branch(&only_change_map, eq, at, Operand(t0)); |
192 | 199 |
193 __ push(ra); | 200 __ push(ra); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 __ bind(&entry); | 313 __ bind(&entry); |
307 __ Branch(&loop, lt, t3, Operand(t2)); | 314 __ Branch(&loop, lt, t3, Operand(t2)); |
308 | 315 |
309 if (!fpu_supported) __ Pop(a1, a0); | 316 if (!fpu_supported) __ Pop(a1, a0); |
310 __ pop(ra); | 317 __ pop(ra); |
311 __ bind(&done); | 318 __ bind(&done); |
312 } | 319 } |
313 | 320 |
314 | 321 |
315 void ElementsTransitionGenerator::GenerateDoubleToObject( | 322 void ElementsTransitionGenerator::GenerateDoubleToObject( |
316 MacroAssembler* masm, Label* fail) { | 323 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { |
317 // ----------- S t a t e ------------- | 324 // ----------- S t a t e ------------- |
318 // -- a0 : value | 325 // -- a0 : value |
319 // -- a1 : key | 326 // -- a1 : key |
320 // -- a2 : receiver | 327 // -- a2 : receiver |
321 // -- ra : return address | 328 // -- ra : return address |
322 // -- a3 : target map, scratch for subsequent call | 329 // -- a3 : target map, scratch for subsequent call |
323 // -- t0 : scratch (elements) | 330 // -- t0 : scratch (elements) |
324 // ----------------------------------- | 331 // ----------------------------------- |
325 Label entry, loop, convert_hole, gc_required, only_change_map; | 332 Label entry, loop, convert_hole, gc_required, only_change_map; |
326 | 333 |
| 334 if (mode == TRACK_ALLOCATION_SITE) { |
| 335 masm->TestJSArrayForAllocationSiteInfo(a2, t0, fail); |
| 336 } |
| 337 |
327 // Check for empty arrays, which only require a map transition and no changes | 338 // Check for empty arrays, which only require a map transition and no changes |
328 // to the backing store. | 339 // to the backing store. |
329 __ lw(t0, FieldMemOperand(a2, JSObject::kElementsOffset)); | 340 __ lw(t0, FieldMemOperand(a2, JSObject::kElementsOffset)); |
330 __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex); | 341 __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex); |
331 __ Branch(&only_change_map, eq, at, Operand(t0)); | 342 __ Branch(&only_change_map, eq, at, Operand(t0)); |
332 | 343 |
333 __ MultiPush(a0.bit() | a1.bit() | a2.bit() | a3.bit() | ra.bit()); | 344 __ MultiPush(a0.bit() | a1.bit() | a2.bit() | a3.bit() | ra.bit()); |
334 | 345 |
335 __ lw(t1, FieldMemOperand(t0, FixedArray::kLengthOffset)); | 346 __ lw(t1, FieldMemOperand(t0, FixedArray::kLengthOffset)); |
336 // t0: source FixedArray | 347 // t0: source FixedArray |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); | 719 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); |
709 } | 720 } |
710 } | 721 } |
711 | 722 |
712 | 723 |
713 #undef __ | 724 #undef __ |
714 | 725 |
715 } } // namespace v8::internal | 726 } } // namespace v8::internal |
716 | 727 |
717 #endif // V8_TARGET_ARCH_MIPS | 728 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |