| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 <limits.h> | 5 #include <limits.h> |
| 6 #include <stddef.h> | 6 #include <stddef.h> |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "include/v8.h" | 9 #include "include/v8.h" |
| 10 #include "src/factory.h" | 10 #include "src/factory.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | 24 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
| 25 v8_fuzzer::FuzzerSupport* support = v8_fuzzer::FuzzerSupport::Get(); | 25 v8_fuzzer::FuzzerSupport* support = v8_fuzzer::FuzzerSupport::Get(); |
| 26 v8::Isolate* isolate = support->GetIsolate(); | 26 v8::Isolate* isolate = support->GetIsolate(); |
| 27 | 27 |
| 28 v8::Isolate::Scope isolate_scope(isolate); | 28 v8::Isolate::Scope isolate_scope(isolate); |
| 29 v8::HandleScope handle_scope(isolate); | 29 v8::HandleScope handle_scope(isolate); |
| 30 v8::Context::Scope context_scope(support->GetContext()); | 30 v8::Context::Scope context_scope(support->GetContext()); |
| 31 v8::TryCatch try_catch(isolate); | 31 v8::TryCatch try_catch(isolate); |
| 32 | 32 |
| 33 i::FLAG_harmony_unicode_regexps = true; | |
| 34 i::FLAG_harmony_regexp_lookbehind = true; | 33 i::FLAG_harmony_regexp_lookbehind = true; |
| 35 | 34 |
| 36 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 35 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
| 37 i::Factory* factory = i_isolate->factory(); | 36 i::Factory* factory = i_isolate->factory(); |
| 38 | 37 |
| 39 if (size > INT_MAX) return 0; | 38 if (size > INT_MAX) return 0; |
| 40 i::MaybeHandle<i::String> maybe_source = factory->NewStringFromOneByte( | 39 i::MaybeHandle<i::String> maybe_source = factory->NewStringFromOneByte( |
| 41 i::Vector<const uint8_t>(data, static_cast<int>(size))); | 40 i::Vector<const uint8_t>(data, static_cast<int>(size))); |
| 42 i::Handle<i::String> source; | 41 i::Handle<i::String> source; |
| 43 if (!maybe_source.ToHandle(&source)) return 0; | 42 if (!maybe_source.ToHandle(&source)) return 0; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 68 Test(isolate, regexp, one_byte, results_array); | 67 Test(isolate, regexp, one_byte, results_array); |
| 69 Test(isolate, regexp, two_byte, results_array); | 68 Test(isolate, regexp, two_byte, results_array); |
| 70 Test(isolate, regexp, factory->empty_string(), results_array); | 69 Test(isolate, regexp, factory->empty_string(), results_array); |
| 71 Test(isolate, regexp, source, results_array); | 70 Test(isolate, regexp, source, results_array); |
| 72 } | 71 } |
| 73 | 72 |
| 74 isolate->RequestGarbageCollectionForTesting( | 73 isolate->RequestGarbageCollectionForTesting( |
| 75 v8::Isolate::kFullGarbageCollection); | 74 v8::Isolate::kFullGarbageCollection); |
| 76 return 0; | 75 return 0; |
| 77 } | 76 } |
| OLD | NEW |