| 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 // ----------- S t a t e ------------- | 395 // ----------- S t a t e ------------- |
| 396 // -- r0 : value | 396 // -- r0 : value |
| 397 // -- r1 : key | 397 // -- r1 : key |
| 398 // -- r2 : receiver | 398 // -- r2 : receiver |
| 399 // -- lr : return address | 399 // -- lr : return address |
| 400 // -- r3 : target map, scratch for subsequent call | 400 // -- r3 : target map, scratch for subsequent call |
| 401 // -- r4 : scratch (elements) | 401 // -- r4 : scratch (elements) |
| 402 // ----------------------------------- | 402 // ----------------------------------- |
| 403 if (mode == TRACK_ALLOCATION_SITE) { | 403 if (mode == TRACK_ALLOCATION_SITE) { |
| 404 ASSERT(allocation_memento_found != NULL); | 404 ASSERT(allocation_memento_found != NULL); |
| 405 __ TestJSArrayForAllocationMemento(r2, r4); | 405 __ JumpIfJSArrayHasAllocationMemento(r2, r4, allocation_memento_found); |
| 406 __ b(eq, allocation_memento_found); | |
| 407 } | 406 } |
| 408 | 407 |
| 409 // Set transitioned map. | 408 // Set transitioned map. |
| 410 __ str(r3, FieldMemOperand(r2, HeapObject::kMapOffset)); | 409 __ str(r3, FieldMemOperand(r2, HeapObject::kMapOffset)); |
| 411 __ RecordWriteField(r2, | 410 __ RecordWriteField(r2, |
| 412 HeapObject::kMapOffset, | 411 HeapObject::kMapOffset, |
| 413 r3, | 412 r3, |
| 414 r9, | 413 r9, |
| 415 kLRHasNotBeenSaved, | 414 kLRHasNotBeenSaved, |
| 416 kDontSaveFPRegs, | 415 kDontSaveFPRegs, |
| 417 EMIT_REMEMBERED_SET, | 416 EMIT_REMEMBERED_SET, |
| 418 OMIT_SMI_CHECK); | 417 OMIT_SMI_CHECK); |
| 419 } | 418 } |
| 420 | 419 |
| 421 | 420 |
| 422 void ElementsTransitionGenerator::GenerateSmiToDouble( | 421 void ElementsTransitionGenerator::GenerateSmiToDouble( |
| 423 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { | 422 MacroAssembler* masm, AllocationSiteMode mode, Label* fail) { |
| 424 // ----------- S t a t e ------------- | 423 // ----------- S t a t e ------------- |
| 425 // -- r0 : value | 424 // -- r0 : value |
| 426 // -- r1 : key | 425 // -- r1 : key |
| 427 // -- r2 : receiver | 426 // -- r2 : receiver |
| 428 // -- lr : return address | 427 // -- lr : return address |
| 429 // -- r3 : target map, scratch for subsequent call | 428 // -- r3 : target map, scratch for subsequent call |
| 430 // -- r4 : scratch (elements) | 429 // -- r4 : scratch (elements) |
| 431 // ----------------------------------- | 430 // ----------------------------------- |
| 432 Label loop, entry, convert_hole, gc_required, only_change_map, done; | 431 Label loop, entry, convert_hole, gc_required, only_change_map, done; |
| 433 | 432 |
| 434 if (mode == TRACK_ALLOCATION_SITE) { | 433 if (mode == TRACK_ALLOCATION_SITE) { |
| 435 __ TestJSArrayForAllocationMemento(r2, r4); | 434 __ JumpIfJSArrayHasAllocationMemento(r2, r4, fail); |
| 436 __ b(eq, fail); | |
| 437 } | 435 } |
| 438 | 436 |
| 439 // Check for empty arrays, which only require a map transition and no changes | 437 // Check for empty arrays, which only require a map transition and no changes |
| 440 // to the backing store. | 438 // to the backing store. |
| 441 __ ldr(r4, FieldMemOperand(r2, JSObject::kElementsOffset)); | 439 __ ldr(r4, FieldMemOperand(r2, JSObject::kElementsOffset)); |
| 442 __ CompareRoot(r4, Heap::kEmptyFixedArrayRootIndex); | 440 __ CompareRoot(r4, Heap::kEmptyFixedArrayRootIndex); |
| 443 __ b(eq, &only_change_map); | 441 __ b(eq, &only_change_map); |
| 444 | 442 |
| 445 __ push(lr); | 443 __ push(lr); |
| 446 __ ldr(r5, FieldMemOperand(r4, FixedArray::kLengthOffset)); | 444 __ ldr(r5, FieldMemOperand(r4, FixedArray::kLengthOffset)); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 // -- r0 : value | 550 // -- r0 : value |
| 553 // -- r1 : key | 551 // -- r1 : key |
| 554 // -- r2 : receiver | 552 // -- r2 : receiver |
| 555 // -- lr : return address | 553 // -- lr : return address |
| 556 // -- r3 : target map, scratch for subsequent call | 554 // -- r3 : target map, scratch for subsequent call |
| 557 // -- r4 : scratch (elements) | 555 // -- r4 : scratch (elements) |
| 558 // ----------------------------------- | 556 // ----------------------------------- |
| 559 Label entry, loop, convert_hole, gc_required, only_change_map; | 557 Label entry, loop, convert_hole, gc_required, only_change_map; |
| 560 | 558 |
| 561 if (mode == TRACK_ALLOCATION_SITE) { | 559 if (mode == TRACK_ALLOCATION_SITE) { |
| 562 __ TestJSArrayForAllocationMemento(r2, r4); | 560 __ JumpIfJSArrayHasAllocationMemento(r2, r4, fail); |
| 563 __ b(eq, fail); | |
| 564 } | 561 } |
| 565 | 562 |
| 566 // Check for empty arrays, which only require a map transition and no changes | 563 // Check for empty arrays, which only require a map transition and no changes |
| 567 // to the backing store. | 564 // to the backing store. |
| 568 __ ldr(r4, FieldMemOperand(r2, JSObject::kElementsOffset)); | 565 __ ldr(r4, FieldMemOperand(r2, JSObject::kElementsOffset)); |
| 569 __ CompareRoot(r4, Heap::kEmptyFixedArrayRootIndex); | 566 __ CompareRoot(r4, Heap::kEmptyFixedArrayRootIndex); |
| 570 __ b(eq, &only_change_map); | 567 __ b(eq, &only_change_map); |
| 571 | 568 |
| 572 __ push(lr); | 569 __ push(lr); |
| 573 __ Push(r3, r2, r1, r0); | 570 __ Push(r3, r2, r1, r0); |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 bool result = !memcmp(sequence, young_sequence, young_length); | 864 bool result = !memcmp(sequence, young_sequence, young_length); |
| 868 ASSERT(result || | 865 ASSERT(result || |
| 869 Memory::uint32_at(sequence) == kCodeAgePatchFirstInstruction); | 866 Memory::uint32_at(sequence) == kCodeAgePatchFirstInstruction); |
| 870 return result; | 867 return result; |
| 871 } | 868 } |
| 872 | 869 |
| 873 | 870 |
| 874 void Code::GetCodeAgeAndParity(byte* sequence, Age* age, | 871 void Code::GetCodeAgeAndParity(byte* sequence, Age* age, |
| 875 MarkingParity* parity) { | 872 MarkingParity* parity) { |
| 876 if (IsYoungSequence(sequence)) { | 873 if (IsYoungSequence(sequence)) { |
| 877 *age = kNoAge; | 874 *age = kNoAgeCodeAge; |
| 878 *parity = NO_MARKING_PARITY; | 875 *parity = NO_MARKING_PARITY; |
| 879 } else { | 876 } else { |
| 880 Address target_address = Memory::Address_at( | 877 Address target_address = Memory::Address_at( |
| 881 sequence + Assembler::kInstrSize * (kNoCodeAgeSequenceLength - 1)); | 878 sequence + Assembler::kInstrSize * (kNoCodeAgeSequenceLength - 1)); |
| 882 Code* stub = GetCodeFromTargetAddress(target_address); | 879 Code* stub = GetCodeFromTargetAddress(target_address); |
| 883 GetCodeAgeAndParity(stub, age, parity); | 880 GetCodeAgeAndParity(stub, age, parity); |
| 884 } | 881 } |
| 885 } | 882 } |
| 886 | 883 |
| 887 | 884 |
| 888 void Code::PatchPlatformCodeAge(Isolate* isolate, | 885 void Code::PatchPlatformCodeAge(Isolate* isolate, |
| 889 byte* sequence, | 886 byte* sequence, |
| 890 Code::Age age, | 887 Code::Age age, |
| 891 MarkingParity parity) { | 888 MarkingParity parity) { |
| 892 uint32_t young_length; | 889 uint32_t young_length; |
| 893 byte* young_sequence = GetNoCodeAgeSequence(&young_length); | 890 byte* young_sequence = GetNoCodeAgeSequence(&young_length); |
| 894 if (age == kNoAge) { | 891 if (age == kNoAgeCodeAge) { |
| 895 CopyBytes(sequence, young_sequence, young_length); | 892 CopyBytes(sequence, young_sequence, young_length); |
| 896 CPU::FlushICache(sequence, young_length); | 893 CPU::FlushICache(sequence, young_length); |
| 897 } else { | 894 } else { |
| 898 Code* stub = GetCodeAgeStub(isolate, age, parity); | 895 Code* stub = GetCodeAgeStub(isolate, age, parity); |
| 899 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize); | 896 CodePatcher patcher(sequence, young_length / Assembler::kInstrSize); |
| 900 patcher.masm()->add(r0, pc, Operand(-8)); | 897 patcher.masm()->add(r0, pc, Operand(-8)); |
| 901 patcher.masm()->ldr(pc, MemOperand(pc, -4)); | 898 patcher.masm()->ldr(pc, MemOperand(pc, -4)); |
| 902 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); | 899 patcher.masm()->dd(reinterpret_cast<uint32_t>(stub->instruction_start())); |
| 903 } | 900 } |
| 904 } | 901 } |
| 905 | 902 |
| 906 | 903 |
| 907 } } // namespace v8::internal | 904 } } // namespace v8::internal |
| 908 | 905 |
| 909 #endif // V8_TARGET_ARCH_ARM | 906 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |