blob: 1cd9361e9a28a461e4122f852d8191ff353a8f66 [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001
Andrei Popescu31002712010-02-23 13:46:05 +00002// Copyright (c) 1994-2006 Sun Microsystems Inc.
3// All Rights Reserved.
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions are
7// met:
8//
9// - Redistributions of source code must retain the above copyright notice,
10// this list of conditions and the following disclaimer.
11//
12// - Redistribution in binary form must reproduce the above copyright
13// notice, this list of conditions and the following disclaimer in the
14// documentation and/or other materials provided with the distribution.
15//
16// - Neither the name of Sun Microsystems or the names of contributors may
17// be used to endorse or promote products derived from this software without
18// specific prior written permission.
19//
20// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32// The original source code covered by the above license above has been
33// modified significantly by Google Inc.
Ben Murdoch3ef787d2012-04-12 10:51:47 +010034// Copyright 2012 the V8 project authors. All rights reserved.
Andrei Popescu31002712010-02-23 13:46:05 +000035
36
37#ifndef V8_MIPS_ASSEMBLER_MIPS_INL_H_
38#define V8_MIPS_ASSEMBLER_MIPS_INL_H_
39
Ben Murdochb8a8cc12014-11-26 15:28:44 +000040#include "src/mips/assembler-mips.h"
Ben Murdoch3ef787d2012-04-12 10:51:47 +010041
Ben Murdochb8a8cc12014-11-26 15:28:44 +000042#include "src/assembler.h"
43#include "src/debug.h"
Andrei Popescu31002712010-02-23 13:46:05 +000044
45
46namespace v8 {
47namespace internal {
48
Ben Murdochb8a8cc12014-11-26 15:28:44 +000049
50bool CpuFeatures::SupportsCrankshaft() { return IsSupported(FPU); }
51
52
Andrei Popescu31002712010-02-23 13:46:05 +000053// -----------------------------------------------------------------------------
Ben Murdoch257744e2011-11-30 15:57:28 +000054// Operand and MemOperand.
Andrei Popescu31002712010-02-23 13:46:05 +000055
56Operand::Operand(int32_t immediate, RelocInfo::Mode rmode) {
57 rm_ = no_reg;
58 imm32_ = immediate;
59 rmode_ = rmode;
60}
61
Steve Block44f0eee2011-05-26 01:26:41 +010062
Andrei Popescu31002712010-02-23 13:46:05 +000063Operand::Operand(const ExternalReference& f) {
64 rm_ = no_reg;
65 imm32_ = reinterpret_cast<int32_t>(f.address());
66 rmode_ = RelocInfo::EXTERNAL_REFERENCE;
67}
68
Andrei Popescu31002712010-02-23 13:46:05 +000069
70Operand::Operand(Smi* value) {
71 rm_ = no_reg;
72 imm32_ = reinterpret_cast<intptr_t>(value);
Ben Murdochb8a8cc12014-11-26 15:28:44 +000073 rmode_ = RelocInfo::NONE32;
Andrei Popescu31002712010-02-23 13:46:05 +000074}
75
Steve Block44f0eee2011-05-26 01:26:41 +010076
Andrei Popescu31002712010-02-23 13:46:05 +000077Operand::Operand(Register rm) {
78 rm_ = rm;
79}
80
Steve Block44f0eee2011-05-26 01:26:41 +010081
Andrei Popescu31002712010-02-23 13:46:05 +000082bool Operand::is_reg() const {
83 return rm_.is_valid();
84}
85
86
Ben Murdochb8a8cc12014-11-26 15:28:44 +000087int Register::NumAllocatableRegisters() {
88 return kMaxNumAllocatableRegisters;
89}
90
91
92int DoubleRegister::NumRegisters() {
93 return FPURegister::kMaxNumRegisters;
94}
95
96
97int DoubleRegister::NumAllocatableRegisters() {
98 return FPURegister::kMaxNumAllocatableRegisters;
99}
100
101
Emily Bernierd0a1eb72015-03-24 16:35:39 -0400102int DoubleRegister::NumAllocatableAliasedRegisters() {
103 return NumAllocatableRegisters();
104}
105
106
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100107int FPURegister::ToAllocationIndex(FPURegister reg) {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000108 DCHECK(reg.code() % 2 == 0);
109 DCHECK(reg.code() / 2 < kMaxNumAllocatableRegisters);
110 DCHECK(reg.is_valid());
111 DCHECK(!reg.is(kDoubleRegZero));
112 DCHECK(!reg.is(kLithiumScratchDouble));
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100113 return (reg.code() / 2);
114}
115
Ben Murdochc7cc0282012-03-05 14:35:55 +0000116
Andrei Popescu31002712010-02-23 13:46:05 +0000117// -----------------------------------------------------------------------------
Ben Murdoch257744e2011-11-30 15:57:28 +0000118// RelocInfo.
Andrei Popescu31002712010-02-23 13:46:05 +0000119
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000120void RelocInfo::apply(intptr_t delta, ICacheFlushMode icache_flush_mode) {
Ben Murdoch589d6972011-11-30 16:04:58 +0000121 if (IsCodeTarget(rmode_)) {
122 uint32_t scope1 = (uint32_t) target_address() & ~kImm28Mask;
123 uint32_t scope2 = reinterpret_cast<uint32_t>(pc_) & ~kImm28Mask;
124
125 if (scope1 != scope2) {
126 Assembler::JumpLabelToJumpRegister(pc_);
127 }
128 }
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000129 if (IsInternalReference(rmode_)) {
130 // Absolute code pointer inside code object moves with the code object.
131 byte* p = reinterpret_cast<byte*>(pc_);
132 int count = Assembler::RelocateInternalReference(p, delta);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000133 CpuFeatures::FlushICache(p, count * sizeof(uint32_t));
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000134 }
Andrei Popescu31002712010-02-23 13:46:05 +0000135}
136
137
138Address RelocInfo::target_address() {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000139 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
140 return Assembler::target_address_at(pc_, host_);
Andrei Popescu31002712010-02-23 13:46:05 +0000141}
142
143
144Address RelocInfo::target_address_address() {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000145 DCHECK(IsCodeTarget(rmode_) ||
146 IsRuntimeEntry(rmode_) ||
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100147 rmode_ == EMBEDDED_OBJECT ||
148 rmode_ == EXTERNAL_REFERENCE);
149 // Read the address of the word containing the target_address in an
150 // instruction stream.
151 // The only architecture-independent user of this function is the serializer.
152 // The serializer uses it to find out how many raw bytes of instruction to
153 // output before the next target.
154 // For an instruction like LUI/ORI where the target bits are mixed into the
155 // instruction bits, the size of the target will be zero, indicating that the
156 // serializer should not step forward in memory after a target is resolved
157 // and written. In this case the target_address_address function should
158 // return the end of the instructions to be patched, allowing the
159 // deserializer to deserialize the instructions as raw bytes and put them in
160 // place, ready to be patched with the target. After jump optimization,
161 // that is the address of the instruction that follows J/JAL/JR/JALR
162 // instruction.
163 return reinterpret_cast<Address>(
164 pc_ + Assembler::kInstructionsFor32BitConstant * Assembler::kInstrSize);
Steve Block44f0eee2011-05-26 01:26:41 +0100165}
166
167
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000168Address RelocInfo::constant_pool_entry_address() {
169 UNREACHABLE();
170 return NULL;
171}
172
173
Steve Block44f0eee2011-05-26 01:26:41 +0100174int RelocInfo::target_address_size() {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100175 return Assembler::kSpecialTargetSize;
Andrei Popescu31002712010-02-23 13:46:05 +0000176}
177
178
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000179void RelocInfo::set_target_address(Address target,
180 WriteBarrierMode write_barrier_mode,
181 ICacheFlushMode icache_flush_mode) {
182 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
183 Assembler::set_target_address_at(pc_, host_, target, icache_flush_mode);
184 if (write_barrier_mode == UPDATE_WRITE_BARRIER &&
185 host() != NULL && IsCodeTarget(rmode_)) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100186 Object* target_code = Code::GetCodeFromTargetAddress(target);
187 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
188 host(), this, HeapObject::cast(target_code));
189 }
Andrei Popescu31002712010-02-23 13:46:05 +0000190}
191
192
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000193Address Assembler::target_address_from_return_address(Address pc) {
194 return pc - kCallTargetAddressOffset;
195}
196
197
198Address Assembler::break_address_from_return_address(Address pc) {
199 return pc - Assembler::kPatchDebugBreakSlotReturnOffset;
200}
201
202
Andrei Popescu31002712010-02-23 13:46:05 +0000203Object* RelocInfo::target_object() {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000204 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
205 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_));
Andrei Popescu31002712010-02-23 13:46:05 +0000206}
207
208
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100209Handle<Object> RelocInfo::target_object_handle(Assembler* origin) {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000210 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
Andrei Popescu31002712010-02-23 13:46:05 +0000211 return Handle<Object>(reinterpret_cast<Object**>(
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000212 Assembler::target_address_at(pc_, host_)));
Andrei Popescu31002712010-02-23 13:46:05 +0000213}
214
215
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000216void RelocInfo::set_target_object(Object* target,
217 WriteBarrierMode write_barrier_mode,
218 ICacheFlushMode icache_flush_mode) {
219 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
220 Assembler::set_target_address_at(pc_, host_,
221 reinterpret_cast<Address>(target),
222 icache_flush_mode);
223 if (write_barrier_mode == UPDATE_WRITE_BARRIER &&
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100224 host() != NULL &&
225 target->IsHeapObject()) {
226 host()->GetHeap()->incremental_marking()->RecordWrite(
227 host(), &Memory::Object_at(pc_), HeapObject::cast(target));
228 }
Andrei Popescu31002712010-02-23 13:46:05 +0000229}
230
231
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000232Address RelocInfo::target_reference() {
233 DCHECK(rmode_ == EXTERNAL_REFERENCE);
234 return Assembler::target_address_at(pc_, host_);
Steve Block44f0eee2011-05-26 01:26:41 +0100235}
236
237
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000238Address RelocInfo::target_runtime_entry(Assembler* origin) {
239 DCHECK(IsRuntimeEntry(rmode_));
240 return target_address();
241}
242
243
244void RelocInfo::set_target_runtime_entry(Address target,
245 WriteBarrierMode write_barrier_mode,
246 ICacheFlushMode icache_flush_mode) {
247 DCHECK(IsRuntimeEntry(rmode_));
248 if (target_address() != target)
249 set_target_address(target, write_barrier_mode, icache_flush_mode);
250}
251
252
253Handle<Cell> RelocInfo::target_cell_handle() {
254 DCHECK(rmode_ == RelocInfo::CELL);
Steve Block44f0eee2011-05-26 01:26:41 +0100255 Address address = Memory::Address_at(pc_);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000256 return Handle<Cell>(reinterpret_cast<Cell**>(address));
Steve Block44f0eee2011-05-26 01:26:41 +0100257}
258
259
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000260Cell* RelocInfo::target_cell() {
261 DCHECK(rmode_ == RelocInfo::CELL);
262 return Cell::FromValueAddress(Memory::Address_at(pc_));
Steve Block44f0eee2011-05-26 01:26:41 +0100263}
264
265
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000266void RelocInfo::set_target_cell(Cell* cell,
267 WriteBarrierMode write_barrier_mode,
268 ICacheFlushMode icache_flush_mode) {
269 DCHECK(rmode_ == RelocInfo::CELL);
270 Address address = cell->address() + Cell::kValueOffset;
Steve Block44f0eee2011-05-26 01:26:41 +0100271 Memory::Address_at(pc_) = address;
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000272 if (write_barrier_mode == UPDATE_WRITE_BARRIER && host() != NULL) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100273 // TODO(1550) We are passing NULL as a slot because cell can never be on
274 // evacuation candidate.
275 host()->GetHeap()->incremental_marking()->RecordWrite(
276 host(), NULL, cell);
277 }
Andrei Popescu31002712010-02-23 13:46:05 +0000278}
279
280
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000281static const int kNoCodeAgeSequenceLength = 7 * Assembler::kInstrSize;
282
283
284Handle<Object> RelocInfo::code_age_stub_handle(Assembler* origin) {
285 UNREACHABLE(); // This should never be reached on Arm.
286 return Handle<Object>();
287}
288
289
290Code* RelocInfo::code_age_stub() {
291 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
292 return Code::GetCodeFromTargetAddress(
293 Assembler::target_address_at(pc_ + Assembler::kInstrSize, host_));
294}
295
296
297void RelocInfo::set_code_age_stub(Code* stub,
298 ICacheFlushMode icache_flush_mode) {
299 DCHECK(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
300 Assembler::set_target_address_at(pc_ + Assembler::kInstrSize,
301 host_,
302 stub->instruction_start());
303}
304
305
Andrei Popescu31002712010-02-23 13:46:05 +0000306Address RelocInfo::call_address() {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000307 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
Steve Block44f0eee2011-05-26 01:26:41 +0100308 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
309 // The pc_ offset of 0 assumes mips patched return sequence per
310 // debug-mips.cc BreakLocationIterator::SetDebugBreakAtReturn(), or
311 // debug break slot per BreakLocationIterator::SetDebugBreakAtSlot().
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000312 return Assembler::target_address_at(pc_, host_);
Andrei Popescu31002712010-02-23 13:46:05 +0000313}
314
315
316void RelocInfo::set_call_address(Address target) {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000317 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
Steve Block44f0eee2011-05-26 01:26:41 +0100318 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
319 // The pc_ offset of 0 assumes mips patched return sequence per
320 // debug-mips.cc BreakLocationIterator::SetDebugBreakAtReturn(), or
321 // debug break slot per BreakLocationIterator::SetDebugBreakAtSlot().
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000322 Assembler::set_target_address_at(pc_, host_, target);
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100323 if (host() != NULL) {
324 Object* target_code = Code::GetCodeFromTargetAddress(target);
325 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
326 host(), this, HeapObject::cast(target_code));
327 }
Andrei Popescu31002712010-02-23 13:46:05 +0000328}
329
330
331Object* RelocInfo::call_object() {
332 return *call_object_address();
333}
334
335
336Object** RelocInfo::call_object_address() {
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000337 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
Steve Block44f0eee2011-05-26 01:26:41 +0100338 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
Andrei Popescu31002712010-02-23 13:46:05 +0000339 return reinterpret_cast<Object**>(pc_ + 2 * Assembler::kInstrSize);
340}
341
342
343void RelocInfo::set_call_object(Object* target) {
344 *call_object_address() = target;
345}
346
347
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000348void RelocInfo::WipeOut() {
349 DCHECK(IsEmbeddedObject(rmode_) ||
350 IsCodeTarget(rmode_) ||
351 IsRuntimeEntry(rmode_) ||
352 IsExternalReference(rmode_));
353 Assembler::set_target_address_at(pc_, host_, NULL);
354}
355
356
Andrei Popescu31002712010-02-23 13:46:05 +0000357bool RelocInfo::IsPatchedReturnSequence() {
Steve Block44f0eee2011-05-26 01:26:41 +0100358 Instr instr0 = Assembler::instr_at(pc_);
359 Instr instr1 = Assembler::instr_at(pc_ + 1 * Assembler::kInstrSize);
360 Instr instr2 = Assembler::instr_at(pc_ + 2 * Assembler::kInstrSize);
361 bool patched_return = ((instr0 & kOpcodeMask) == LUI &&
362 (instr1 & kOpcodeMask) == ORI &&
Ben Murdoch589d6972011-11-30 16:04:58 +0000363 ((instr2 & kOpcodeMask) == JAL ||
364 ((instr2 & kOpcodeMask) == SPECIAL &&
365 (instr2 & kFunctionFieldMask) == JALR)));
Steve Block44f0eee2011-05-26 01:26:41 +0100366 return patched_return;
367}
368
369
370bool RelocInfo::IsPatchedDebugBreakSlotSequence() {
371 Instr current_instr = Assembler::instr_at(pc_);
372 return !Assembler::IsNop(current_instr, Assembler::DEBUG_BREAK_NOP);
373}
374
375
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000376void RelocInfo::Visit(Isolate* isolate, ObjectVisitor* visitor) {
Steve Block44f0eee2011-05-26 01:26:41 +0100377 RelocInfo::Mode mode = rmode();
378 if (mode == RelocInfo::EMBEDDED_OBJECT) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100379 visitor->VisitEmbeddedPointer(this);
Steve Block44f0eee2011-05-26 01:26:41 +0100380 } else if (RelocInfo::IsCodeTarget(mode)) {
381 visitor->VisitCodeTarget(this);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000382 } else if (mode == RelocInfo::CELL) {
383 visitor->VisitCell(this);
Steve Block44f0eee2011-05-26 01:26:41 +0100384 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100385 visitor->VisitExternalReference(this);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000386 } else if (RelocInfo::IsCodeAgeSequence(mode)) {
387 visitor->VisitCodeAgeSequence(this);
Steve Block44f0eee2011-05-26 01:26:41 +0100388 } else if (((RelocInfo::IsJSReturn(mode) &&
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100389 IsPatchedReturnSequence()) ||
390 (RelocInfo::IsDebugBreakSlot(mode) &&
391 IsPatchedDebugBreakSlotSequence())) &&
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000392 isolate->debug()->has_break_points()) {
Steve Block44f0eee2011-05-26 01:26:41 +0100393 visitor->VisitDebugTarget(this);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000394 } else if (RelocInfo::IsRuntimeEntry(mode)) {
Steve Block44f0eee2011-05-26 01:26:41 +0100395 visitor->VisitRuntimeEntry(this);
396 }
397}
398
399
400template<typename StaticVisitor>
401void RelocInfo::Visit(Heap* heap) {
402 RelocInfo::Mode mode = rmode();
403 if (mode == RelocInfo::EMBEDDED_OBJECT) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100404 StaticVisitor::VisitEmbeddedPointer(heap, this);
Steve Block44f0eee2011-05-26 01:26:41 +0100405 } else if (RelocInfo::IsCodeTarget(mode)) {
Ben Murdoch257744e2011-11-30 15:57:28 +0000406 StaticVisitor::VisitCodeTarget(heap, this);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000407 } else if (mode == RelocInfo::CELL) {
408 StaticVisitor::VisitCell(heap, this);
Steve Block44f0eee2011-05-26 01:26:41 +0100409 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
Ben Murdoch3ef787d2012-04-12 10:51:47 +0100410 StaticVisitor::VisitExternalReference(this);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000411 } else if (RelocInfo::IsCodeAgeSequence(mode)) {
412 StaticVisitor::VisitCodeAgeSequence(heap, this);
Steve Block44f0eee2011-05-26 01:26:41 +0100413 } else if (heap->isolate()->debug()->has_break_points() &&
414 ((RelocInfo::IsJSReturn(mode) &&
415 IsPatchedReturnSequence()) ||
416 (RelocInfo::IsDebugBreakSlot(mode) &&
417 IsPatchedDebugBreakSlotSequence()))) {
Ben Murdoch257744e2011-11-30 15:57:28 +0000418 StaticVisitor::VisitDebugTarget(heap, this);
Ben Murdochb8a8cc12014-11-26 15:28:44 +0000419 } else if (RelocInfo::IsRuntimeEntry(mode)) {
Steve Block44f0eee2011-05-26 01:26:41 +0100420 StaticVisitor::VisitRuntimeEntry(this);
421 }
Andrei Popescu31002712010-02-23 13:46:05 +0000422}
423
424
425// -----------------------------------------------------------------------------
Ben Murdoch257744e2011-11-30 15:57:28 +0000426// Assembler.
Andrei Popescu31002712010-02-23 13:46:05 +0000427
428
429void Assembler::CheckBuffer() {
430 if (buffer_space() <= kGap) {
431 GrowBuffer();
432 }
433}
434
435
Steve Block44f0eee2011-05-26 01:26:41 +0100436void Assembler::CheckTrampolinePoolQuick() {
437 if (pc_offset() >= next_buffer_check_) {
438 CheckTrampolinePool();
439 }
440}
441
442
Andrei Popescu31002712010-02-23 13:46:05 +0000443void Assembler::emit(Instr x) {
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000444 if (!is_buffer_growth_blocked()) {
445 CheckBuffer();
446 }
Andrei Popescu31002712010-02-23 13:46:05 +0000447 *reinterpret_cast<Instr*>(pc_) = x;
448 pc_ += kInstrSize;
Steve Block44f0eee2011-05-26 01:26:41 +0100449 CheckTrampolinePoolQuick();
Andrei Popescu31002712010-02-23 13:46:05 +0000450}
451
452
453} } // namespace v8::internal
454
455#endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_