OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/heap.h" | 10 #include "src/heap.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 192 |
193 #undef __ | 193 #undef __ |
194 | 194 |
195 // ------------------------------------------------------------------------- | 195 // ------------------------------------------------------------------------- |
196 // Code generators | 196 // Code generators |
197 | 197 |
198 #define __ ACCESS_MASM(masm) | 198 #define __ ACCESS_MASM(masm) |
199 | 199 |
200 | 200 |
201 void ElementsTransitionGenerator::GenerateMapChangeElementsTransition( | 201 void ElementsTransitionGenerator::GenerateMapChangeElementsTransition( |
202 MacroAssembler* masm, AllocationSiteMode mode, | 202 MacroAssembler* masm, |
| 203 Register receiver, |
| 204 Register key, |
| 205 Register value, |
| 206 Register target_map, |
| 207 AllocationSiteMode mode, |
203 Label* allocation_memento_found) { | 208 Label* allocation_memento_found) { |
204 // ----------- S t a t e ------------- | 209 Register scratch = edi; |
205 // -- eax : value | 210 ASSERT(!AreAliased(receiver, key, value, target_map, scratch)); |
206 // -- ebx : target map | 211 |
207 // -- ecx : key | |
208 // -- edx : receiver | |
209 // -- esp[0] : return address | |
210 // ----------------------------------- | |
211 if (mode == TRACK_ALLOCATION_SITE) { | 212 if (mode == TRACK_ALLOCATION_SITE) { |
212 ASSERT(allocation_memento_found != NULL); | 213 ASSERT(allocation_memento_found != NULL); |
213 __ JumpIfJSArrayHasAllocationMemento(edx, edi, allocation_memento_found); | 214 __ JumpIfJSArrayHasAllocationMemento( |
| 215 receiver, scratch, allocation_memento_found); |
214 } | 216 } |
215 | 217 |
216 // Set transitioned map. | 218 // Set transitioned map. |
217 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); | 219 __ mov(FieldOperand(receiver, HeapObject::kMapOffset), target_map); |
218 __ RecordWriteField(edx, | 220 __ RecordWriteField(receiver, |
219 HeapObject::kMapOffset, | 221 HeapObject::kMapOffset, |
220 ebx, | 222 target_map, |
221 edi, | 223 scratch, |
222 EMIT_REMEMBERED_SET, | 224 EMIT_REMEMBERED_SET, |
223 OMIT_SMI_CHECK); | 225 OMIT_SMI_CHECK); |
224 } | 226 } |
225 | 227 |
226 | 228 |
227 void ElementsTransitionGenerator::GenerateSmiToDouble( | 229 void ElementsTransitionGenerator::GenerateSmiToDouble( |
228 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { | 230 MacroAssembler* masm, |
229 // ----------- S t a t e ------------- | 231 Register receiver, |
230 // -- eax : value | 232 Register key, |
231 // -- ebx : target map | 233 Register value, |
232 // -- ecx : key | 234 Register target_map, |
233 // -- edx : receiver | 235 AllocationSiteMode mode, |
234 // -- esp[0] : return address | 236 Label* fail) { |
235 // ----------------------------------- | 237 // Return address is on the stack. |
| 238 ASSERT(receiver.is(edx)); |
| 239 ASSERT(key.is(ecx)); |
| 240 ASSERT(value.is(eax)); |
| 241 ASSERT(target_map.is(ebx)); |
| 242 |
236 Label loop, entry, convert_hole, gc_required, only_change_map; | 243 Label loop, entry, convert_hole, gc_required, only_change_map; |
237 | 244 |
238 if (mode == TRACK_ALLOCATION_SITE) { | 245 if (mode == TRACK_ALLOCATION_SITE) { |
239 __ JumpIfJSArrayHasAllocationMemento(edx, edi, fail); | 246 __ JumpIfJSArrayHasAllocationMemento(edx, edi, fail); |
240 } | 247 } |
241 | 248 |
242 // Check for empty arrays, which only require a map transition and no changes | 249 // Check for empty arrays, which only require a map transition and no changes |
243 // to the backing store. | 250 // to the backing store. |
244 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | 251 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
245 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); | 252 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 __ RecordWriteField(edx, | 342 __ RecordWriteField(edx, |
336 HeapObject::kMapOffset, | 343 HeapObject::kMapOffset, |
337 ebx, | 344 ebx, |
338 edi, | 345 edi, |
339 OMIT_REMEMBERED_SET, | 346 OMIT_REMEMBERED_SET, |
340 OMIT_SMI_CHECK); | 347 OMIT_SMI_CHECK); |
341 } | 348 } |
342 | 349 |
343 | 350 |
344 void ElementsTransitionGenerator::GenerateDoubleToObject( | 351 void ElementsTransitionGenerator::GenerateDoubleToObject( |
345 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { | 352 MacroAssembler* masm, |
346 // ----------- S t a t e ------------- | 353 Register receiver, |
347 // -- eax : value | 354 Register key, |
348 // -- ebx : target map | 355 Register value, |
349 // -- ecx : key | 356 Register target_map, |
350 // -- edx : receiver | 357 AllocationSiteMode mode, |
351 // -- esp[0] : return address | 358 Label* fail) { |
352 // ----------------------------------- | 359 // Return address is on the stack. |
| 360 ASSERT(receiver.is(edx)); |
| 361 ASSERT(key.is(ecx)); |
| 362 ASSERT(value.is(eax)); |
| 363 ASSERT(target_map.is(ebx)); |
| 364 |
353 Label loop, entry, convert_hole, gc_required, only_change_map, success; | 365 Label loop, entry, convert_hole, gc_required, only_change_map, success; |
354 | 366 |
355 if (mode == TRACK_ALLOCATION_SITE) { | 367 if (mode == TRACK_ALLOCATION_SITE) { |
356 __ JumpIfJSArrayHasAllocationMemento(edx, edi, fail); | 368 __ JumpIfJSArrayHasAllocationMemento(edx, edi, fail); |
357 } | 369 } |
358 | 370 |
359 // Check for empty arrays, which only require a map transition and no changes | 371 // Check for empty arrays, which only require a map transition and no changes |
360 // to the backing store. | 372 // to the backing store. |
361 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | 373 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
362 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); | 374 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 Code* stub = GetCodeAgeStub(isolate, age, parity); | 636 Code* stub = GetCodeAgeStub(isolate, age, parity); |
625 CodePatcher patcher(sequence, young_length); | 637 CodePatcher patcher(sequence, young_length); |
626 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 638 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
627 } | 639 } |
628 } | 640 } |
629 | 641 |
630 | 642 |
631 } } // namespace v8::internal | 643 } } // namespace v8::internal |
632 | 644 |
633 #endif // V8_TARGET_ARCH_X87 | 645 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |