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

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

Issue 2752143003: [regexp] Remove remainder of native RegExpExecStub (Closed)
Patch Set: Fix non-sim arm64 and mips builds Created 3 years, 8 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/regexp/regexp-macro-assembler.h" 5 #include "src/regexp/regexp-macro-assembler.h"
6 6
7 #include "src/assembler.h" 7 #include "src/assembler.h"
8 #include "src/isolate-inl.h" 8 #include "src/isolate-inl.h"
9 #include "src/regexp/regexp-stack.h" 9 #include "src/regexp/regexp-stack.h"
10 #include "src/simulator.h" 10 #include "src/simulator.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 DCHECK(re_code->instruction_start() <= *return_address); 163 DCHECK(re_code->instruction_start() <= *return_address);
164 DCHECK(*return_address <= re_code->instruction_end()); 164 DCHECK(*return_address <= re_code->instruction_end());
165 int return_value = 0; 165 int return_value = 0;
166 // Prepare for possible GC. 166 // Prepare for possible GC.
167 HandleScope handles(isolate); 167 HandleScope handles(isolate);
168 Handle<Code> code_handle(re_code); 168 Handle<Code> code_handle(re_code);
169 Handle<String> subject_handle(*subject); 169 Handle<String> subject_handle(*subject);
170 bool is_one_byte = subject_handle->IsOneByteRepresentationUnderneath(); 170 bool is_one_byte = subject_handle->IsOneByteRepresentationUnderneath();
171 171
172 StackLimitCheck check(isolate); 172 StackLimitCheck check(isolate);
173 if (check.JsHasOverflowed()) { 173 bool js_has_overflowed = check.JsHasOverflowed();
174
175 if (is_direct_call) {
176 // Direct calls from JavaScript can be interrupted in two ways:
177 // 1. A real stack overflow, in which case we let the caller throw the
178 // exception.
179 // 2. The stack guard was used to interrupt execution for another purpose,
180 // forcing the call through the runtime system.
181 return_value = js_has_overflowed ? EXCEPTION : RETRY;
182 } else if (js_has_overflowed) {
174 isolate->StackOverflow(); 183 isolate->StackOverflow();
175 return_value = EXCEPTION; 184 return_value = EXCEPTION;
176 } else if (is_direct_call) {
177 // If not real stack overflow the stack guard was used to interrupt
178 // execution for another purpose. If this is a direct call from JavaScript
179 // retry the RegExp forcing the call through the runtime system.
180 // Currently the direct call cannot handle a GC.
181 return_value = RETRY;
182 } else { 185 } else {
183 Object* result = isolate->stack_guard()->HandleInterrupts(); 186 Object* result = isolate->stack_guard()->HandleInterrupts();
184 if (result->IsException(isolate)) return_value = EXCEPTION; 187 if (result->IsException(isolate)) return_value = EXCEPTION;
185 } 188 }
186 189
187 DisallowHeapAllocation no_gc; 190 DisallowHeapAllocation no_gc;
188 191
189 if (*code_handle != re_code) { // Return address no longer valid 192 if (*code_handle != re_code) { // Return address no longer valid
190 intptr_t delta = code_handle->address() - re_code->address(); 193 intptr_t delta = code_handle->address() - re_code->address();
191 // Overwrite the return address on the stack. 194 // Overwrite the return address on the stack.
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 } 357 }
355 *stack_base = new_stack_base; 358 *stack_base = new_stack_base;
356 intptr_t stack_content_size = old_stack_base - stack_pointer; 359 intptr_t stack_content_size = old_stack_base - stack_pointer;
357 return new_stack_base - stack_content_size; 360 return new_stack_base - stack_content_size;
358 } 361 }
359 362
360 #endif // V8_INTERPRETED_REGEXP 363 #endif // V8_INTERPRETED_REGEXP
361 364
362 } // namespace internal 365 } // namespace internal
363 } // namespace v8 366 } // namespace v8
OLDNEW
« no previous file with comments | « src/regexp/ppc/regexp-macro-assembler-ppc.cc ('k') | src/regexp/s390/regexp-macro-assembler-s390.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698