11cb0ef41Sopenharmony_ci// Copyright 2022 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#include "src/maglev/maglev.h"
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci#include "src/common/globals.h"
81cb0ef41Sopenharmony_ci#include "src/maglev/maglev-compilation-info.h"
91cb0ef41Sopenharmony_ci#include "src/maglev/maglev-compiler.h"
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_cinamespace v8 {
121cb0ef41Sopenharmony_cinamespace internal {
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ciMaybeHandle<CodeT> Maglev::Compile(Isolate* isolate,
151cb0ef41Sopenharmony_ci                                   Handle<JSFunction> function) {
161cb0ef41Sopenharmony_ci  DCHECK(FLAG_maglev);
171cb0ef41Sopenharmony_ci  auto info = maglev::MaglevCompilationInfo::New(isolate, function);
181cb0ef41Sopenharmony_ci  maglev::MaglevCompilationUnit* const unit = info->toplevel_compilation_unit();
191cb0ef41Sopenharmony_ci  maglev::MaglevCompiler::Compile(isolate->main_thread_local_isolate(), unit);
201cb0ef41Sopenharmony_ci  return maglev::MaglevCompiler::GenerateCode(unit);
211cb0ef41Sopenharmony_ci}
221cb0ef41Sopenharmony_ci
231cb0ef41Sopenharmony_ci}  // namespace internal
241cb0ef41Sopenharmony_ci}  // namespace v8
25