| 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 27 matching lines...) Expand all Loading... |
| 38 Label* on_match; | 38 Label* on_match; |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 | 41 |
| 42 class RegExpMacroAssembler { | 42 class RegExpMacroAssembler { |
| 43 public: | 43 public: |
| 44 // The implementation must be able to handle at least: | 44 // The implementation must be able to handle at least: |
| 45 static const int kMaxRegister = (1 << 16) - 1; | 45 static const int kMaxRegister = (1 << 16) - 1; |
| 46 static const int kMaxCPOffset = (1 << 15) - 1; | 46 static const int kMaxCPOffset = (1 << 15) - 1; |
| 47 static const int kMinCPOffset = -(1 << 15); | 47 static const int kMinCPOffset = -(1 << 15); |
| 48 |
| 49 static const int kTableSizeBits = 7; |
| 50 static const int kTableSize = 1 << kTableSizeBits; |
| 51 static const int kTableMask = kTableSize - 1; |
| 52 |
| 48 enum IrregexpImplementation { | 53 enum IrregexpImplementation { |
| 49 kIA32Implementation, | 54 kIA32Implementation, |
| 50 kARMImplementation, | 55 kARMImplementation, |
| 51 kMIPSImplementation, | 56 kMIPSImplementation, |
| 52 kX64Implementation, | 57 kX64Implementation, |
| 53 kBytecodeImplementation | 58 kBytecodeImplementation |
| 54 }; | 59 }; |
| 55 | 60 |
| 56 enum StackCheckFlag { | 61 enum StackCheckFlag { |
| 57 kNoStackLimitCheck = false, | 62 kNoStackLimitCheck = false, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 virtual void CheckNotBackReferenceIgnoreCase(int start_reg, | 104 virtual void CheckNotBackReferenceIgnoreCase(int start_reg, |
| 100 Label* on_no_match) = 0; | 105 Label* on_no_match) = 0; |
| 101 // Check the current character for a match with a literal character. If we | 106 // Check the current character for a match with a literal character. If we |
| 102 // fail to match then goto the on_failure label. End of input always | 107 // fail to match then goto the on_failure label. End of input always |
| 103 // matches. If the label is NULL then we should pop a backtrack address off | 108 // matches. If the label is NULL then we should pop a backtrack address off |
| 104 // the stack and go to that. | 109 // the stack and go to that. |
| 105 virtual void CheckNotCharacter(unsigned c, Label* on_not_equal) = 0; | 110 virtual void CheckNotCharacter(unsigned c, Label* on_not_equal) = 0; |
| 106 virtual void CheckNotCharacterAfterAnd(unsigned c, | 111 virtual void CheckNotCharacterAfterAnd(unsigned c, |
| 107 unsigned and_with, | 112 unsigned and_with, |
| 108 Label* on_not_equal) = 0; | 113 Label* on_not_equal) = 0; |
| 109 // Subtract a constant from the current character, then or with the given | 114 // Subtract a constant from the current character, then and with the given |
| 110 // constant and then check for a match with c. | 115 // constant and then check for a match with c. |
| 111 virtual void CheckNotCharacterAfterMinusAnd(uc16 c, | 116 virtual void CheckNotCharacterAfterMinusAnd(uc16 c, |
| 112 uc16 minus, | 117 uc16 minus, |
| 113 uc16 and_with, | 118 uc16 and_with, |
| 114 Label* on_not_equal) = 0; | 119 Label* on_not_equal) = 0; |
| 120 virtual void CheckCharacterInRange(uc16 from, |
| 121 uc16 to, // Both inclusive. |
| 122 Label* on_in_range) = 0; |
| 123 virtual void CheckCharacterNotInRange(uc16 from, |
| 124 uc16 to, // Both inclusive. |
| 125 Label* on_not_in_range) = 0; |
| 126 |
| 127 // The current character (modulus the kTableSize) is looked up in the byte |
| 128 // array, and if the found byte is non-zero, we jump to the on_bit_set label. |
| 129 virtual void CheckBitInTable(Handle<ByteArray> table, Label* on_bit_set) = 0; |
| 130 |
| 115 virtual void CheckNotRegistersEqual(int reg1, | 131 virtual void CheckNotRegistersEqual(int reg1, |
| 116 int reg2, | 132 int reg2, |
| 117 Label* on_not_equal) = 0; | 133 Label* on_not_equal) = 0; |
| 118 | 134 |
| 119 // Checks whether the given offset from the current position is before | 135 // Checks whether the given offset from the current position is before |
| 120 // the end of the string. May overwrite the current character. | 136 // the end of the string. May overwrite the current character. |
| 121 virtual void CheckPosition(int cp_offset, Label* on_outside_input) { | 137 virtual void CheckPosition(int cp_offset, Label* on_outside_input) { |
| 122 LoadCurrentCharacter(cp_offset, on_outside_input, true); | 138 LoadCurrentCharacter(cp_offset, on_outside_input, true); |
| 123 } | 139 } |
| 124 // Check whether a standard/default character class matches the current | 140 // Check whether a standard/default character class matches the current |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 const byte* input_end, | 250 const byte* input_end, |
| 235 int* output, | 251 int* output, |
| 236 Isolate* isolate); | 252 Isolate* isolate); |
| 237 }; | 253 }; |
| 238 | 254 |
| 239 #endif // V8_INTERPRETED_REGEXP | 255 #endif // V8_INTERPRETED_REGEXP |
| 240 | 256 |
| 241 } } // namespace v8::internal | 257 } } // namespace v8::internal |
| 242 | 258 |
| 243 #endif // V8_REGEXP_MACRO_ASSEMBLER_H_ | 259 #endif // V8_REGEXP_MACRO_ASSEMBLER_H_ |
| OLD | NEW |