// Copyright 2016 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "test/unittests/test-helpers.h" #include "include/v8.h" #include "src/api/api.h" #include "src/execution/isolate.h" #include "src/handles/handles.h" #include "src/objects/objects-inl.h" #include "src/objects/objects.h" #include "src/parsing/scanner-character-streams.h" #include "src/parsing/scanner.h" namespace v8 { namespace internal { namespace test { Handle CreateSource(Isolate* isolate, ExternalOneByteString::Resource* maybe_resource) { if (!maybe_resource) { static const char test_script[] = "(x) { x*x; }"; maybe_resource = new test::ScriptResource(test_script, strlen(test_script)); } return isolate->factory() ->NewExternalStringFromOneByte(maybe_resource) .ToHandleChecked(); } Handle CreateSharedFunctionInfo( Isolate* isolate, v8::String::ExternalOneByteStringResource* maybe_resource) { HandleScope scope(isolate); Handle source = CreateSource(isolate, maybe_resource); Handle