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 "src/common/globals.h" 8 #include "src/maglev/maglev-compilation-info.h" 9 #include "src/maglev/maglev-compiler.h" 10 11 namespace v8 { 12 namespace internal { 13 Compile(Isolate* isolate, Handle<JSFunction> function)14MaybeHandle<CodeT> Maglev::Compile(Isolate* isolate, 15 Handle<JSFunction> function) { 16 DCHECK(FLAG_maglev); 17 auto info = maglev::MaglevCompilationInfo::New(isolate, function); 18 maglev::MaglevCompilationUnit* const unit = info->toplevel_compilation_unit(); 19 maglev::MaglevCompiler::Compile(isolate->main_thread_local_isolate(), unit); 20 return maglev::MaglevCompiler::GenerateCode(unit); 21 } 22 23 } // namespace internal 24 } // namespace v8 25