2014-07-30 13:54:45 +00:00
|
|
|
// Copyright 2014 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.
|
|
|
|
|
|
|
|
#ifndef V8_COMPILER_PIPELINE_H_
|
|
|
|
#define V8_COMPILER_PIPELINE_H_
|
|
|
|
|
2015-02-06 09:00:40 +00:00
|
|
|
// Clients of this interface shouldn't depend on lots of compiler internals.
|
|
|
|
// Do not include anything from src/compiler here!
|
2019-05-24 13:51:59 +00:00
|
|
|
#include "src/common/globals.h"
|
2017-10-13 13:24:26 +00:00
|
|
|
#include "src/objects/code.h"
|
2019-05-23 08:51:46 +00:00
|
|
|
#include "src/objects/objects.h"
|
2014-07-30 13:54:45 +00:00
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
2015-10-02 16:55:12 +00:00
|
|
|
|
2018-07-06 08:58:43 +00:00
|
|
|
struct AssemblerOptions;
|
2018-04-04 20:30:34 +00:00
|
|
|
class OptimizedCompilationInfo;
|
|
|
|
class OptimizedCompilationJob;
|
2015-10-02 16:55:12 +00:00
|
|
|
class RegisterConfiguration;
|
|
|
|
|
2017-06-29 01:14:44 +00:00
|
|
|
namespace wasm {
|
2018-05-24 09:52:43 +00:00
|
|
|
struct FunctionBody;
|
2018-06-04 13:44:41 +00:00
|
|
|
class NativeModule;
|
2019-03-12 11:00:28 +00:00
|
|
|
struct WasmCompilationResult;
|
2018-07-10 13:15:29 +00:00
|
|
|
class WasmEngine;
|
2019-01-21 11:57:22 +00:00
|
|
|
struct WasmModule;
|
2017-06-29 01:14:44 +00:00
|
|
|
} // namespace wasm
|
|
|
|
|
2014-07-30 13:54:45 +00:00
|
|
|
namespace compiler {
|
|
|
|
|
2014-11-17 14:46:41 +00:00
|
|
|
class CallDescriptor;
|
2014-07-30 13:54:45 +00:00
|
|
|
class Graph;
|
2014-11-17 12:36:58 +00:00
|
|
|
class InstructionSequence;
|
2019-01-29 12:50:53 +00:00
|
|
|
class JSHeapBroker;
|
2018-05-08 16:09:47 +00:00
|
|
|
class MachineGraph;
|
2018-05-18 14:04:36 +00:00
|
|
|
class NodeOriginTable;
|
2014-07-30 13:54:45 +00:00
|
|
|
class Schedule;
|
2016-04-26 12:46:03 +00:00
|
|
|
class SourcePositionTable;
|
2014-07-30 13:54:45 +00:00
|
|
|
|
2016-05-03 14:15:03 +00:00
|
|
|
class Pipeline : public AllStatic {
|
2014-07-30 13:54:45 +00:00
|
|
|
public:
|
2018-07-03 09:13:55 +00:00
|
|
|
// Returns a new compilation job for the given JavaScript function.
|
2019-06-14 09:55:31 +00:00
|
|
|
static std::unique_ptr<OptimizedCompilationJob> NewCompilationJob(
|
|
|
|
Isolate* isolate, Handle<JSFunction> function, bool has_script);
|
2014-07-30 13:54:45 +00:00
|
|
|
|
2018-11-14 16:38:59 +00:00
|
|
|
// Run the pipeline for the WebAssembly compilation info.
|
2019-01-21 11:57:22 +00:00
|
|
|
static void GenerateCodeForWasmFunction(
|
2018-07-10 13:15:29 +00:00
|
|
|
OptimizedCompilationInfo* info, wasm::WasmEngine* wasm_engine,
|
2018-07-16 13:02:43 +00:00
|
|
|
MachineGraph* mcgraph, CallDescriptor* call_descriptor,
|
2018-07-10 13:15:29 +00:00
|
|
|
SourcePositionTable* source_positions, NodeOriginTable* node_origins,
|
2019-01-21 11:57:22 +00:00
|
|
|
wasm::FunctionBody function_body, const wasm::WasmModule* module,
|
2018-10-29 11:52:52 +00:00
|
|
|
int function_index);
|
2014-07-30 13:54:45 +00:00
|
|
|
|
2018-09-04 09:41:36 +00:00
|
|
|
// Run the pipeline on a machine graph and generate code.
|
2019-03-12 11:00:28 +00:00
|
|
|
static wasm::WasmCompilationResult GenerateCodeForWasmNativeStub(
|
2018-11-14 15:23:40 +00:00
|
|
|
wasm::WasmEngine* wasm_engine, CallDescriptor* call_descriptor,
|
2018-11-15 09:30:52 +00:00
|
|
|
MachineGraph* mcgraph, Code::Kind kind, int wasm_kind,
|
|
|
|
const char* debug_name, const AssemblerOptions& assembler_options,
|
2018-11-14 15:23:40 +00:00
|
|
|
SourcePositionTable* source_positions = nullptr);
|
|
|
|
|
2019-06-18 14:24:59 +00:00
|
|
|
// Returns a new compilation job for a wasm heap stub.
|
|
|
|
static std::unique_ptr<OptimizedCompilationJob> NewWasmHeapStubCompilationJob(
|
|
|
|
Isolate* isolate, CallDescriptor* call_descriptor,
|
|
|
|
std::unique_ptr<Zone> zone, Graph* graph, Code::Kind kind,
|
|
|
|
std::unique_ptr<char[]> debug_name, const AssemblerOptions& options,
|
2018-09-04 09:41:36 +00:00
|
|
|
SourcePositionTable* source_positions = nullptr);
|
|
|
|
|
2018-12-12 14:25:17 +00:00
|
|
|
// Run the pipeline on a machine graph and generate code.
|
2018-06-19 08:09:09 +00:00
|
|
|
static MaybeHandle<Code> GenerateCodeForCodeStub(
|
2017-10-26 13:00:43 +00:00
|
|
|
Isolate* isolate, CallDescriptor* call_descriptor, Graph* graph,
|
2019-01-22 15:23:23 +00:00
|
|
|
SourcePositionTable* source_positions, Code::Kind kind,
|
|
|
|
const char* debug_name, int32_t builtin_index,
|
2018-07-06 08:58:43 +00:00
|
|
|
PoisoningMitigationLevel poisoning_level,
|
|
|
|
const AssemblerOptions& options);
|
2015-08-25 12:56:50 +00:00
|
|
|
|
2018-07-03 09:13:55 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// The following methods are for testing purposes only. Avoid production use.
|
|
|
|
// ---------------------------------------------------------------------------
|
2016-04-27 12:38:19 +00:00
|
|
|
|
2019-05-02 12:17:06 +00:00
|
|
|
// Run the pipeline on JavaScript bytecode and generate code. If requested,
|
|
|
|
// hands out the heap broker on success, transferring its ownership to the
|
|
|
|
// caller.
|
2019-03-27 11:56:38 +00:00
|
|
|
V8_EXPORT_PRIVATE static MaybeHandle<Code> GenerateCodeForTesting(
|
2019-01-29 12:50:53 +00:00
|
|
|
OptimizedCompilationInfo* info, Isolate* isolate,
|
2019-05-02 12:17:06 +00:00
|
|
|
std::unique_ptr<JSHeapBroker>* out_broker = nullptr);
|
2014-11-17 12:36:58 +00:00
|
|
|
|
2015-08-28 09:02:09 +00:00
|
|
|
// Run the pipeline on a machine graph and generate code. If {schedule} is
|
|
|
|
// {nullptr}, then compute a new schedule for code generation.
|
2018-06-19 08:09:09 +00:00
|
|
|
V8_EXPORT_PRIVATE static MaybeHandle<Code> GenerateCodeForTesting(
|
2018-04-04 20:30:34 +00:00
|
|
|
OptimizedCompilationInfo* info, Isolate* isolate,
|
|
|
|
CallDescriptor* call_descriptor, Graph* graph,
|
2018-09-04 11:55:58 +00:00
|
|
|
const AssemblerOptions& options, Schedule* schedule = nullptr);
|
2014-11-17 14:46:41 +00:00
|
|
|
|
2018-07-03 09:13:55 +00:00
|
|
|
// Run just the register allocator phases.
|
|
|
|
V8_EXPORT_PRIVATE static bool AllocateRegistersForTesting(
|
|
|
|
const RegisterConfiguration* config, InstructionSequence* sequence,
|
|
|
|
bool run_verifier);
|
|
|
|
|
2015-08-28 09:02:09 +00:00
|
|
|
private:
|
2016-05-03 14:15:03 +00:00
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(Pipeline);
|
2014-07-30 13:54:45 +00:00
|
|
|
};
|
2014-11-14 16:44:38 +00:00
|
|
|
|
|
|
|
} // namespace compiler
|
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|
2014-07-30 13:54:45 +00:00
|
|
|
|
|
|
|
#endif // V8_COMPILER_PIPELINE_H_
|