| OLD | NEW |
| 1 // Copyright 2008-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2008-2009 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // | 45 // |
| 46 // If the provided buffer is not NULL, the assembler uses the provided buffer | 46 // If the provided buffer is not NULL, the assembler uses the provided buffer |
| 47 // for code generation and assumes its size to be buffer_size. If the buffer | 47 // for code generation and assumes its size to be buffer_size. If the buffer |
| 48 // is too small, a fatal error occurs. No deallocation of the buffer is done | 48 // is too small, a fatal error occurs. No deallocation of the buffer is done |
| 49 // upon destruction of the assembler. | 49 // upon destruction of the assembler. |
| 50 explicit RegExpMacroAssemblerIrregexp(Vector<byte>); | 50 explicit RegExpMacroAssemblerIrregexp(Vector<byte>); |
| 51 virtual ~RegExpMacroAssemblerIrregexp(); | 51 virtual ~RegExpMacroAssemblerIrregexp(); |
| 52 // The byte-code interpreter checks on each push anyway. | 52 // The byte-code interpreter checks on each push anyway. |
| 53 virtual int stack_limit_slack() { return 1; } | 53 virtual int stack_limit_slack() { return 1; } |
| 54 virtual void Bind(Label* label); | 54 virtual void Bind(Label* label); |
| 55 virtual void EmitOrLink(Label* label); | |
| 56 virtual void AdvanceCurrentPosition(int by); // Signed cp change. | 55 virtual void AdvanceCurrentPosition(int by); // Signed cp change. |
| 57 virtual void PopCurrentPosition(); | 56 virtual void PopCurrentPosition(); |
| 58 virtual void PushCurrentPosition(); | 57 virtual void PushCurrentPosition(); |
| 59 virtual void Backtrack(); | 58 virtual void Backtrack(); |
| 60 virtual void GoTo(Label* label); | 59 virtual void GoTo(Label* label); |
| 61 virtual void PushBacktrack(Label* label); | 60 virtual void PushBacktrack(Label* label); |
| 62 virtual void Succeed(); | 61 virtual void Succeed(); |
| 63 virtual void Fail(); | 62 virtual void Fail(); |
| 64 virtual void PopRegister(int register_index); | 63 virtual void PopRegister(int register_index); |
| 65 virtual void PushRegister(int register_index, | 64 virtual void PushRegister(int register_index, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 93 uc16 mask, | 92 uc16 mask, |
| 94 Label* on_not_equal); | 93 Label* on_not_equal); |
| 95 virtual void CheckNotBackReference(int start_reg, Label* on_no_match); | 94 virtual void CheckNotBackReference(int start_reg, Label* on_no_match); |
| 96 virtual void CheckNotBackReferenceIgnoreCase(int start_reg, | 95 virtual void CheckNotBackReferenceIgnoreCase(int start_reg, |
| 97 Label* on_no_match); | 96 Label* on_no_match); |
| 98 virtual void CheckNotRegistersEqual(int reg1, int reg2, Label* on_not_equal); | 97 virtual void CheckNotRegistersEqual(int reg1, int reg2, Label* on_not_equal); |
| 99 virtual void CheckCharacters(Vector<const uc16> str, | 98 virtual void CheckCharacters(Vector<const uc16> str, |
| 100 int cp_offset, | 99 int cp_offset, |
| 101 Label* on_failure, | 100 Label* on_failure, |
| 102 bool check_end_of_string); | 101 bool check_end_of_string); |
| 103 virtual void CheckBitmap(uc16 start, Label* bitmap, Label* on_zero); | |
| 104 virtual void DispatchHalfNibbleMap(uc16 start, | |
| 105 Label* half_nibble_map, | |
| 106 const Vector<Label*>& destinations); | |
| 107 virtual void DispatchByteMap(uc16 start, | |
| 108 Label* byte_map, | |
| 109 const Vector<Label*>& destinations); | |
| 110 virtual void DispatchHighByteMap(byte start, | |
| 111 Label* byte_map, | |
| 112 const Vector<Label*>& destinations); | |
| 113 virtual void IfRegisterLT(int register_index, int comparand, Label* if_lt); | 102 virtual void IfRegisterLT(int register_index, int comparand, Label* if_lt); |
| 114 virtual void IfRegisterGE(int register_index, int comparand, Label* if_ge); | 103 virtual void IfRegisterGE(int register_index, int comparand, Label* if_ge); |
| 115 virtual void IfRegisterEqPos(int register_index, Label* if_eq); | 104 virtual void IfRegisterEqPos(int register_index, Label* if_eq); |
| 116 | 105 |
| 117 virtual IrregexpImplementation Implementation(); | 106 virtual IrregexpImplementation Implementation(); |
| 118 virtual Handle<Object> GetCode(Handle<String> source); | 107 virtual Handle<Object> GetCode(Handle<String> source); |
| 119 private: | 108 private: |
| 120 void Expand(); | 109 void Expand(); |
| 121 // Code and bitmap emission. | 110 // Code and bitmap emission. |
| 111 inline void EmitOrLink(Label* label); |
| 122 inline void Emit32(uint32_t x); | 112 inline void Emit32(uint32_t x); |
| 123 inline void Emit16(uint32_t x); | 113 inline void Emit16(uint32_t x); |
| 124 inline void Emit(uint32_t bc, uint32_t arg); | 114 inline void Emit(uint32_t bc, uint32_t arg); |
| 125 // Bytecode buffer. | 115 // Bytecode buffer. |
| 126 int length(); | 116 int length(); |
| 127 void Copy(Address a); | 117 void Copy(Address a); |
| 128 | 118 |
| 129 // The buffer into which code and relocation info are generated. | 119 // The buffer into which code and relocation info are generated. |
| 130 Vector<byte> buffer_; | 120 Vector<byte> buffer_; |
| 131 // The program counter. | 121 // The program counter. |
| 132 int pc_; | 122 int pc_; |
| 133 // True if the assembler owns the buffer, false if buffer is external. | 123 // True if the assembler owns the buffer, false if buffer is external. |
| 134 bool own_buffer_; | 124 bool own_buffer_; |
| 135 Label backtrack_; | 125 Label backtrack_; |
| 136 | 126 |
| 137 int advance_current_start_; | 127 int advance_current_start_; |
| 138 int advance_current_offset_; | 128 int advance_current_offset_; |
| 139 int advance_current_end_; | 129 int advance_current_end_; |
| 140 | 130 |
| 141 static const int kInvalidPC = -1; | 131 static const int kInvalidPC = -1; |
| 142 | 132 |
| 143 DISALLOW_IMPLICIT_CONSTRUCTORS(RegExpMacroAssemblerIrregexp); | 133 DISALLOW_IMPLICIT_CONSTRUCTORS(RegExpMacroAssemblerIrregexp); |
| 144 }; | 134 }; |
| 145 | 135 |
| 146 } } // namespace v8::internal | 136 } } // namespace v8::internal |
| 147 | 137 |
| 148 #endif // V8_REGEXP_MACRO_ASSEMBLER_IRREGEXP_H_ | 138 #endif // V8_REGEXP_MACRO_ASSEMBLER_IRREGEXP_H_ |
| OLD | NEW |