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

Side by Side Diff: src/jsregexp.cc

Issue 20040: Fix the not-at-start optimization to trigger on the V8 regexp benchmark. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 10 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 | « no previous file | 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 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 2400 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 compiler, 2411 compiler,
2412 characters_filled_in, 2412 characters_filled_in,
2413 not_at_start); 2413 not_at_start);
2414 } 2414 }
2415 2415
2416 2416
2417 void ChoiceNode::GetQuickCheckDetails(QuickCheckDetails* details, 2417 void ChoiceNode::GetQuickCheckDetails(QuickCheckDetails* details,
2418 RegExpCompiler* compiler, 2418 RegExpCompiler* compiler,
2419 int characters_filled_in, 2419 int characters_filled_in,
2420 bool not_at_start) { 2420 bool not_at_start) {
2421 not_at_start = not_at_start || not_at_start_; 2421 not_at_start = (not_at_start || not_at_start_);
2422 int choice_count = alternatives_->length(); 2422 int choice_count = alternatives_->length();
2423 ASSERT(choice_count > 0); 2423 ASSERT(choice_count > 0);
2424 alternatives_->at(0).node()->GetQuickCheckDetails(details, 2424 alternatives_->at(0).node()->GetQuickCheckDetails(details,
2425 compiler, 2425 compiler,
2426 characters_filled_in, 2426 characters_filled_in,
2427 not_at_start); 2427 not_at_start);
2428 for (int i = 1; i < choice_count; i++) { 2428 for (int i = 1; i < choice_count; i++) {
2429 QuickCheckDetails new_details(details->characters()); 2429 QuickCheckDetails new_details(details->characters());
2430 RegExpNode* node = alternatives_->at(i).node(); 2430 RegExpNode* node = alternatives_->at(i).node();
2431 node->GetQuickCheckDetails(&new_details, compiler, 2431 node->GetQuickCheckDetails(&new_details, compiler,
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
3154 ZoneList<Guard*>* guards = alternative.guards(); 3154 ZoneList<Guard*>* guards = alternative.guards();
3155 int guard_count = (guards == NULL) ? 0 : guards->length(); 3155 int guard_count = (guards == NULL) ? 0 : guards->length();
3156 Trace new_trace(*current_trace); 3156 Trace new_trace(*current_trace);
3157 new_trace.set_characters_preloaded(preload_is_current ? 3157 new_trace.set_characters_preloaded(preload_is_current ?
3158 preload_characters : 3158 preload_characters :
3159 0); 3159 0);
3160 if (preload_has_checked_bounds) { 3160 if (preload_has_checked_bounds) {
3161 new_trace.set_bound_checked_up_to(preload_characters); 3161 new_trace.set_bound_checked_up_to(preload_characters);
3162 } 3162 }
3163 new_trace.quick_check_performed()->Clear(); 3163 new_trace.quick_check_performed()->Clear();
3164 if (not_at_start_) new_trace.set_at_start(Trace::FALSE);
3164 alt_gen->expects_preload = preload_is_current; 3165 alt_gen->expects_preload = preload_is_current;
3165 bool generate_full_check_inline = false; 3166 bool generate_full_check_inline = false;
3166 if (FLAG_irregexp_optimization && 3167 if (FLAG_irregexp_optimization &&
3167 try_to_emit_quick_check_for_alternative(i) && 3168 try_to_emit_quick_check_for_alternative(i) &&
3168 alternative.node()->EmitQuickCheck(compiler, 3169 alternative.node()->EmitQuickCheck(compiler,
3169 &new_trace, 3170 &new_trace,
3170 preload_has_checked_bounds, 3171 preload_has_checked_bounds,
3171 &alt_gen->possible_success, 3172 &alt_gen->possible_success,
3172 &alt_gen->quick_check_details, 3173 &alt_gen->quick_check_details,
3173 i < choice_count - 1)) { 3174 i < choice_count - 1)) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
3242 AlternativeGeneration* alt_gen, 3243 AlternativeGeneration* alt_gen,
3243 int preload_characters, 3244 int preload_characters,
3244 bool next_expects_preload) { 3245 bool next_expects_preload) {
3245 if (!alt_gen->possible_success.is_linked()) return; 3246 if (!alt_gen->possible_success.is_linked()) return;
3246 3247
3247 RegExpMacroAssembler* macro_assembler = compiler->macro_assembler(); 3248 RegExpMacroAssembler* macro_assembler = compiler->macro_assembler();
3248 macro_assembler->Bind(&alt_gen->possible_success); 3249 macro_assembler->Bind(&alt_gen->possible_success);
3249 Trace out_of_line_trace(*trace); 3250 Trace out_of_line_trace(*trace);
3250 out_of_line_trace.set_characters_preloaded(preload_characters); 3251 out_of_line_trace.set_characters_preloaded(preload_characters);
3251 out_of_line_trace.set_quick_check_performed(&alt_gen->quick_check_details); 3252 out_of_line_trace.set_quick_check_performed(&alt_gen->quick_check_details);
3253 if (not_at_start_) out_of_line_trace.set_at_start(Trace::FALSE);
3252 ZoneList<Guard*>* guards = alternative.guards(); 3254 ZoneList<Guard*>* guards = alternative.guards();
3253 int guard_count = (guards == NULL) ? 0 : guards->length(); 3255 int guard_count = (guards == NULL) ? 0 : guards->length();
3254 if (next_expects_preload) { 3256 if (next_expects_preload) {
3255 Label reload_current_char; 3257 Label reload_current_char;
3256 out_of_line_trace.set_backtrack(&reload_current_char); 3258 out_of_line_trace.set_backtrack(&reload_current_char);
3257 for (int j = 0; j < guard_count; j++) { 3259 for (int j = 0; j < guard_count; j++) {
3258 GenerateGuard(macro_assembler, guards->at(j), &out_of_line_trace); 3260 GenerateGuard(macro_assembler, guards->at(j), &out_of_line_trace);
3259 } 3261 }
3260 alternative.node()->Emit(compiler, &out_of_line_trace); 3262 alternative.node()->Emit(compiler, &out_of_line_trace);
3261 macro_assembler->Bind(&reload_current_char); 3263 macro_assembler->Bind(&reload_current_char);
(...skipping 1603 matching lines...) Expand 10 before | Expand all | Expand 10 after
4865 EmbeddedVector<byte, 1024> codes; 4867 EmbeddedVector<byte, 1024> codes;
4866 RegExpMacroAssemblerIrregexp macro_assembler(codes); 4868 RegExpMacroAssemblerIrregexp macro_assembler(codes);
4867 return compiler.Assemble(&macro_assembler, 4869 return compiler.Assemble(&macro_assembler,
4868 node, 4870 node,
4869 data->capture_count, 4871 data->capture_count,
4870 pattern); 4872 pattern);
4871 } 4873 }
4872 4874
4873 4875
4874 }} // namespace v8::internal 4876 }} // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698