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/interpreter-irregexp.cc

Issue 7477045: Tentative implementation of string slices (hidden under the flag --string-slices). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Some more suggested changes. 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
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 617 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
639 if (subject->IsAsciiRepresentationUnderneath()) {
639 Vector<const char> subject_vector = subject->ToAsciiVector(); 640 Vector<const char> subject_vector = subject->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 Vector<const uc16> subject_vector = subject->ToUC16Vector();
649 if (start_position != 0) previous_char = subject_vector[start_position - 1]; 650 if (start_position != 0) previous_char = subject_vector[start_position - 1];
650 return RawMatch(isolate, 651 return RawMatch(isolate,
651 code_base, 652 code_base,
652 subject_vector, 653 subject_vector,
653 registers, 654 registers,
654 start_position, 655 start_position,
655 previous_char); 656 previous_char);
656 } 657 }
657 } 658 }
658 659
659 } } // namespace v8::internal 660 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698