| OLD | NEW |
| 1 // Copyright 2008 the V8 project authors. All rights reserved. | 1 // Copyright 2008 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // If the provided buffer is NULL, the assembler allocates and grows its own | 41 // If the provided buffer is NULL, the assembler allocates and grows its own |
| 42 // buffer, and buffer_size determines the initial buffer size. The buffer is | 42 // buffer, and buffer_size determines the initial buffer size. The buffer is |
| 43 // owned by the assembler and deallocated upon destruction of the assembler. | 43 // owned by the assembler and deallocated upon destruction of the assembler. |
| 44 // | 44 // |
| 45 // If the provided buffer is not NULL, the assembler uses the provided buffer | 45 // If the provided buffer is not NULL, the assembler uses the provided buffer |
| 46 // for code generation and assumes its size to be buffer_size. If the buffer | 46 // for code generation and assumes its size to be buffer_size. If the buffer |
| 47 // is too small, a fatal error occurs. No deallocation of the buffer is done | 47 // is too small, a fatal error occurs. No deallocation of the buffer is done |
| 48 // upon destruction of the assembler. | 48 // upon destruction of the assembler. |
| 49 explicit RegExpMacroAssemblerIrregexp(Vector<byte>); | 49 explicit RegExpMacroAssemblerIrregexp(Vector<byte>); |
| 50 virtual ~RegExpMacroAssemblerIrregexp(); | 50 virtual ~RegExpMacroAssemblerIrregexp(); |
| 51 // The byte-code interpreter checks on each push anyway. |
| 52 virtual int stack_limit_slack() { return 1; } |
| 51 virtual void Bind(Label* label); | 53 virtual void Bind(Label* label); |
| 52 virtual void EmitOrLink(Label* label); | 54 virtual void EmitOrLink(Label* label); |
| 53 virtual void AdvanceCurrentPosition(int by); // Signed cp change. | 55 virtual void AdvanceCurrentPosition(int by); // Signed cp change. |
| 54 virtual void PopCurrentPosition(); | 56 virtual void PopCurrentPosition(); |
| 55 virtual void PushCurrentPosition(); | 57 virtual void PushCurrentPosition(); |
| 56 virtual void Backtrack(); | 58 virtual void Backtrack(); |
| 57 virtual void GoTo(Label* label); | 59 virtual void GoTo(Label* label); |
| 58 virtual void PushBacktrack(Label* label); | 60 virtual void PushBacktrack(Label* label); |
| 59 virtual void Succeed(); | 61 virtual void Succeed(); |
| 60 virtual void Fail(); | 62 virtual void Fail(); |
| 61 virtual void PopRegister(int register_index); | 63 virtual void PopRegister(int register_index); |
| 62 virtual void PushRegister(int register_index); | 64 virtual void PushRegister(int register_index, |
| 65 StackCheckFlag check_stack_limit); |
| 63 virtual void AdvanceRegister(int reg, int by); // r[reg] += by. | 66 virtual void AdvanceRegister(int reg, int by); // r[reg] += by. |
| 64 virtual void SetRegister(int register_index, int to); | 67 virtual void SetRegister(int register_index, int to); |
| 65 virtual void WriteCurrentPositionToRegister(int reg, int cp_offset); | 68 virtual void WriteCurrentPositionToRegister(int reg, int cp_offset); |
| 69 virtual void ClearRegister(int reg); |
| 66 virtual void ReadCurrentPositionFromRegister(int reg); | 70 virtual void ReadCurrentPositionFromRegister(int reg); |
| 67 virtual void WriteStackPointerToRegister(int reg); | 71 virtual void WriteStackPointerToRegister(int reg); |
| 68 virtual void ReadStackPointerFromRegister(int reg); | 72 virtual void ReadStackPointerFromRegister(int reg); |
| 69 virtual void LoadCurrentCharacter(int cp_offset, | 73 virtual void LoadCurrentCharacter(int cp_offset, |
| 70 Label* on_end_of_input, | 74 Label* on_end_of_input, |
| 71 bool check_bounds = true, | 75 bool check_bounds = true, |
| 72 int characters = 1); | 76 int characters = 1); |
| 73 virtual void CheckCharacter(uint32_t c, Label* on_equal); | 77 virtual void CheckCharacter(uint32_t c, Label* on_equal); |
| 74 virtual void CheckCharacterAfterAnd(uint32_t c, | 78 virtual void CheckCharacterAfterAnd(uint32_t c, |
| 75 uint32_t mask, | 79 uint32_t mask, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 99 Label* half_nibble_map, | 103 Label* half_nibble_map, |
| 100 const Vector<Label*>& destinations); | 104 const Vector<Label*>& destinations); |
| 101 virtual void DispatchByteMap(uc16 start, | 105 virtual void DispatchByteMap(uc16 start, |
| 102 Label* byte_map, | 106 Label* byte_map, |
| 103 const Vector<Label*>& destinations); | 107 const Vector<Label*>& destinations); |
| 104 virtual void DispatchHighByteMap(byte start, | 108 virtual void DispatchHighByteMap(byte start, |
| 105 Label* byte_map, | 109 Label* byte_map, |
| 106 const Vector<Label*>& destinations); | 110 const Vector<Label*>& destinations); |
| 107 virtual void IfRegisterLT(int register_index, int comparand, Label* if_lt); | 111 virtual void IfRegisterLT(int register_index, int comparand, Label* if_lt); |
| 108 virtual void IfRegisterGE(int register_index, int comparand, Label* if_ge); | 112 virtual void IfRegisterGE(int register_index, int comparand, Label* if_ge); |
| 113 virtual void IfRegisterEqPos(int register_index, Label* if_eq); |
| 109 | 114 |
| 110 virtual IrregexpImplementation Implementation(); | 115 virtual IrregexpImplementation Implementation(); |
| 111 virtual Handle<Object> GetCode(Handle<String> source); | 116 virtual Handle<Object> GetCode(Handle<String> source); |
| 112 private: | 117 private: |
| 113 void Expand(); | 118 void Expand(); |
| 114 // Code and bitmap emission. | 119 // Code and bitmap emission. |
| 115 inline void Emit32(uint32_t x); | 120 inline void Emit32(uint32_t x); |
| 116 inline void Emit16(uint32_t x); | 121 inline void Emit16(uint32_t x); |
| 117 inline void Emit(uint32_t x); | 122 inline void Emit(uint32_t x); |
| 118 // Bytecode buffer. | 123 // Bytecode buffer. |
| 119 int length(); | 124 int length(); |
| 120 void Copy(Address a); | 125 void Copy(Address a); |
| 121 | 126 |
| 122 // The buffer into which code and relocation info are generated. | 127 // The buffer into which code and relocation info are generated. |
| 123 Vector<byte> buffer_; | 128 Vector<byte> buffer_; |
| 124 // The program counter. | 129 // The program counter. |
| 125 int pc_; | 130 int pc_; |
| 126 // True if the assembler owns the buffer, false if buffer is external. | 131 // True if the assembler owns the buffer, false if buffer is external. |
| 127 bool own_buffer_; | 132 bool own_buffer_; |
| 128 Label backtrack_; | 133 Label backtrack_; |
| 129 | 134 |
| 130 DISALLOW_IMPLICIT_CONSTRUCTORS(RegExpMacroAssemblerIrregexp); | 135 DISALLOW_IMPLICIT_CONSTRUCTORS(RegExpMacroAssemblerIrregexp); |
| 131 }; | 136 }; |
| 132 | 137 |
| 133 } } // namespace v8::internal | 138 } } // namespace v8::internal |
| 134 | 139 |
| 135 #endif // V8_REGEXP_MACRO_ASSEMBLER_IRREGEXP_H_ | 140 #endif // V8_REGEXP_MACRO_ASSEMBLER_IRREGEXP_H_ |
| OLD | NEW |