Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(661)

Side by Side Diff: src/arm/full-codegen-arm.cc

Issue 317653003: [Arm] Various cleanups to the Arm assembler backend. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/constants-arm.h ('k') | src/arm/macro-assembler-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 4743 matching lines...) Expand 10 before | Expand all | Expand 10 after
4754 ASSERT(Assembler::IsLdrPpImmediateOffset(Memory::int32_at(load_address))); 4754 ASSERT(Assembler::IsLdrPpImmediateOffset(Memory::int32_at(load_address)));
4755 } 4755 }
4756 return load_address; 4756 return load_address;
4757 } 4757 }
4758 4758
4759 4759
4760 void BackEdgeTable::PatchAt(Code* unoptimized_code, 4760 void BackEdgeTable::PatchAt(Code* unoptimized_code,
4761 Address pc, 4761 Address pc,
4762 BackEdgeState target_state, 4762 BackEdgeState target_state,
4763 Code* replacement_code) { 4763 Code* replacement_code) {
4764 static const int kInstrSize = Assembler::kInstrSize;
4765 Address pc_immediate_load_address = GetInterruptImmediateLoadAddress(pc); 4764 Address pc_immediate_load_address = GetInterruptImmediateLoadAddress(pc);
4766 Address branch_address = pc_immediate_load_address - kInstrSize; 4765 Address branch_address = pc_immediate_load_address - Assembler::kInstrSize;
4767 CodePatcher patcher(branch_address, 1); 4766 CodePatcher patcher(branch_address, 1);
4768 switch (target_state) { 4767 switch (target_state) {
4769 case INTERRUPT: 4768 case INTERRUPT:
4770 { 4769 {
4771 // <decrement profiling counter> 4770 // <decrement profiling counter>
4772 // bpl ok 4771 // bpl ok
4773 // ; load interrupt stub address into ip - either of: 4772 // ; load interrupt stub address into ip - either of:
4774 // ldr ip, [pc/pp, <constant pool offset>] | movw ip, <immed low> 4773 // ldr ip, [pc/pp, <constant pool offset>] | movw ip, <immed low>
4775 // | movt ip, <immed high> 4774 // | movt ip, <immed high>
4776 // blx ip 4775 // blx ip
4777 // ok-label 4776 // ok-label
4778 4777
4779 // Calculate branch offet to the ok-label - this is the difference between 4778 // Calculate branch offet to the ok-label - this is the difference between
4780 // the branch address and |pc| (which points at <blx ip>) plus one instr. 4779 // the branch address and |pc| (which points at <blx ip>) plus one instr.
4781 int branch_offset = pc + kInstrSize - branch_address; 4780 int branch_offset = pc + Assembler::kInstrSize - branch_address;
4782 patcher.masm()->b(branch_offset, pl); 4781 patcher.masm()->b(branch_offset, pl);
4783 break; 4782 break;
4784 } 4783 }
4785 case ON_STACK_REPLACEMENT: 4784 case ON_STACK_REPLACEMENT:
4786 case OSR_AFTER_STACK_CHECK: 4785 case OSR_AFTER_STACK_CHECK:
4787 // <decrement profiling counter> 4786 // <decrement profiling counter>
4788 // mov r0, r0 (NOP) 4787 // mov r0, r0 (NOP)
4789 // ; load on-stack replacement address into ip - either of: 4788 // ; load on-stack replacement address into ip - either of:
4790 // ldr ip, [pc/pp, <constant pool offset>] | movw ip, <immed low> 4789 // ldr ip, [pc/pp, <constant pool offset>] | movw ip, <immed low>
4791 // | movt ip, <immed high> 4790 // | movt ip, <immed high>
4792 // blx ip 4791 // blx ip
4793 // ok-label 4792 // ok-label
4794 patcher.masm()->nop(); 4793 patcher.masm()->nop();
4795 break; 4794 break;
4796 } 4795 }
4797 4796
4798 // Replace the call address. 4797 // Replace the call address.
4799 Assembler::set_target_address_at(pc_immediate_load_address, unoptimized_code, 4798 Assembler::set_target_address_at(pc_immediate_load_address, unoptimized_code,
4800 replacement_code->entry()); 4799 replacement_code->entry());
4801 4800
4802 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( 4801 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch(
4803 unoptimized_code, pc_immediate_load_address, replacement_code); 4802 unoptimized_code, pc_immediate_load_address, replacement_code);
4804 } 4803 }
4805 4804
4806 4805
4807 BackEdgeTable::BackEdgeState BackEdgeTable::GetBackEdgeState( 4806 BackEdgeTable::BackEdgeState BackEdgeTable::GetBackEdgeState(
4808 Isolate* isolate, 4807 Isolate* isolate,
4809 Code* unoptimized_code, 4808 Code* unoptimized_code,
4810 Address pc) { 4809 Address pc) {
4811 static const int kInstrSize = Assembler::kInstrSize; 4810 ASSERT(Assembler::IsBlxIp(Memory::int32_at(pc - Assembler::kInstrSize)));
4812 ASSERT(Memory::int32_at(pc - kInstrSize) == kBlxIp);
4813 4811
4814 Address pc_immediate_load_address = GetInterruptImmediateLoadAddress(pc); 4812 Address pc_immediate_load_address = GetInterruptImmediateLoadAddress(pc);
4815 Address branch_address = pc_immediate_load_address - kInstrSize; 4813 Address branch_address = pc_immediate_load_address - Assembler::kInstrSize;
4816 Address interrupt_address = Assembler::target_address_at( 4814 Address interrupt_address = Assembler::target_address_at(
4817 pc_immediate_load_address, unoptimized_code); 4815 pc_immediate_load_address, unoptimized_code);
4818 4816
4819 if (Assembler::IsBranch(Assembler::instr_at(branch_address))) { 4817 if (Assembler::IsBranch(Assembler::instr_at(branch_address))) {
4820 ASSERT(interrupt_address == 4818 ASSERT(interrupt_address ==
4821 isolate->builtins()->InterruptCheck()->entry()); 4819 isolate->builtins()->InterruptCheck()->entry());
4822 return INTERRUPT; 4820 return INTERRUPT;
4823 } 4821 }
4824 4822
4825 ASSERT(Assembler::IsNop(Assembler::instr_at(branch_address))); 4823 ASSERT(Assembler::IsNop(Assembler::instr_at(branch_address)));
4826 4824
4827 if (interrupt_address == 4825 if (interrupt_address ==
4828 isolate->builtins()->OnStackReplacement()->entry()) { 4826 isolate->builtins()->OnStackReplacement()->entry()) {
4829 return ON_STACK_REPLACEMENT; 4827 return ON_STACK_REPLACEMENT;
4830 } 4828 }
4831 4829
4832 ASSERT(interrupt_address == 4830 ASSERT(interrupt_address ==
4833 isolate->builtins()->OsrAfterStackCheck()->entry()); 4831 isolate->builtins()->OsrAfterStackCheck()->entry());
4834 return OSR_AFTER_STACK_CHECK; 4832 return OSR_AFTER_STACK_CHECK;
4835 } 4833 }
4836 4834
4837 4835
4838 } } // namespace v8::internal 4836 } } // namespace v8::internal
4839 4837
4840 #endif // V8_TARGET_ARCH_ARM 4838 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/constants-arm.h ('k') | src/arm/macro-assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698