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

Side by Side Diff: src/interpreter-irregexp.cc

Issue 10998: Add an operation that checks whether we are at the start of the string. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years 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/bytecodes-irregexp.h ('k') | src/regexp-macro-assembler.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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 break; 358 break;
359 } else { 359 } else {
360 if (BackRefMatchesNoCase(from, current, len, subject)) { 360 if (BackRefMatchesNoCase(from, current, len, subject)) {
361 pc += BC_CHECK_NOT_BACK_REF_NO_CASE_LENGTH; 361 pc += BC_CHECK_NOT_BACK_REF_NO_CASE_LENGTH;
362 } else { 362 } else {
363 pc = code_base + Load32(pc + 2); 363 pc = code_base + Load32(pc + 2);
364 } 364 }
365 } 365 }
366 break; 366 break;
367 } 367 }
368 BYTECODE(CHECK_NOT_AT_START)
369 if (current == 0) {
370 pc += BC_CHECK_NOT_AT_START_LENGTH;
371 } else {
372 pc = code_base + Load32(pc + 1);
373 }
374 break;
368 default: 375 default:
369 UNREACHABLE(); 376 UNREACHABLE();
370 break; 377 break;
371 } 378 }
372 } 379 }
373 } 380 }
374 381
375 382
376 bool IrregexpInterpreter::Match(Handle<ByteArray> code_array, 383 bool IrregexpInterpreter::Match(Handle<ByteArray> code_array,
377 Handle<String> subject16, 384 Handle<String> subject16,
378 int* registers, 385 int* registers,
379 int start_position) { 386 int start_position) {
380 ASSERT(StringShape(*subject16).IsTwoByteRepresentation()); 387 ASSERT(StringShape(*subject16).IsTwoByteRepresentation());
381 ASSERT(subject16->IsFlat(StringShape(*subject16))); 388 ASSERT(subject16->IsFlat(StringShape(*subject16)));
382 389
383 AssertNoAllocation a; 390 AssertNoAllocation a;
384 const byte* code_base = code_array->GetDataStartAddress(); 391 const byte* code_base = code_array->GetDataStartAddress();
385 uc16 previous_char = '\n'; 392 uc16 previous_char = '\n';
386 Vector<const uc16> subject_vector = 393 Vector<const uc16> subject_vector =
387 Vector<const uc16>(subject16->GetTwoByteData(), subject16->length()); 394 Vector<const uc16>(subject16->GetTwoByteData(), subject16->length());
388 if (start_position != 0) previous_char = subject_vector[start_position - 1]; 395 if (start_position != 0) previous_char = subject_vector[start_position - 1];
389 return RawMatch(code_base, 396 return RawMatch(code_base,
390 subject_vector, 397 subject_vector,
391 registers, 398 registers,
392 start_position, 399 start_position,
393 previous_char); 400 previous_char);
394 } 401 }
395 402
396 } } // namespace v8::internal 403 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bytecodes-irregexp.h ('k') | src/regexp-macro-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698