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 351 matching lines...) Loading... |
362 | 362 |
363 void ElementsTransitionGenerator::GenerateDoubleToObject( | 363 void ElementsTransitionGenerator::GenerateDoubleToObject( |
364 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { | 364 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { |
365 // ----------- S t a t e ------------- | 365 // ----------- S t a t e ------------- |
366 // -- rax : value | 366 // -- rax : value |
367 // -- rbx : target map | 367 // -- rbx : target map |
368 // -- rcx : key | 368 // -- rcx : key |
369 // -- rdx : receiver | 369 // -- rdx : receiver |
370 // -- rsp[0] : return address | 370 // -- rsp[0] : return address |
371 // ----------------------------------- | 371 // ----------------------------------- |
372 Label loop, entry, convert_hole, gc_required, only_change_map; | 372 Label loop, entry, convert_hole, gc_required, gc_cleanup, only_change_map; |
373 | 373 |
374 if (mode == TRACK_ALLOCATION_SITE) { | 374 if (mode == TRACK_ALLOCATION_SITE) { |
375 __ JumpIfJSArrayHasAllocationMemento(rdx, rdi, fail); | 375 __ JumpIfJSArrayHasAllocationMemento(rdx, rdi, fail); |
376 } | 376 } |
377 | 377 |
378 // Check for empty arrays, which only require a map transition and no changes | 378 // Check for empty arrays, which only require a map transition and no changes |
379 // to the backing store. | 379 // to the backing store. |
380 __ movp(r8, FieldOperand(rdx, JSObject::kElementsOffset)); | 380 __ movp(r8, FieldOperand(rdx, JSObject::kElementsOffset)); |
381 __ CompareRoot(r8, Heap::kEmptyFixedArrayRootIndex); | 381 __ CompareRoot(r8, Heap::kEmptyFixedArrayRootIndex); |
382 __ j(equal, &only_change_map); | 382 __ j(equal, &only_change_map); |
(...skipping 12 matching lines...) Loading... |
395 __ Integer32ToSmi(r14, r9); | 395 __ Integer32ToSmi(r14, r9); |
396 __ movp(FieldOperand(r11, FixedArray::kLengthOffset), r14); | 396 __ movp(FieldOperand(r11, FixedArray::kLengthOffset), r14); |
397 | 397 |
398 // Prepare for conversion loop. | 398 // Prepare for conversion loop. |
399 __ movq(rsi, BitCast<int64_t, uint64_t>(kHoleNanInt64)); | 399 __ movq(rsi, BitCast<int64_t, uint64_t>(kHoleNanInt64)); |
400 __ LoadRoot(rdi, Heap::kTheHoleValueRootIndex); | 400 __ LoadRoot(rdi, Heap::kTheHoleValueRootIndex); |
401 // rsi: the-hole NaN | 401 // rsi: the-hole NaN |
402 // rdi: pointer to the-hole | 402 // rdi: pointer to the-hole |
403 __ jmp(&entry); | 403 __ jmp(&entry); |
404 | 404 |
| 405 __ bind(&gc_cleanup); |
| 406 #ifdef VERIFY_HEAP |
| 407 // Make sure new space is iterable if we are verifying the heap. |
| 408 __ Move(rax, Smi::FromInt(0)); |
| 409 __ movp(FieldOperand(r11, |
| 410 r9, |
| 411 times_pointer_size, |
| 412 FixedArray::kHeaderSize), |
| 413 rax); |
| 414 __ decp(r9); |
| 415 __ j(not_sign, &gc_cleanup); |
| 416 #endif |
| 417 |
405 // Call into runtime if GC is required. | 418 // Call into runtime if GC is required. |
406 __ bind(&gc_required); | 419 __ bind(&gc_required); |
407 __ Pop(rax); | 420 __ Pop(rax); |
408 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 421 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
409 __ jmp(fail); | 422 __ jmp(fail); |
410 | 423 |
411 // Box doubles into heap numbers. | 424 // Box doubles into heap numbers. |
412 __ bind(&loop); | 425 __ bind(&loop); |
413 __ movq(r14, FieldOperand(r8, | 426 __ movq(r14, FieldOperand(r8, |
414 r9, | 427 r9, |
415 times_8, | 428 times_8, |
416 FixedDoubleArray::kHeaderSize)); | 429 FixedDoubleArray::kHeaderSize)); |
417 // r9 : current element's index | 430 // r9 : current element's index |
418 // r14: current element | 431 // r14: current element |
419 __ cmpq(r14, rsi); | 432 __ cmpq(r14, rsi); |
420 __ j(equal, &convert_hole); | 433 __ j(equal, &convert_hole); |
421 | 434 |
422 // Non-hole double, copy value into a heap number. | 435 // Non-hole double, copy value into a heap number. |
423 __ AllocateHeapNumber(rax, r15, &gc_required); | 436 __ AllocateHeapNumber(rax, r15, &gc_cleanup); |
424 // rax: new heap number | 437 // rax: new heap number |
425 __ movq(FieldOperand(rax, HeapNumber::kValueOffset), r14); | 438 __ movq(FieldOperand(rax, HeapNumber::kValueOffset), r14); |
426 __ movp(FieldOperand(r11, | 439 __ movp(FieldOperand(r11, |
427 r9, | 440 r9, |
428 times_pointer_size, | 441 times_pointer_size, |
429 FixedArray::kHeaderSize), | 442 FixedArray::kHeaderSize), |
430 rax); | 443 rax); |
431 __ movp(r15, r9); | 444 __ movp(r15, r9); |
432 __ RecordWriteArray(r11, | 445 __ RecordWriteArray(r11, |
433 rax, | 446 rax, |
(...skipping 276 matching lines...) Loading... |
710 // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize. | 723 // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize. |
711 return Operand(base_reg_, argument_count_reg_, times_pointer_size, | 724 return Operand(base_reg_, argument_count_reg_, times_pointer_size, |
712 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); | 725 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); |
713 } | 726 } |
714 } | 727 } |
715 | 728 |
716 | 729 |
717 } } // namespace v8::internal | 730 } } // namespace v8::internal |
718 | 731 |
719 #endif // V8_TARGET_ARCH_X64 | 732 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |