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!
|
2016-10-17 10:01:42 +00:00
|
|
|
#include "src/globals.h"
|
2016-02-15 17:27:06 +00:00
|
|
|
#include "src/objects.h"
|
2017-10-13 13:24:26 +00:00
|
|
|
#include "src/objects/code.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-08-23 03:08:51 +00:00
|
|
|
class JumpOptimizationInfo;
|
2015-10-02 16:55:12 +00:00
|
|
|
|
2017-06-29 01:14:44 +00:00
|
|
|
namespace wasm {
|
|
|
|
enum ModuleOrigin : uint8_t;
|
2018-05-24 09:52:43 +00:00
|
|
|
struct FunctionBody;
|
2018-06-04 13:44:41 +00:00
|
|
|
class NativeModule;
|
2018-07-10 13:15:29 +00:00
|
|
|
class WasmEngine;
|
2018-05-24 09:52:43 +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;
|
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.
|
2018-06-14 17:41:15 +00:00
|
|
|
static OptimizedCompilationJob* NewCompilationJob(Isolate* isolate,
|
|
|
|
Handle<JSFunction> function,
|
2018-04-04 20:30:34 +00:00
|
|
|
bool has_script);
|
2014-07-30 13:54:45 +00:00
|
|
|
|
2016-05-03 11:56:20 +00:00
|
|
|
// Returns a new compilation job for the WebAssembly compilation info.
|
2018-04-04 20:30:34 +00:00
|
|
|
static OptimizedCompilationJob* NewWasmCompilationJob(
|
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,
|
2018-05-24 09:52:43 +00:00
|
|
|
wasm::FunctionBody function_body, wasm::WasmModule* wasm_module,
|
2018-06-04 13:44:41 +00:00
|
|
|
wasm::NativeModule* native_module, int function_index,
|
2017-06-29 01:14:44 +00:00
|
|
|
wasm::ModuleOrigin wasm_origin);
|
2014-07-30 13:54:45 +00:00
|
|
|
|
2015-12-09 14:09:22 +00:00
|
|
|
// Run the pipeline on a machine graph and generate code. The {schedule} must
|
|
|
|
// be valid, hence the given {graph} does not need to be schedulable.
|
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,
|
|
|
|
Schedule* schedule, Code::Kind kind, const char* debug_name,
|
2018-03-26 15:44:44 +00:00
|
|
|
uint32_t stub_key, int32_t builtin_index, JumpOptimizationInfo* jump_opt,
|
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
|
|
|
|
2018-07-03 09:13:55 +00:00
|
|
|
// Run the pipeline on JavaScript bytecode and generate code.
|
2018-06-19 08:09:09 +00:00
|
|
|
static MaybeHandle<Code> GenerateCodeForTesting(
|
2018-07-03 09:13:55 +00:00
|
|
|
OptimizedCompilationInfo* info, Isolate* isolate);
|
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-07-06 08:58:43 +00:00
|
|
|
const AssemblerOptions& options, Schedule* schedule = nullptr,
|
2016-12-09 10:29:53 +00:00
|
|
|
SourcePositionTable* source_positions = 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_
|