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

Side by Side Diff: src/regexp-macro-assembler-irregexp.cc

Issue 17409: Check for empty repetitions. (Closed)
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
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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 int comparand, 394 int comparand,
395 Label* on_greater_or_equal) { 395 Label* on_greater_or_equal) {
396 ASSERT(comparand >= 0 && comparand <= 65535); 396 ASSERT(comparand >= 0 && comparand <= 65535);
397 Emit(BC_CHECK_REGISTER_GE); 397 Emit(BC_CHECK_REGISTER_GE);
398 Emit(register_index); 398 Emit(register_index);
399 Emit16(comparand); 399 Emit16(comparand);
400 EmitOrLink(on_greater_or_equal); 400 EmitOrLink(on_greater_or_equal);
401 } 401 }
402 402
403 403
404 void RegExpMacroAssemblerIrregexp::IfRegisterEqPos(int register_index,
405 Label* on_eq) {
406 Emit(BC_CHECK_REGISTER_EQ_POS);
407 Emit(register_index);
408 EmitOrLink(on_eq);
409 }
410
411
404 Handle<Object> RegExpMacroAssemblerIrregexp::GetCode(Handle<String> source) { 412 Handle<Object> RegExpMacroAssemblerIrregexp::GetCode(Handle<String> source) {
405 Bind(&backtrack_); 413 Bind(&backtrack_);
406 Emit(BC_POP_BT); 414 Emit(BC_POP_BT);
407 Handle<ByteArray> array = Factory::NewByteArray(length()); 415 Handle<ByteArray> array = Factory::NewByteArray(length());
408 Copy(array->GetDataStartAddress()); 416 Copy(array->GetDataStartAddress());
409 return array; 417 return array;
410 } 418 }
411 419
412 420
413 int RegExpMacroAssemblerIrregexp::length() { 421 int RegExpMacroAssemblerIrregexp::length() {
(...skipping 12 matching lines...) Expand all
426 buffer_ = Vector<byte>::New(old_buffer.length() * 2); 434 buffer_ = Vector<byte>::New(old_buffer.length() * 2);
427 own_buffer_ = true; 435 own_buffer_ = true;
428 memcpy(buffer_.start(), old_buffer.start(), old_buffer.length()); 436 memcpy(buffer_.start(), old_buffer.start(), old_buffer.length());
429 if (old_buffer_was_our_own) { 437 if (old_buffer_was_our_own) {
430 old_buffer.Dispose(); 438 old_buffer.Dispose();
431 } 439 }
432 } 440 }
433 441
434 442
435 } } // namespace v8::internal 443 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698