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

Side by Side Diff: src/assembler-re2k.cc

Issue 11228: * No failures on our own tests.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/regexp2000/
Patch Set: Created 12 years, 1 month 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
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 29 matching lines...) Expand all
40 40
41 41
42 Re2kAssembler::Re2kAssembler(Vector<byte> buffer) 42 Re2kAssembler::Re2kAssembler(Vector<byte> buffer)
43 : buffer_(buffer), 43 : buffer_(buffer),
44 pc_(0), 44 pc_(0),
45 own_buffer_(false) { 45 own_buffer_(false) {
46 } 46 }
47 47
48 48
49 Re2kAssembler::~Re2kAssembler() { 49 Re2kAssembler::~Re2kAssembler() {
50 if (own_buffer_) {
51 buffer_.Dispose();
52 }
50 } 53 }
51 54
52 55
53 void Re2kAssembler::PushCurrentPosition(int cp_offset) { 56 void Re2kAssembler::PushCurrentPosition(int cp_offset) {
54 ASSERT(cp_offset >= 0); 57 ASSERT(cp_offset >= 0);
55 Emit(BC_PUSH_CP); 58 Emit(BC_PUSH_CP);
56 Emit32(cp_offset); 59 Emit32(cp_offset);
57 } 60 }
58 61
59 62
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 } 169 }
167 170
168 171
169 void Re2kAssembler::CheckNotChar(uc16 c, Label* on_match) { 172 void Re2kAssembler::CheckNotChar(uc16 c, Label* on_match) {
170 Emit(BC_CHECK_NOT_CHAR); 173 Emit(BC_CHECK_NOT_CHAR);
171 Emit16(c); 174 Emit16(c);
172 EmitOrLink(on_match); 175 EmitOrLink(on_match);
173 } 176 }
174 177
175 178
176 void Re2kAssembler::CheckRange(uc16 start, uc16 end, Label* on_mismatch) { 179 void Re2kAssembler::CheckCharacterLT(uc16 limit, Label* on_less) {
177 if (start == end) { 180 Emit(BC_CHECK_LT);
178 CheckChar(start, on_mismatch); 181 Emit16(limit);
179 } 182 EmitOrLink(on_less);
180 Emit(BC_CHECK_RANGE);
181 Emit16(start);
182 Emit16(end);
183 EmitOrLink(on_mismatch);
184 } 183 }
185 184
186 185
187 void Re2kAssembler::CheckNotRange(uc16 start, uc16 end, Label* on_match) { 186 void Re2kAssembler::CheckCharacterGT(uc16 limit, Label* on_greater) {
188 Emit(BC_CHECK_NOT_RANGE); 187 Emit(BC_CHECK_GT);
189 Emit16(start); 188 Emit16(limit);
190 Emit16(end); 189 EmitOrLink(on_greater);
191 EmitOrLink(on_match);
192 } 190 }
193 191
194 192
195 void Re2kAssembler::CheckBackref(int capture_index, 193 void Re2kAssembler::CheckBackref(int capture_index,
196 Label* on_mismatch) { 194 Label* on_mismatch) {
197 Emit(BC_CHECK_BACKREF); 195 Emit(BC_CHECK_BACKREF);
198 Emit32(0); 196 Emit32(0);
199 Emit(capture_index); 197 Emit(capture_index);
200 EmitOrLink(on_mismatch); 198 EmitOrLink(on_mismatch);
201 } 199 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 276
279 int Re2kAssembler::length() { 277 int Re2kAssembler::length() {
280 return pc_; 278 return pc_;
281 } 279 }
282 280
283 281
284 void Re2kAssembler::Copy(Address a) { 282 void Re2kAssembler::Copy(Address a) {
285 memcpy(a, buffer_.start(), length()); 283 memcpy(a, buffer_.start(), length());
286 } 284 }
287 285
286
287 void Re2kAssembler::Expand() {
288 bool old_buffer_was_our_own = own_buffer_;
289 Vector<byte> old_buffer = buffer_;
290 buffer_ = Vector<byte>::New(old_buffer.length() * 2);
291 own_buffer_ = true;
292 memcpy(buffer_.start(), old_buffer.start(), old_buffer.length());
293 if (old_buffer_was_our_own) {
294 old_buffer.Dispose();
295 }
296 }
297
298
288 } } // namespace v8::internal 299 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/assembler-re2k.h ('k') | src/assembler-re2k-inl.h » ('j') | src/bytecodes-re2k.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698