| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // ----------- S t a t e ------------- | 149 // ----------- S t a t e ------------- |
| 150 // -- a0 : value | 150 // -- a0 : value |
| 151 // -- a1 : key | 151 // -- a1 : key |
| 152 // -- a2 : receiver | 152 // -- a2 : receiver |
| 153 // -- ra : return address | 153 // -- ra : return address |
| 154 // -- a3 : target map, scratch for subsequent call | 154 // -- a3 : target map, scratch for subsequent call |
| 155 // -- t0 : scratch (elements) | 155 // -- t0 : scratch (elements) |
| 156 // ----------------------------------- | 156 // ----------------------------------- |
| 157 if (mode == TRACK_ALLOCATION_SITE) { | 157 if (mode == TRACK_ALLOCATION_SITE) { |
| 158 ASSERT(allocation_memento_found != NULL); | 158 ASSERT(allocation_memento_found != NULL); |
| 159 masm->TestJSArrayForAllocationMemento(a2, t0, eq, | 159 __ JumpIfJSArrayHasAllocationMemento(a2, t0, allocation_memento_found); |
| 160 allocation_memento_found); | |
| 161 } | 160 } |
| 162 | 161 |
| 163 // Set transitioned map. | 162 // Set transitioned map. |
| 164 __ sw(a3, FieldMemOperand(a2, HeapObject::kMapOffset)); | 163 __ sw(a3, FieldMemOperand(a2, HeapObject::kMapOffset)); |
| 165 __ RecordWriteField(a2, | 164 __ RecordWriteField(a2, |
| 166 HeapObject::kMapOffset, | 165 HeapObject::kMapOffset, |
| 167 a3, | 166 a3, |
| 168 t5, | 167 t5, |
| 169 kRAHasNotBeenSaved, | 168 kRAHasNotBeenSaved, |
| 170 kDontSaveFPRegs, | 169 kDontSaveFPRegs, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 181 // -- a2 : receiver | 180 // -- a2 : receiver |
| 182 // -- ra : return address | 181 // -- ra : return address |
| 183 // -- a3 : target map, scratch for subsequent call | 182 // -- a3 : target map, scratch for subsequent call |
| 184 // -- t0 : scratch (elements) | 183 // -- t0 : scratch (elements) |
| 185 // ----------------------------------- | 184 // ----------------------------------- |
| 186 Label loop, entry, convert_hole, gc_required, only_change_map, done; | 185 Label loop, entry, convert_hole, gc_required, only_change_map, done; |
| 187 | 186 |
| 188 Register scratch = t6; | 187 Register scratch = t6; |
| 189 | 188 |
| 190 if (mode == TRACK_ALLOCATION_SITE) { | 189 if (mode == TRACK_ALLOCATION_SITE) { |
| 191 masm->TestJSArrayForAllocationMemento(a2, t0, eq, fail); | 190 __ JumpIfJSArrayHasAllocationMemento(a2, t0, fail); |
| 192 } | 191 } |
| 193 | 192 |
| 194 // Check for empty arrays, which only require a map transition and no changes | 193 // Check for empty arrays, which only require a map transition and no changes |
| 195 // to the backing store. | 194 // to the backing store. |
| 196 __ lw(t0, FieldMemOperand(a2, JSObject::kElementsOffset)); | 195 __ lw(t0, FieldMemOperand(a2, JSObject::kElementsOffset)); |
| 197 __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex); | 196 __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex); |
| 198 __ Branch(&only_change_map, eq, at, Operand(t0)); | 197 __ Branch(&only_change_map, eq, at, Operand(t0)); |
| 199 | 198 |
| 200 __ push(ra); | 199 __ push(ra); |
| 201 __ lw(t1, FieldMemOperand(t0, FixedArray::kLengthOffset)); | 200 __ lw(t1, FieldMemOperand(t0, FixedArray::kLengthOffset)); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 // -- a0 : value | 308 // -- a0 : value |
| 310 // -- a1 : key | 309 // -- a1 : key |
| 311 // -- a2 : receiver | 310 // -- a2 : receiver |
| 312 // -- ra : return address | 311 // -- ra : return address |
| 313 // -- a3 : target map, scratch for subsequent call | 312 // -- a3 : target map, scratch for subsequent call |
| 314 // -- t0 : scratch (elements) | 313 // -- t0 : scratch (elements) |
| 315 // ----------------------------------- | 314 // ----------------------------------- |
| 316 Label entry, loop, convert_hole, gc_required, only_change_map; | 315 Label entry, loop, convert_hole, gc_required, only_change_map; |
| 317 | 316 |
| 318 if (mode == TRACK_ALLOCATION_SITE) { | 317 if (mode == TRACK_ALLOCATION_SITE) { |
| 319 masm->TestJSArrayForAllocationMemento(a2, t0, eq, fail); | 318 __ JumpIfJSArrayHasAllocationMemento(a2, t0, fail); |
| 320 } | 319 } |
| 321 | 320 |
| 322 // Check for empty arrays, which only require a map transition and no changes | 321 // Check for empty arrays, which only require a map transition and no changes |
| 323 // to the backing store. | 322 // to the backing store. |
| 324 __ lw(t0, FieldMemOperand(a2, JSObject::kElementsOffset)); | 323 __ lw(t0, FieldMemOperand(a2, JSObject::kElementsOffset)); |
| 325 __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex); | 324 __ LoadRoot(at, Heap::kEmptyFixedArrayRootIndex); |
| 326 __ Branch(&only_change_map, eq, at, Operand(t0)); | 325 __ Branch(&only_change_map, eq, at, Operand(t0)); |
| 327 | 326 |
| 328 __ MultiPush(a0.bit() | a1.bit() | a2.bit() | a3.bit() | ra.bit()); | 327 __ MultiPush(a0.bit() | a1.bit() | a2.bit() | a3.bit() | ra.bit()); |
| 329 | 328 |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 bool result = !memcmp(sequence, young_sequence, young_length); | 631 bool result = !memcmp(sequence, young_sequence, young_length); |
| 633 ASSERT(result || | 632 ASSERT(result || |
| 634 Memory::uint32_at(sequence) == kCodeAgePatchFirstInstruction); | 633 Memory::uint32_at(sequence) == kCodeAgePatchFirstInstruction); |
| 635 return result; | 634 return result; |
| 636 } | 635 } |
| 637 | 636 |
| 638 | 637 |
| 639 void Code::GetCodeAgeAndParity(byte* sequence, Age* age, | 638 void Code::GetCodeAgeAndParity(byte* sequence, Age* age, |
| 640 MarkingParity* parity) { | 639 MarkingParity* parity) { |
| 641 if (IsYoungSequence(sequence)) { | 640 if (IsYoungSequence(sequence)) { |
| 642 *age = kNoAge; | 641 *age = kNoAgeCodeAge; |
| 643 *parity = NO_MARKING_PARITY; | 642 *parity = NO_MARKING_PARITY; |
| 644 } else { | 643 } else { |
| 645 Address target_address = Memory::Address_at( | 644 Address target_address = Memory::Address_at( |
| 646 sequence + Assembler::kInstrSize * (kNoCodeAgeSequenceLength - 1)); | 645 sequence + Assembler::kInstrSize * (kNoCodeAgeSequenceLength - 1)); |
| 647 Code* stub = GetCodeFromTargetAddress(target_address); | 646 Code* stub = GetCodeFromTargetAddress(target_address); |
| 648 GetCodeAgeAndParity(stub, age, parity); | 647 GetCodeAgeAndParity(stub, age, parity); |
| 649 } | 648 } |
| 650 } | 649 } |
| 651 | 650 |
| 652 | 651 |
| 653 void Code::PatchPlatformCodeAge(Isolate* isolate, | 652 void Code::PatchPlatformCodeAge(Isolate* isolate, |
| 654 byte* sequence, | 653 byte* sequence, |
| 655 Code::Age age, | 654 Code::Age age, |
| 656 MarkingParity parity) { | 655 MarkingParity parity) { |
| 657 uint32_t young_length; | 656 uint32_t young_length; |
| 658 byte* young_sequence = GetNoCodeAgeSequence(&young_length); | 657 byte* young_sequence = GetNoCodeAgeSequence(&young_length); |
| 659 if (age == kNoAge) { | 658 if (age == kNoAgeCodeAge) { |
| 660 CopyBytes(sequence, young_sequence, young_length); | 659 CopyBytes(sequence, young_sequence, young_length); |
| 661 CPU::FlushICache(sequence, young_length); | 660 CPU::FlushICache(sequence, young_length); |
| 662 } else { | 661 } else { |
| 663 Code* stub = GetCodeAgeStub(isolate, age, parity); | 662 Code* stub = GetCodeAgeStub(isolate, age, parity); |
| 664 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize); | 663 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize); |
| 665 // Mark this code sequence for FindPlatformCodeAgeSequence() | 664 // Mark this code sequence for FindPlatformCodeAgeSequence() |
| 666 patcher.masm()->nop(Assembler::CODE_AGE_MARKER_NOP); | 665 patcher.masm()->nop(Assembler::CODE_AGE_MARKER_NOP); |
| 667 // Save the function's original return address | 666 // Save the function's original return address |
| 668 // (it will be clobbered by Call(t9)) | 667 // (it will be clobbered by Call(t9)) |
| 669 patcher.masm()->mov(at, ra); | 668 patcher.masm()->mov(at, ra); |
| 670 // Load the stub address to t9 and call it | 669 // Load the stub address to t9 and call it |
| 671 patcher.masm()->li(t9, | 670 patcher.masm()->li(t9, |
| 672 Operand(reinterpret_cast<uint32_t>(stub->instruction_start()))); | 671 Operand(reinterpret_cast<uint32_t>(stub->instruction_start()))); |
| 673 patcher.masm()->Call(t9); | 672 patcher.masm()->Call(t9); |
| 674 // Record the stub address in the empty space for GetCodeAgeAndParity() | 673 // Record the stub address in the empty space for GetCodeAgeAndParity() |
| 675 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); | 674 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); |
| 676 } | 675 } |
| 677 } | 676 } |
| 678 | 677 |
| 679 | 678 |
| 680 #undef __ | 679 #undef __ |
| 681 | 680 |
| 682 } } // namespace v8::internal | 681 } } // namespace v8::internal |
| 683 | 682 |
| 684 #endif // V8_TARGET_ARCH_MIPS | 683 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |