[turbofan] Brokerization prep for bytecode graph builder.
Bug: v8:7790 Change-Id: I513c3ba048eafb7ca5bfa2fb63e35143f49643ec Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1596736 Commit-Queue: Jaroslav Sevcik <jarin@chromium.org> Reviewed-by: Georg Neis <neis@chromium.org> Cr-Commit-Position: refs/heads/master@{#61246}
This commit is contained in:
parent
226b58341e
commit
c696f7fd14
@ -31,7 +31,8 @@ namespace compiler {
|
||||
|
||||
class BytecodeGraphBuilder {
|
||||
public:
|
||||
BytecodeGraphBuilder(Zone* local_zone, Handle<BytecodeArray> bytecode_array,
|
||||
BytecodeGraphBuilder(JSHeapBroker* broker, Zone* local_zone,
|
||||
Handle<BytecodeArray> bytecode_array,
|
||||
Handle<SharedFunctionInfo> shared,
|
||||
Handle<FeedbackVector> feedback_vector,
|
||||
BailoutId osr_offset, JSGraph* jsgraph,
|
||||
@ -371,10 +372,13 @@ class BytecodeGraphBuilder {
|
||||
|
||||
Handle<Context> native_context() const { return native_context_; }
|
||||
|
||||
JSHeapBroker* broker() const { return broker_; }
|
||||
|
||||
#define DECLARE_VISIT_BYTECODE(name, ...) void Visit##name();
|
||||
BYTECODE_LIST(DECLARE_VISIT_BYTECODE)
|
||||
#undef DECLARE_VISIT_BYTECODE
|
||||
|
||||
JSHeapBroker* const broker_;
|
||||
Zone* const local_zone_;
|
||||
JSGraph* const jsgraph_;
|
||||
CallFrequency const invocation_frequency_;
|
||||
@ -934,13 +938,15 @@ Node* BytecodeGraphBuilder::Environment::Checkpoint(
|
||||
}
|
||||
|
||||
BytecodeGraphBuilder::BytecodeGraphBuilder(
|
||||
Zone* local_zone, Handle<BytecodeArray> bytecode_array,
|
||||
JSHeapBroker* broker, Zone* local_zone,
|
||||
Handle<BytecodeArray> bytecode_array,
|
||||
Handle<SharedFunctionInfo> shared_info,
|
||||
Handle<FeedbackVector> feedback_vector, BailoutId osr_offset,
|
||||
JSGraph* jsgraph, CallFrequency invocation_frequency,
|
||||
SourcePositionTable* source_positions, Handle<Context> native_context,
|
||||
int inlining_id, BytecodeGraphBuilderFlags flags)
|
||||
: local_zone_(local_zone),
|
||||
: broker_(broker),
|
||||
local_zone_(local_zone),
|
||||
jsgraph_(jsgraph),
|
||||
invocation_frequency_(invocation_frequency),
|
||||
bytecode_array_(bytecode_array),
|
||||
@ -1005,18 +1011,21 @@ VectorSlotPair BytecodeGraphBuilder::CreateVectorSlotPair(int slot_id) {
|
||||
}
|
||||
|
||||
void BytecodeGraphBuilder::CreateGraph() {
|
||||
BytecodeArrayRef bytecode_array_ref(broker(), bytecode_array());
|
||||
|
||||
SourcePositionTable::Scope pos_scope(source_positions_, start_position_);
|
||||
|
||||
// Set up the basic structure of the graph. Outputs for {Start} are the formal
|
||||
// parameters (including the receiver) plus new target, number of arguments,
|
||||
// context and closure.
|
||||
int actual_parameter_count = bytecode_array()->parameter_count() + 4;
|
||||
int actual_parameter_count = bytecode_array_ref.parameter_count() + 4;
|
||||
graph()->SetStart(graph()->NewNode(common()->Start(actual_parameter_count)));
|
||||
|
||||
Environment env(this, bytecode_array()->register_count(),
|
||||
bytecode_array()->parameter_count(),
|
||||
bytecode_array()->incoming_new_target_or_generator_register(),
|
||||
graph()->start());
|
||||
Environment env(
|
||||
this, bytecode_array_ref.register_count(),
|
||||
bytecode_array_ref.parameter_count(),
|
||||
bytecode_array_ref.incoming_new_target_or_generator_register(),
|
||||
graph()->start());
|
||||
set_environment(&env);
|
||||
|
||||
VisitBytecodes();
|
||||
@ -4023,13 +4032,16 @@ void BytecodeGraphBuilder::UpdateSourcePosition(int offset) {
|
||||
}
|
||||
}
|
||||
|
||||
void BuildGraphFromBytecode(
|
||||
Zone* local_zone, Handle<BytecodeArray> bytecode_array,
|
||||
Handle<SharedFunctionInfo> shared, Handle<FeedbackVector> feedback_vector,
|
||||
BailoutId osr_offset, JSGraph* jsgraph, CallFrequency invocation_frequency,
|
||||
SourcePositionTable* source_positions, Handle<Context> native_context,
|
||||
int inlining_id, BytecodeGraphBuilderFlags flags) {
|
||||
BytecodeGraphBuilder builder(local_zone, bytecode_array, shared,
|
||||
void BuildGraphFromBytecode(JSHeapBroker* broker, Zone* local_zone,
|
||||
Handle<BytecodeArray> bytecode_array,
|
||||
Handle<SharedFunctionInfo> shared,
|
||||
Handle<FeedbackVector> feedback_vector,
|
||||
BailoutId osr_offset, JSGraph* jsgraph,
|
||||
CallFrequency invocation_frequency,
|
||||
SourcePositionTable* source_positions,
|
||||
Handle<Context> native_context, int inlining_id,
|
||||
BytecodeGraphBuilderFlags flags) {
|
||||
BytecodeGraphBuilder builder(broker, local_zone, bytecode_array, shared,
|
||||
feedback_vector, osr_offset, jsgraph,
|
||||
invocation_frequency, source_positions,
|
||||
native_context, inlining_id, flags);
|
||||
|
@ -30,12 +30,15 @@ enum class BytecodeGraphBuilderFlag : uint8_t {
|
||||
};
|
||||
using BytecodeGraphBuilderFlags = base::Flags<BytecodeGraphBuilderFlag>;
|
||||
|
||||
void BuildGraphFromBytecode(
|
||||
Zone* local_zone, Handle<BytecodeArray> bytecode_array,
|
||||
Handle<SharedFunctionInfo> shared, Handle<FeedbackVector> feedback_vector,
|
||||
BailoutId osr_offset, JSGraph* jsgraph, CallFrequency invocation_frequency,
|
||||
SourcePositionTable* source_positions, Handle<Context> native_context,
|
||||
int inlining_id, BytecodeGraphBuilderFlags flags);
|
||||
void BuildGraphFromBytecode(JSHeapBroker* broker, Zone* local_zone,
|
||||
Handle<BytecodeArray> bytecode_array,
|
||||
Handle<SharedFunctionInfo> shared,
|
||||
Handle<FeedbackVector> feedback_vector,
|
||||
BailoutId osr_offset, JSGraph* jsgraph,
|
||||
CallFrequency invocation_frequency,
|
||||
SourcePositionTable* source_positions,
|
||||
Handle<Context> native_context, int inlining_id,
|
||||
BytecodeGraphBuilderFlags flags);
|
||||
|
||||
} // namespace compiler
|
||||
} // namespace internal
|
||||
|
@ -1277,14 +1277,23 @@ void FixedDoubleArrayData::SerializeContents(JSHeapBroker* broker) {
|
||||
class BytecodeArrayData : public FixedArrayBaseData {
|
||||
public:
|
||||
int register_count() const { return register_count_; }
|
||||
int parameter_count() const { return parameter_count_; }
|
||||
interpreter::Register incoming_new_target_or_generator_register() const {
|
||||
return incoming_new_target_or_generator_register_;
|
||||
}
|
||||
|
||||
BytecodeArrayData(JSHeapBroker* broker, ObjectData** storage,
|
||||
Handle<BytecodeArray> object)
|
||||
: FixedArrayBaseData(broker, storage, object),
|
||||
register_count_(object->register_count()) {}
|
||||
register_count_(object->register_count()),
|
||||
parameter_count_(object->parameter_count()),
|
||||
incoming_new_target_or_generator_register_(
|
||||
object->incoming_new_target_or_generator_register()) {}
|
||||
|
||||
private:
|
||||
int const register_count_;
|
||||
int const parameter_count_;
|
||||
interpreter::Register const incoming_new_target_or_generator_register_;
|
||||
};
|
||||
|
||||
class JSArrayData : public JSObjectData {
|
||||
@ -2575,6 +2584,9 @@ BIMODAL_ACCESSOR_C(AllocationSite, ElementsKind, GetElementsKind)
|
||||
BIMODAL_ACCESSOR_C(AllocationSite, AllocationType, GetAllocationType)
|
||||
|
||||
BIMODAL_ACCESSOR_C(BytecodeArray, int, register_count)
|
||||
BIMODAL_ACCESSOR_C(BytecodeArray, int, parameter_count)
|
||||
BIMODAL_ACCESSOR_C(BytecodeArray, interpreter::Register,
|
||||
incoming_new_target_or_generator_register)
|
||||
|
||||
BIMODAL_ACCESSOR(Cell, Object, value)
|
||||
|
||||
|
@ -558,6 +558,8 @@ class BytecodeArrayRef : public FixedArrayBaseRef {
|
||||
Handle<BytecodeArray> object() const;
|
||||
|
||||
int register_count() const;
|
||||
int parameter_count() const;
|
||||
interpreter::Register incoming_new_target_or_generator_register() const;
|
||||
};
|
||||
|
||||
class JSArrayRef : public JSObjectRef {
|
||||
|
@ -496,10 +496,10 @@ Reduction JSInliner::ReduceJSCall(Node* node) {
|
||||
if (info_->is_bailout_on_uninitialized()) {
|
||||
flags |= BytecodeGraphBuilderFlag::kBailoutOnUninitialized;
|
||||
}
|
||||
BuildGraphFromBytecode(zone(), bytecode_array, shared_info, feedback_vector,
|
||||
BailoutId::None(), jsgraph(), call.frequency(),
|
||||
source_positions_, native_context(), inlining_id,
|
||||
flags);
|
||||
BuildGraphFromBytecode(broker(), zone(), bytecode_array, shared_info,
|
||||
feedback_vector, BailoutId::None(), jsgraph(),
|
||||
call.frequency(), source_positions_,
|
||||
native_context(), inlining_id, flags);
|
||||
|
||||
// Extract the inlinee start/end nodes.
|
||||
start = graph()->start();
|
||||
|
@ -1072,7 +1072,8 @@ struct GraphBuilderPhase {
|
||||
flags |= BytecodeGraphBuilderFlag::kBailoutOnUninitialized;
|
||||
}
|
||||
BuildGraphFromBytecode(
|
||||
temp_zone, data->info()->bytecode_array(), data->info()->shared_info(),
|
||||
data->broker(), temp_zone, data->info()->bytecode_array(),
|
||||
data->info()->shared_info(),
|
||||
handle(data->info()->closure()->feedback_vector(), data->isolate()),
|
||||
data->info()->osr_offset(), data->jsgraph(), CallFrequency(1.0f),
|
||||
data->source_positions(), data->native_context(),
|
||||
|
Loading…
Reference in New Issue
Block a user