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"
|
2016-11-30 22:31:37 +00:00
|
|
|
#include "src/zone/zone-containers.h"
|
2014-07-30 13:54:45 +00:00
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
2015-10-02 16:55:12 +00:00
|
|
|
|
2016-02-15 17:27:06 +00:00
|
|
|
class CompilationInfo;
|
2016-04-27 17:54:16 +00:00
|
|
|
class CompilationJob;
|
2015-10-02 16:55:12 +00:00
|
|
|
class RegisterConfiguration;
|
|
|
|
|
2016-11-30 22:31:37 +00:00
|
|
|
namespace trap_handler {
|
|
|
|
struct ProtectedInstructionData;
|
|
|
|
} // namespace trap_handler
|
|
|
|
|
2017-06-29 01:14:44 +00:00
|
|
|
namespace wasm {
|
|
|
|
enum ModuleOrigin : uint8_t;
|
|
|
|
} // namespace wasm
|
|
|
|
|
2014-07-30 13:54:45 +00:00
|
|
|
namespace compiler {
|
|
|
|
|
2014-11-17 14:46:41 +00:00
|
|
|
class CallDescriptor;
|
2016-11-30 10:35:53 +00:00
|
|
|
class JSGraph;
|
2014-07-30 13:54:45 +00:00
|
|
|
class Graph;
|
2014-11-17 12:36:58 +00:00
|
|
|
class InstructionSequence;
|
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:
|
2016-05-03 11:56:20 +00:00
|
|
|
// Returns a new compilation job for the given function.
|
2017-02-16 14:39:17 +00:00
|
|
|
static CompilationJob* NewCompilationJob(Handle<JSFunction> function,
|
|
|
|
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.
|
|
|
|
static CompilationJob* NewWasmCompilationJob(
|
2016-11-30 10:35:53 +00:00
|
|
|
CompilationInfo* info, JSGraph* jsgraph, CallDescriptor* descriptor,
|
2016-11-30 22:31:37 +00:00
|
|
|
SourcePositionTable* source_positions,
|
|
|
|
ZoneVector<trap_handler::ProtectedInstructionData>*
|
2017-02-01 11:51:59 +00:00
|
|
|
protected_instructions,
|
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.
|
2015-12-02 12:35:12 +00:00
|
|
|
static Handle<Code> GenerateCodeForCodeStub(Isolate* isolate,
|
|
|
|
CallDescriptor* call_descriptor,
|
|
|
|
Graph* graph, Schedule* schedule,
|
2016-01-20 15:17:39 +00:00
|
|
|
Code::Flags flags,
|
2016-12-15 11:45:18 +00:00
|
|
|
const char* debug_name);
|
2015-08-25 12:56:50 +00:00
|
|
|
|
2016-04-27 12:38:19 +00:00
|
|
|
// Run the entire pipeline and generate a handle to a code object suitable for
|
|
|
|
// testing.
|
|
|
|
static Handle<Code> GenerateCodeForTesting(CompilationInfo* info);
|
|
|
|
|
2014-11-17 14:46:41 +00:00
|
|
|
// Run the pipeline on a machine graph and generate code. If {schedule} is
|
|
|
|
// {nullptr}, then compute a new schedule for code generation.
|
|
|
|
static Handle<Code> GenerateCodeForTesting(CompilationInfo* info,
|
|
|
|
Graph* graph,
|
|
|
|
Schedule* schedule = nullptr);
|
2014-07-30 13:54:45 +00:00
|
|
|
|
2014-11-17 14:46:41 +00:00
|
|
|
// Run just the register allocator phases.
|
2016-10-17 10:01:42 +00:00
|
|
|
V8_EXPORT_PRIVATE static bool AllocateRegistersForTesting(
|
|
|
|
const RegisterConfiguration* config, InstructionSequence* sequence,
|
|
|
|
bool run_verifier);
|
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.
|
2016-12-09 10:29:53 +00:00
|
|
|
static Handle<Code> GenerateCodeForTesting(
|
|
|
|
CompilationInfo* info, CallDescriptor* call_descriptor, Graph* graph,
|
|
|
|
Schedule* schedule = nullptr,
|
|
|
|
SourcePositionTable* source_positions = nullptr);
|
2014-11-17 14:46:41 +00:00
|
|
|
|
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_
|