Commit 7540e841 authored by Jaroslav Sevcik's avatar Jaroslav Sevcik Committed by Commit Bot

Revert "[turbofan] Lower monomorphic loads during graph building."

This reverts commit 14b424c3.

Reason for revert: Regresses benchmarks, e.g., Octane/gameboy

Original change's description:
> [turbofan] Lower monomorphic loads during graph building.
> 
> We introduce an explicit LoweringResult data structure. Until this change,
> the lowering result could be recovered from the node. However, lowering
> monomorphic loads requires wiring different value and effect, so we need
> a structure that can express such lowering result.
> 
> Bug: v8:6357
> Change-Id: I92655800890b744d9203a778a1936a8dcd465ed3
> Reviewed-on: https://chromium-review.googlesource.com/637304
> Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#47992}

TBR=mstarzinger@chromium.org,jarin@chromium.org,bmeurer@chromium.org

Change-Id: I2b7db0278c13414e20c94a34d215ed92bd0d412b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:6357
Reviewed-on: https://chromium-review.googlesource.com/667016Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48012}
parent b88adb28
......@@ -476,8 +476,7 @@ BytecodeGraphBuilder::BytecodeGraphBuilder(
Zone* local_zone, Handle<SharedFunctionInfo> shared_info,
Handle<FeedbackVector> feedback_vector, BailoutId osr_offset,
JSGraph* jsgraph, CallFrequency invocation_frequency,
SourcePositionTable* source_positions, Handle<Context> native_context,
CompilationDependencies* dependencies, int inlining_id,
SourcePositionTable* source_positions, int inlining_id,
JSTypeHintLowering::Flags flags, bool stack_check)
: local_zone_(local_zone),
jsgraph_(jsgraph),
......@@ -486,8 +485,7 @@ BytecodeGraphBuilder::BytecodeGraphBuilder(
exception_handler_table_(
handle(HandlerTable::cast(bytecode_array()->handler_table()))),
feedback_vector_(feedback_vector),
type_hint_lowering_(jsgraph, feedback_vector, native_context,
dependencies, flags, local_zone),
type_hint_lowering_(jsgraph, feedback_vector, flags),
frame_state_function_info_(common()->CreateFrameStateFunctionInfo(
FrameStateType::kInterpretedFunction,
bytecode_array()->parameter_count(),
......
......@@ -16,9 +16,6 @@
namespace v8 {
namespace internal {
class CompilationDependencies;
namespace compiler {
class Reduction;
......@@ -32,8 +29,7 @@ class BytecodeGraphBuilder {
Zone* local_zone, Handle<SharedFunctionInfo> shared,
Handle<FeedbackVector> feedback_vector, BailoutId osr_offset,
JSGraph* jsgraph, CallFrequency invocation_frequency,
SourcePositionTable* source_positions, Handle<Context> native_context,
CompilationDependencies* dependencies,
SourcePositionTable* source_positions,
int inlining_id = SourcePosition::kNotInlined,
JSTypeHintLowering::Flags flags = JSTypeHintLowering::kNoFlags,
bool stack_check = true);
......
......@@ -350,7 +350,8 @@ bool JSInliner::DetermineCallTarget(
// TODO(turbofan): We might want to revisit this restriction later when we
// have a need for this, and we know how to model different native contexts
// in the same graph in a compositional way.
if (function->context()->native_context() != *native_context()) {
if (function->context()->native_context() !=
info_->context()->native_context()) {
return false;
}
......@@ -429,10 +430,6 @@ Reduction JSInliner::Reduce(Node* node) {
return ReduceJSCall(node);
}
Handle<Context> JSInliner::native_context() const {
return handle(info_->context()->native_context());
}
Reduction JSInliner::ReduceJSCall(Node* node) {
DCHECK(IrOpcode::IsInlineeOpcode(node->opcode()));
Handle<SharedFunctionInfo> shared_info;
......@@ -544,8 +541,7 @@ Reduction JSInliner::ReduceJSCall(Node* node) {
}
BytecodeGraphBuilder graph_builder(
zone(), shared_info, feedback_vector, BailoutId::None(), jsgraph(),
call.frequency(), source_positions_, native_context(),
info_->dependencies(), inlining_id, flags, false);
call.frequency(), source_positions_, inlining_id, flags, false);
graph_builder.CreateGraph();
// Extract the inlinee start/end nodes.
......
......@@ -47,7 +47,6 @@ class JSInliner final : public AdvancedReducer {
SimplifiedOperatorBuilder* simplified() const;
Graph* graph() const;
JSGraph* jsgraph() const { return jsgraph_; }
Handle<Context> native_context() const;
Zone* const local_zone_;
CompilationInfo* info_;
......
......@@ -5,10 +5,8 @@
#include "src/compiler/js-type-hint-lowering.h"
#include "src/compiler/access-builder.h"
#include "src/compiler/access-info.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/operator-properties.h"
#include "src/compiler/property-access-builder.h"
#include "src/compiler/simplified-operator.h"
#include "src/feedback-vector.h"
#include "src/type-hints.h"
......@@ -211,17 +209,8 @@ class JSSpeculativeBinopBuilder final {
JSTypeHintLowering::JSTypeHintLowering(JSGraph* jsgraph,
Handle<FeedbackVector> feedback_vector,
Handle<Context> native_context,
CompilationDependencies* dependencies,
Flags flags, Zone* local_zone)
: jsgraph_(jsgraph),
flags_(flags),
feedback_vector_(feedback_vector),
native_context_(native_context),
dependencies_(dependencies),
local_zone_(local_zone) {}
Graph* JSTypeHintLowering::graph() const { return jsgraph_->graph(); }
Flags flags)
: jsgraph_(jsgraph), flags_(flags), feedback_vector_(feedback_vector) {}
JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceBinaryOperation(
const Operator* op, Node* left, Node* right, Node* effect, Node* control,
......@@ -371,59 +360,7 @@ JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceLoadNamedOperation(
DeoptimizeReason::kInsufficientTypeFeedbackForGenericNamedAccess)) {
return LoweringResult::Exit(node);
}
// Try to extract maps from the feedback vector. Give up if the IC
// is megamorphic or unitialized.
MapHandles receiver_maps;
if (nexus.ExtractMaps(&receiver_maps) == 0) {
return LoweringResult::NoChange();
}
// Extract information about accesses from the maps.
NamedAccess const& p = NamedAccessOf(op);
AccessInfoFactory access_info_factory(dependencies(), native_context(),
graph()->zone());
ZoneVector<PropertyAccessInfo> access_infos(local_zone());
if (!access_info_factory.ComputePropertyAccessInfos(
receiver_maps, p.name(), AccessMode::kLoad, &access_infos)) {
return LoweringResult::NoChange();
}
// Bail out if not monomorphic.
if (access_infos.size() != 1) return LoweringResult::NoChange();
// We only lower data fields and data constants.
PropertyAccessInfo const& access_info = access_infos[0];
if (!access_info.IsDataField() && !access_info.IsDataConstant()) {
return LoweringResult::NoChange();
}
PropertyAccessBuilder access_builder(jsgraph(), dependencies());
if (!access_builder.TryBuildStringCheck(access_info.receiver_maps(),
&receiver, &effect, control) &&
!access_builder.TryBuildNumberCheck(access_info.receiver_maps(),
&receiver, &effect, control)) {
receiver = access_builder.BuildCheckHeapObject(receiver, &effect, control);
access_builder.BuildCheckMaps(receiver, &effect, control,
access_info.receiver_maps());
}
Handle<JSObject> holder;
if (access_info.holder().ToHandle(&holder)) {
access_builder.AssumePrototypesStable(native_context(),
access_info.receiver_maps(), holder);
}
Node* value = nullptr;
if (access_info.IsDataConstant()) {
value = jsgraph()->Constant(access_info.constant());
} else {
DCHECK(access_info.IsDataField());
value = access_builder.BuildLoadDataField(p.name(), access_info, receiver,
&effect, &control);
}
return LoweringResult::SideEffectFree(value, effect, control);
return LoweringResult::NoChange();
}
JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceLoadKeyedOperation(
......
......@@ -14,7 +14,6 @@ namespace v8 {
namespace internal {
// Forward declarations.
class CompilationDependencies;
class FeedbackNexus;
class FeedbackSlot;
......@@ -43,9 +42,7 @@ class JSTypeHintLowering {
typedef base::Flags<Flag> Flags;
JSTypeHintLowering(JSGraph* jsgraph, Handle<FeedbackVector> feedback_vector,
Handle<Context> native_context,
CompilationDependencies* dependencies, Flags flags,
Zone* local_zone);
Flags flags);
// {LoweringResult} describes the result of lowering. The following outcomes
// are possible:
......@@ -159,21 +156,11 @@ class JSTypeHintLowering {
const Handle<FeedbackVector>& feedback_vector() const {
return feedback_vector_;
}
Graph* graph() const;
Zone* local_zone() const { return local_zone_; }
Handle<Context> native_context() const { return native_context_; }
CompilationDependencies* dependencies() const { return dependencies_; }
JSGraph* jsgraph_;
Flags const flags_;
Handle<FeedbackVector> feedback_vector_;
Handle<Context> native_context_;
CompilationDependencies* dependencies_;
Zone* local_zone_;
DISALLOW_COPY_AND_ASSIGN(JSTypeHintLowering);
};
......
......@@ -893,8 +893,7 @@ struct GraphBuilderPhase {
temp_zone, data->info()->shared_info(),
handle(data->info()->closure()->feedback_vector()),
data->info()->osr_offset(), data->jsgraph(), CallFrequency(1.0f),
data->source_positions(), data->native_context(),
data->info()->dependencies(), SourcePosition::kNotInlined, flags);
data->source_positions(), SourcePosition::kNotInlined, flags);
graph_builder.CreateGraph();
}
};
......
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