ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 1 | // Copyright 2008 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 |
| 4 | // met: |
| 5 | // |
| 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. |
| 15 | // |
| 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. |
| 27 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 28 | #ifndef V8_REGEXP_MACRO_ASSEMBLER_TRACER_H_ |
| 29 | #define V8_REGEXP_MACRO_ASSEMBLER_TRACER_H_ |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 30 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 31 | namespace v8 { |
| 32 | namespace internal { |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 33 | |
| 34 | // Decorator on a RegExpMacroAssembler that write all calls. |
| 35 | class RegExpMacroAssemblerTracer: public RegExpMacroAssembler { |
| 36 | public: |
| 37 | explicit RegExpMacroAssemblerTracer(RegExpMacroAssembler* assembler); |
| 38 | virtual ~RegExpMacroAssemblerTracer(); |
ager@chromium.org | 3291210 | 2009-01-16 10:38:43 +0000 | [diff] [blame] | 39 | virtual int stack_limit_slack() { return assembler_->stack_limit_slack(); } |
ager@chromium.org | 18ad94b | 2009-09-02 08:22:29 +0000 | [diff] [blame] | 40 | virtual bool CanReadUnaligned() { return assembler_->CanReadUnaligned(); } |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 41 | virtual void AdvanceCurrentPosition(int by); // Signed cp change. |
| 42 | virtual void AdvanceRegister(int reg, int by); // r[reg] += by. |
| 43 | virtual void Backtrack(); |
| 44 | virtual void Bind(Label* label); |
ager@chromium.org | ddb913d | 2009-01-27 10:01:48 +0000 | [diff] [blame] | 45 | virtual void CheckAtStart(Label* on_at_start); |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 46 | virtual void CheckCharacter(unsigned c, Label* on_equal); |
| 47 | virtual void CheckCharacterAfterAnd(unsigned c, |
| 48 | unsigned and_with, |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 49 | Label* on_equal); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 50 | virtual void CheckCharacterGT(uc16 limit, Label* on_greater); |
| 51 | virtual void CheckCharacterLT(uc16 limit, Label* on_less); |
| 52 | virtual void CheckCharacters( |
| 53 | Vector<const uc16> str, |
| 54 | int cp_offset, |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 55 | Label* on_failure, |
| 56 | bool check_end_of_string); |
| 57 | virtual void CheckGreedyLoop(Label* on_tos_equals_current_position); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 58 | virtual void CheckNotAtStart(Label* on_not_at_start); |
| 59 | virtual void CheckNotBackReference(int start_reg, Label* on_no_match); |
| 60 | virtual void CheckNotBackReferenceIgnoreCase(int start_reg, |
| 61 | Label* on_no_match); |
sgjesse@chromium.org | c6c5718 | 2011-01-17 12:24:25 +0000 | [diff] [blame] | 62 | virtual void CheckNotCharacter(unsigned c, Label* on_not_equal); |
| 63 | virtual void CheckNotCharacterAfterAnd(unsigned c, |
| 64 | unsigned and_with, |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 65 | Label* on_not_equal); |
| 66 | virtual void CheckNotCharacterAfterMinusAnd(uc16 c, |
| 67 | uc16 minus, |
| 68 | uc16 and_with, |
| 69 | Label* on_not_equal); |
jkummerow@chromium.org | 1456e70 | 2012-03-30 08:38:13 +0000 | [diff] [blame] | 70 | virtual void CheckCharacterInRange(uc16 from, |
| 71 | uc16 to, |
| 72 | Label* on_in_range); |
| 73 | virtual void CheckCharacterNotInRange(uc16 from, |
| 74 | uc16 to, |
| 75 | Label* on_not_in_range); |
| 76 | virtual void CheckBitInTable(Handle<ByteArray> table, Label* on_bit_set); |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 77 | virtual bool CheckSpecialCharacterClass(uc16 type, |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 78 | Label* on_no_match); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 79 | virtual void Fail(); |
karlklose@chromium.org | 83a4728 | 2011-05-11 11:54:09 +0000 | [diff] [blame] | 80 | virtual Handle<HeapObject> GetCode(Handle<String> source); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 81 | virtual void GoTo(Label* label); |
| 82 | virtual void IfRegisterGE(int reg, int comparand, Label* if_ge); |
| 83 | virtual void IfRegisterLT(int reg, int comparand, Label* if_lt); |
ager@chromium.org | 3291210 | 2009-01-16 10:38:43 +0000 | [diff] [blame] | 84 | virtual void IfRegisterEqPos(int reg, Label* if_eq); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 85 | virtual IrregexpImplementation Implementation(); |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 86 | virtual void LoadCurrentCharacter(int cp_offset, |
| 87 | Label* on_end_of_input, |
| 88 | bool check_bounds = true, |
| 89 | int characters = 1); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 90 | virtual void PopCurrentPosition(); |
| 91 | virtual void PopRegister(int register_index); |
| 92 | virtual void PushBacktrack(Label* label); |
| 93 | virtual void PushCurrentPosition(); |
ager@chromium.org | 3291210 | 2009-01-16 10:38:43 +0000 | [diff] [blame] | 94 | virtual void PushRegister(int register_index, |
| 95 | StackCheckFlag check_stack_limit); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 96 | virtual void ReadCurrentPositionFromRegister(int reg); |
| 97 | virtual void ReadStackPointerFromRegister(int reg); |
whesse@chromium.org | 4a5224e | 2010-10-20 12:37:07 +0000 | [diff] [blame] | 98 | virtual void SetCurrentPositionFromEnd(int by); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 99 | virtual void SetRegister(int register_index, int to); |
mstarzinger@chromium.org | 15613d0 | 2012-05-23 12:04:37 +0000 | [diff] [blame] | 100 | virtual bool Succeed(); |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 101 | virtual void WriteCurrentPositionToRegister(int reg, int cp_offset); |
ager@chromium.org | ddb913d | 2009-01-27 10:01:48 +0000 | [diff] [blame] | 102 | virtual void ClearRegisters(int reg_from, int reg_to); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 103 | virtual void WriteStackPointerToRegister(int reg); |
kmillikin@chromium.org | 83e1682 | 2011-09-13 08:21:47 +0000 | [diff] [blame] | 104 | |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 105 | private: |
| 106 | RegExpMacroAssembler* assembler_; |
| 107 | }; |
| 108 | |
| 109 | }} // namespace v8::internal |
| 110 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 111 | #endif // V8_REGEXP_MACRO_ASSEMBLER_TRACER_H_ |