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

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

Issue 2858033: Fix Chromium issue 47824. (Closed)
Patch Set: Addressed review comments Created 10 years, 5 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/objects.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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 // No allocations before calling the regexp, but we can't use 114 // No allocations before calling the regexp, but we can't use
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();
124
125 // The string has been flattened, so it it is a cons string it contains the 123 // The string has been flattened, so it it is a cons string it contains the
126 // full string in the first part. 124 // full string in the first part.
127 if (StringShape(subject_ptr).IsCons()) { 125 if (StringShape(subject_ptr).IsCons()) {
128 ASSERT_EQ(0, ConsString::cast(subject_ptr)->second()->length()); 126 ASSERT_EQ(0, ConsString::cast(subject_ptr)->second()->length());
129 subject_ptr = ConsString::cast(subject_ptr)->first(); 127 subject_ptr = ConsString::cast(subject_ptr)->first();
130 } 128 }
131 // Ensure that an underlying string has the same ascii-ness. 129 // Ensure that an underlying string has the same ascii-ness.
132 ASSERT(subject_ptr->IsAsciiRepresentation() == is_ascii); 130 bool is_ascii = subject_ptr->IsAsciiRepresentation();
133 ASSERT(subject_ptr->IsExternalString() || subject_ptr->IsSeqString()); 131 ASSERT(subject_ptr->IsExternalString() || subject_ptr->IsSeqString());
134 // String is now either Sequential or External 132 // String is now either Sequential or External
135 int char_size_shift = is_ascii ? 0 : 1; 133 int char_size_shift = is_ascii ? 0 : 1;
136 int char_length = end_offset - start_offset; 134 int char_length = end_offset - start_offset;
137 135
138 const byte* input_start = 136 const byte* input_start =
139 StringCharacterPosition(subject_ptr, start_offset); 137 StringCharacterPosition(subject_ptr, start_offset);
140 int byte_length = char_length << char_size_shift; 138 int byte_length = char_length << char_size_shift;
141 const byte* input_end = input_start + byte_length; 139 const byte* input_end = input_start + byte_length;
142 Result res = Execute(*regexp_code, 140 Result res = Execute(*regexp_code,
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 return NULL; 252 return NULL;
255 } 253 }
256 *stack_base = new_stack_base; 254 *stack_base = new_stack_base;
257 intptr_t stack_content_size = old_stack_base - stack_pointer; 255 intptr_t stack_content_size = old_stack_base - stack_pointer;
258 return new_stack_base - stack_content_size; 256 return new_stack_base - stack_content_size;
259 } 257 }
260 258
261 #endif // V8_INTERPRETED_REGEXP 259 #endif // V8_INTERPRETED_REGEXP
262 260
263 } } // namespace v8::internal 261 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698