Commit 5fdea8fd authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[GetIsolate] Remove GetIsolate from src/compiler

Bug: v8:7786
Change-Id: I1e568ff6da02dfd92b24b8badd665096cf49a13a
Reviewed-on: https://chromium-review.googlesource.com/1101321Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53747}
parent 14e0f3cc
...@@ -711,7 +711,7 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function, ...@@ -711,7 +711,7 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
// tolerate the lack of a script without bytecode. // tolerate the lack of a script without bytecode.
DCHECK_IMPLIES(!has_script, shared->HasBytecodeArray()); DCHECK_IMPLIES(!has_script, shared->HasBytecodeArray());
std::unique_ptr<OptimizedCompilationJob> job( std::unique_ptr<OptimizedCompilationJob> job(
compiler::Pipeline::NewCompilationJob(function, has_script)); compiler::Pipeline::NewCompilationJob(isolate, function, has_script));
OptimizedCompilationInfo* compilation_info = job->compilation_info(); OptimizedCompilationInfo* compilation_info = job->compilation_info();
compilation_info->SetOptimizingForOsr(osr_offset, osr_frame); compilation_info->SetOptimizingForOsr(osr_offset, osr_frame);
......
...@@ -90,6 +90,7 @@ class AllocationBuilder final { ...@@ -90,6 +90,7 @@ class AllocationBuilder final {
protected: protected:
JSGraph* jsgraph() { return jsgraph_; } JSGraph* jsgraph() { return jsgraph_; }
Isolate* isolate() const { return jsgraph_->isolate(); }
Graph* graph() { return jsgraph_->graph(); } Graph* graph() { return jsgraph_->graph(); }
CommonOperatorBuilder* common() { return jsgraph_->common(); } CommonOperatorBuilder* common() { return jsgraph_->common(); }
SimplifiedOperatorBuilder* simplified() { return jsgraph_->simplified(); } SimplifiedOperatorBuilder* simplified() { return jsgraph_->simplified(); }
......
...@@ -247,13 +247,15 @@ bool BranchElimination::ControlPathConditions::LookupCondition( ...@@ -247,13 +247,15 @@ bool BranchElimination::ControlPathConditions::LookupCondition(
} }
} }
return false; return false;
} }
Graph* BranchElimination::graph() const { return jsgraph()->graph(); } Graph* BranchElimination::graph() const { return jsgraph()->graph(); }
CommonOperatorBuilder* BranchElimination::common() const { Isolate* BranchElimination::isolate() const { return jsgraph()->isolate(); }
return jsgraph()->common();
} CommonOperatorBuilder* BranchElimination::common() const {
return jsgraph()->common();
}
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
......
...@@ -72,6 +72,7 @@ class V8_EXPORT_PRIVATE BranchElimination final ...@@ -72,6 +72,7 @@ class V8_EXPORT_PRIVATE BranchElimination final
Node* dead() const { return dead_; } Node* dead() const { return dead_; }
Graph* graph() const; Graph* graph() const;
JSGraph* jsgraph() const { return jsgraph_; } JSGraph* jsgraph() const { return jsgraph_; }
Isolate* isolate() const;
CommonOperatorBuilder* common() const; CommonOperatorBuilder* common() const;
JSGraph* const jsgraph_; JSGraph* const jsgraph_;
......
...@@ -521,7 +521,8 @@ BytecodeGraphBuilder::BytecodeGraphBuilder( ...@@ -521,7 +521,8 @@ BytecodeGraphBuilder::BytecodeGraphBuilder(
: local_zone_(local_zone), : local_zone_(local_zone),
jsgraph_(jsgraph), jsgraph_(jsgraph),
invocation_frequency_(invocation_frequency), invocation_frequency_(invocation_frequency),
bytecode_array_(handle(shared_info->GetBytecodeArray())), bytecode_array_(
handle(shared_info->GetBytecodeArray(), jsgraph->isolate())),
feedback_vector_(feedback_vector), feedback_vector_(feedback_vector),
type_hint_lowering_(jsgraph, feedback_vector, flags), type_hint_lowering_(jsgraph, feedback_vector, flags),
frame_state_function_info_(common()->CreateFrameStateFunctionInfo( frame_state_function_info_(common()->CreateFrameStateFunctionInfo(
...@@ -878,7 +879,7 @@ void BytecodeGraphBuilder::VisitBytecodes() { ...@@ -878,7 +879,7 @@ void BytecodeGraphBuilder::VisitBytecodes() {
interpreter::BytecodeArrayIterator iterator(bytecode_array()); interpreter::BytecodeArrayIterator iterator(bytecode_array());
set_bytecode_iterator(&iterator); set_bytecode_iterator(&iterator);
SourcePositionTableIterator source_position_iterator( SourcePositionTableIterator source_position_iterator(
handle(bytecode_array()->SourcePositionTable())); handle(bytecode_array()->SourcePositionTable(), isolate()));
if (analyze_environment_liveness() && FLAG_trace_environment_liveness) { if (analyze_environment_liveness() && FLAG_trace_environment_liveness) {
StdoutStream of; StdoutStream of;
...@@ -1471,7 +1472,8 @@ void BytecodeGraphBuilder::VisitCreateClosure() { ...@@ -1471,7 +1472,8 @@ void BytecodeGraphBuilder::VisitCreateClosure() {
: NOT_TENURED; : NOT_TENURED;
const Operator* op = javascript()->CreateClosure( const Operator* op = javascript()->CreateClosure(
shared_info, nexus.GetFeedbackCell(), shared_info, nexus.GetFeedbackCell(),
handle(jsgraph()->isolate()->builtins()->builtin(Builtins::kCompileLazy)), handle(jsgraph()->isolate()->builtins()->builtin(Builtins::kCompileLazy),
isolate()),
tenured); tenured);
Node* closure = NewNode(op); Node* closure = NewNode(op);
environment()->BindAccumulator(closure); environment()->BindAccumulator(closure);
...@@ -1625,8 +1627,8 @@ void BytecodeGraphBuilder::VisitGetTemplateObject() { ...@@ -1625,8 +1627,8 @@ void BytecodeGraphBuilder::VisitGetTemplateObject() {
cached_value = TemplateObjectDescription::CreateTemplateObject(description); cached_value = TemplateObjectDescription::CreateTemplateObject(description);
nexus.vector()->Set(slot, *cached_value); nexus.vector()->Set(slot, *cached_value);
} else { } else {
cached_value = cached_value = handle(
handle(JSArray::cast(nexus.GetFeedback()->ToStrongHeapObject())); JSArray::cast(nexus.GetFeedback()->ToStrongHeapObject()), isolate());
} }
Node* template_object = jsgraph()->HeapConstant(cached_value); Node* template_object = jsgraph()->HeapConstant(cached_value);
......
...@@ -302,6 +302,7 @@ class BytecodeGraphBuilder { ...@@ -302,6 +302,7 @@ class BytecodeGraphBuilder {
CommonOperatorBuilder* common() const { return jsgraph_->common(); } CommonOperatorBuilder* common() const { return jsgraph_->common(); }
Zone* graph_zone() const { return graph()->zone(); } Zone* graph_zone() const { return graph()->zone(); }
JSGraph* jsgraph() const { return jsgraph_; } JSGraph* jsgraph() const { return jsgraph_; }
Isolate* isolate() const { return jsgraph_->isolate(); }
JSOperatorBuilder* javascript() const { return jsgraph_->javascript(); } JSOperatorBuilder* javascript() const { return jsgraph_->javascript(); }
SimplifiedOperatorBuilder* simplified() const { SimplifiedOperatorBuilder* simplified() const {
return jsgraph_->simplified(); return jsgraph_->simplified();
......
...@@ -100,6 +100,7 @@ class V8_EXPORT_PRIVATE EscapeAnalysisReducer final ...@@ -100,6 +100,7 @@ class V8_EXPORT_PRIVATE EscapeAnalysisReducer final
Reduction ReplaceNode(Node* original, Node* replacement); Reduction ReplaceNode(Node* original, Node* replacement);
JSGraph* jsgraph() const { return jsgraph_; } JSGraph* jsgraph() const { return jsgraph_; }
Isolate* isolate() const { return jsgraph_->isolate(); }
EscapeAnalysisResult analysis_result() const { return analysis_result_; } EscapeAnalysisResult analysis_result() const { return analysis_result_; }
Zone* zone() const { return zone_; } Zone* zone() const { return zone_; }
......
...@@ -180,6 +180,7 @@ class V8_EXPORT_PRIVATE EscapeAnalysis final ...@@ -180,6 +180,7 @@ class V8_EXPORT_PRIVATE EscapeAnalysis final
private: private:
void Reduce(Node* node, Reduction* reduction); void Reduce(Node* node, Reduction* reduction);
JSGraph* jsgraph() { return jsgraph_; } JSGraph* jsgraph() { return jsgraph_; }
Isolate* isolate() const { return jsgraph_->isolate(); }
EscapeAnalysisTracker* tracker_; EscapeAnalysisTracker* tracker_;
JSGraph* jsgraph_; JSGraph* jsgraph_;
}; };
......
...@@ -258,6 +258,7 @@ class GraphAssembler { ...@@ -258,6 +258,7 @@ class GraphAssembler {
Operator const* ToNumberOperator(); Operator const* ToNumberOperator();
JSGraph* jsgraph() const { return jsgraph_; } JSGraph* jsgraph() const { return jsgraph_; }
Isolate* isolate() const { return jsgraph_->isolate(); }
Graph* graph() const { return jsgraph_->graph(); } Graph* graph() const { return jsgraph_->graph(); }
Zone* temp_zone() const { return temp_zone_; } Zone* temp_zone() const { return temp_zone_; }
CommonOperatorBuilder* common() const { return jsgraph()->common(); } CommonOperatorBuilder* common() const { return jsgraph()->common(); }
......
This diff is collapsed.
...@@ -1147,7 +1147,7 @@ Reduction JSCreateLowering::ReduceJSCreateKeyValueArray(Node* node) { ...@@ -1147,7 +1147,7 @@ Reduction JSCreateLowering::ReduceJSCreateKeyValueArray(Node* node) {
Node* effect = NodeProperties::GetEffectInput(node); Node* effect = NodeProperties::GetEffectInput(node);
Node* array_map = jsgraph()->HeapConstant( Node* array_map = jsgraph()->HeapConstant(
handle(native_context()->js_array_fast_elements_map_index())); handle(native_context()->js_array_fast_elements_map_index(), isolate()));
Node* properties = jsgraph()->EmptyFixedArrayConstant(); Node* properties = jsgraph()->EmptyFixedArrayConstant();
Node* length = jsgraph()->Constant(2); Node* length = jsgraph()->Constant(2);
......
...@@ -113,7 +113,7 @@ Reduction JSInliningHeuristic::Reduce(Node* node) { ...@@ -113,7 +113,7 @@ Reduction JSInliningHeuristic::Reduce(Node* node) {
Handle<SharedFunctionInfo> shared = Handle<SharedFunctionInfo> shared =
candidate.functions[i].is_null() candidate.functions[i].is_null()
? candidate.shared_info ? candidate.shared_info
: handle(candidate.functions[i]->shared()); : handle(candidate.functions[i]->shared(), isolate());
candidate.can_inline_function[i] = CanInlineFunction(shared); candidate.can_inline_function[i] = CanInlineFunction(shared);
// Do not allow direct recursion i.e. f() -> f(). We still allow indirect // Do not allow direct recursion i.e. f() -> f(). We still allow indirect
// recurion like f() -> g() -> f(). The indirect recursion is helpful in // recurion like f() -> g() -> f(). The indirect recursion is helpful in
...@@ -607,7 +607,7 @@ Reduction JSInliningHeuristic::InlineCandidate(Candidate const& candidate, ...@@ -607,7 +607,7 @@ Reduction JSInliningHeuristic::InlineCandidate(Candidate const& candidate,
Handle<SharedFunctionInfo> shared = Handle<SharedFunctionInfo> shared =
candidate.functions[0].is_null() candidate.functions[0].is_null()
? candidate.shared_info ? candidate.shared_info
: handle(candidate.functions[0]->shared()); : handle(candidate.functions[0]->shared(), isolate());
Reduction const reduction = inliner_.ReduceJSCall(node); Reduction const reduction = inliner_.ReduceJSCall(node);
if (reduction.Changed()) { if (reduction.Changed()) {
cumulative_count_ += shared->GetBytecodeArray()->length(); cumulative_count_ += shared->GetBytecodeArray()->length();
...@@ -719,7 +719,7 @@ void JSInliningHeuristic::PrintCandidates() { ...@@ -719,7 +719,7 @@ void JSInliningHeuristic::PrintCandidates() {
Handle<SharedFunctionInfo> shared = Handle<SharedFunctionInfo> shared =
candidate.functions[i].is_null() candidate.functions[i].is_null()
? candidate.shared_info ? candidate.shared_info
: handle(candidate.functions[i]->shared()); : handle(candidate.functions[i]->shared(), isolate());
PrintF(" - size:%d, name: %s\n", shared->GetBytecodeArray()->length(), PrintF(" - size:%d, name: %s\n", shared->GetBytecodeArray()->length(),
shared->DebugName()->ToCString().get()); shared->DebugName()->ToCString().get());
} }
......
...@@ -80,6 +80,7 @@ class JSInliningHeuristic final : public AdvancedReducer { ...@@ -80,6 +80,7 @@ class JSInliningHeuristic final : public AdvancedReducer {
CommonOperatorBuilder* common() const; CommonOperatorBuilder* common() const;
Graph* graph() const; Graph* graph() const;
JSGraph* jsgraph() const { return jsgraph_; } JSGraph* jsgraph() const { return jsgraph_; }
Isolate* isolate() const { return jsgraph_->isolate(); }
SimplifiedOperatorBuilder* simplified() const; SimplifiedOperatorBuilder* simplified() const;
Mode const mode_; Mode const mode_;
......
...@@ -298,7 +298,7 @@ bool JSInliner::DetermineCallTarget( ...@@ -298,7 +298,7 @@ bool JSInliner::DetermineCallTarget(
return false; return false;
} }
shared_info_out = handle(function->shared()); shared_info_out = handle(function->shared(), isolate());
return true; return true;
} }
...@@ -343,8 +343,8 @@ void JSInliner::DetermineCallContext( ...@@ -343,8 +343,8 @@ void JSInliner::DetermineCallContext(
JSFunction::EnsureFeedbackVector(function); JSFunction::EnsureFeedbackVector(function);
// The inlinee specializes to the context from the JSFunction object. // The inlinee specializes to the context from the JSFunction object.
context_out = jsgraph()->Constant(handle(function->context())); context_out = jsgraph()->Constant(handle(function->context(), isolate()));
feedback_vector_out = handle(function->feedback_vector()); feedback_vector_out = handle(function->feedback_vector(), isolate());
return; return;
} }
...@@ -358,7 +358,8 @@ void JSInliner::DetermineCallContext( ...@@ -358,7 +358,8 @@ void JSInliner::DetermineCallContext(
// The inlinee uses the locally provided context at instantiation. // The inlinee uses the locally provided context at instantiation.
context_out = NodeProperties::GetContextInput(match.node()); context_out = NodeProperties::GetContextInput(match.node());
feedback_vector_out = handle(FeedbackVector::cast(cell->value())); feedback_vector_out =
handle(FeedbackVector::cast(cell->value()), isolate());
return; return;
} }
...@@ -372,7 +373,7 @@ Reduction JSInliner::Reduce(Node* node) { ...@@ -372,7 +373,7 @@ Reduction JSInliner::Reduce(Node* node) {
} }
Handle<Context> JSInliner::native_context() const { Handle<Context> JSInliner::native_context() const {
return handle(info_->context()->native_context()); return handle(info_->context()->native_context(), isolate());
} }
Reduction JSInliner::ReduceJSCall(Node* node) { Reduction JSInliner::ReduceJSCall(Node* node) {
...@@ -604,10 +605,10 @@ Reduction JSInliner::ReduceJSCall(Node* node) { ...@@ -604,10 +605,10 @@ Reduction JSInliner::ReduceJSCall(Node* node) {
if (node->opcode() == IrOpcode::kJSCall && if (node->opcode() == IrOpcode::kJSCall &&
is_sloppy(shared_info->language_mode()) && !shared_info->native()) { is_sloppy(shared_info->language_mode()) && !shared_info->native()) {
Node* effect = NodeProperties::GetEffectInput(node); Node* effect = NodeProperties::GetEffectInput(node);
if (NodeProperties::CanBePrimitive(call.receiver(), effect)) { if (NodeProperties::CanBePrimitive(isolate(), call.receiver(), effect)) {
CallParameters const& p = CallParametersOf(node->op()); CallParameters const& p = CallParametersOf(node->op());
Node* global_proxy = jsgraph()->HeapConstant( Node* global_proxy = jsgraph()->HeapConstant(
handle(info_->native_context()->global_proxy())); handle(info_->native_context()->global_proxy(), isolate()));
Node* receiver = effect = Node* receiver = effect =
graph()->NewNode(simplified()->ConvertReceiver(p.convert_mode()), graph()->NewNode(simplified()->ConvertReceiver(p.convert_mode()),
call.receiver(), global_proxy, effect, start); call.receiver(), global_proxy, effect, start);
......
...@@ -47,6 +47,7 @@ class JSInliner final : public AdvancedReducer { ...@@ -47,6 +47,7 @@ class JSInliner final : public AdvancedReducer {
SimplifiedOperatorBuilder* simplified() const; SimplifiedOperatorBuilder* simplified() const;
Graph* graph() const; Graph* graph() const;
JSGraph* jsgraph() const { return jsgraph_; } JSGraph* jsgraph() const { return jsgraph_; }
Isolate* isolate() const { return jsgraph_->isolate(); }
Handle<Context> native_context() const; Handle<Context> native_context() const;
Zone* const local_zone_; Zone* const local_zone_;
......
...@@ -302,7 +302,8 @@ JSNativeContextSpecialization::InferHasInPrototypeChain( ...@@ -302,7 +302,8 @@ JSNativeContextSpecialization::InferHasInPrototypeChain(
Node* receiver, Node* effect, Handle<HeapObject> prototype) { Node* receiver, Node* effect, Handle<HeapObject> prototype) {
ZoneHandleSet<Map> receiver_maps; ZoneHandleSet<Map> receiver_maps;
NodeProperties::InferReceiverMapsResult result = NodeProperties::InferReceiverMapsResult result =
NodeProperties::InferReceiverMaps(receiver, effect, &receiver_maps); NodeProperties::InferReceiverMaps(isolate(), receiver, effect,
&receiver_maps);
if (result == NodeProperties::kNoReceiverMaps) return kMayBeInPrototypeChain; if (result == NodeProperties::kNoReceiverMaps) return kMayBeInPrototypeChain;
// Check if either all or none of the {receiver_maps} have the given // Check if either all or none of the {receiver_maps} have the given
...@@ -437,12 +438,13 @@ Reduction JSNativeContextSpecialization::ReduceJSPromiseResolve(Node* node) { ...@@ -437,12 +438,13 @@ Reduction JSNativeContextSpecialization::ReduceJSPromiseResolve(Node* node) {
// Check if the {constructor} is the %Promise% function. // Check if the {constructor} is the %Promise% function.
HeapObjectMatcher m(constructor); HeapObjectMatcher m(constructor);
if (!m.Is(handle(native_context()->promise_function()))) return NoChange(); if (!m.Is(handle(native_context()->promise_function(), isolate())))
return NoChange();
// Check if we know something about the {value}. // Check if we know something about the {value}.
ZoneHandleSet<Map> value_maps; ZoneHandleSet<Map> value_maps;
NodeProperties::InferReceiverMapsResult result = NodeProperties::InferReceiverMapsResult result =
NodeProperties::InferReceiverMaps(value, effect, &value_maps); NodeProperties::InferReceiverMaps(isolate(), value, effect, &value_maps);
if (result == NodeProperties::kNoReceiverMaps) return NoChange(); if (result == NodeProperties::kNoReceiverMaps) return NoChange();
DCHECK_NE(0, value_maps.size()); DCHECK_NE(0, value_maps.size());
...@@ -472,7 +474,8 @@ Reduction JSNativeContextSpecialization::ReduceJSResolvePromise(Node* node) { ...@@ -472,7 +474,8 @@ Reduction JSNativeContextSpecialization::ReduceJSResolvePromise(Node* node) {
// Check if we know something about the {resolution}. // Check if we know something about the {resolution}.
ZoneHandleSet<Map> resolution_maps; ZoneHandleSet<Map> resolution_maps;
NodeProperties::InferReceiverMapsResult result = NodeProperties::InferReceiverMapsResult result =
NodeProperties::InferReceiverMaps(resolution, effect, &resolution_maps); NodeProperties::InferReceiverMaps(isolate(), resolution, effect,
&resolution_maps);
if (result != NodeProperties::kReliableReceiverMaps) return NoChange(); if (result != NodeProperties::kReliableReceiverMaps) return NoChange();
DCHECK_NE(0, resolution_maps.size()); DCHECK_NE(0, resolution_maps.size());
...@@ -2837,7 +2840,7 @@ bool JSNativeContextSpecialization::InferReceiverMaps( ...@@ -2837,7 +2840,7 @@ bool JSNativeContextSpecialization::InferReceiverMaps(
Node* receiver, Node* effect, MapHandles* receiver_maps) { Node* receiver, Node* effect, MapHandles* receiver_maps) {
ZoneHandleSet<Map> maps; ZoneHandleSet<Map> maps;
NodeProperties::InferReceiverMapsResult result = NodeProperties::InferReceiverMapsResult result =
NodeProperties::InferReceiverMaps(receiver, effect, &maps); NodeProperties::InferReceiverMaps(isolate(), receiver, effect, &maps);
if (result == NodeProperties::kReliableReceiverMaps) { if (result == NodeProperties::kReliableReceiverMaps) {
for (size_t i = 0; i < maps.size(); ++i) { for (size_t i = 0; i < maps.size(); ++i) {
receiver_maps->push_back(maps[i]); receiver_maps->push_back(maps[i]);
......
...@@ -189,6 +189,7 @@ class JSSpeculativeBinopBuilder final { ...@@ -189,6 +189,7 @@ class JSSpeculativeBinopBuilder final {
} }
JSGraph* jsgraph() const { return lowering_->jsgraph(); } JSGraph* jsgraph() const { return lowering_->jsgraph(); }
Isolate* isolate() const { return jsgraph()->isolate(); }
Graph* graph() const { return jsgraph()->graph(); } Graph* graph() const { return jsgraph()->graph(); }
JSOperatorBuilder* javascript() { return jsgraph()->javascript(); } JSOperatorBuilder* javascript() { return jsgraph()->javascript(); }
SimplifiedOperatorBuilder* simplified() { return jsgraph()->simplified(); } SimplifiedOperatorBuilder* simplified() { return jsgraph()->simplified(); }
...@@ -212,6 +213,8 @@ JSTypeHintLowering::JSTypeHintLowering(JSGraph* jsgraph, ...@@ -212,6 +213,8 @@ JSTypeHintLowering::JSTypeHintLowering(JSGraph* jsgraph,
Flags flags) Flags flags)
: jsgraph_(jsgraph), flags_(flags), feedback_vector_(feedback_vector) {} : jsgraph_(jsgraph), flags_(flags), feedback_vector_(feedback_vector) {}
Isolate* JSTypeHintLowering::isolate() const { return jsgraph()->isolate(); }
JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceUnaryOperation( JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceUnaryOperation(
const Operator* op, Node* operand, Node* effect, Node* control, const Operator* op, Node* operand, Node* effect, Node* control,
FeedbackSlot slot) const { FeedbackSlot slot) const {
......
...@@ -157,6 +157,7 @@ class JSTypeHintLowering { ...@@ -157,6 +157,7 @@ class JSTypeHintLowering {
DeoptimizeReason reson) const; DeoptimizeReason reson) const;
JSGraph* jsgraph() const { return jsgraph_; } JSGraph* jsgraph() const { return jsgraph_; }
Isolate* isolate() const;
Flags flags() const { return flags_; } Flags flags() const { return flags_; }
const Handle<FeedbackVector>& feedback_vector() const { const Handle<FeedbackVector>& feedback_vector() const {
return feedback_vector_; return feedback_vector_;
......
...@@ -360,6 +360,7 @@ class JSBinopReduction final { ...@@ -360,6 +360,7 @@ class JSBinopReduction final {
SimplifiedOperatorBuilder* simplified() { return lowering_->simplified(); } SimplifiedOperatorBuilder* simplified() { return lowering_->simplified(); }
Graph* graph() const { return lowering_->graph(); } Graph* graph() const { return lowering_->graph(); }
JSGraph* jsgraph() { return lowering_->jsgraph(); } JSGraph* jsgraph() { return lowering_->jsgraph(); }
Isolate* isolate() { return jsgraph()->isolate(); }
JSOperatorBuilder* javascript() { return lowering_->javascript(); } JSOperatorBuilder* javascript() { return lowering_->javascript(); }
CommonOperatorBuilder* common() { return jsgraph()->common(); } CommonOperatorBuilder* common() { return jsgraph()->common(); }
Zone* zone() const { return graph()->zone(); } Zone* zone() const { return graph()->zone(); }
...@@ -1673,7 +1674,7 @@ Reduction JSTypedLowering::ReduceJSCall(Node* node) { ...@@ -1673,7 +1674,7 @@ Reduction JSTypedLowering::ReduceJSCall(Node* node) {
if (is_sloppy(shared->language_mode()) && !shared->native() && if (is_sloppy(shared->language_mode()) && !shared->native() &&
!receiver_type.Is(Type::Receiver())) { !receiver_type.Is(Type::Receiver())) {
Node* global_proxy = Node* global_proxy =
jsgraph()->HeapConstant(handle(function->global_proxy())); jsgraph()->HeapConstant(handle(function->global_proxy(), isolate()));
receiver = effect = receiver = effect =
graph()->NewNode(simplified()->ConvertReceiver(convert_mode), graph()->NewNode(simplified()->ConvertReceiver(convert_mode),
receiver, global_proxy, effect, control); receiver, global_proxy, effect, control);
......
...@@ -1369,6 +1369,8 @@ CommonOperatorBuilder* LoadElimination::common() const { ...@@ -1369,6 +1369,8 @@ CommonOperatorBuilder* LoadElimination::common() const {
Graph* LoadElimination::graph() const { return jsgraph()->graph(); } Graph* LoadElimination::graph() const { return jsgraph()->graph(); }
Isolate* LoadElimination::isolate() const { return jsgraph()->isolate(); }
Factory* LoadElimination::factory() const { return jsgraph()->factory(); } Factory* LoadElimination::factory() const { return jsgraph()->factory(); }
} // namespace compiler } // namespace compiler
......
...@@ -302,6 +302,7 @@ class V8_EXPORT_PRIVATE LoadElimination final ...@@ -302,6 +302,7 @@ class V8_EXPORT_PRIVATE LoadElimination final
CommonOperatorBuilder* common() const; CommonOperatorBuilder* common() const;
AbstractState const* empty_state() const { return &empty_state_; } AbstractState const* empty_state() const { return &empty_state_; }
Isolate* isolate() const;
Factory* factory() const; Factory* factory() const;
Graph* graph() const; Graph* graph() const;
JSGraph* jsgraph() const { return jsgraph_; } JSGraph* jsgraph() const { return jsgraph_; }
......
...@@ -363,11 +363,11 @@ bool NodeProperties::IsSame(Node* a, Node* b) { ...@@ -363,11 +363,11 @@ bool NodeProperties::IsSame(Node* a, Node* b) {
// static // static
NodeProperties::InferReceiverMapsResult NodeProperties::InferReceiverMaps( NodeProperties::InferReceiverMapsResult NodeProperties::InferReceiverMaps(
Node* receiver, Node* effect, ZoneHandleSet<Map>* maps_return) { Isolate* isolate, Node* receiver, Node* effect,
ZoneHandleSet<Map>* maps_return) {
HeapObjectMatcher m(receiver); HeapObjectMatcher m(receiver);
if (m.HasValue()) { if (m.HasValue()) {
Handle<HeapObject> receiver = m.Value(); Handle<HeapObject> receiver = m.Value();
Isolate* const isolate = m.Value()->GetIsolate();
// We don't use ICs for the Array.prototype and the Object.prototype // We don't use ICs for the Array.prototype and the Object.prototype
// because the runtime has to be able to intercept them properly, so // because the runtime has to be able to intercept them properly, so
// we better make sure that TurboFan doesn't outsmart the system here // we better make sure that TurboFan doesn't outsmart the system here
...@@ -503,12 +503,12 @@ NodeProperties::InferReceiverMapsResult NodeProperties::InferReceiverMaps( ...@@ -503,12 +503,12 @@ NodeProperties::InferReceiverMapsResult NodeProperties::InferReceiverMaps(
} }
// static // static
MaybeHandle<Map> NodeProperties::GetMapWitness(Node* node) { MaybeHandle<Map> NodeProperties::GetMapWitness(Isolate* isolate, Node* node) {
ZoneHandleSet<Map> maps; ZoneHandleSet<Map> maps;
Node* receiver = NodeProperties::GetValueInput(node, 1); Node* receiver = NodeProperties::GetValueInput(node, 1);
Node* effect = NodeProperties::GetEffectInput(node); Node* effect = NodeProperties::GetEffectInput(node);
NodeProperties::InferReceiverMapsResult result = NodeProperties::InferReceiverMapsResult result =
NodeProperties::InferReceiverMaps(receiver, effect, &maps); NodeProperties::InferReceiverMaps(isolate, receiver, effect, &maps);
if (result == NodeProperties::kReliableReceiverMaps && maps.size() == 1) { if (result == NodeProperties::kReliableReceiverMaps && maps.size() == 1) {
return maps[0]; return maps[0];
} }
...@@ -516,11 +516,13 @@ MaybeHandle<Map> NodeProperties::GetMapWitness(Node* node) { ...@@ -516,11 +516,13 @@ MaybeHandle<Map> NodeProperties::GetMapWitness(Node* node) {
} }
// static // static
bool NodeProperties::HasInstanceTypeWitness(Node* receiver, Node* effect, bool NodeProperties::HasInstanceTypeWitness(Isolate* isolate, Node* receiver,
Node* effect,
InstanceType instance_type) { InstanceType instance_type) {
ZoneHandleSet<Map> receiver_maps; ZoneHandleSet<Map> receiver_maps;
NodeProperties::InferReceiverMapsResult result = NodeProperties::InferReceiverMapsResult result =
NodeProperties::InferReceiverMaps(receiver, effect, &receiver_maps); NodeProperties::InferReceiverMaps(isolate, receiver, effect,
&receiver_maps);
switch (result) { switch (result) {
case NodeProperties::kUnreliableReceiverMaps: case NodeProperties::kUnreliableReceiverMaps:
case NodeProperties::kReliableReceiverMaps: case NodeProperties::kReliableReceiverMaps:
...@@ -551,7 +553,8 @@ bool NodeProperties::NoObservableSideEffectBetween(Node* effect, ...@@ -551,7 +553,8 @@ bool NodeProperties::NoObservableSideEffectBetween(Node* effect,
} }
// static // static
bool NodeProperties::CanBePrimitive(Node* receiver, Node* effect) { bool NodeProperties::CanBePrimitive(Isolate* isolate, Node* receiver,
Node* effect) {
switch (receiver->opcode()) { switch (receiver->opcode()) {
#define CASE(Opcode) case IrOpcode::k##Opcode: #define CASE(Opcode) case IrOpcode::k##Opcode:
JS_CONSTRUCT_OP_LIST(CASE) JS_CONSTRUCT_OP_LIST(CASE)
...@@ -571,7 +574,8 @@ bool NodeProperties::CanBePrimitive(Node* receiver, Node* effect) { ...@@ -571,7 +574,8 @@ bool NodeProperties::CanBePrimitive(Node* receiver, Node* effect) {
// just the instance types, which don't change // just the instance types, which don't change
// across potential side-effecting operations. // across potential side-effecting operations.
ZoneHandleSet<Map> maps; ZoneHandleSet<Map> maps;
if (InferReceiverMaps(receiver, effect, &maps) != kNoReceiverMaps) { if (InferReceiverMaps(isolate, receiver, effect, &maps) !=
kNoReceiverMaps) {
// Check if all {maps} are actually JSReceiver maps. // Check if all {maps} are actually JSReceiver maps.
for (size_t i = 0; i < maps.size(); ++i) { for (size_t i = 0; i < maps.size(); ++i) {
if (!maps[i]->IsJSReceiverMap()) return true; if (!maps[i]->IsJSReceiverMap()) return true;
...@@ -584,8 +588,9 @@ bool NodeProperties::CanBePrimitive(Node* receiver, Node* effect) { ...@@ -584,8 +588,9 @@ bool NodeProperties::CanBePrimitive(Node* receiver, Node* effect) {
} }
// static // static
bool NodeProperties::CanBeNullOrUndefined(Node* receiver, Node* effect) { bool NodeProperties::CanBeNullOrUndefined(Isolate* isolate, Node* receiver,
if (CanBePrimitive(receiver, effect)) { Node* effect) {
if (CanBePrimitive(isolate, receiver, effect)) {
switch (receiver->opcode()) { switch (receiver->opcode()) {
case IrOpcode::kCheckInternalizedString: case IrOpcode::kCheckInternalizedString:
case IrOpcode::kCheckNumber: case IrOpcode::kCheckNumber:
...@@ -602,7 +607,6 @@ bool NodeProperties::CanBeNullOrUndefined(Node* receiver, Node* effect) { ...@@ -602,7 +607,6 @@ bool NodeProperties::CanBeNullOrUndefined(Node* receiver, Node* effect) {
return false; return false;
case IrOpcode::kHeapConstant: { case IrOpcode::kHeapConstant: {
Handle<HeapObject> value = HeapObjectMatcher(receiver).Value(); Handle<HeapObject> value = HeapObjectMatcher(receiver).Value();
Isolate* const isolate = value->GetIsolate();
return value->IsNullOrUndefined(isolate); return value->IsNullOrUndefined(isolate);
} }
default: default:
......
...@@ -152,11 +152,12 @@ class V8_EXPORT_PRIVATE NodeProperties final { ...@@ -152,11 +152,12 @@ class V8_EXPORT_PRIVATE NodeProperties final {
// but instance type is reliable. // but instance type is reliable.
}; };
static InferReceiverMapsResult InferReceiverMaps( static InferReceiverMapsResult InferReceiverMaps(
Node* receiver, Node* effect, ZoneHandleSet<Map>* maps_return); Isolate* isolate, Node* receiver, Node* effect,
ZoneHandleSet<Map>* maps_return);
static MaybeHandle<Map> GetMapWitness(Node* node); static MaybeHandle<Map> GetMapWitness(Isolate* isolate, Node* node);
static bool HasInstanceTypeWitness(Node* receiver, Node* effect, static bool HasInstanceTypeWitness(Isolate* isolate, Node* receiver,
InstanceType instance_type); Node* effect, InstanceType instance_type);
// Walks up the {effect} chain to check that there's no observable side-effect // Walks up the {effect} chain to check that there's no observable side-effect
// between the {effect} and it's {dominator}. Aborts the walk if there's join // between the {effect} and it's {dominator}. Aborts the walk if there's join
...@@ -166,11 +167,12 @@ class V8_EXPORT_PRIVATE NodeProperties final { ...@@ -166,11 +167,12 @@ class V8_EXPORT_PRIVATE NodeProperties final {
// Returns true if the {receiver} can be a primitive value (i.e. is not // Returns true if the {receiver} can be a primitive value (i.e. is not
// definitely a JavaScript object); might walk up the {effect} chain to // definitely a JavaScript object); might walk up the {effect} chain to
// find map checks on {receiver}. // find map checks on {receiver}.
static bool CanBePrimitive(Node* receiver, Node* effect); static bool CanBePrimitive(Isolate* isolate, Node* receiver, Node* effect);
// Returns true if the {receiver} can be null or undefined. Might walk // Returns true if the {receiver} can be null or undefined. Might walk
// up the {effect} chain to find map checks for {receiver}. // up the {effect} chain to find map checks for {receiver}.
static bool CanBeNullOrUndefined(Node* receiver, Node* effect); static bool CanBeNullOrUndefined(Isolate* isolate, Node* receiver,
Node* effect);
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Context. // Context.
......
...@@ -568,8 +568,8 @@ void PrintParticipatingSource(OptimizedCompilationInfo* info, ...@@ -568,8 +568,8 @@ void PrintParticipatingSource(OptimizedCompilationInfo* info,
} }
// Print the code after compiling it. // Print the code after compiling it.
void PrintCode(Handle<Code> code, OptimizedCompilationInfo* info) { void PrintCode(Isolate* isolate, Handle<Code> code,
Isolate* isolate = code->GetIsolate(); OptimizedCompilationInfo* info) {
if (FLAG_print_opt_source && info->IsOptimizing()) { if (FLAG_print_opt_source && info->IsOptimizing()) {
PrintParticipatingSource(info, isolate); PrintParticipatingSource(info, isolate);
} }
...@@ -800,7 +800,8 @@ PipelineStatistics* CreatePipelineStatistics(wasm::FunctionBody function_body, ...@@ -800,7 +800,8 @@ PipelineStatistics* CreatePipelineStatistics(wasm::FunctionBody function_body,
class PipelineCompilationJob final : public OptimizedCompilationJob { class PipelineCompilationJob final : public OptimizedCompilationJob {
public: public:
PipelineCompilationJob(Handle<SharedFunctionInfo> shared_info, PipelineCompilationJob(Isolate* isolate,
Handle<SharedFunctionInfo> shared_info,
Handle<JSFunction> function) Handle<JSFunction> function)
// Note that the OptimizedCompilationInfo is not initialized at the time // Note that the OptimizedCompilationInfo is not initialized at the time
// we pass it to the CompilationJob constructor, but it is not // we pass it to the CompilationJob constructor, but it is not
...@@ -813,8 +814,8 @@ class PipelineCompilationJob final : public OptimizedCompilationJob { ...@@ -813,8 +814,8 @@ class PipelineCompilationJob final : public OptimizedCompilationJob {
compilation_info_(&zone_, function->GetIsolate(), shared_info, compilation_info_(&zone_, function->GetIsolate(), shared_info,
function), function),
pipeline_statistics_(CreatePipelineStatistics( pipeline_statistics_(CreatePipelineStatistics(
handle(Script::cast(shared_info->script())), compilation_info(), handle(Script::cast(shared_info->script()), isolate),
function->GetIsolate(), &zone_stats_)), compilation_info(), function->GetIsolate(), &zone_stats_)),
data_(&zone_stats_, function->GetIsolate(), compilation_info(), data_(&zone_stats_, function->GetIsolate(), compilation_info(),
pipeline_statistics_.get()), pipeline_statistics_.get()),
pipeline_(&data_), pipeline_(&data_),
...@@ -1106,7 +1107,7 @@ struct GraphBuilderPhase { ...@@ -1106,7 +1107,7 @@ struct GraphBuilderPhase {
} }
BytecodeGraphBuilder graph_builder( BytecodeGraphBuilder graph_builder(
temp_zone, data->info()->shared_info(), temp_zone, data->info()->shared_info(),
handle(data->info()->closure()->feedback_vector()), handle(data->info()->closure()->feedback_vector(), data->isolate()),
data->info()->osr_offset(), data->jsgraph(), CallFrequency(1.0f), data->info()->osr_offset(), data->jsgraph(), CallFrequency(1.0f),
data->source_positions(), data->native_context(), data->source_positions(), data->native_context(),
SourcePosition::kNotInlined, flags, true, SourcePosition::kNotInlined, flags, true,
...@@ -1132,10 +1133,10 @@ Maybe<OuterContext> GetModuleContext(Handle<JSFunction> closure) { ...@@ -1132,10 +1133,10 @@ Maybe<OuterContext> GetModuleContext(Handle<JSFunction> closure) {
} }
Maybe<OuterContext> ChooseSpecializationContext( Maybe<OuterContext> ChooseSpecializationContext(
OptimizedCompilationInfo* info) { Isolate* isolate, OptimizedCompilationInfo* info) {
if (info->is_function_context_specializing()) { if (info->is_function_context_specializing()) {
DCHECK(info->has_context()); DCHECK(info->has_context());
return Just(OuterContext(handle(info->context()), 0)); return Just(OuterContext(handle(info->context(), isolate), 0));
} }
return GetModuleContext(info->closure()); return GetModuleContext(info->closure());
} }
...@@ -1146,14 +1147,15 @@ struct InliningPhase { ...@@ -1146,14 +1147,15 @@ struct InliningPhase {
static const char* phase_name() { return "inlining"; } static const char* phase_name() { return "inlining"; }
void Run(PipelineData* data, Zone* temp_zone) { void Run(PipelineData* data, Zone* temp_zone) {
Isolate* isolate = data->isolate();
GraphReducer graph_reducer(temp_zone, data->graph(), GraphReducer graph_reducer(temp_zone, data->graph(),
data->jsgraph()->Dead()); data->jsgraph()->Dead());
DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(), DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
data->common(), temp_zone); data->common(), temp_zone);
CheckpointElimination checkpoint_elimination(&graph_reducer); CheckpointElimination checkpoint_elimination(&graph_reducer);
CommonOperatorReducer common_reducer(data->isolate(), &graph_reducer, CommonOperatorReducer common_reducer(isolate, &graph_reducer, data->graph(),
data->graph(), data->common(), data->common(), data->machine(),
data->machine(), temp_zone); temp_zone);
JSCallReducer call_reducer( JSCallReducer call_reducer(
&graph_reducer, data->jsgraph(), data->js_heap_broker(), &graph_reducer, data->jsgraph(), data->js_heap_broker(),
data->info()->is_bailout_on_uninitialized() data->info()->is_bailout_on_uninitialized()
...@@ -1162,7 +1164,7 @@ struct InliningPhase { ...@@ -1162,7 +1164,7 @@ struct InliningPhase {
data->native_context(), data->info()->dependencies()); data->native_context(), data->info()->dependencies());
JSContextSpecialization context_specialization( JSContextSpecialization context_specialization(
&graph_reducer, data->jsgraph(), &graph_reducer, data->jsgraph(),
ChooseSpecializationContext(data->info()), ChooseSpecializationContext(isolate, data->info()),
data->info()->is_function_context_specializing() data->info()->is_function_context_specializing()
? data->info()->closure() ? data->info()->closure()
: MaybeHandle<JSFunction>()); : MaybeHandle<JSFunction>());
...@@ -2199,9 +2201,10 @@ Handle<Code> Pipeline::GenerateCodeForTesting( ...@@ -2199,9 +2201,10 @@ Handle<Code> Pipeline::GenerateCodeForTesting(
// static // static
OptimizedCompilationJob* Pipeline::NewCompilationJob( OptimizedCompilationJob* Pipeline::NewCompilationJob(
Handle<JSFunction> function, bool has_script) { Isolate* isolate, Handle<JSFunction> function, bool has_script) {
Handle<SharedFunctionInfo> shared = handle(function->shared()); Handle<SharedFunctionInfo> shared =
return new PipelineCompilationJob(shared, function); handle(function->shared(), function->GetIsolate());
return new PipelineCompilationJob(isolate, shared, function);
} }
// static // static
...@@ -2423,7 +2426,7 @@ Handle<Code> PipelineImpl::FinalizeCode() { ...@@ -2423,7 +2426,7 @@ Handle<Code> PipelineImpl::FinalizeCode() {
} }
info()->SetCode(code); info()->SetCode(code);
PrintCode(code, info()); PrintCode(isolate(), code, info());
if (info()->trace_turbo_json_enabled()) { if (info()->trace_turbo_json_enabled()) {
TurboJsonFile json_of(info(), std::ios_base::app); TurboJsonFile json_of(info(), std::ios_base::app);
......
...@@ -41,7 +41,8 @@ class WasmCompilationData; ...@@ -41,7 +41,8 @@ class WasmCompilationData;
class Pipeline : public AllStatic { class Pipeline : public AllStatic {
public: public:
// Returns a new compilation job for the given function. // Returns a new compilation job for the given function.
static OptimizedCompilationJob* NewCompilationJob(Handle<JSFunction> function, static OptimizedCompilationJob* NewCompilationJob(Isolate* isolate,
Handle<JSFunction> function,
bool has_script); bool has_script);
// Returns a new compilation job for the WebAssembly compilation info. // Returns a new compilation job for the WebAssembly compilation info.
......
...@@ -147,6 +147,7 @@ class RedundantStoreFinder final { ...@@ -147,6 +147,7 @@ class RedundantStoreFinder final {
bool HasBeenVisited(Node* node); bool HasBeenVisited(Node* node);
JSGraph* jsgraph() const { return jsgraph_; } JSGraph* jsgraph() const { return jsgraph_; }
Isolate* isolate() { return jsgraph()->isolate(); }
Zone* temp_zone() const { return temp_zone_; } Zone* temp_zone() const { return temp_zone_; }
ZoneVector<UnobservablesSet>& unobservable() { return unobservable_; } ZoneVector<UnobservablesSet>& unobservable() { return unobservable_; }
UnobservablesSet& unobservable_for_id(NodeId id) { UnobservablesSet& unobservable_for_id(NodeId id) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment