| 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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 8 | 8 |
| 9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
| 10 #include "src/heap.h" | 10 #include "src/heap.h" |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 | 515 |
| 516 #undef __ | 516 #undef __ |
| 517 | 517 |
| 518 // ------------------------------------------------------------------------- | 518 // ------------------------------------------------------------------------- |
| 519 // Code generators | 519 // Code generators |
| 520 | 520 |
| 521 #define __ ACCESS_MASM(masm) | 521 #define __ ACCESS_MASM(masm) |
| 522 | 522 |
| 523 | 523 |
| 524 void ElementsTransitionGenerator::GenerateMapChangeElementsTransition( | 524 void ElementsTransitionGenerator::GenerateMapChangeElementsTransition( |
| 525 MacroAssembler* masm, AllocationSiteMode mode, | 525 MacroAssembler* masm, |
| 526 Register receiver, |
| 527 Register key, |
| 528 Register value, |
| 529 Register target_map, |
| 530 AllocationSiteMode mode, |
| 526 Label* allocation_memento_found) { | 531 Label* allocation_memento_found) { |
| 527 // ----------- S t a t e ------------- | 532 Register scratch = edi; |
| 528 // -- eax : value | 533 ASSERT(!AreAliased(receiver, key, value, target_map, scratch)); |
| 529 // -- ebx : target map | 534 |
| 530 // -- ecx : key | |
| 531 // -- edx : receiver | |
| 532 // -- esp[0] : return address | |
| 533 // ----------------------------------- | |
| 534 if (mode == TRACK_ALLOCATION_SITE) { | 535 if (mode == TRACK_ALLOCATION_SITE) { |
| 535 ASSERT(allocation_memento_found != NULL); | 536 ASSERT(allocation_memento_found != NULL); |
| 536 __ JumpIfJSArrayHasAllocationMemento(edx, edi, allocation_memento_found); | 537 __ JumpIfJSArrayHasAllocationMemento( |
| 538 receiver, scratch, allocation_memento_found); |
| 537 } | 539 } |
| 538 | 540 |
| 539 // Set transitioned map. | 541 // Set transitioned map. |
| 540 __ mov(FieldOperand(edx, HeapObject::kMapOffset), ebx); | 542 __ mov(FieldOperand(receiver, HeapObject::kMapOffset), target_map); |
| 541 __ RecordWriteField(edx, | 543 __ RecordWriteField(receiver, |
| 542 HeapObject::kMapOffset, | 544 HeapObject::kMapOffset, |
| 543 ebx, | 545 target_map, |
| 544 edi, | 546 scratch, |
| 545 kDontSaveFPRegs, | 547 kDontSaveFPRegs, |
| 546 EMIT_REMEMBERED_SET, | 548 EMIT_REMEMBERED_SET, |
| 547 OMIT_SMI_CHECK); | 549 OMIT_SMI_CHECK); |
| 548 } | 550 } |
| 549 | 551 |
| 550 | 552 |
| 551 void ElementsTransitionGenerator::GenerateSmiToDouble( | 553 void ElementsTransitionGenerator::GenerateSmiToDouble( |
| 552 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { | 554 MacroAssembler* masm, |
| 553 // ----------- S t a t e ------------- | 555 Register receiver, |
| 554 // -- eax : value | 556 Register key, |
| 555 // -- ebx : target map | 557 Register value, |
| 556 // -- ecx : key | 558 Register target_map, |
| 557 // -- edx : receiver | 559 AllocationSiteMode mode, |
| 558 // -- esp[0] : return address | 560 Label* fail) { |
| 559 // ----------------------------------- | 561 // Return address is on the stack. |
| 562 ASSERT(receiver.is(edx)); |
| 563 ASSERT(key.is(ecx)); |
| 564 ASSERT(value.is(eax)); |
| 565 ASSERT(target_map.is(ebx)); |
| 566 |
| 560 Label loop, entry, convert_hole, gc_required, only_change_map; | 567 Label loop, entry, convert_hole, gc_required, only_change_map; |
| 561 | 568 |
| 562 if (mode == TRACK_ALLOCATION_SITE) { | 569 if (mode == TRACK_ALLOCATION_SITE) { |
| 563 __ JumpIfJSArrayHasAllocationMemento(edx, edi, fail); | 570 __ JumpIfJSArrayHasAllocationMemento(edx, edi, fail); |
| 564 } | 571 } |
| 565 | 572 |
| 566 // Check for empty arrays, which only require a map transition and no changes | 573 // Check for empty arrays, which only require a map transition and no changes |
| 567 // to the backing store. | 574 // to the backing store. |
| 568 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | 575 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
| 569 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); | 576 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 HeapObject::kMapOffset, | 670 HeapObject::kMapOffset, |
| 664 ebx, | 671 ebx, |
| 665 edi, | 672 edi, |
| 666 kDontSaveFPRegs, | 673 kDontSaveFPRegs, |
| 667 OMIT_REMEMBERED_SET, | 674 OMIT_REMEMBERED_SET, |
| 668 OMIT_SMI_CHECK); | 675 OMIT_SMI_CHECK); |
| 669 } | 676 } |
| 670 | 677 |
| 671 | 678 |
| 672 void ElementsTransitionGenerator::GenerateDoubleToObject( | 679 void ElementsTransitionGenerator::GenerateDoubleToObject( |
| 673 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { | 680 MacroAssembler* masm, |
| 674 // ----------- S t a t e ------------- | 681 Register receiver, |
| 675 // -- eax : value | 682 Register key, |
| 676 // -- ebx : target map | 683 Register value, |
| 677 // -- ecx : key | 684 Register target_map, |
| 678 // -- edx : receiver | 685 AllocationSiteMode mode, |
| 679 // -- esp[0] : return address | 686 Label* fail) { |
| 680 // ----------------------------------- | 687 // Return address is on the stack. |
| 688 ASSERT(receiver.is(edx)); |
| 689 ASSERT(key.is(ecx)); |
| 690 ASSERT(value.is(eax)); |
| 691 ASSERT(target_map.is(ebx)); |
| 692 |
| 681 Label loop, entry, convert_hole, gc_required, only_change_map, success; | 693 Label loop, entry, convert_hole, gc_required, only_change_map, success; |
| 682 | 694 |
| 683 if (mode == TRACK_ALLOCATION_SITE) { | 695 if (mode == TRACK_ALLOCATION_SITE) { |
| 684 __ JumpIfJSArrayHasAllocationMemento(edx, edi, fail); | 696 __ JumpIfJSArrayHasAllocationMemento(edx, edi, fail); |
| 685 } | 697 } |
| 686 | 698 |
| 687 // Check for empty arrays, which only require a map transition and no changes | 699 // Check for empty arrays, which only require a map transition and no changes |
| 688 // to the backing store. | 700 // to the backing store. |
| 689 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); | 701 __ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
| 690 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); | 702 __ cmp(edi, Immediate(masm->isolate()->factory()->empty_fixed_array())); |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 Code* stub = GetCodeAgeStub(isolate, age, parity); | 1023 Code* stub = GetCodeAgeStub(isolate, age, parity); |
| 1012 CodePatcher patcher(sequence, young_length); | 1024 CodePatcher patcher(sequence, young_length); |
| 1013 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); | 1025 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); |
| 1014 } | 1026 } |
| 1015 } | 1027 } |
| 1016 | 1028 |
| 1017 | 1029 |
| 1018 } } // namespace v8::internal | 1030 } } // namespace v8::internal |
| 1019 | 1031 |
| 1020 #endif // V8_TARGET_ARCH_IA32 | 1032 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |