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

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

Issue 45010: Remove all uses of StringShape variables, since that has proven... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 9 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/prettyprinter.cc ('k') | src/runtime.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 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 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 } 978 }
979 979
980 980
981 981
982 RegExpMacroAssemblerIA32::Result RegExpMacroAssemblerIA32::Match( 982 RegExpMacroAssemblerIA32::Result RegExpMacroAssemblerIA32::Match(
983 Handle<Code> regexp_code, 983 Handle<Code> regexp_code,
984 Handle<String> subject, 984 Handle<String> subject,
985 int* offsets_vector, 985 int* offsets_vector,
986 int offsets_vector_length, 986 int offsets_vector_length,
987 int previous_index) { 987 int previous_index) {
988 StringShape shape(*subject);
989
990 // Character offsets into string. 988 // Character offsets into string.
991 int start_offset = previous_index; 989 int start_offset = previous_index;
992 int end_offset = subject->length(shape); 990 int end_offset = subject->length();
993 991
994 if (shape.IsCons()) { 992 if (StringShape(*subject).IsCons()) {
995 subject = 993 subject =
996 Handle<String>(String::cast(ConsString::cast(*subject)->first())); 994 Handle<String>(String::cast(ConsString::cast(*subject)->first()));
997 } else if (shape.IsSliced()) { 995 } else if (StringShape(*subject).IsSliced()) {
998 SlicedString* slice = SlicedString::cast(*subject); 996 SlicedString* slice = SlicedString::cast(*subject);
999 start_offset += slice->start(); 997 start_offset += slice->start();
1000 end_offset += slice->start(); 998 end_offset += slice->start();
1001 subject = Handle<String>(String::cast(slice->buffer())); 999 subject = Handle<String>(String::cast(slice->buffer()));
1002 } 1000 }
1003 1001
1004 // String is now either Sequential or External 1002 // String is now either Sequential or External
1005 StringShape flatshape(*subject); 1003 bool is_ascii = StringShape(*subject).IsAsciiRepresentation();
1006 bool is_ascii = flatshape.IsAsciiRepresentation();
1007 int char_size_shift = is_ascii ? 0 : 1; 1004 int char_size_shift = is_ascii ? 0 : 1;
1008 1005
1009 RegExpMacroAssemblerIA32::Result res; 1006 RegExpMacroAssemblerIA32::Result res;
1010 1007
1011 if (flatshape.IsExternal()) { 1008 if (StringShape(*subject).IsExternal()) {
1012 const byte* address; 1009 const byte* address;
1013 if (is_ascii) { 1010 if (is_ascii) {
1014 ExternalAsciiString* ext = ExternalAsciiString::cast(*subject); 1011 ExternalAsciiString* ext = ExternalAsciiString::cast(*subject);
1015 address = reinterpret_cast<const byte*>(ext->resource()->data()); 1012 address = reinterpret_cast<const byte*>(ext->resource()->data());
1016 } else { 1013 } else {
1017 ExternalTwoByteString* ext = ExternalTwoByteString::cast(*subject); 1014 ExternalTwoByteString* ext = ExternalTwoByteString::cast(*subject);
1018 address = reinterpret_cast<const byte*>(ext->resource()->data()); 1015 address = reinterpret_cast<const byte*>(ext->resource()->data());
1019 } 1016 }
1020 1017
1021 res = Execute(*regexp_code, 1018 res = Execute(*regexp_code,
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1325 1322
1326 1323
1327 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg, 1324 void RegExpMacroAssemblerIA32::LoadConstantBufferAddress(Register reg,
1328 ArraySlice* buffer) { 1325 ArraySlice* buffer) {
1329 __ mov(reg, buffer->array()); 1326 __ mov(reg, buffer->array());
1330 __ add(Operand(reg), Immediate(buffer->base_offset())); 1327 __ add(Operand(reg), Immediate(buffer->base_offset()));
1331 } 1328 }
1332 1329
1333 #undef __ 1330 #undef __
1334 }} // namespace v8::internal 1331 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « src/prettyprinter.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698