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

Side by Side Diff: src/jsregexp.cc

Issue 9181: Push string shape fixes to trunk (version 0.4.3.1). (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 12 years, 1 month 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/heap.cc ('k') | src/log.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 return two_byte_string; 125 return two_byte_string;
126 } 126 }
127 127
128 128
129 // Converts a source string to a 16 bit flat string or a SlicedString containing 129 // Converts a source string to a 16 bit flat string or a SlicedString containing
130 // a 16 bit flat string). 130 // a 16 bit flat string).
131 Handle<String> RegExpImpl::StringToTwoByte(Handle<String> pattern) { 131 Handle<String> RegExpImpl::StringToTwoByte(Handle<String> pattern) {
132 StringShape shape(*pattern); 132 StringShape shape(*pattern);
133 if (!pattern->IsFlat(shape)) { 133 if (!pattern->IsFlat(shape)) {
134 FlattenString(pattern); 134 FlattenString(pattern);
135 shape = StringShape(*pattern);
135 } 136 }
136 Handle<String> flat_string(shape.IsCons() ? 137 Handle<String> flat_string(shape.IsCons() ?
137 String::cast(ConsString::cast(*pattern)->first()) : 138 String::cast(ConsString::cast(*pattern)->first()) :
138 *pattern); 139 *pattern);
139 ASSERT(flat_string->IsString()); 140 ASSERT(flat_string->IsString());
140 StringShape flat_shape(*flat_string); 141 StringShape flat_shape(*flat_string);
141 ASSERT(!flat_shape.IsCons()); 142 ASSERT(!flat_shape.IsCons());
142 ASSERT(flat_shape.IsSequential() || 143 ASSERT(flat_shape.IsSequential() ||
143 flat_shape.IsSliced() || 144 flat_shape.IsSliced() ||
144 flat_shape.IsExternal()); 145 flat_shape.IsExternal());
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 return Smi::cast(value->get(CAPTURE_INDEX))->value(); 566 return Smi::cast(value->get(CAPTURE_INDEX))->value();
566 } 567 }
567 568
568 569
569 ByteArray* RegExpImpl::JsreInternal(Handle<JSRegExp> re) { 570 ByteArray* RegExpImpl::JsreInternal(Handle<JSRegExp> re) {
570 FixedArray* value = FixedArray::cast(re->DataAt(JSRegExp::kJscreDataIndex)); 571 FixedArray* value = FixedArray::cast(re->DataAt(JSRegExp::kJscreDataIndex));
571 return ByteArray::cast(value->get(INTERNAL_INDEX)); 572 return ByteArray::cast(value->get(INTERNAL_INDEX));
572 } 573 }
573 574
574 }} // namespace v8::internal 575 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698