OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 // The original source code covered by the above license above has been modified | 33 // The original source code covered by the above license above has been modified |
34 // significantly by Google Inc. | 34 // significantly by Google Inc. |
35 // Copyright 2012 the V8 project authors. All rights reserved. | 35 // Copyright 2012 the V8 project authors. All rights reserved. |
36 | 36 |
37 #ifndef V8_ARM_ASSEMBLER_ARM_INL_H_ | 37 #ifndef V8_ARM_ASSEMBLER_ARM_INL_H_ |
38 #define V8_ARM_ASSEMBLER_ARM_INL_H_ | 38 #define V8_ARM_ASSEMBLER_ARM_INL_H_ |
39 | 39 |
40 #include "src/arm/assembler-arm.h" | 40 #include "src/arm/assembler-arm.h" |
41 | 41 |
42 #include "src/cpu.h" | 42 #include "src/assembler.h" |
43 #include "src/debug.h" | 43 #include "src/debug.h" |
44 | 44 |
45 | 45 |
46 namespace v8 { | 46 namespace v8 { |
47 namespace internal { | 47 namespace internal { |
48 | 48 |
49 | 49 |
50 bool CpuFeatures::SupportsCrankshaft() { return IsSupported(VFP3); } | 50 bool CpuFeatures::SupportsCrankshaft() { return IsSupported(VFP3); } |
51 | 51 |
52 | 52 |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 | 520 |
521 void Assembler::set_target_address_at(Address pc, | 521 void Assembler::set_target_address_at(Address pc, |
522 ConstantPoolArray* constant_pool, | 522 ConstantPoolArray* constant_pool, |
523 Address target, | 523 Address target, |
524 ICacheFlushMode icache_flush_mode) { | 524 ICacheFlushMode icache_flush_mode) { |
525 if (IsConstantPoolLoad(pc)) { | 525 if (IsConstantPoolLoad(pc)) { |
526 // This is a constant pool lookup. Update the entry in the constant pool. | 526 // This is a constant pool lookup. Update the entry in the constant pool. |
527 Memory::Address_at(constant_pool_entry_address(pc, constant_pool)) = target; | 527 Memory::Address_at(constant_pool_entry_address(pc, constant_pool)) = target; |
528 // Intuitively, we would think it is necessary to always flush the | 528 // Intuitively, we would think it is necessary to always flush the |
529 // instruction cache after patching a target address in the code as follows: | 529 // instruction cache after patching a target address in the code as follows: |
530 // CPU::FlushICache(pc, sizeof(target)); | 530 // CpuFeatures::FlushICache(pc, sizeof(target)); |
531 // However, on ARM, no instruction is actually patched in the case | 531 // However, on ARM, no instruction is actually patched in the case |
532 // of embedded constants of the form: | 532 // of embedded constants of the form: |
533 // ldr ip, [pp, #...] | 533 // ldr ip, [pp, #...] |
534 // since the instruction accessing this address in the constant pool remains | 534 // since the instruction accessing this address in the constant pool remains |
535 // unchanged. | 535 // unchanged. |
536 } else { | 536 } else { |
537 // This is an movw_movt immediate load. Patch the immediate embedded in the | 537 // This is an movw_movt immediate load. Patch the immediate embedded in the |
538 // instructions. | 538 // instructions. |
539 ASSERT(IsMovW(Memory::int32_at(pc))); | 539 ASSERT(IsMovW(Memory::int32_at(pc))); |
540 ASSERT(IsMovT(Memory::int32_at(pc + kInstrSize))); | 540 ASSERT(IsMovT(Memory::int32_at(pc + kInstrSize))); |
541 uint32_t* instr_ptr = reinterpret_cast<uint32_t*>(pc); | 541 uint32_t* instr_ptr = reinterpret_cast<uint32_t*>(pc); |
542 uint32_t immediate = reinterpret_cast<uint32_t>(target); | 542 uint32_t immediate = reinterpret_cast<uint32_t>(target); |
543 instr_ptr[0] = PatchMovwImmediate(instr_ptr[0], immediate & 0xFFFF); | 543 instr_ptr[0] = PatchMovwImmediate(instr_ptr[0], immediate & 0xFFFF); |
544 instr_ptr[1] = PatchMovwImmediate(instr_ptr[1], immediate >> 16); | 544 instr_ptr[1] = PatchMovwImmediate(instr_ptr[1], immediate >> 16); |
545 ASSERT(IsMovW(Memory::int32_at(pc))); | 545 ASSERT(IsMovW(Memory::int32_at(pc))); |
546 ASSERT(IsMovT(Memory::int32_at(pc + kInstrSize))); | 546 ASSERT(IsMovT(Memory::int32_at(pc + kInstrSize))); |
547 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 547 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
548 CPU::FlushICache(pc, 2 * kInstrSize); | 548 CpuFeatures::FlushICache(pc, 2 * kInstrSize); |
549 } | 549 } |
550 } | 550 } |
551 } | 551 } |
552 | 552 |
553 | 553 |
554 } } // namespace v8::internal | 554 } } // namespace v8::internal |
555 | 555 |
556 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_ | 556 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_ |
OLD | NEW |