1a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// Copyright 2006-2008 the V8 project authors. All rights reserved. 2a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// Redistribution and use in source and binary forms, with or without 3a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// modification, are permitted provided that the following conditions are 4a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// met: 5a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// 6a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// * Redistributions of source code must retain the above copyright 7a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// notice, this list of conditions and the following disclaimer. 8a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// * Redistributions in binary form must reproduce the above 9a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// copyright notice, this list of conditions and the following 10a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// disclaimer in the documentation and/or other materials provided 11a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// with the distribution. 12a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// * Neither the name of Google Inc. nor the names of its 13a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// contributors may be used to endorse or promote products derived 14a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// from this software without specific prior written permission. 15a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// 16a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 28a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#ifndef V8_ARM_REGEXP_MACRO_ASSEMBLER_ARM_H_ 29a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#define V8_ARM_REGEXP_MACRO_ASSEMBLER_ARM_H_ 30a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 313fb3ca8c7ca439d408449a395897395c0faae8d1Ben Murdoch#include "arm/assembler-arm.h" 323fb3ca8c7ca439d408449a395897395c0faae8d1Ben Murdoch#include "arm/assembler-arm-inl.h" 333fb3ca8c7ca439d408449a395897395c0faae8d1Ben Murdoch 34a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blocknamespace v8 { 35a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blocknamespace internal { 36a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 37a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 386ded16be15dd865a9b21ea304d5273c8be299c87Steve Block#ifdef V8_INTERPRETED_REGEXP 39a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blockclass RegExpMacroAssemblerARM: public RegExpMacroAssembler { 40a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block public: 41a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block RegExpMacroAssemblerARM(); 42a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual ~RegExpMacroAssemblerARM(); 43a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block}; 44a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 456ded16be15dd865a9b21ea304d5273c8be299c87Steve Block#else // V8_INTERPRETED_REGEXP 46a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blockclass RegExpMacroAssemblerARM: public NativeRegExpMacroAssembler { 47a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block public: 48a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block RegExpMacroAssemblerARM(Mode mode, int registers_to_save); 49a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual ~RegExpMacroAssemblerARM(); 50a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual int stack_limit_slack(); 51a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void AdvanceCurrentPosition(int by); 52a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void AdvanceRegister(int reg, int by); 53a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void Backtrack(); 54a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void Bind(Label* label); 55a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void CheckAtStart(Label* on_at_start); 56b8e0da25ee8efac3bb05cd6b2730aafbd96119f4Ben Murdoch virtual void CheckCharacter(unsigned c, Label* on_equal); 57b8e0da25ee8efac3bb05cd6b2730aafbd96119f4Ben Murdoch virtual void CheckCharacterAfterAnd(unsigned c, 58b8e0da25ee8efac3bb05cd6b2730aafbd96119f4Ben Murdoch unsigned mask, 59a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label* on_equal); 60a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void CheckCharacterGT(uc16 limit, Label* on_greater); 61a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void CheckCharacterLT(uc16 limit, Label* on_less); 62a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void CheckCharacters(Vector<const uc16> str, 63a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int cp_offset, 64a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label* on_failure, 65a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block bool check_end_of_string); 66a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // A "greedy loop" is a loop that is both greedy and with a simple 67a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // body. It has a particularly simple implementation. 68a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void CheckGreedyLoop(Label* on_tos_equals_current_position); 69a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void CheckNotAtStart(Label* on_not_at_start); 70a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void CheckNotBackReference(int start_reg, Label* on_no_match); 71a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void CheckNotBackReferenceIgnoreCase(int start_reg, 72a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label* on_no_match); 73a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void CheckNotRegistersEqual(int reg1, int reg2, Label* on_not_equal); 74b8e0da25ee8efac3bb05cd6b2730aafbd96119f4Ben Murdoch virtual void CheckNotCharacter(unsigned c, Label* on_not_equal); 75b8e0da25ee8efac3bb05cd6b2730aafbd96119f4Ben Murdoch virtual void CheckNotCharacterAfterAnd(unsigned c, 76b8e0da25ee8efac3bb05cd6b2730aafbd96119f4Ben Murdoch unsigned mask, 77a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label* on_not_equal); 78a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void CheckNotCharacterAfterMinusAnd(uc16 c, 79a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block uc16 minus, 80a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block uc16 mask, 81a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label* on_not_equal); 82a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Checks whether the given offset from the current position is before 83a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // the end of the string. 84a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void CheckPosition(int cp_offset, Label* on_outside_input); 85a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual bool CheckSpecialCharacterClass(uc16 type, 86a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label* on_no_match); 87a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void Fail(); 88053d10c438f14580aaf4ab1b2aad93a5a4fe8b82Steve Block virtual Handle<HeapObject> GetCode(Handle<String> source); 89a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void GoTo(Label* label); 90a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void IfRegisterGE(int reg, int comparand, Label* if_ge); 91a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void IfRegisterLT(int reg, int comparand, Label* if_lt); 92a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void IfRegisterEqPos(int reg, Label* if_eq); 93a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual IrregexpImplementation Implementation(); 94a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void LoadCurrentCharacter(int cp_offset, 95a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label* on_end_of_input, 96a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block bool check_bounds = true, 97a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int characters = 1); 98a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void PopCurrentPosition(); 99a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void PopRegister(int register_index); 100a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void PushBacktrack(Label* label); 101a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void PushCurrentPosition(); 102a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void PushRegister(int register_index, 103a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block StackCheckFlag check_stack_limit); 104a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void ReadCurrentPositionFromRegister(int reg); 105a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void ReadStackPointerFromRegister(int reg); 106f87a203d89e1bbb6708282e0b64dbd13d59b723dBen Murdoch virtual void SetCurrentPositionFromEnd(int by); 107a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void SetRegister(int register_index, int to); 108a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void Succeed(); 109a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void WriteCurrentPositionToRegister(int reg, int cp_offset); 110a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void ClearRegisters(int reg_from, int reg_to); 111a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block virtual void WriteStackPointerToRegister(int reg); 112a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 113a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Called from RegExp if the stack-guard is triggered. 114a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // If the code object is relocated, the return address is fixed before 115a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // returning. 116a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static int CheckStackGuardState(Address* return_address, 117a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Code* re_code, 118a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Address re_frame); 119589d6979ff2ef66fca2d8fa51404c369ca5e9250Ben Murdoch 120a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block private: 121a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Offsets from frame_pointer() of function parameters and stored registers. 122a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static const int kFramePointer = 0; 123a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 124a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Above the frame pointer - Stored registers and stack passed parameters. 125a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Register 4..11. 126a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static const int kStoredRegisters = kFramePointer; 127a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Return address (stored from link register, read into pc on return). 128a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static const int kReturnAddress = kStoredRegisters + 8 * kPointerSize; 129e0cee9b3ed82e2391fd85d118aeaa4ea361c687dBen Murdoch static const int kSecondaryReturnAddress = kReturnAddress + kPointerSize; 130a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Stack parameters placed by caller. 131e0cee9b3ed82e2391fd85d118aeaa4ea361c687dBen Murdoch static const int kRegisterOutput = kSecondaryReturnAddress + kPointerSize; 132d91b9f7d46489a9ee00f9cb415630299c76a502bLeon Clarke static const int kStackHighEnd = kRegisterOutput + kPointerSize; 133e46be819fca9468a0cd4e74859ce0f778eb8ca60Leon Clarke static const int kDirectCall = kStackHighEnd + kPointerSize; 13444f0eee88ff00398ff7f715fab053374d808c90dSteve Block static const int kIsolate = kDirectCall + kPointerSize; 135a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 136a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Below the frame pointer. 137a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Register parameters stored by setup code. 138a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static const int kInputEnd = kFramePointer - kPointerSize; 139a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static const int kInputStart = kInputEnd - kPointerSize; 140a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static const int kStartIndex = kInputStart - kPointerSize; 141a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static const int kInputString = kStartIndex - kPointerSize; 142a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // When adding local variables remember to push space for them in 143a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // the frame in GetCode. 144a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static const int kInputStartMinusOne = kInputString - kPointerSize; 145d91b9f7d46489a9ee00f9cb415630299c76a502bLeon Clarke static const int kAtStart = kInputStartMinusOne - kPointerSize; 146a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // First register address. Following registers are below it on the stack. 147d91b9f7d46489a9ee00f9cb415630299c76a502bLeon Clarke static const int kRegisterZero = kAtStart - kPointerSize; 148a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 149a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Initial size of code buffer. 150a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static const size_t kRegExpCodeSize = 1024; 151a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 152a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static const int kBacktrackConstantPoolSize = 4; 153a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 154a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Load a number of characters at the given offset from the 155a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // current position, into the current-character register. 156a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block void LoadCurrentCharacterUnchecked(int cp_offset, int character_count); 157a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 158a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Check whether preemption has been requested. 159a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block void CheckPreemption(); 160a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 161a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Check whether we are exceeding the stack limit on the backtrack stack. 162a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block void CheckStackLimit(); 163a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 164a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block void EmitBacktrackConstantPool(); 165a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int GetBacktrackConstantPoolEntry(); 166a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 167a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 168a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Generate a call to CheckStackGuardState. 169a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block void CallCheckStackGuardState(Register scratch); 170a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 171a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // The ebp-relative location of a regexp register. 172a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block MemOperand register_location(int register_index); 173a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 174a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Register holding the current input position as negative offset from 175a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // the end of the string. 176a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block inline Register current_input_offset() { return r6; } 177a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 178a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // The register containing the current character after LoadCurrentCharacter. 179a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block inline Register current_character() { return r7; } 180a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 181a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Register holding address of the end of the input string. 182a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block inline Register end_of_input_address() { return r10; } 183a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 184a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Register holding the frame address. Local variables, parameters and 185a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // regexp registers are addressed relative to this. 186a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block inline Register frame_pointer() { return fp; } 187a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 188a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // The register containing the backtrack stack top. Provides a meaningful 189a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // name to the register. 190a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block inline Register backtrack_stackpointer() { return r8; } 191a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 192a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Register holding pointer to the current code object. 193a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block inline Register code_pointer() { return r5; } 194a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 195a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Byte size of chars in the string to match (decided by the Mode argument) 196a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block inline int char_size() { return static_cast<int>(mode_); } 197a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 198a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Equivalent to a conditional branch to the label, unless the label 199a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // is NULL, in which case it is a conditional Backtrack. 200a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block void BranchOrBacktrack(Condition condition, Label* to); 201a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 202a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Call and return internally in the generated code in a way that 203a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // is GC-safe (i.e., doesn't leave absolute code addresses on the stack) 204a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block inline void SafeCall(Label* to, Condition cond = al); 205a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block inline void SafeReturn(); 206a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block inline void SafeCallTarget(Label* name); 207a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 208a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Pushes the value of a register on the backtrack stack. Decrements the 209a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // stack pointer by a word size and stores the register's value there. 210a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block inline void Push(Register source); 211a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 212a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Pops a value from the backtrack stack. Reads the word at the stack pointer 213a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // and increments it by a word size. 214a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block inline void Pop(Register target); 215a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 216a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Calls a C function and cleans up the frame alignment done by 217a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // by FrameAlign. The called function *is* allowed to trigger a garbage 218a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // collection, but may not take more than four arguments (no arguments 219a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // passed on the stack), and the first argument will be a pointer to the 220a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // return address. 221a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block inline void CallCFunctionUsingStub(ExternalReference function, 222a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int num_arguments); 223a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 224a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 225a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block MacroAssembler* masm_; 226a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 227a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Which mode to generate code for (ASCII or UC16). 228a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Mode mode_; 229a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 230a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // One greater than maximal register index actually used. 231a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int num_registers_; 232a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 233a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Number of registers to output at the end (the saved registers 234a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // are always 0..num_saved_registers_-1) 235a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int num_saved_registers_; 236a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 237a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Manage a small pre-allocated pool for writing label targets 238a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // to for pushing backtrack addresses. 239a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int backtrack_constant_pool_offset_; 240a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int backtrack_constant_pool_capacity_; 241a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 242a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Labels used internally. 243a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label entry_label_; 244a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label start_label_; 245a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label success_label_; 246a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label backtrack_label_; 247a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label exit_label_; 248a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label check_preempt_label_; 249a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label stack_overflow_label_; 250a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block}; 251a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 2526ded16be15dd865a9b21ea304d5273c8be299c87Steve Block#endif // V8_INTERPRETED_REGEXP 253a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 254a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 255a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block}} // namespace v8::internal 256a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 257a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#endif // V8_ARM_REGEXP_MACRO_ASSEMBLER_ARM_H_ 258