37 #ifndef V8_ARM_ASSEMBLER_ARM_INL_H_
38 #define V8_ARM_ASSEMBLER_ARM_INL_H_
57 void RelocInfo::apply(intptr_t delta) {
58 if (RelocInfo::IsInternalReference(rmode_)) {
68 Address RelocInfo::target_address() {
74 Address RelocInfo::target_address_address() {
76 || rmode_ == EMBEDDED_OBJECT
77 || rmode_ == EXTERNAL_REFERENCE);
78 return reinterpret_cast<Address>(Assembler::target_pointer_address_at(pc_));
82 int RelocInfo::target_address_size() {
90 reinterpret_cast<intptr_t>(target) & ~3));
93 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
99 Object* RelocInfo::target_object() {
100 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
101 return reinterpret_cast<Object*
>(Assembler::target_pointer_at(pc_));
105 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) {
106 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
107 return Handle<Object>(
reinterpret_cast<Object**
>(
108 Assembler::target_pointer_at(pc_)));
112 Object** RelocInfo::target_object_address() {
115 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
116 reconstructed_obj_ptr_ =
117 reinterpret_cast<Object*
>(Assembler::target_pointer_at(pc_));
118 return &reconstructed_obj_ptr_;
123 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
124 Assembler::set_target_pointer_at(pc_, reinterpret_cast<Address>(target));
127 target->IsHeapObject()) {
128 host()->GetHeap()->incremental_marking()->RecordWrite(
134 Address* RelocInfo::target_reference_address() {
135 ASSERT(rmode_ == EXTERNAL_REFERENCE);
137 return &reconstructed_adr_ptr_;
141 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() {
142 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL);
144 return Handle<JSGlobalPropertyCell>(
145 reinterpret_cast<JSGlobalPropertyCell**
>(address));
149 JSGlobalPropertyCell* RelocInfo::target_cell() {
150 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL);
155 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell,
157 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL);
163 host()->GetHeap()->incremental_marking()->RecordWrite(
169 Address RelocInfo::call_address() {
172 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
173 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
178 void RelocInfo::set_call_address(
Address target) {
179 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
180 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
182 if (host() !=
NULL) {
184 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
190 Object* RelocInfo::call_object() {
191 return *call_object_address();
195 void RelocInfo::set_call_object(
Object* target) {
196 *call_object_address() = target;
200 Object** RelocInfo::call_object_address() {
201 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
202 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
207 bool RelocInfo::IsPatchedReturnSequence() {
226 bool RelocInfo::IsPatchedDebugBreakSlotSequence() {
232 void RelocInfo::Visit(ObjectVisitor* visitor) {
233 RelocInfo::Mode mode = rmode();
234 if (mode == RelocInfo::EMBEDDED_OBJECT) {
235 visitor->VisitEmbeddedPointer(
this);
236 }
else if (RelocInfo::IsCodeTarget(mode)) {
237 visitor->VisitCodeTarget(
this);
238 }
else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) {
239 visitor->VisitGlobalPropertyCell(
this);
240 }
else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
241 visitor->VisitExternalReference(
this);
242 #ifdef ENABLE_DEBUGGER_SUPPORT
244 }
else if (((RelocInfo::IsJSReturn(mode) &&
245 IsPatchedReturnSequence()) ||
246 (RelocInfo::IsDebugBreakSlot(mode) &&
247 IsPatchedDebugBreakSlotSequence())) &&
248 Isolate::Current()->debug()->has_break_points()) {
249 visitor->VisitDebugTarget(
this);
252 visitor->VisitRuntimeEntry(
this);
257 template<
typename StaticVisitor>
258 void RelocInfo::Visit(Heap* heap) {
259 RelocInfo::Mode mode = rmode();
260 if (mode == RelocInfo::EMBEDDED_OBJECT) {
261 StaticVisitor::VisitEmbeddedPointer(heap,
this);
262 }
else if (RelocInfo::IsCodeTarget(mode)) {
263 StaticVisitor::VisitCodeTarget(heap,
this);
264 }
else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) {
265 StaticVisitor::VisitGlobalPropertyCell(heap,
this);
266 }
else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
267 StaticVisitor::VisitExternalReference(
this);
268 #ifdef ENABLE_DEBUGGER_SUPPORT
269 }
else if (heap->isolate()->debug()->has_break_points() &&
270 ((RelocInfo::IsJSReturn(mode) &&
271 IsPatchedReturnSequence()) ||
272 (RelocInfo::IsDebugBreakSlot(mode) &&
273 IsPatchedDebugBreakSlotSequence()))) {
274 StaticVisitor::VisitDebugTarget(heap,
this);
277 StaticVisitor::VisitRuntimeEntry(
this);
282 Operand::Operand(
int32_t immediate, RelocInfo::Mode rmode) {
289 Operand::Operand(
const ExternalReference& f) {
291 imm32_ =
reinterpret_cast<int32_t>(f.address());
292 rmode_ = RelocInfo::EXTERNAL_REFERENCE;
296 Operand::Operand(Smi* value) {
298 imm32_ =
reinterpret_cast<intptr_t
>(value);
303 Operand::Operand(Register rm) {
311 bool Operand::is_reg()
const {
312 return rm_.is_valid() &&
319 void Assembler::CheckBuffer() {
329 void Assembler::emit(
Instr x) {
331 *
reinterpret_cast<Instr*
>(pc_) = x;
341 static const int32_t kBxInstMask = 0x0ffffff0;
342 static const int32_t kBxInstPattern = 0x012fff10;
343 if ((instr & kBxInstMask) == kBxInstPattern) {
358 int offset = instr & 0xfff;
359 if ((instr & (1 << 23)) == 0) offset = -offset;
362 return target_pc + offset + 8;
371 return reinterpret_cast<Address>(
372 (next_instr->ImmedMovwMovtValue() << 16) |
373 instr->ImmedMovwMovtValue());
438 static Instr EncodeMovwImmediate(uint32_t immediate) {
439 ASSERT(immediate < 0x10000);
440 return ((immediate & 0xf000) << 4) | (immediate & 0xfff);
444 void Assembler::set_target_pointer_at(
Address pc,
Address target) {
447 uint32_t* instr_ptr =
reinterpret_cast<uint32_t*
>(
pc);
448 uint32_t immediate =
reinterpret_cast<uint32_t
>(target);
449 uint32_t intermediate = instr_ptr[0];
450 intermediate &= ~EncodeMovwImmediate(0xFFFF);
451 intermediate |= EncodeMovwImmediate(immediate & 0xFFFF);
452 instr_ptr[0] = intermediate;
453 intermediate = instr_ptr[1];
454 intermediate &= ~EncodeMovwImmediate(0xFFFF);
455 intermediate |= EncodeMovwImmediate(immediate >> 16);
456 instr_ptr[1] = intermediate;
476 return reinterpret_cast<Address>(
477 reinterpret_cast<intptr_t
>(target_pointer_at(pc)) & ~3);
482 set_target_pointer_at(pc, reinterpret_cast<Address>(
483 reinterpret_cast<intptr_t>(target) & ~3));
489 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_
static Object *& Object_at(Address addr)
const Instr kLdrPCPattern
static void deserialization_set_special_target_at(Address constant_pool_entry, Address target)
static bool IsMovW(Instr instr)
static HeapObject * cast(Object *obj)
#define ASSERT(condition)
static Instruction * At(byte *pc)
#define kScratchDoubleReg
static Address & Address_at(Address addr)
static void set_target_address_at(Address pc, Address target)
static int32_t & int32_at(Address addr)
static void set_external_target_at(Address constant_pool_entry, Address target)
static bool IsMovT(Instr instr)
static Code * GetCodeFromTargetAddress(Address address)
void CheckConstPool(bool force_emit, bool require_jump)
static bool IsNop(Instr instr, int type=NON_MARKING_NOP)
static Address target_address_at(Address pc)
static JSGlobalPropertyCell * FromValueAddress(Address value)
static int ToAllocationIndex(DwVfpRegister reg)
const Instr kBlxRegPattern
static Address target_address_from_return_address(Address pc)
bool is(DwVfpRegister reg) const
static const int kInstrSize
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of MIPS FPU instructions if NULL
#define RUNTIME_ENTRY(name, nargs, ressize)
static void FlushICache(void *start, size_t size)
static const int kValueOffset
static bool IsLdrPcImmediateOffset(Instr instr)