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

Side by Side Diff: src/jsregexp.cc

Issue 6342: Specialized string equality based on representation (Closed)
Patch Set: Created 12 years, 2 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
« no previous file with comments | « src/heap.cc ('k') | src/objects.h » ('j') | src/objects.h » ('J')
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 Handle<String> RegExpImpl::StringToTwoByte(Handle<String> pattern) { 121 Handle<String> RegExpImpl::StringToTwoByte(Handle<String> pattern) {
122 if (!pattern->IsFlat()) { 122 if (!pattern->IsFlat()) {
123 FlattenString(pattern); 123 FlattenString(pattern);
124 } 124 }
125 Handle<String> flat_string(pattern->IsConsString() ? 125 Handle<String> flat_string(pattern->IsConsString() ?
126 String::cast(ConsString::cast(*pattern)->first()) : 126 String::cast(ConsString::cast(*pattern)->first()) :
127 *pattern); 127 *pattern);
128 ASSERT(!flat_string->IsConsString()); 128 ASSERT(!flat_string->IsConsString());
129 ASSERT(flat_string->IsSeqString() || flat_string->IsSlicedString() || 129 ASSERT(flat_string->IsSeqString() || flat_string->IsSlicedString() ||
130 flat_string->IsExternalString()); 130 flat_string->IsExternalString());
131 if (!flat_string->IsAscii()) { 131 if (!flat_string->IsAsciiRepresentation()) {
132 return flat_string; 132 return flat_string;
133 } 133 }
134 134
135 Handle<String> two_byte_string = 135 Handle<String> two_byte_string =
136 Factory::NewRawTwoByteString(flat_string->length(), TENURED); 136 Factory::NewRawTwoByteString(flat_string->length(), TENURED);
137 static StringInputBuffer convert_to_two_byte_buffer; 137 static StringInputBuffer convert_to_two_byte_buffer;
138 convert_to_two_byte_buffer.Reset(*flat_string); 138 convert_to_two_byte_buffer.Reset(*flat_string);
139 for (int i = 0; convert_to_two_byte_buffer.has_more(); i++) { 139 for (int i = 0; convert_to_two_byte_buffer.has_more(); i++) {
140 two_byte_string->Set(i, convert_to_two_byte_buffer.GetNext()); 140 two_byte_string->Set(i, convert_to_two_byte_buffer.GetNext());
141 } 141 }
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 } 491 }
492 492
493 493
494 ByteArray* RegExpImpl::JsreInternal(Handle<JSRegExp> re) { 494 ByteArray* RegExpImpl::JsreInternal(Handle<JSRegExp> re) {
495 Object* value = re->data(); 495 Object* value = re->data();
496 ASSERT(value->IsFixedArray()); 496 ASSERT(value->IsFixedArray());
497 return ByteArray::cast(FixedArray::cast(value)->get(INTERNAL_INDEX)); 497 return ByteArray::cast(FixedArray::cast(value)->get(INTERNAL_INDEX));
498 } 498 }
499 499
500 }} // namespace v8::internal 500 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/objects.h » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698