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

Unified Diff: src/jsregexp.cc

Issue 6997015: Limit the generation of regexp code with large inlined constants. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/jsregexp.h ('k') | src/mips/regexp-macro-assembler-mips.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/jsregexp.cc
===================================================================
--- src/jsregexp.cc (revision 7820)
+++ src/jsregexp.cc (working copy)
@@ -858,12 +858,25 @@
RegExpNode* start,
int capture_count,
Handle<String> pattern) {
+ Heap* heap = pattern->GetHeap();
+
+ bool use_slow_safe_regexp_compiler = false;
+ if (heap->total_regexp_code_generated() >
+ RegExpImpl::kRegWxpCompiledLimit &&
+ heap->isolate()->memory_allocator()->SizeExecutable() >
+ RegExpImpl::kRegExpExecutableMemoryLimit) {
+ use_slow_safe_regexp_compiler = true;
+ }
+
+ macro_assembler->set_slow_safe(use_slow_safe_regexp_compiler);
+
#ifdef DEBUG
if (FLAG_trace_regexp_assembler)
macro_assembler_ = new RegExpMacroAssemblerTracer(macro_assembler);
else
#endif
macro_assembler_ = macro_assembler;
+
List <RegExpNode*> work_list(0);
work_list_ = &work_list;
Label fail;
@@ -877,7 +890,8 @@
}
if (reg_exp_too_big_) return IrregexpRegExpTooBig();
- Handle<Object> code = macro_assembler_->GetCode(pattern);
+ Handle<HeapObject> code = macro_assembler_->GetCode(pattern);
+ heap->IncreaseTotalRegexpCodeGenerated(code->Size());
work_list_ = NULL;
#ifdef DEBUG
if (FLAG_print_code) {
« no previous file with comments | « src/jsregexp.h ('k') | src/mips/regexp-macro-assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698