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

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

Issue 7709024: Replace ToAsciiVector and ToUC16Vector with single function that returns a tagged value. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Require AssertNoAllocation. Fixed bug detected by this requirement. Created 9 years, 4 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/hydrogen-instructions.cc ('k') | src/jsregexp.cc » ('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 2011 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
11 // with the distribution. 11 // with the distribution.
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 bool IrregexpInterpreter::Match(Isolate* isolate, 628 bool IrregexpInterpreter::Match(Isolate* isolate,
629 Handle<ByteArray> code_array, 629 Handle<ByteArray> code_array,
630 Handle<String> subject, 630 Handle<String> subject,
631 int* registers, 631 int* registers,
632 int start_position) { 632 int start_position) {
633 ASSERT(subject->IsFlat()); 633 ASSERT(subject->IsFlat());
634 634
635 AssertNoAllocation a; 635 AssertNoAllocation a;
636 const byte* code_base = code_array->GetDataStartAddress(); 636 const byte* code_base = code_array->GetDataStartAddress();
637 uc16 previous_char = '\n'; 637 uc16 previous_char = '\n';
638 if (subject->IsAsciiRepresentation()) { 638 String::FlatContent subject_content = subject->GetFlatContent(a);
639 Vector<const char> subject_vector = subject->ToAsciiVector(); 639 if (subject_content.IsAscii()) {
640 Vector<const char> subject_vector = subject_content.ToAsciiVector();
640 if (start_position != 0) previous_char = subject_vector[start_position - 1]; 641 if (start_position != 0) previous_char = subject_vector[start_position - 1];
641 return RawMatch(isolate, 642 return RawMatch(isolate,
642 code_base, 643 code_base,
643 subject_vector, 644 subject_vector,
644 registers, 645 registers,
645 start_position, 646 start_position,
646 previous_char); 647 previous_char);
647 } else { 648 } else {
648 Vector<const uc16> subject_vector = subject->ToUC16Vector(); 649 ASSERT(subject_content.IsTwoByte());
650 Vector<const uc16> subject_vector = subject_content.ToUC16Vector();
649 if (start_position != 0) previous_char = subject_vector[start_position - 1]; 651 if (start_position != 0) previous_char = subject_vector[start_position - 1];
650 return RawMatch(isolate, 652 return RawMatch(isolate,
651 code_base, 653 code_base,
652 subject_vector, 654 subject_vector,
653 registers, 655 registers,
654 start_position, 656 start_position,
655 previous_char); 657 previous_char);
656 } 658 }
657 } 659 }
658 660
659 } } // namespace v8::internal 661 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | src/jsregexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698