| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
| 2 | 2 |
| 3 // A light-weight assembler for the Regexp2000 byte code. | 3 // A light-weight assembler for the Regexp2000 byte code. |
| 4 | 4 |
| 5 #ifndef V8_ASSEMBLER_RE2K_H_ | 5 #ifndef V8_ASSEMBLER_RE2K_H_ |
| 6 #define V8_ASSEMBLER_RE2K_H_ | 6 #define V8_ASSEMBLER_RE2K_H_ |
| 7 | 7 |
| 8 namespace v8 { namespace internal { | 8 namespace v8 { namespace internal { |
| 9 | 9 |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 explicit Re2kAssembler(Vector<byte>); | 26 explicit Re2kAssembler(Vector<byte>); |
| 27 ~Re2kAssembler(); | 27 ~Re2kAssembler(); |
| 28 | 28 |
| 29 // CP = current position in source. | 29 // CP = current position in source. |
| 30 // BT = backtrack label. | 30 // BT = backtrack label. |
| 31 | 31 |
| 32 // Stack. | 32 // Stack. |
| 33 void PushCurrentPosition(int cp_offset = 0); | 33 void PushCurrentPosition(int cp_offset = 0); |
| 34 void PushBacktrack(Label* l); | 34 void PushBacktrack(Label* l); |
| 35 void PushRegister(int index); | 35 void PushRegister(int index); |
| 36 void SetRegisterToCurrentPosition(int index, int cp_offset = 0); | 36 void WriteCurrentPositionToRegister(int index, int cp_offset = 0); |
| 37 void SetCurrentPositionFromRegister(int index); |
| 38 void WriteStackPointerToRegister(int index); |
| 39 void SetStackPointerFromRegister(int index); |
| 37 void SetRegister(int index, int value); | 40 void SetRegister(int index, int value); |
| 38 void AdvanceRegister(int index, int by); | 41 void AdvanceRegister(int index, int by); |
| 39 | 42 |
| 40 void PopCurrentPosition(); | 43 void PopCurrentPosition(); |
| 41 void PopBacktrack(); | 44 void PopBacktrack(); |
| 42 void PopRegister(int index); | 45 void PopRegister(int index); |
| 43 | 46 |
| 44 void Fail(); | 47 void Fail(); |
| 45 void Succeed(); | 48 void Succeed(); |
| 46 | 49 |
| 47 void Break(); // This instruction will cause a fatal VM error if hit. | 50 void Break(); // This instruction will cause a fatal VM error if hit. |
| 48 | 51 |
| 49 void Bind(Label* l); // Binds an unbound label L to the current code posn. | 52 void Bind(Label* l); // Binds an unbound label L to the current code posn. |
| 50 | 53 |
| 51 void AdvanceCP(int by); | 54 void AdvanceCP(int by); |
| 52 | 55 |
| 53 void GoTo(Label* l); | 56 void GoTo(Label* l); |
| 54 | 57 |
| 55 // Loads current char into a machine register. Jumps to the label if we | 58 // Loads current char into a machine register. Jumps to the label if we |
| 56 // reached the end of the subject string. Fall through otherwise. | 59 // reached the end of the subject string. Fall through otherwise. |
| 57 void LoadCurrentChar(int cp_offset, Label* on_end); | 60 void LoadCurrentChar(int cp_offset, Label* on_end); |
| 58 | 61 |
| 59 // Checks current char register against a singleton. | 62 // Checks current char register against a singleton. |
| 60 void CheckChar(uc16 c, Label* on_mismatch); | 63 void CheckCharacter(uc16 c, Label* on_match); |
| 61 void CheckNotChar(uc16 c, Label* on_match); | 64 void CheckNotCharacter(uc16 c, Label* on_mismatch); |
| 62 | 65 |
| 63 // Used to check current char register against a range. | 66 // Used to check current char register against a range. |
| 64 void CheckCharacterLT(uc16 limit, Label* on_less); | 67 void CheckCharacterLT(uc16 limit, Label* on_less); |
| 65 void CheckCharacterGT(uc16 limit, Label* on_greater); | 68 void CheckCharacterGT(uc16 limit, Label* on_greater); |
| 66 | 69 |
| 67 // Checks current position for a match against a | 70 // Checks current position for a match against a |
| 68 // previous capture. Advances current position by the length of the capture | 71 // previous capture. Advances current position by the length of the capture |
| 69 // iff it matches. The capture is stored in a given register and the | 72 // iff it matches. The capture is stored in a given register and the |
| 70 // the register after. If a register contains -1 then the other register | 73 // the register after. If a register contains -1 then the other register |
| 71 // mush always contain -1 and the on_mismatch label will never be called. | 74 // mush always contain -1 and the on_mismatch label will never be called. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 // True if the assembler owns the buffer, false if buffer is external. | 126 // True if the assembler owns the buffer, false if buffer is external. |
| 124 bool own_buffer_; | 127 bool own_buffer_; |
| 125 | 128 |
| 126 void Expand(); | 129 void Expand(); |
| 127 }; | 130 }; |
| 128 | 131 |
| 129 | 132 |
| 130 } } // namespace v8::internal | 133 } } // namespace v8::internal |
| 131 | 134 |
| 132 #endif // V8_ASSEMBLER_RE2K_H_ | 135 #endif // V8_ASSEMBLER_RE2K_H_ |
| OLD | NEW |