1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #ifndef V8_ARM_MACRO_ASSEMBLER_ARM_H_
29 #define V8_ARM_MACRO_ASSEMBLER_ARM_H_
31 #include "assembler.h"
33 #include "v8globals.h"
38 // ----------------------------------------------------------------------------
39 // Static helper functions
41 // Generate a MemOperand for loading a field from an object.
42 inline MemOperand FieldMemOperand(Register object, int offset) {
43 return MemOperand(object, offset - kHeapObjectTag);
47 // Give alias names to registers
48 const Register cp = { kRegister_r7_Code }; // JavaScript context pointer.
49 const Register pp = { kRegister_r8_Code }; // Constant pool pointer.
50 const Register kRootRegister = { kRegister_r10_Code }; // Roots array pointer.
52 // Flags used for AllocateHeapNumber
61 enum RememberedSetAction { EMIT_REMEMBERED_SET, OMIT_REMEMBERED_SET };
62 enum SmiCheck { INLINE_SMI_CHECK, OMIT_SMI_CHECK };
63 enum LinkRegisterStatus { kLRHasNotBeenSaved, kLRHasBeenSaved };
66 Register GetRegisterThatIsNotOneOf(Register reg1,
67 Register reg2 = no_reg,
68 Register reg3 = no_reg,
69 Register reg4 = no_reg,
70 Register reg5 = no_reg,
71 Register reg6 = no_reg);
75 bool AreAliased(Register reg1,
77 Register reg3 = no_reg,
78 Register reg4 = no_reg,
79 Register reg5 = no_reg,
80 Register reg6 = no_reg);
84 enum TargetAddressStorageMode {
85 CAN_INLINE_TARGET_ADDRESS,
86 NEVER_INLINE_TARGET_ADDRESS
89 // MacroAssembler implements a collection of frequently used macros.
90 class MacroAssembler: public Assembler {
92 // The isolate parameter can be NULL if the macro assembler should
93 // not use isolate-dependent functionality. In this case, it's the
94 // responsibility of the caller to never invoke such function on the
96 MacroAssembler(Isolate* isolate, void* buffer, int size);
98 // Jump, Call, and Ret pseudo instructions implementing inter-working.
99 void Jump(Register target, Condition cond = al);
100 void Jump(Address target, RelocInfo::Mode rmode, Condition cond = al);
101 void Jump(Handle<Code> code, RelocInfo::Mode rmode, Condition cond = al);
102 static int CallSize(Register target, Condition cond = al);
103 void Call(Register target, Condition cond = al);
104 int CallSize(Address target, RelocInfo::Mode rmode, Condition cond = al);
105 static int CallSizeNotPredictableCodeSize(Address target,
106 RelocInfo::Mode rmode,
107 Condition cond = al);
108 void Call(Address target, RelocInfo::Mode rmode,
110 TargetAddressStorageMode mode = CAN_INLINE_TARGET_ADDRESS);
111 int CallSize(Handle<Code> code,
112 RelocInfo::Mode rmode = RelocInfo::CODE_TARGET,
113 TypeFeedbackId ast_id = TypeFeedbackId::None(),
114 Condition cond = al);
115 void Call(Handle<Code> code,
116 RelocInfo::Mode rmode = RelocInfo::CODE_TARGET,
117 TypeFeedbackId ast_id = TypeFeedbackId::None(),
119 TargetAddressStorageMode mode = CAN_INLINE_TARGET_ADDRESS);
120 void Ret(Condition cond = al);
122 // Emit code to discard a non-negative number of pointer-sized elements
123 // from the stack, clobbering only the sp register.
124 void Drop(int count, Condition cond = al);
126 void Ret(int drop, Condition cond = al);
128 // Swap two registers. If the scratch register is omitted then a slightly
129 // less efficient form using xor instead of mov is emitted.
130 void Swap(Register reg1,
132 Register scratch = no_reg,
133 Condition cond = al);
136 void And(Register dst, Register src1, const Operand& src2,
137 Condition cond = al);
138 void Ubfx(Register dst, Register src, int lsb, int width,
139 Condition cond = al);
140 void Sbfx(Register dst, Register src, int lsb, int width,
141 Condition cond = al);
142 // The scratch register is not used for ARMv7.
143 // scratch can be the same register as src (in which case it is trashed), but
144 // not the same as dst.
145 void Bfi(Register dst,
150 Condition cond = al);
151 void Bfc(Register dst, Register src, int lsb, int width, Condition cond = al);
152 void Usat(Register dst, int satpos, const Operand& src,
153 Condition cond = al);
155 void Call(Label* target);
156 void Push(Register src) { push(src); }
157 void Pop(Register dst) { pop(dst); }
159 // Register move. May do nothing if the registers are identical.
160 void Move(Register dst, Handle<Object> value);
161 void Move(Register dst, Register src, Condition cond = al);
162 void Move(DwVfpRegister dst, DwVfpRegister src);
164 void Load(Register dst, const MemOperand& src, Representation r);
165 void Store(Register src, const MemOperand& dst, Representation r);
167 // Load an object from the root table.
168 void LoadRoot(Register destination,
169 Heap::RootListIndex index,
170 Condition cond = al);
171 // Store an object to the root table.
172 void StoreRoot(Register source,
173 Heap::RootListIndex index,
174 Condition cond = al);
176 // ---------------------------------------------------------------------------
179 void IncrementalMarkingRecordWriteHelper(Register object,
183 enum RememberedSetFinalAction {
188 // Record in the remembered set the fact that we have a pointer to new space
189 // at the address pointed to by the addr register. Only works if addr is not
191 void RememberedSetHelper(Register object, // Used for debug code.
194 SaveFPRegsMode save_fp,
195 RememberedSetFinalAction and_then);
197 void CheckPageFlag(Register object,
201 Label* condition_met);
203 void CheckMapDeprecated(Handle<Map> map,
205 Label* if_deprecated);
207 // Check if object is in new space. Jumps if the object is not in new space.
208 // The register scratch can be object itself, but scratch will be clobbered.
209 void JumpIfNotInNewSpace(Register object,
212 InNewSpace(object, scratch, ne, branch);
215 // Check if object is in new space. Jumps if the object is in new space.
216 // The register scratch can be object itself, but it will be clobbered.
217 void JumpIfInNewSpace(Register object,
220 InNewSpace(object, scratch, eq, branch);
223 // Check if an object has a given incremental marking color.
224 void HasColor(Register object,
231 void JumpIfBlack(Register object,
236 // Checks the color of an object. If the object is already grey or black
237 // then we just fall through, since it is already live. If it is white and
238 // we can determine that it doesn't need to be scanned, then we just mark it
239 // black and fall through. For the rest we jump to the label so the
240 // incremental marker can fix its assumptions.
241 void EnsureNotWhite(Register object,
245 Label* object_is_white_and_not_data);
247 // Detects conservatively whether an object is data-only, i.e. it does need to
248 // be scanned by the garbage collector.
249 void JumpIfDataObject(Register value,
251 Label* not_data_object);
253 // Notify the garbage collector that we wrote a pointer into an object.
254 // |object| is the object being stored into, |value| is the object being
255 // stored. value and scratch registers are clobbered by the operation.
256 // The offset is the offset from the start of the object, not the offset from
257 // the tagged HeapObject pointer. For use with FieldOperand(reg, off).
258 void RecordWriteField(
263 LinkRegisterStatus lr_status,
264 SaveFPRegsMode save_fp,
265 RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET,
266 SmiCheck smi_check = INLINE_SMI_CHECK);
268 // As above, but the offset has the tag presubtracted. For use with
269 // MemOperand(reg, off).
270 inline void RecordWriteContextSlot(
275 LinkRegisterStatus lr_status,
276 SaveFPRegsMode save_fp,
277 RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET,
278 SmiCheck smi_check = INLINE_SMI_CHECK) {
279 RecordWriteField(context,
280 offset + kHeapObjectTag,
285 remembered_set_action,
289 // For a given |object| notify the garbage collector that the slot |address|
290 // has been written. |value| is the object being stored. The value and
291 // address registers are clobbered by the operation.
296 LinkRegisterStatus lr_status,
297 SaveFPRegsMode save_fp,
298 RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET,
299 SmiCheck smi_check = INLINE_SMI_CHECK);
302 void Push(Handle<Object> handle);
303 void Push(Smi* smi) { Push(Handle<Smi>(smi, isolate())); }
305 // Push two registers. Pushes leftmost register first (to highest address).
306 void Push(Register src1, Register src2, Condition cond = al) {
307 ASSERT(!src1.is(src2));
308 if (src1.code() > src2.code()) {
309 stm(db_w, sp, src1.bit() | src2.bit(), cond);
311 str(src1, MemOperand(sp, 4, NegPreIndex), cond);
312 str(src2, MemOperand(sp, 4, NegPreIndex), cond);
316 // Push three registers. Pushes leftmost register first (to highest address).
317 void Push(Register src1, Register src2, Register src3, Condition cond = al) {
318 ASSERT(!src1.is(src2));
319 ASSERT(!src2.is(src3));
320 ASSERT(!src1.is(src3));
321 if (src1.code() > src2.code()) {
322 if (src2.code() > src3.code()) {
323 stm(db_w, sp, src1.bit() | src2.bit() | src3.bit(), cond);
325 stm(db_w, sp, src1.bit() | src2.bit(), cond);
326 str(src3, MemOperand(sp, 4, NegPreIndex), cond);
329 str(src1, MemOperand(sp, 4, NegPreIndex), cond);
330 Push(src2, src3, cond);
334 // Push four registers. Pushes leftmost register first (to highest address).
335 void Push(Register src1,
339 Condition cond = al) {
340 ASSERT(!src1.is(src2));
341 ASSERT(!src2.is(src3));
342 ASSERT(!src1.is(src3));
343 ASSERT(!src1.is(src4));
344 ASSERT(!src2.is(src4));
345 ASSERT(!src3.is(src4));
346 if (src1.code() > src2.code()) {
347 if (src2.code() > src3.code()) {
348 if (src3.code() > src4.code()) {
351 src1.bit() | src2.bit() | src3.bit() | src4.bit(),
354 stm(db_w, sp, src1.bit() | src2.bit() | src3.bit(), cond);
355 str(src4, MemOperand(sp, 4, NegPreIndex), cond);
358 stm(db_w, sp, src1.bit() | src2.bit(), cond);
359 Push(src3, src4, cond);
362 str(src1, MemOperand(sp, 4, NegPreIndex), cond);
363 Push(src2, src3, src4, cond);
367 // Pop two registers. Pops rightmost register first (from lower address).
368 void Pop(Register src1, Register src2, Condition cond = al) {
369 ASSERT(!src1.is(src2));
370 if (src1.code() > src2.code()) {
371 ldm(ia_w, sp, src1.bit() | src2.bit(), cond);
373 ldr(src2, MemOperand(sp, 4, PostIndex), cond);
374 ldr(src1, MemOperand(sp, 4, PostIndex), cond);
378 // Pop three registers. Pops rightmost register first (from lower address).
379 void Pop(Register src1, Register src2, Register src3, Condition cond = al) {
380 ASSERT(!src1.is(src2));
381 ASSERT(!src2.is(src3));
382 ASSERT(!src1.is(src3));
383 if (src1.code() > src2.code()) {
384 if (src2.code() > src3.code()) {
385 ldm(ia_w, sp, src1.bit() | src2.bit() | src3.bit(), cond);
387 ldr(src3, MemOperand(sp, 4, PostIndex), cond);
388 ldm(ia_w, sp, src1.bit() | src2.bit(), cond);
391 Pop(src2, src3, cond);
392 ldr(src1, MemOperand(sp, 4, PostIndex), cond);
396 // Pop four registers. Pops rightmost register first (from lower address).
397 void Pop(Register src1,
401 Condition cond = al) {
402 ASSERT(!src1.is(src2));
403 ASSERT(!src2.is(src3));
404 ASSERT(!src1.is(src3));
405 ASSERT(!src1.is(src4));
406 ASSERT(!src2.is(src4));
407 ASSERT(!src3.is(src4));
408 if (src1.code() > src2.code()) {
409 if (src2.code() > src3.code()) {
410 if (src3.code() > src4.code()) {
413 src1.bit() | src2.bit() | src3.bit() | src4.bit(),
416 ldr(src4, MemOperand(sp, 4, PostIndex), cond);
417 ldm(ia_w, sp, src1.bit() | src2.bit() | src3.bit(), cond);
420 Pop(src3, src4, cond);
421 ldm(ia_w, sp, src1.bit() | src2.bit(), cond);
424 Pop(src2, src3, src4, cond);
425 ldr(src1, MemOperand(sp, 4, PostIndex), cond);
429 // Push a fixed frame, consisting of lr, fp, constant pool (if
430 // FLAG_enable_ool_constant_pool), context and JS function / marker id if
431 // marker_reg is a valid register.
432 void PushFixedFrame(Register marker_reg = no_reg);
433 void PopFixedFrame(Register marker_reg = no_reg);
435 // Push and pop the registers that can hold pointers, as defined by the
436 // RegList constant kSafepointSavedRegisters.
437 void PushSafepointRegisters();
438 void PopSafepointRegisters();
439 void PushSafepointRegistersAndDoubles();
440 void PopSafepointRegistersAndDoubles();
441 // Store value in register src in the safepoint stack slot for
443 void StoreToSafepointRegisterSlot(Register src, Register dst);
444 void StoreToSafepointRegistersAndDoublesSlot(Register src, Register dst);
445 // Load the value of the src register from its safepoint stack slot
446 // into register dst.
447 void LoadFromSafepointRegisterSlot(Register dst, Register src);
449 // Load two consecutive registers with two consecutive memory locations.
450 void Ldrd(Register dst1,
452 const MemOperand& src,
453 Condition cond = al);
455 // Store two consecutive registers to two consecutive memory locations.
456 void Strd(Register src1,
458 const MemOperand& dst,
459 Condition cond = al);
461 // Ensure that FPSCR contains values needed by JavaScript.
462 // We need the NaNModeControlBit to be sure that operations like
463 // vadd and vsub generate the Canonical NaN (if a NaN must be generated).
464 // In VFP3 it will be always the Canonical NaN.
465 // In VFP2 it will be either the Canonical NaN or the negative version
466 // of the Canonical NaN. It doesn't matter if we have two values. The aim
467 // is to be sure to never generate the hole NaN.
468 void VFPEnsureFPSCRState(Register scratch);
470 // If the value is a NaN, canonicalize the value else, do nothing.
471 void VFPCanonicalizeNaN(const DwVfpRegister dst,
472 const DwVfpRegister src,
473 const Condition cond = al);
474 void VFPCanonicalizeNaN(const DwVfpRegister value,
475 const Condition cond = al) {
476 VFPCanonicalizeNaN(value, value, cond);
479 // Compare double values and move the result to the normal condition flags.
480 void VFPCompareAndSetFlags(const DwVfpRegister src1,
481 const DwVfpRegister src2,
482 const Condition cond = al);
483 void VFPCompareAndSetFlags(const DwVfpRegister src1,
485 const Condition cond = al);
487 // Compare double values and then load the fpscr flags to a register.
488 void VFPCompareAndLoadFlags(const DwVfpRegister src1,
489 const DwVfpRegister src2,
490 const Register fpscr_flags,
491 const Condition cond = al);
492 void VFPCompareAndLoadFlags(const DwVfpRegister src1,
494 const Register fpscr_flags,
495 const Condition cond = al);
497 void Vmov(const DwVfpRegister dst,
499 const Register scratch = no_reg);
501 void VmovHigh(Register dst, DwVfpRegister src);
502 void VmovHigh(DwVfpRegister dst, Register src);
503 void VmovLow(Register dst, DwVfpRegister src);
504 void VmovLow(DwVfpRegister dst, Register src);
506 // Loads the number from object into dst register.
507 // If |object| is neither smi nor heap number, |not_number| is jumped to
508 // with |object| still intact.
509 void LoadNumber(Register object,
510 LowDwVfpRegister dst,
511 Register heap_number_map,
515 // Loads the number from object into double_dst in the double format.
516 // Control will jump to not_int32 if the value cannot be exactly represented
517 // by a 32-bit integer.
518 // Floating point value in the 32-bit integer range that are not exact integer
520 void LoadNumberAsInt32Double(Register object,
521 DwVfpRegister double_dst,
522 Register heap_number_map,
524 LowDwVfpRegister double_scratch,
527 // Loads the number from object into dst as a 32-bit integer.
528 // Control will jump to not_int32 if the object cannot be exactly represented
529 // by a 32-bit integer.
530 // Floating point value in the 32-bit integer range that are not exact integer
531 // won't be converted.
532 void LoadNumberAsInt32(Register object,
534 Register heap_number_map,
536 DwVfpRegister double_scratch0,
537 LowDwVfpRegister double_scratch1,
540 // Generates function and stub prologue code.
541 void Prologue(PrologueFrameMode frame_mode);
543 // Loads the constant pool pointer (pp) register.
544 void LoadConstantPoolPointerRegister();
547 // stack_space - extra stack space, used for alignment before call to C.
548 void EnterExitFrame(bool save_doubles, int stack_space = 0);
550 // Leave the current exit frame. Expects the return value in r0.
551 // Expect the number of values, pushed prior to the exit frame, to
552 // remove in a register (or no_reg, if there is nothing to remove).
553 void LeaveExitFrame(bool save_doubles,
554 Register argument_count,
555 bool restore_context);
557 // Get the actual activation frame alignment for target environment.
558 static int ActivationFrameAlignment();
560 void LoadContext(Register dst, int context_chain_length);
562 // Conditionally load the cached Array transitioned map of type
563 // transitioned_kind from the native context if the map in register
564 // map_in_out is the cached Array map in the native context of
566 void LoadTransitionedArrayMapConditional(
567 ElementsKind expected_kind,
568 ElementsKind transitioned_kind,
571 Label* no_map_match);
573 // Load the initial map for new Arrays from a JSFunction.
574 void LoadInitialArrayMap(Register function_in,
577 bool can_have_holes);
579 void LoadGlobalFunction(int index, Register function);
580 void LoadArrayFunction(Register function);
582 // Load the initial map from the global function. The registers
583 // function and map can be the same, function is then overwritten.
584 void LoadGlobalFunctionInitialMap(Register function,
588 void InitializeRootRegister() {
589 ExternalReference roots_array_start =
590 ExternalReference::roots_array_start(isolate());
591 mov(kRootRegister, Operand(roots_array_start));
594 // ---------------------------------------------------------------------------
595 // JavaScript invokes
597 // Invoke the JavaScript function code by either calling or jumping.
598 void InvokeCode(Register code,
599 const ParameterCount& expected,
600 const ParameterCount& actual,
602 const CallWrapper& call_wrapper);
604 // Invoke the JavaScript function in the given register. Changes the
605 // current context to the context in the function before invoking.
606 void InvokeFunction(Register function,
607 const ParameterCount& actual,
609 const CallWrapper& call_wrapper);
611 void InvokeFunction(Register function,
612 const ParameterCount& expected,
613 const ParameterCount& actual,
615 const CallWrapper& call_wrapper);
617 void InvokeFunction(Handle<JSFunction> function,
618 const ParameterCount& expected,
619 const ParameterCount& actual,
621 const CallWrapper& call_wrapper);
623 void IsObjectJSObjectType(Register heap_object,
628 void IsInstanceJSObjectType(Register map,
632 void IsObjectJSStringType(Register object,
636 void IsObjectNameType(Register object,
640 #ifdef ENABLE_DEBUGGER_SUPPORT
641 // ---------------------------------------------------------------------------
647 // ---------------------------------------------------------------------------
648 // Exception handling
650 // Push a new try handler and link into try handler chain.
651 void PushTryHandler(StackHandler::Kind kind, int handler_index);
653 // Unlink the stack handler on top of the stack from the try handler chain.
654 // Must preserve the result register.
655 void PopTryHandler();
657 // Passes thrown value to the handler of top of the try handler chain.
658 void Throw(Register value);
660 // Propagates an uncatchable exception to the top of the current JS stack's
662 void ThrowUncatchable(Register value);
664 // Throw a message string as an exception.
665 void Throw(BailoutReason reason);
667 // Throw a message string as an exception if a condition is not true.
668 void ThrowIf(Condition cc, BailoutReason reason);
670 // ---------------------------------------------------------------------------
671 // Inline caching support
673 // Generate code for checking access rights - used for security checks
674 // on access to global objects across environments. The holder register
675 // is left untouched, whereas both scratch registers are clobbered.
676 void CheckAccessGlobalProxy(Register holder_reg,
680 void GetNumberHash(Register t0, Register scratch);
682 void LoadFromNumberDictionary(Label* miss,
691 inline void MarkCode(NopMarkerTypes type) {
695 // Check if the given instruction is a 'type' marker.
696 // i.e. check if is is a mov r<type>, r<type> (referenced as nop(type))
697 // These instructions are generated to mark special location in the code,
698 // like some special IC code.
699 static inline bool IsMarkedCode(Instr instr, int type) {
700 ASSERT((FIRST_IC_MARKER <= type) && (type < LAST_CODE_MARKER));
701 return IsNop(instr, type);
705 static inline int GetCodeMarker(Instr instr) {
706 int dst_reg_offset = 12;
707 int dst_mask = 0xf << dst_reg_offset;
709 int dst_reg = (instr & dst_mask) >> dst_reg_offset;
710 int src_reg = instr & src_mask;
711 uint32_t non_register_mask = ~(dst_mask | src_mask);
712 uint32_t mov_mask = al | 13 << 21;
714 // Return <n> if we have a mov rn rn, else return -1.
715 int type = ((instr & non_register_mask) == mov_mask) &&
716 (dst_reg == src_reg) &&
717 (FIRST_IC_MARKER <= dst_reg) && (dst_reg < LAST_CODE_MARKER)
720 ASSERT((type == -1) ||
721 ((FIRST_IC_MARKER <= type) && (type < LAST_CODE_MARKER)));
726 // ---------------------------------------------------------------------------
727 // Allocation support
729 // Allocate an object in new space or old pointer space. The object_size is
730 // specified either in bytes or in words if the allocation flag SIZE_IN_WORDS
731 // is passed. If the space is exhausted control continues at the gc_required
732 // label. The allocated object is returned in result. If the flag
733 // tag_allocated_object is true the result is tagged as as a heap object.
734 // All registers are clobbered also when control continues at the gc_required
736 void Allocate(int object_size,
741 AllocationFlags flags);
743 void Allocate(Register object_size,
748 AllocationFlags flags);
750 // Undo allocation in new space. The object passed and objects allocated after
751 // it will no longer be allocated. The caller must make sure that no pointers
752 // are left to the object(s) no longer allocated as they would be invalid when
753 // allocation is undone.
754 void UndoAllocationInNewSpace(Register object, Register scratch);
757 void AllocateTwoByteString(Register result,
763 void AllocateAsciiString(Register result,
769 void AllocateTwoByteConsString(Register result,
774 void AllocateAsciiConsString(Register result,
779 void AllocateTwoByteSlicedString(Register result,
784 void AllocateAsciiSlicedString(Register result,
790 // Allocates a heap number or jumps to the gc_required label if the young
791 // space is full and a scavenge is needed. All registers are clobbered also
792 // when control continues at the gc_required label.
793 void AllocateHeapNumber(Register result,
796 Register heap_number_map,
798 TaggingMode tagging_mode = TAG_RESULT);
799 void AllocateHeapNumberWithValue(Register result,
803 Register heap_number_map,
805 void AllocateSIMDHeapObject(int size,
811 TaggingMode tagging_mode = TAG_RESULT);
813 // Copies a fixed number of fields of heap objects from src to dst.
814 void CopyFields(Register dst,
816 LowDwVfpRegister double_scratch,
819 // Copies a number of bytes from src to dst. All registers are clobbered. On
820 // exit src and dst will point to the place just after where the last byte was
821 // read or written and length will be zero.
822 void CopyBytes(Register src,
827 // Initialize fields with filler values. Fields starting at |start_offset|
828 // not including end_offset are overwritten with the value in |filler|. At
829 // the end the loop, |start_offset| takes the value of |end_offset|.
830 void InitializeFieldsWithFiller(Register start_offset,
834 // ---------------------------------------------------------------------------
835 // Support functions.
837 // Try to get function prototype of a function and puts the value in
838 // the result register. Checks that the function really is a
839 // function and jumps to the miss label if the fast checks fail. The
840 // function register will be untouched; the other registers may be
842 void TryGetFunctionPrototype(Register function,
846 bool miss_on_bound_function = false);
848 // Compare object type for heap object. heap_object contains a non-Smi
849 // whose object type should be compared with the given type. This both
850 // sets the flags and leaves the object type in the type_reg register.
851 // It leaves the map in the map register (unless the type_reg and map register
852 // are the same register). It leaves the heap object in the heap_object
853 // register unless the heap_object register is the same register as one of the
855 // Type_reg can be no_reg. In that case ip is used.
856 void CompareObjectType(Register heap_object,
861 // Compare object type for heap object. Branch to false_label if type
862 // is lower than min_type or greater than max_type.
863 // Load map into the register map.
864 void CheckObjectTypeRange(Register heap_object,
866 InstanceType min_type,
867 InstanceType max_type,
870 // Compare instance type in a map. map contains a valid map object whose
871 // object type should be compared with the given type. This both
872 // sets the flags and leaves the object type in the type_reg register.
873 void CompareInstanceType(Register map,
878 // Check if a map for a JSObject indicates that the object has fast elements.
879 // Jump to the specified label if it does not.
880 void CheckFastElements(Register map,
884 // Check if a map for a JSObject indicates that the object can have both smi
885 // and HeapObject elements. Jump to the specified label if it does not.
886 void CheckFastObjectElements(Register map,
890 // Check if a map for a JSObject indicates that the object has fast smi only
891 // elements. Jump to the specified label if it does not.
892 void CheckFastSmiElements(Register map,
896 // Check to see if maybe_number can be stored as a double in
897 // FastDoubleElements. If it can, store it at the index specified by key in
898 // the FastDoubleElements array elements. Otherwise jump to fail.
899 void StoreNumberToDoubleElements(Register value_reg,
901 Register elements_reg,
903 LowDwVfpRegister double_scratch,
905 int elements_offset = 0);
907 // Compare an object's map with the specified map and its transitioned
908 // elements maps if mode is ALLOW_ELEMENT_TRANSITION_MAPS. Condition flags are
909 // set with result of map compare. If multiple map compares are required, the
910 // compare sequences branches to early_success.
911 void CompareMap(Register obj,
914 Label* early_success);
916 // As above, but the map of the object is already loaded into the register
917 // which is preserved by the code generated.
918 void CompareMap(Register obj_map,
920 Label* early_success);
922 // Check if the map of an object is equal to a specified map and branch to
923 // label if not. Skip the smi check if not required (object is known to be a
924 // heap object). If mode is ALLOW_ELEMENT_TRANSITION_MAPS, then also match
925 // against maps that are ElementsKind transition maps of the specified map.
926 void CheckMap(Register obj,
930 SmiCheckType smi_check_type);
933 void CheckMap(Register obj,
935 Heap::RootListIndex index,
937 SmiCheckType smi_check_type);
940 // Check if the map of an object is equal to a specified map and branch to a
941 // specified target if equal. Skip the smi check if not required (object is
942 // known to be a heap object)
943 void DispatchMap(Register obj,
946 Handle<Code> success,
947 SmiCheckType smi_check_type);
950 // Compare the object in a register to a value from the root list.
951 // Uses the ip register as scratch.
952 void CompareRoot(Register obj, Heap::RootListIndex index);
955 // Load and check the instance type of an object for being a string.
956 // Loads the type into the second argument register.
957 // Returns a condition that will be enabled if the object was a string
958 // and the passed-in condition passed. If the passed-in condition failed
959 // then flags remain unchanged.
960 Condition IsObjectStringType(Register obj,
962 Condition cond = al) {
963 ldr(type, FieldMemOperand(obj, HeapObject::kMapOffset), cond);
964 ldrb(type, FieldMemOperand(type, Map::kInstanceTypeOffset), cond);
965 tst(type, Operand(kIsNotStringMask), cond);
966 ASSERT_EQ(0, kStringTag);
971 // Generates code for reporting that an illegal operation has
973 void IllegalOperation(int num_arguments);
975 // Picks out an array index from the hash field.
977 // hash - holds the index's hash. Clobbered.
978 // index - holds the overwritten index on exit.
979 void IndexFromHash(Register hash, Register index);
981 // Get the number of least significant bits from a register
982 void GetLeastBitsFromSmi(Register dst, Register src, int num_least_bits);
983 void GetLeastBitsFromInt32(Register dst, Register src, int mun_least_bits);
985 // Load the value of a smi object into a double register.
986 // The register value must be between d0 and d15.
987 void SmiToDouble(LowDwVfpRegister value, Register smi);
989 // Check if a double can be exactly represented as a signed 32-bit integer.
990 // Z flag set to one if true.
991 void TestDoubleIsInt32(DwVfpRegister double_input,
992 LowDwVfpRegister double_scratch);
994 // Try to convert a double to a signed 32-bit integer.
995 // Z flag set to one and result assigned if the conversion is exact.
996 void TryDoubleToInt32Exact(Register result,
997 DwVfpRegister double_input,
998 LowDwVfpRegister double_scratch);
1000 // Floor a double and writes the value to the result register.
1001 // Go to exact if the conversion is exact (to be able to test -0),
1002 // fall through calling code if an overflow occurred, else go to done.
1003 // In return, input_high is loaded with high bits of input.
1004 void TryInt32Floor(Register result,
1005 DwVfpRegister double_input,
1006 Register input_high,
1007 LowDwVfpRegister double_scratch,
1011 // Performs a truncating conversion of a floating point number as used by
1012 // the JS bitwise operations. See ECMA-262 9.5: ToInt32. Goes to 'done' if it
1013 // succeeds, otherwise falls through if result is saturated. On return
1014 // 'result' either holds answer, or is clobbered on fall through.
1016 // Only public for the test code in test-code-stubs-arm.cc.
1017 void TryInlineTruncateDoubleToI(Register result,
1018 DwVfpRegister input,
1021 // Performs a truncating conversion of a floating point number as used by
1022 // the JS bitwise operations. See ECMA-262 9.5: ToInt32.
1023 // Exits with 'result' holding the answer.
1024 void TruncateDoubleToI(Register result, DwVfpRegister double_input);
1026 // Performs a truncating conversion of a heap number as used by
1027 // the JS bitwise operations. See ECMA-262 9.5: ToInt32. 'result' and 'input'
1028 // must be different registers. Exits with 'result' holding the answer.
1029 void TruncateHeapNumberToI(Register result, Register object);
1031 // Converts the smi or heap number in object to an int32 using the rules
1032 // for ToInt32 as described in ECMAScript 9.5.: the value is truncated
1033 // and brought into the range -2^31 .. +2^31 - 1. 'result' and 'input' must be
1034 // different registers.
1035 void TruncateNumberToI(Register object,
1037 Register heap_number_map,
1041 // Check whether d16-d31 are available on the CPU. The result is given by the
1042 // Z condition flag: Z==0 if d16-d31 available, Z==1 otherwise.
1043 void CheckFor32DRegs(Register scratch);
1045 // Does a runtime check for 16/32 FP registers. Either way, pushes 32 double
1046 // values to location, saving [d0..(d15|d31)].
1047 void SaveFPRegs(Register location, Register scratch);
1049 // Does a runtime check for 16/32 FP registers. Either way, pops 32 double
1050 // values to location, restoring [d0..(d15|d31)].
1051 void RestoreFPRegs(Register location, Register scratch);
1053 // ---------------------------------------------------------------------------
1056 // Call a code stub.
1057 void CallStub(CodeStub* stub,
1058 TypeFeedbackId ast_id = TypeFeedbackId::None(),
1059 Condition cond = al);
1061 // Call a code stub.
1062 void TailCallStub(CodeStub* stub, Condition cond = al);
1064 // Call a runtime routine.
1065 void CallRuntime(const Runtime::Function* f,
1067 SaveFPRegsMode save_doubles = kDontSaveFPRegs);
1068 void CallRuntimeSaveDoubles(Runtime::FunctionId id) {
1069 const Runtime::Function* function = Runtime::FunctionForId(id);
1070 CallRuntime(function, function->nargs, kSaveFPRegs);
1073 // Convenience function: Same as above, but takes the fid instead.
1074 void CallRuntime(Runtime::FunctionId id,
1076 SaveFPRegsMode save_doubles = kDontSaveFPRegs) {
1077 CallRuntime(Runtime::FunctionForId(id), num_arguments, save_doubles);
1080 // Convenience function: call an external reference.
1081 void CallExternalReference(const ExternalReference& ext,
1084 // Tail call of a runtime routine (jump).
1085 // Like JumpToExternalReference, but also takes care of passing the number
1087 void TailCallExternalReference(const ExternalReference& ext,
1091 // Convenience function: tail call a runtime routine (jump).
1092 void TailCallRuntime(Runtime::FunctionId fid,
1096 int CalculateStackPassedWords(int num_reg_arguments,
1097 int num_double_arguments);
1099 // Before calling a C-function from generated code, align arguments on stack.
1100 // After aligning the frame, non-register arguments must be stored in
1101 // sp[0], sp[4], etc., not pushed. The argument count assumes all arguments
1102 // are word sized. If double arguments are used, this function assumes that
1103 // all double arguments are stored before core registers; otherwise the
1104 // correct alignment of the double values is not guaranteed.
1105 // Some compilers/platforms require the stack to be aligned when calling
1107 // Needs a scratch register to do some arithmetic. This register will be
1109 void PrepareCallCFunction(int num_reg_arguments,
1110 int num_double_registers,
1112 void PrepareCallCFunction(int num_reg_arguments,
1115 // There are two ways of passing double arguments on ARM, depending on
1116 // whether soft or hard floating point ABI is used. These functions
1117 // abstract parameter passing for the three different ways we call
1118 // C functions from generated code.
1119 void MovToFloatParameter(DwVfpRegister src);
1120 void MovToFloatParameters(DwVfpRegister src1, DwVfpRegister src2);
1121 void MovToFloatResult(DwVfpRegister src);
1123 // Calls a C function and cleans up the space for arguments allocated
1124 // by PrepareCallCFunction. The called function is not allowed to trigger a
1125 // garbage collection, since that might move the code and invalidate the
1126 // return address (unless this is somehow accounted for by the called
1128 void CallCFunction(ExternalReference function, int num_arguments);
1129 void CallCFunction(Register function, int num_arguments);
1130 void CallCFunction(ExternalReference function,
1131 int num_reg_arguments,
1132 int num_double_arguments);
1133 void CallCFunction(Register function,
1134 int num_reg_arguments,
1135 int num_double_arguments);
1137 void MovFromFloatParameter(DwVfpRegister dst);
1138 void MovFromFloatResult(DwVfpRegister dst);
1140 // Calls an API function. Allocates HandleScope, extracts returned value
1141 // from handle and propagates exceptions. Restores context. stack_space
1142 // - space to be unwound on exit (includes the call JS arguments space and
1143 // the additional space allocated for the fast call).
1144 void CallApiFunctionAndReturn(Register function_address,
1145 ExternalReference thunk_ref,
1147 MemOperand return_value_operand,
1148 MemOperand* context_restore_operand);
1150 // Jump to a runtime routine.
1151 void JumpToExternalReference(const ExternalReference& builtin);
1153 // Invoke specified builtin JavaScript function. Adds an entry to
1154 // the unresolved list if the name does not resolve.
1155 void InvokeBuiltin(Builtins::JavaScript id,
1157 const CallWrapper& call_wrapper = NullCallWrapper());
1159 // Store the code object for the given builtin in the target register and
1160 // setup the function in r1.
1161 void GetBuiltinEntry(Register target, Builtins::JavaScript id);
1163 // Store the function for the given builtin in the target register.
1164 void GetBuiltinFunction(Register target, Builtins::JavaScript id);
1166 Handle<Object> CodeObject() {
1167 ASSERT(!code_object_.is_null());
1168 return code_object_;
1172 // ---------------------------------------------------------------------------
1173 // StatsCounter support
1175 void SetCounter(StatsCounter* counter, int value,
1176 Register scratch1, Register scratch2);
1177 void IncrementCounter(StatsCounter* counter, int value,
1178 Register scratch1, Register scratch2);
1179 void DecrementCounter(StatsCounter* counter, int value,
1180 Register scratch1, Register scratch2);
1183 // ---------------------------------------------------------------------------
1186 // Calls Abort(msg) if the condition cond is not satisfied.
1187 // Use --debug_code to enable.
1188 void Assert(Condition cond, BailoutReason reason);
1189 void AssertFastElements(Register elements);
1191 // Like Assert(), but always enabled.
1192 void Check(Condition cond, BailoutReason reason);
1194 // Print a message to stdout and abort execution.
1195 void Abort(BailoutReason msg);
1197 // Verify restrictions about code generated in stubs.
1198 void set_generating_stub(bool value) { generating_stub_ = value; }
1199 bool generating_stub() { return generating_stub_; }
1200 void set_has_frame(bool value) { has_frame_ = value; }
1201 bool has_frame() { return has_frame_; }
1202 inline bool AllowThisStubCall(CodeStub* stub);
1204 // EABI variant for double arguments in use.
1205 bool use_eabi_hardfloat() {
1207 return OS::ArmUsingHardFloat();
1208 #elif USE_EABI_HARDFLOAT
1215 // ---------------------------------------------------------------------------
1218 // Check whether the value of reg is a power of two and not zero. If not
1219 // control continues at the label not_power_of_two. If reg is a power of two
1220 // the register scratch contains the value of (reg - 1) when control falls
1222 void JumpIfNotPowerOfTwoOrZero(Register reg,
1224 Label* not_power_of_two_or_zero);
1225 // Check whether the value of reg is a power of two and not zero.
1226 // Control falls through if it is, with scratch containing the mask
1228 // Otherwise control jumps to the 'zero_and_neg' label if the value of reg is
1229 // zero or negative, or jumps to the 'not_power_of_two' label if the value is
1230 // strictly positive but not a power of two.
1231 void JumpIfNotPowerOfTwoOrZeroAndNeg(Register reg,
1233 Label* zero_and_neg,
1234 Label* not_power_of_two);
1236 // ---------------------------------------------------------------------------
1239 void SmiTag(Register reg, SBit s = LeaveCC) {
1240 add(reg, reg, Operand(reg), s);
1242 void SmiTag(Register dst, Register src, SBit s = LeaveCC) {
1243 add(dst, src, Operand(src), s);
1246 // Try to convert int32 to smi. If the value is to large, preserve
1247 // the original value and jump to not_a_smi. Destroys scratch and
1249 void TrySmiTag(Register reg, Label* not_a_smi) {
1250 TrySmiTag(reg, reg, not_a_smi);
1252 void TrySmiTag(Register reg, Register src, Label* not_a_smi) {
1253 SmiTag(ip, src, SetCC);
1259 void SmiUntag(Register reg, SBit s = LeaveCC) {
1260 mov(reg, Operand::SmiUntag(reg), s);
1262 void SmiUntag(Register dst, Register src, SBit s = LeaveCC) {
1263 mov(dst, Operand::SmiUntag(src), s);
1266 // Untag the source value into destination and jump if source is a smi.
1267 // Souce and destination can be the same register.
1268 void UntagAndJumpIfSmi(Register dst, Register src, Label* smi_case);
1270 // Untag the source value into destination and jump if source is not a smi.
1271 // Souce and destination can be the same register.
1272 void UntagAndJumpIfNotSmi(Register dst, Register src, Label* non_smi_case);
1274 // Test if the register contains a smi (Z == 0 (eq) if true).
1275 inline void SmiTst(Register value) {
1276 tst(value, Operand(kSmiTagMask));
1278 inline void NonNegativeSmiTst(Register value) {
1279 tst(value, Operand(kSmiTagMask | kSmiSignMask));
1281 // Jump if the register contains a smi.
1282 inline void JumpIfSmi(Register value, Label* smi_label) {
1283 tst(value, Operand(kSmiTagMask));
1286 // Jump if either of the registers contain a non-smi.
1287 inline void JumpIfNotSmi(Register value, Label* not_smi_label) {
1288 tst(value, Operand(kSmiTagMask));
1289 b(ne, not_smi_label);
1291 // Jump if either of the registers contain a non-smi.
1292 void JumpIfNotBothSmi(Register reg1, Register reg2, Label* on_not_both_smi);
1293 // Jump if either of the registers contain a smi.
1294 void JumpIfEitherSmi(Register reg1, Register reg2, Label* on_either_smi);
1296 // Abort execution if argument is a smi, enabled via --debug-code.
1297 void AssertNotSmi(Register object);
1298 void AssertSmi(Register object);
1300 // Abort execution if argument is not a string, enabled via --debug-code.
1301 void AssertString(Register object);
1303 // Abort execution if argument is not a name, enabled via --debug-code.
1304 void AssertName(Register object);
1306 // Abort execution if reg is not the root value with the given index,
1307 // enabled via --debug-code.
1308 void AssertIsRoot(Register reg, Heap::RootListIndex index);
1310 // ---------------------------------------------------------------------------
1311 // HeapNumber utilities
1313 void JumpIfNotHeapNumber(Register object,
1314 Register heap_number_map,
1316 Label* on_not_heap_number);
1318 // ---------------------------------------------------------------------------
1321 // Generate code to do a lookup in the number string cache. If the number in
1322 // the register object is found in the cache the generated code falls through
1323 // with the result in the result register. The object and the result register
1324 // can be the same. If the number is not found in the cache the code jumps to
1325 // the label not_found with only the content of register object unchanged.
1326 void LookupNumberStringCache(Register object,
1333 // Checks if both objects are sequential ASCII strings and jumps to label
1334 // if either is not. Assumes that neither object is a smi.
1335 void JumpIfNonSmisNotBothSequentialAsciiStrings(Register object1,
1341 // Checks if both objects are sequential ASCII strings and jumps to label
1342 // if either is not.
1343 void JumpIfNotBothSequentialAsciiStrings(Register first,
1347 Label* not_flat_ascii_strings);
1349 // Checks if both instance types are sequential ASCII strings and jumps to
1350 // label if either is not.
1351 void JumpIfBothInstanceTypesAreNotSequentialAscii(
1352 Register first_object_instance_type,
1353 Register second_object_instance_type,
1358 // Check if instance type is sequential ASCII string and jump to label if
1360 void JumpIfInstanceTypeIsNotSequentialAscii(Register type,
1364 void JumpIfNotUniqueName(Register reg, Label* not_unique_name);
1366 void EmitSeqStringSetCharCheck(Register string,
1369 uint32_t encoding_mask);
1371 // ---------------------------------------------------------------------------
1372 // Patching helpers.
1374 // Get the location of a relocated constant (its address in the constant pool)
1375 // from its load site.
1376 void GetRelocatedValueLocation(Register ldr_location,
1380 void ClampUint8(Register output_reg, Register input_reg);
1382 void ClampDoubleToUint8(Register result_reg,
1383 DwVfpRegister input_reg,
1384 LowDwVfpRegister double_scratch);
1387 void LoadInstanceDescriptors(Register map, Register descriptors);
1388 void EnumLength(Register dst, Register map);
1389 void NumberOfOwnDescriptors(Register dst, Register map);
1391 template<typename Field>
1392 void DecodeField(Register reg) {
1393 static const int shift = Field::kShift;
1394 static const int mask = (Field::kMask >> shift) << kSmiTagSize;
1395 mov(reg, Operand(reg, LSR, shift));
1396 and_(reg, reg, Operand(mask));
1399 // Activation support.
1400 void EnterFrame(StackFrame::Type type);
1401 // Returns the pc offset at which the frame ends.
1402 int LeaveFrame(StackFrame::Type type);
1404 // Expects object in r0 and returns map with validated enum cache
1405 // in r0. Assumes that any other register can be used as a scratch.
1406 void CheckEnumCache(Register null_value, Label* call_runtime);
1408 // AllocationMemento support. Arrays may have an associated
1409 // AllocationMemento object that can be checked for in order to pretransition
1411 // On entry, receiver_reg should point to the array object.
1412 // scratch_reg gets clobbered.
1413 // If allocation info is present, condition flags are set to eq.
1414 void TestJSArrayForAllocationMemento(Register receiver_reg,
1415 Register scratch_reg,
1416 Label* no_memento_found);
1418 void JumpIfJSArrayHasAllocationMemento(Register receiver_reg,
1419 Register scratch_reg,
1420 Label* memento_found) {
1421 Label no_memento_found;
1422 TestJSArrayForAllocationMemento(receiver_reg, scratch_reg,
1424 b(eq, memento_found);
1425 bind(&no_memento_found);
1428 // Jumps to found label if a prototype map has dictionary elements.
1429 void JumpIfDictionaryInPrototypeChain(Register object, Register scratch0,
1430 Register scratch1, Label* found);
1433 void CallCFunctionHelper(Register function,
1434 int num_reg_arguments,
1435 int num_double_arguments);
1437 void Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond = al);
1439 // Helper functions for generating invokes.
1440 void InvokePrologue(const ParameterCount& expected,
1441 const ParameterCount& actual,
1442 Handle<Code> code_constant,
1445 bool* definitely_mismatches,
1447 const CallWrapper& call_wrapper);
1449 void InitializeNewString(Register string,
1451 Heap::RootListIndex map_index,
1455 // Helper for implementing JumpIfNotInNewSpace and JumpIfInNewSpace.
1456 void InNewSpace(Register object,
1458 Condition cond, // eq for new space, ne otherwise.
1461 // Helper for finding the mark bits for an address. Afterwards, the
1462 // bitmap register points at the word with the mark bits and the mask
1463 // the position of the first bit. Leaves addr_reg unchanged.
1464 inline void GetMarkBits(Register addr_reg,
1465 Register bitmap_reg,
1468 // Helper for throwing exceptions. Compute a handler address and jump to
1469 // it. See the implementation for register usage.
1470 void JumpToHandlerEntry();
1472 // Compute memory operands for safepoint stack slots.
1473 static int SafepointRegisterStackIndex(int reg_code);
1474 MemOperand SafepointRegisterSlot(Register reg);
1475 MemOperand SafepointRegistersAndDoublesSlot(Register reg);
1477 bool generating_stub_;
1479 // This handle will be patched with the code object on installation.
1480 Handle<Object> code_object_;
1482 // Needs access to SafepointRegisterStackIndex for compiled frame
1484 friend class StandardFrame;
1488 // The code patcher is used to patch (typically) small parts of code e.g. for
1489 // debugging and other types of instrumentation. When using the code patcher
1490 // the exact number of bytes specified must be emitted. It is not legal to emit
1491 // relocation information. If any of these constraints are violated it causes
1492 // an assertion to fail.
1500 CodePatcher(byte* address,
1502 FlushICache flush_cache = FLUSH);
1503 virtual ~CodePatcher();
1505 // Macro assembler to emit code.
1506 MacroAssembler* masm() { return &masm_; }
1508 // Emit an instruction directly.
1509 void Emit(Instr instr);
1511 // Emit an address directly.
1512 void Emit(Address addr);
1514 // Emit the condition part of an instruction leaving the rest of the current
1515 // instruction unchanged.
1516 void EmitCondition(Condition cond);
1519 byte* address_; // The address of the code being patched.
1520 int size_; // Number of bytes of the expected patch size.
1521 MacroAssembler masm_; // Macro assembler used to generate the code.
1522 FlushICache flush_cache_; // Whether to flush the I cache after patching.
1526 // -----------------------------------------------------------------------------
1527 // Static helper functions.
1529 inline MemOperand ContextOperand(Register context, int index) {
1530 return MemOperand(context, Context::SlotOffset(index));
1534 inline MemOperand GlobalObjectOperand() {
1535 return ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX);
1539 #ifdef GENERATED_CODE_COVERAGE
1540 #define CODE_COVERAGE_STRINGIFY(x) #x
1541 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x)
1542 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__)
1543 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm->
1545 #define ACCESS_MASM(masm) masm->
1549 } } // namespace v8::internal
1551 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_