v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
maglev.cc
Go to the documentation of this file.
1// Copyright 2022 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "src/maglev/maglev.h"
6
7#include <memory>
8
13#include "src/utils/utils.h"
14
15namespace v8 {
16namespace internal {
17
18MaybeHandle<Code> Maglev::Compile(Isolate* isolate, Handle<JSFunction> function,
19 BytecodeOffset osr_offset) {
20 DCHECK(v8_flags.maglev);
21 RCS_SCOPE(isolate, RuntimeCallCounterId::kOptimizeNonConcurrentMaglev);
22 std::unique_ptr<maglev::MaglevCompilationInfo> info =
23 maglev::MaglevCompilationInfo::New(isolate, function, osr_offset);
24 if (!maglev::MaglevCompiler::Compile(isolate->main_thread_local_isolate(),
25 info.get())) {
26 return {};
27 }
28 // TODO(olivf): Maybe return the BailoutReason too.
29 return maglev::MaglevCompiler::GenerateCode(isolate, info.get()).first;
30}
31
32} // namespace internal
33} // namespace v8
V8_EXPORT_PRIVATE FlagValues v8_flags
Local< T > Handle
#define RCS_SCOPE(...)
#define DCHECK(condition)
Definition logging.h:482