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

Side by Side Diff: src/jsregexp.cc

Issue 100249: When strings can change from an ASCII representation to a... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 7 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
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 // Dispatch to the correct RegExp implementation. 422 // Dispatch to the correct RegExp implementation.
423 423
424 Handle<String> original_subject = subject; 424 Handle<String> original_subject = subject;
425 Handle<FixedArray> regexp(FixedArray::cast(jsregexp->data())); 425 Handle<FixedArray> regexp(FixedArray::cast(jsregexp->data()));
426 if (UseNativeRegexp()) { 426 if (UseNativeRegexp()) {
427 #ifdef ARM 427 #ifdef ARM
428 UNREACHABLE(); 428 UNREACHABLE();
429 #else 429 #else
430 RegExpMacroAssemblerIA32::Result res; 430 RegExpMacroAssemblerIA32::Result res;
431 do { 431 do {
432 bool is_ascii = StringShape(*subject).IsAsciiRepresentation(); 432 bool is_ascii = subject->IsAsciiRepresentation();
433 if (!EnsureCompiledIrregexp(jsregexp, is_ascii)) { 433 if (!EnsureCompiledIrregexp(jsregexp, is_ascii)) {
434 return Handle<Object>::null(); 434 return Handle<Object>::null();
435 } 435 }
436 Handle<Code> code(RegExpImpl::IrregexpNativeCode(*regexp, is_ascii)); 436 Handle<Code> code(RegExpImpl::IrregexpNativeCode(*regexp, is_ascii));
437 res = RegExpMacroAssemblerIA32::Match(code, 437 res = RegExpMacroAssemblerIA32::Match(code,
438 subject, 438 subject,
439 offsets_vector, 439 offsets_vector,
440 offsets.length(), 440 offsets.length(),
441 previous_index); 441 previous_index);
442 // If result is RETRY, the string have changed representation, and we 442 // If result is RETRY, the string have changed representation, and we
443 // must restart from scratch. 443 // must restart from scratch.
444 } while (res == RegExpMacroAssemblerIA32::RETRY); 444 } while (res == RegExpMacroAssemblerIA32::RETRY);
445 if (res == RegExpMacroAssemblerIA32::EXCEPTION) { 445 if (res == RegExpMacroAssemblerIA32::EXCEPTION) {
446 ASSERT(Top::has_pending_exception()); 446 ASSERT(Top::has_pending_exception());
447 return Handle<Object>::null(); 447 return Handle<Object>::null();
448 } 448 }
449 ASSERT(res == RegExpMacroAssemblerIA32::SUCCESS 449 ASSERT(res == RegExpMacroAssemblerIA32::SUCCESS
450 || res == RegExpMacroAssemblerIA32::FAILURE); 450 || res == RegExpMacroAssemblerIA32::FAILURE);
451 451
452 rc = (res == RegExpMacroAssemblerIA32::SUCCESS); 452 rc = (res == RegExpMacroAssemblerIA32::SUCCESS);
453 #endif 453 #endif
454 } else { 454 } else {
455 bool is_ascii = StringShape(*subject).IsAsciiRepresentation(); 455 bool is_ascii = subject->IsAsciiRepresentation();
456 if (!EnsureCompiledIrregexp(jsregexp, is_ascii)) { 456 if (!EnsureCompiledIrregexp(jsregexp, is_ascii)) {
457 return Handle<Object>::null(); 457 return Handle<Object>::null();
458 } 458 }
459 for (int i = number_of_capture_registers - 1; i >= 0; i--) { 459 for (int i = number_of_capture_registers - 1; i >= 0; i--) {
460 offsets_vector[i] = -1; 460 offsets_vector[i] = -1;
461 } 461 }
462 Handle<ByteArray> byte_codes(IrregexpByteCode(*regexp, is_ascii)); 462 Handle<ByteArray> byte_codes(IrregexpByteCode(*regexp, is_ascii));
463 463
464 rc = IrregexpInterpreter::Match(byte_codes, 464 rc = IrregexpInterpreter::Match(byte_codes,
465 subject, 465 subject,
(...skipping 3988 matching lines...) Expand 10 before | Expand all | Expand 10 after
4454 EmbeddedVector<byte, 1024> codes; 4454 EmbeddedVector<byte, 1024> codes;
4455 RegExpMacroAssemblerIrregexp macro_assembler(codes); 4455 RegExpMacroAssemblerIrregexp macro_assembler(codes);
4456 return compiler.Assemble(&macro_assembler, 4456 return compiler.Assemble(&macro_assembler,
4457 node, 4457 node,
4458 data->capture_count, 4458 data->capture_count,
4459 pattern); 4459 pattern);
4460 } 4460 }
4461 4461
4462 4462
4463 }} // namespace v8::internal 4463 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « src/interpreter-irregexp.cc ('k') | src/log.cc » ('j') | src/objects-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698