summaryrefslogtreecommitdiff
path: root/deps/v8/test/unittests/compiler-dispatcher/compiler-dispatcher-helper.cc
blob: 16fa160aec8ffa35e9e5f26273aaa0ba8e0a5ac6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// 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/compiler-dispatcher/compiler-dispatcher-helper.h"

#include <memory>

#include "include/v8.h"
#include "src/api.h"
#include "src/objects-inl.h"

namespace v8 {
namespace internal {

Handle<Object> RunJS(v8::Isolate* isolate, const char* script) {
  return Utils::OpenHandle(
      *v8::Script::Compile(
           isolate->GetCurrentContext(),
           v8::String::NewFromUtf8(isolate, script, v8::NewStringType::kNormal)
               .ToLocalChecked())
           .ToLocalChecked()
           ->Run(isolate->GetCurrentContext())
           .ToLocalChecked());
}

}  // namespace internal
}  // namespace v8