Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(770)

Side by Side Diff: src/regexp-macro-assembler.h

Issue 18842: Experimental: periodic merge of the bleeding_edge branch to the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/property.h ('k') | src/regexp-macro-assembler-ia32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 20 matching lines...) Expand all
31 namespace v8 { namespace internal { 31 namespace v8 { namespace internal {
32 32
33 struct DisjunctDecisionRow { 33 struct DisjunctDecisionRow {
34 RegExpCharacterClass cc; 34 RegExpCharacterClass cc;
35 Label* on_match; 35 Label* on_match;
36 }; 36 };
37 37
38 38
39 class RegExpMacroAssembler { 39 class RegExpMacroAssembler {
40 public: 40 public:
41 // The implementation must be able to handle at least:
42 static const int kMaxRegister = (1 << 16) - 1;
43 static const int kMaxCPOffset = (1 << 15) - 1;
44 static const int kMinCPOffset = -(1 << 15);
41 enum IrregexpImplementation { 45 enum IrregexpImplementation {
42 kIA32Implementation, 46 kIA32Implementation,
43 kARMImplementation, 47 kARMImplementation,
44 kBytecodeImplementation 48 kBytecodeImplementation
45 }; 49 };
46 50
47 enum StackCheckFlag { 51 enum StackCheckFlag {
48 kNoStackLimitCheck = false, 52 kNoStackLimitCheck = false,
49 kCheckStackLimit = true 53 kCheckStackLimit = true
50 }; 54 };
51 55
52 RegExpMacroAssembler(); 56 RegExpMacroAssembler();
53 virtual ~RegExpMacroAssembler(); 57 virtual ~RegExpMacroAssembler();
54 // The maximal number of pushes between stack checks. Users must supply 58 // The maximal number of pushes between stack checks. Users must supply
55 // kCheckStackLimit flag to push operations (instead of kNoStackLimitCheck) 59 // kCheckStackLimit flag to push operations (instead of kNoStackLimitCheck)
56 // at least once for every stack_limit() pushes that are executed. 60 // at least once for every stack_limit() pushes that are executed.
57 virtual int stack_limit_slack() = 0; 61 virtual int stack_limit_slack() = 0;
58 virtual void AdvanceCurrentPosition(int by) = 0; // Signed cp change. 62 virtual void AdvanceCurrentPosition(int by) = 0; // Signed cp change.
59 virtual void AdvanceRegister(int reg, int by) = 0; // r[reg] += by. 63 virtual void AdvanceRegister(int reg, int by) = 0; // r[reg] += by.
60 // Continues execution from the position pushed on the top of the backtrack 64 // Continues execution from the position pushed on the top of the backtrack
61 // stack by an earlier PushBacktrack(Label*). 65 // stack by an earlier PushBacktrack(Label*).
62 virtual void Backtrack() = 0; 66 virtual void Backtrack() = 0;
63 virtual void Bind(Label* label) = 0; 67 virtual void Bind(Label* label) = 0;
68 virtual void CheckAtStart(Label* on_at_start) = 0;
64 // Check the current character against a bitmap. The range of the current 69 // Check the current character against a bitmap. The range of the current
65 // character must be from start to start + length_of_bitmap_in_bits. 70 // character must be from start to start + length_of_bitmap_in_bits.
66 virtual void CheckBitmap( 71 virtual void CheckBitmap(
67 uc16 start, // The bitmap is indexed from this character. 72 uc16 start, // The bitmap is indexed from this character.
68 Label* bitmap, // Where the bitmap is emitted. 73 Label* bitmap, // Where the bitmap is emitted.
69 Label* on_zero) = 0; // Where to go if the bit is 0. Fall through on 1. 74 Label* on_zero) = 0; // Where to go if the bit is 0. Fall through on 1.
70 // Dispatch after looking the current character up in a 2-bits-per-entry 75 // Dispatch after looking the current character up in a 2-bits-per-entry
71 // map. The destinations vector has up to 4 labels. 76 // map. The destinations vector has up to 4 labels.
72 virtual void CheckCharacter(uint32_t c, Label* on_equal) = 0; 77 virtual void CheckCharacter(uint32_t c, Label* on_equal) = 0;
73 // Bitwise and the current character with the given constant and then 78 // Bitwise and the current character with the given constant and then
(...skipping 29 matching lines...) Expand all
103 Label* on_not_equal) = 0; 108 Label* on_not_equal) = 0;
104 // Subtract a constant from the current character, then or with the given 109 // Subtract a constant from the current character, then or with the given
105 // constant and then check for a match with c. 110 // constant and then check for a match with c.
106 virtual void CheckNotCharacterAfterMinusAnd(uc16 c, 111 virtual void CheckNotCharacterAfterMinusAnd(uc16 c,
107 uc16 minus, 112 uc16 minus,
108 uc16 and_with, 113 uc16 and_with,
109 Label* on_not_equal) = 0; 114 Label* on_not_equal) = 0;
110 virtual void CheckNotRegistersEqual(int reg1, 115 virtual void CheckNotRegistersEqual(int reg1,
111 int reg2, 116 int reg2,
112 Label* on_not_equal) = 0; 117 Label* on_not_equal) = 0;
118
119 // Checks whether the given offset from the current position is before
120 // the end of the string. May overwrite the current character.
121 virtual void CheckPosition(int cp_offset, Label* on_outside_input) {
122 LoadCurrentCharacter(cp_offset, on_outside_input, true);
123 }
113 // Check whether a standard/default character class matches the current 124 // Check whether a standard/default character class matches the current
114 // character. Returns false if the type of special character class does 125 // character. Returns false if the type of special character class does
115 // not have custom support. 126 // not have custom support.
116 // May clobber the current loaded character. 127 // May clobber the current loaded character.
117 virtual bool CheckSpecialCharacterClass(uc16 type, 128 virtual bool CheckSpecialCharacterClass(uc16 type,
118 int cp_offset, 129 int cp_offset,
119 bool check_offset, 130 bool check_offset,
120 Label* on_no_match) { 131 Label* on_no_match) {
121 return false; 132 return false;
122 } 133 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // will go to this label. Always checks the backtrack stack limit. 171 // will go to this label. Always checks the backtrack stack limit.
161 virtual void PushBacktrack(Label* label) = 0; 172 virtual void PushBacktrack(Label* label) = 0;
162 virtual void PushCurrentPosition() = 0; 173 virtual void PushCurrentPosition() = 0;
163 virtual void PushRegister(int register_index, 174 virtual void PushRegister(int register_index,
164 StackCheckFlag check_stack_limit) = 0; 175 StackCheckFlag check_stack_limit) = 0;
165 virtual void ReadCurrentPositionFromRegister(int reg) = 0; 176 virtual void ReadCurrentPositionFromRegister(int reg) = 0;
166 virtual void ReadStackPointerFromRegister(int reg) = 0; 177 virtual void ReadStackPointerFromRegister(int reg) = 0;
167 virtual void SetRegister(int register_index, int to) = 0; 178 virtual void SetRegister(int register_index, int to) = 0;
168 virtual void Succeed() = 0; 179 virtual void Succeed() = 0;
169 virtual void WriteCurrentPositionToRegister(int reg, int cp_offset) = 0; 180 virtual void WriteCurrentPositionToRegister(int reg, int cp_offset) = 0;
170 virtual void ClearRegister(int reg) = 0; 181 virtual void ClearRegisters(int reg_from, int reg_to) = 0;
171 virtual void WriteStackPointerToRegister(int reg) = 0; 182 virtual void WriteStackPointerToRegister(int reg) = 0;
172 183
173 private: 184 private:
174 }; 185 };
175 186
176 187
177 struct ArraySlice { 188 struct ArraySlice {
178 public: 189 public:
179 ArraySlice(Handle<ByteArray> array, size_t offset) 190 ArraySlice(Handle<ByteArray> array, size_t offset)
180 : array_(array), offset_(offset) {} 191 : array_(array), offset_(offset) {}
(...skipping 29 matching lines...) Expand all
210 ArraySlice GetBuffer(Vector<T> values); 221 ArraySlice GetBuffer(Vector<T> values);
211 private: 222 private:
212 size_t byte_array_size_; 223 size_t byte_array_size_;
213 Handle<ByteArray> current_byte_array_; 224 Handle<ByteArray> current_byte_array_;
214 int current_byte_array_free_offset_; 225 int current_byte_array_free_offset_;
215 }; 226 };
216 227
217 } } // namespace v8::internal 228 } } // namespace v8::internal
218 229
219 #endif // V8_REGEXP_MACRO_ASSEMBLER_H_ 230 #endif // V8_REGEXP_MACRO_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « src/property.h ('k') | src/regexp-macro-assembler-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698