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

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

Issue 545151: Add support for two byte strings in direct call to RegExp... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 11 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/objects.h ('k') | no next file » | 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // AssertNoAllocation, since regexps might be preempted, and another thread 115 // AssertNoAllocation, since regexps might be preempted, and another thread
116 // might do allocation anyway. 116 // might do allocation anyway.
117 117
118 String* subject_ptr = *subject; 118 String* subject_ptr = *subject;
119 // Character offsets into string. 119 // Character offsets into string.
120 int start_offset = previous_index; 120 int start_offset = previous_index;
121 int end_offset = subject_ptr->length(); 121 int end_offset = subject_ptr->length();
122 122
123 bool is_ascii = subject->IsAsciiRepresentation(); 123 bool is_ascii = subject->IsAsciiRepresentation();
124 124
125 // The string has been flattened, so it it is a cons string it contains the
126 // full string in the first part.
125 if (StringShape(subject_ptr).IsCons()) { 127 if (StringShape(subject_ptr).IsCons()) {
128 ASSERT_EQ(0, ConsString::cast(subject_ptr)->second()->length());
126 subject_ptr = ConsString::cast(subject_ptr)->first(); 129 subject_ptr = ConsString::cast(subject_ptr)->first();
127 } 130 }
128 // Ensure that an underlying string has the same ascii-ness. 131 // Ensure that an underlying string has the same ascii-ness.
129 ASSERT(subject_ptr->IsAsciiRepresentation() == is_ascii); 132 ASSERT(subject_ptr->IsAsciiRepresentation() == is_ascii);
130 ASSERT(subject_ptr->IsExternalString() || subject_ptr->IsSeqString()); 133 ASSERT(subject_ptr->IsExternalString() || subject_ptr->IsSeqString());
131 // String is now either Sequential or External 134 // String is now either Sequential or External
132 int char_size_shift = is_ascii ? 0 : 1; 135 int char_size_shift = is_ascii ? 0 : 1;
133 int char_length = end_offset - start_offset; 136 int char_length = end_offset - start_offset;
134 137
135 const byte* input_start = 138 const byte* input_start =
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 if (new_stack_base == NULL) { 258 if (new_stack_base == NULL) {
256 return NULL; 259 return NULL;
257 } 260 }
258 *stack_base = new_stack_base; 261 *stack_base = new_stack_base;
259 intptr_t stack_content_size = old_stack_base - stack_pointer; 262 intptr_t stack_content_size = old_stack_base - stack_pointer;
260 return new_stack_base - stack_content_size; 263 return new_stack_base - stack_content_size;
261 } 264 }
262 265
263 #endif // V8_NATIVE_REGEXP 266 #endif // V8_NATIVE_REGEXP
264 } } // namespace v8::internal 267 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698