// 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 "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 { ScriptResource* CreateSource(ScriptResource* maybe_resource) { if (!maybe_resource) { static const char test_script[] = "(x) { x*x; }"; return new test::ScriptResource(test_script, strlen(test_script), JSParameterCount(1)); } else { return maybe_resource; } } Handle CreateSharedFunctionInfo( Isolate* isolate, ScriptResource* maybe_resource) { HandleScope scope(isolate); test::ScriptResource* resource = CreateSource(maybe_resource); DirectHandle source = isolate->factory() ->NewExternalStringFromOneByte(resource) .ToHandleChecked(); DirectHandle