| 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...) Expand 10 before | Expand all | Expand 10 after 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, gc_cleanup, only_change_map; | 372 Label loop, entry, convert_hole, gc_required, 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...) Expand all 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, masm->isolate()->factory()->one_pointer_filler_map()); | |
| 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 | |
| 418 // Call into runtime if GC is required. | 405 // Call into runtime if GC is required. |
| 419 __ bind(&gc_required); | 406 __ bind(&gc_required); |
| 420 __ Pop(rax); | 407 __ Pop(rax); |
| 421 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 408 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
| 422 __ jmp(fail); | 409 __ jmp(fail); |
| 423 | 410 |
| 424 // Box doubles into heap numbers. | 411 // Box doubles into heap numbers. |
| 425 __ bind(&loop); | 412 __ bind(&loop); |
| 426 __ movq(r14, FieldOperand(r8, | 413 __ movq(r14, FieldOperand(r8, |
| 427 r9, | 414 r9, |
| 428 times_8, | 415 times_8, |
| 429 FixedDoubleArray::kHeaderSize)); | 416 FixedDoubleArray::kHeaderSize)); |
| 430 // r9 : current element's index | 417 // r9 : current element's index |
| 431 // r14: current element | 418 // r14: current element |
| 432 __ cmpq(r14, rsi); | 419 __ cmpq(r14, rsi); |
| 433 __ j(equal, &convert_hole); | 420 __ j(equal, &convert_hole); |
| 434 | 421 |
| 435 // Non-hole double, copy value into a heap number. | 422 // Non-hole double, copy value into a heap number. |
| 436 __ AllocateHeapNumber(rax, r15, &gc_cleanup); | 423 __ AllocateHeapNumber(rax, r15, &gc_required); |
| 437 // rax: new heap number | 424 // rax: new heap number |
| 438 __ movq(FieldOperand(rax, HeapNumber::kValueOffset), r14); | 425 __ movq(FieldOperand(rax, HeapNumber::kValueOffset), r14); |
| 439 __ movp(FieldOperand(r11, | 426 __ movp(FieldOperand(r11, |
| 440 r9, | 427 r9, |
| 441 times_pointer_size, | 428 times_pointer_size, |
| 442 FixedArray::kHeaderSize), | 429 FixedArray::kHeaderSize), |
| 443 rax); | 430 rax); |
| 444 __ movp(r15, r9); | 431 __ movp(r15, r9); |
| 445 __ RecordWriteArray(r11, | 432 __ RecordWriteArray(r11, |
| 446 rax, | 433 rax, |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize. | 710 // argument_count_reg_ * times_pointer_size + (receiver - 1) * kPointerSize. |
| 724 return Operand(base_reg_, argument_count_reg_, times_pointer_size, | 711 return Operand(base_reg_, argument_count_reg_, times_pointer_size, |
| 725 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); | 712 displacement_to_last_argument + (receiver - 1 - index) * kPointerSize); |
| 726 } | 713 } |
| 727 } | 714 } |
| 728 | 715 |
| 729 | 716 |
| 730 } } // namespace v8::internal | 717 } } // namespace v8::internal |
| 731 | 718 |
| 732 #endif // V8_TARGET_ARCH_X64 | 719 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |