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/x64/codegen-x64.h" | 5 #include "src/x64/codegen-x64.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 if (mode == TRACK_ALLOCATION_SITE) { | 281 if (mode == TRACK_ALLOCATION_SITE) { |
282 __ JumpIfJSArrayHasAllocationMemento(rdx, rdi, fail); | 282 __ JumpIfJSArrayHasAllocationMemento(rdx, rdi, fail); |
283 } | 283 } |
284 | 284 |
285 // Check for empty arrays, which only require a map transition and no changes | 285 // Check for empty arrays, which only require a map transition and no changes |
286 // to the backing store. | 286 // to the backing store. |
287 __ movp(r8, FieldOperand(rdx, JSObject::kElementsOffset)); | 287 __ movp(r8, FieldOperand(rdx, JSObject::kElementsOffset)); |
288 __ CompareRoot(r8, Heap::kEmptyFixedArrayRootIndex); | 288 __ CompareRoot(r8, Heap::kEmptyFixedArrayRootIndex); |
289 __ j(equal, &only_change_map); | 289 __ j(equal, &only_change_map); |
290 | 290 |
| 291 __ Push(rsi); |
291 __ Push(rax); | 292 __ Push(rax); |
292 | 293 |
293 __ movp(r8, FieldOperand(rdx, JSObject::kElementsOffset)); | 294 __ movp(r8, FieldOperand(rdx, JSObject::kElementsOffset)); |
294 __ SmiToInteger32(r9, FieldOperand(r8, FixedDoubleArray::kLengthOffset)); | 295 __ SmiToInteger32(r9, FieldOperand(r8, FixedDoubleArray::kLengthOffset)); |
295 // r8 : source FixedDoubleArray | 296 // r8 : source FixedDoubleArray |
296 // r9 : number of elements | 297 // r9 : number of elements |
297 __ leap(rdi, Operand(r9, times_pointer_size, FixedArray::kHeaderSize)); | 298 __ leap(rdi, Operand(r9, times_pointer_size, FixedArray::kHeaderSize)); |
298 __ Allocate(rdi, r11, r14, r15, &gc_required, TAG_OBJECT); | 299 __ Allocate(rdi, r11, r14, r15, &gc_required, TAG_OBJECT); |
299 // r11: destination FixedArray | 300 // r11: destination FixedArray |
300 __ LoadRoot(rdi, Heap::kFixedArrayMapRootIndex); | 301 __ LoadRoot(rdi, Heap::kFixedArrayMapRootIndex); |
(...skipping 18 matching lines...) Expand all Loading... |
319 __ bind(&initialization_loop_entry); | 320 __ bind(&initialization_loop_entry); |
320 __ decp(r9); | 321 __ decp(r9); |
321 __ j(not_sign, &initialization_loop); | 322 __ j(not_sign, &initialization_loop); |
322 | 323 |
323 __ SmiToInteger32(r9, FieldOperand(r8, FixedDoubleArray::kLengthOffset)); | 324 __ SmiToInteger32(r9, FieldOperand(r8, FixedDoubleArray::kLengthOffset)); |
324 __ jmp(&entry); | 325 __ jmp(&entry); |
325 | 326 |
326 // Call into runtime if GC is required. | 327 // Call into runtime if GC is required. |
327 __ bind(&gc_required); | 328 __ bind(&gc_required); |
328 __ Pop(rax); | 329 __ Pop(rax); |
329 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 330 __ Pop(rsi); |
330 __ jmp(fail); | 331 __ jmp(fail); |
331 | 332 |
332 // Box doubles into heap numbers. | 333 // Box doubles into heap numbers. |
333 __ bind(&loop); | 334 __ bind(&loop); |
334 __ movq(r14, FieldOperand(r8, | 335 __ movq(r14, FieldOperand(r8, |
335 r9, | 336 r9, |
336 times_8, | 337 times_8, |
337 FixedDoubleArray::kHeaderSize)); | 338 FixedDoubleArray::kHeaderSize)); |
338 // r9 : current element's index | 339 // r9 : current element's index |
339 // r14: current element | 340 // r14: current element |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 // Replace receiver's backing store with newly created and filled FixedArray. | 374 // Replace receiver's backing store with newly created and filled FixedArray. |
374 __ movp(FieldOperand(rdx, JSObject::kElementsOffset), r11); | 375 __ movp(FieldOperand(rdx, JSObject::kElementsOffset), r11); |
375 __ RecordWriteField(rdx, | 376 __ RecordWriteField(rdx, |
376 JSObject::kElementsOffset, | 377 JSObject::kElementsOffset, |
377 r11, | 378 r11, |
378 r15, | 379 r15, |
379 kDontSaveFPRegs, | 380 kDontSaveFPRegs, |
380 EMIT_REMEMBERED_SET, | 381 EMIT_REMEMBERED_SET, |
381 OMIT_SMI_CHECK); | 382 OMIT_SMI_CHECK); |
382 __ Pop(rax); | 383 __ Pop(rax); |
383 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 384 __ Pop(rsi); |
384 | 385 |
385 __ bind(&only_change_map); | 386 __ bind(&only_change_map); |
386 // Set transitioned map. | 387 // Set transitioned map. |
387 __ movp(FieldOperand(rdx, HeapObject::kMapOffset), rbx); | 388 __ movp(FieldOperand(rdx, HeapObject::kMapOffset), rbx); |
388 __ RecordWriteField(rdx, | 389 __ RecordWriteField(rdx, |
389 HeapObject::kMapOffset, | 390 HeapObject::kMapOffset, |
390 rbx, | 391 rbx, |
391 rdi, | 392 rdi, |
392 kDontSaveFPRegs, | 393 kDontSaveFPRegs, |
393 OMIT_REMEMBERED_SET, | 394 OMIT_REMEMBERED_SET, |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 return Operand(base_reg_, argument_count_reg_, times_pointer_size, | 634 return Operand(base_reg_, argument_count_reg_, times_pointer_size, |
634 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); | 635 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); |
635 } | 636 } |
636 } | 637 } |
637 | 638 |
638 | 639 |
639 } // namespace internal | 640 } // namespace internal |
640 } // namespace v8 | 641 } // namespace v8 |
641 | 642 |
642 #endif // V8_TARGET_ARCH_X64 | 643 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |