OLD | NEW |
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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "src/compilation-cache.h" | 9 #include "src/compilation-cache.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 353 |
354 | 354 |
355 static void CreateRegExpErrorObjectAndThrow(Handle<JSRegExp> re, | 355 static void CreateRegExpErrorObjectAndThrow(Handle<JSRegExp> re, |
356 Handle<String> error_message, | 356 Handle<String> error_message, |
357 Isolate* isolate) { | 357 Isolate* isolate) { |
358 Factory* factory = isolate->factory(); | 358 Factory* factory = isolate->factory(); |
359 Handle<FixedArray> elements = factory->NewFixedArray(2); | 359 Handle<FixedArray> elements = factory->NewFixedArray(2); |
360 elements->set(0, re->Pattern()); | 360 elements->set(0, re->Pattern()); |
361 elements->set(1, *error_message); | 361 elements->set(1, *error_message); |
362 Handle<JSArray> array = factory->NewJSArrayWithElements(elements); | 362 Handle<JSArray> array = factory->NewJSArrayWithElements(elements); |
363 Handle<Object> error; | 363 Handle<Object> error = factory->NewSyntaxError("malformed_regexp", array); |
364 MaybeHandle<Object> maybe_error = | 364 isolate->Throw(*error); |
365 factory->NewSyntaxError("malformed_regexp", array); | |
366 if (maybe_error.ToHandle(&error)) isolate->Throw(*error); | |
367 } | 365 } |
368 | 366 |
369 | 367 |
370 bool RegExpImpl::CompileIrregexp(Handle<JSRegExp> re, | 368 bool RegExpImpl::CompileIrregexp(Handle<JSRegExp> re, |
371 Handle<String> sample_subject, | 369 Handle<String> sample_subject, |
372 bool is_one_byte) { | 370 bool is_one_byte) { |
373 // Compile the RegExp. | 371 // Compile the RegExp. |
374 Isolate* isolate = re->GetIsolate(); | 372 Isolate* isolate = re->GetIsolate(); |
375 Zone zone; | 373 Zone zone; |
376 PostponeInterruptsScope postpone(isolate); | 374 PostponeInterruptsScope postpone(isolate); |
(...skipping 5786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6163 Heap* heap = pattern->GetHeap(); | 6161 Heap* heap = pattern->GetHeap(); |
6164 bool too_much = pattern->length() > RegExpImpl::kRegExpTooLargeToOptimize; | 6162 bool too_much = pattern->length() > RegExpImpl::kRegExpTooLargeToOptimize; |
6165 if (heap->total_regexp_code_generated() > RegExpImpl::kRegExpCompiledLimit && | 6163 if (heap->total_regexp_code_generated() > RegExpImpl::kRegExpCompiledLimit && |
6166 heap->isolate()->memory_allocator()->SizeExecutable() > | 6164 heap->isolate()->memory_allocator()->SizeExecutable() > |
6167 RegExpImpl::kRegExpExecutableMemoryLimit) { | 6165 RegExpImpl::kRegExpExecutableMemoryLimit) { |
6168 too_much = true; | 6166 too_much = true; |
6169 } | 6167 } |
6170 return too_much; | 6168 return too_much; |
6171 } | 6169 } |
6172 }} // namespace v8::internal | 6170 }} // namespace v8::internal |
OLD | NEW |