Commit c17e8605 authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Remove type feedback from AstGraphBuilder pipeline.

The AstGraphBuilder pipeline is only used for asm.js now, so the whole
type feedback mechanism is essentially dead code currently, thus we
better nuke it.

BUG=v8:5267,v8:5657

Review-Url: https://codereview.chromium.org/2523953002
Cr-Commit-Position: refs/heads/master@{#41201}
parent 23193d39
...@@ -1192,8 +1192,6 @@ v8_source_set("v8_base") { ...@@ -1192,8 +1192,6 @@ v8_source_set("v8_base") {
"src/compiler/tail-call-optimization.h", "src/compiler/tail-call-optimization.h",
"src/compiler/type-cache.cc", "src/compiler/type-cache.cc",
"src/compiler/type-cache.h", "src/compiler/type-cache.h",
"src/compiler/type-hint-analyzer.cc",
"src/compiler/type-hint-analyzer.h",
"src/compiler/typed-optimization.cc", "src/compiler/typed-optimization.cc",
"src/compiler/typed-optimization.h", "src/compiler/typed-optimization.h",
"src/compiler/typer.cc", "src/compiler/typer.cc",
......
...@@ -49,7 +49,6 @@ class CompilationInfo final { ...@@ -49,7 +49,6 @@ class CompilationInfo final {
kSourcePositionsEnabled = 1 << 13, kSourcePositionsEnabled = 1 << 13,
kBailoutOnUninitialized = 1 << 14, kBailoutOnUninitialized = 1 << 14,
kOptimizeFromBytecode = 1 << 15, kOptimizeFromBytecode = 1 << 15,
kTypeFeedbackEnabled = 1 << 16,
}; };
CompilationInfo(ParseInfo* parse_info, Handle<JSFunction> closure); CompilationInfo(ParseInfo* parse_info, Handle<JSFunction> closure);
...@@ -141,12 +140,6 @@ class CompilationInfo final { ...@@ -141,12 +140,6 @@ class CompilationInfo final {
return GetFlag(kDeoptimizationEnabled); return GetFlag(kDeoptimizationEnabled);
} }
void MarkAsTypeFeedbackEnabled() { SetFlag(kTypeFeedbackEnabled); }
bool is_type_feedback_enabled() const {
return GetFlag(kTypeFeedbackEnabled);
}
void MarkAsAccessorInliningEnabled() { SetFlag(kAccessorInliningEnabled); } void MarkAsAccessorInliningEnabled() { SetFlag(kAccessorInliningEnabled); }
bool is_accessor_inlining_enabled() const { bool is_accessor_inlining_enabled() const {
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "src/compiler/node-properties.h" #include "src/compiler/node-properties.h"
#include "src/compiler/operator-properties.h" #include "src/compiler/operator-properties.h"
#include "src/compiler/state-values-utils.h" #include "src/compiler/state-values-utils.h"
#include "src/compiler/type-hint-analyzer.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -413,8 +412,7 @@ class AstGraphBuilder::ControlScopeForFinally : public ControlScope { ...@@ -413,8 +412,7 @@ class AstGraphBuilder::ControlScopeForFinally : public ControlScope {
AstGraphBuilder::AstGraphBuilder(Zone* local_zone, CompilationInfo* info, AstGraphBuilder::AstGraphBuilder(Zone* local_zone, CompilationInfo* info,
JSGraph* jsgraph, float invocation_frequency, JSGraph* jsgraph, float invocation_frequency,
LoopAssignmentAnalysis* loop, LoopAssignmentAnalysis* loop)
TypeHintAnalysis* type_hint_analysis)
: isolate_(info->isolate()), : isolate_(info->isolate()),
local_zone_(local_zone), local_zone_(local_zone),
info_(info), info_(info),
...@@ -430,7 +428,6 @@ AstGraphBuilder::AstGraphBuilder(Zone* local_zone, CompilationInfo* info, ...@@ -430,7 +428,6 @@ AstGraphBuilder::AstGraphBuilder(Zone* local_zone, CompilationInfo* info,
input_buffer_(nullptr), input_buffer_(nullptr),
exit_controls_(local_zone), exit_controls_(local_zone),
loop_assignment_analysis_(loop), loop_assignment_analysis_(loop),
type_hint_analysis_(type_hint_analysis),
state_values_cache_(jsgraph), state_values_cache_(jsgraph),
liveness_analyzer_(static_cast<size_t>(info->scope()->num_stack_slots()), liveness_analyzer_(static_cast<size_t>(info->scope()->num_stack_slots()),
false, local_zone), false, local_zone),
...@@ -1279,13 +1276,7 @@ void AstGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) { ...@@ -1279,13 +1276,7 @@ void AstGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) {
Node* label = environment()->Pop(); Node* label = environment()->Pop();
Node* tag = environment()->Top(); Node* tag = environment()->Top();
CompareOperationHint hint; CompareOperationHint hint = CompareOperationHint::kAny;
if (!type_hint_analysis_ ||
!type_hint_analysis_->GetCompareOperationHint(clause->CompareId(),
&hint)) {
hint = CompareOperationHint::kAny;
}
const Operator* op = javascript()->StrictEqual(hint); const Operator* op = javascript()->StrictEqual(hint);
Node* condition = NewNode(op, tag, label); Node* condition = NewNode(op, tag, label);
compare_switch.BeginLabel(i, condition); compare_switch.BeginLabel(i, condition);
...@@ -2805,13 +2796,7 @@ void AstGraphBuilder::VisitCompareOperation(CompareOperation* expr) { ...@@ -2805,13 +2796,7 @@ void AstGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
return VisitLiteralCompareNil(expr, sub_expr, jsgraph()->NullConstant()); return VisitLiteralCompareNil(expr, sub_expr, jsgraph()->NullConstant());
} }
CompareOperationHint hint; CompareOperationHint hint = CompareOperationHint::kAny;
if (!type_hint_analysis_ ||
!type_hint_analysis_->GetCompareOperationHint(
expr->CompareOperationFeedbackId(), &hint)) {
hint = CompareOperationHint::kAny;
}
const Operator* op; const Operator* op;
switch (expr->op()) { switch (expr->op()) {
case Token::EQ: case Token::EQ:
...@@ -3680,11 +3665,7 @@ Node* AstGraphBuilder::BuildLoadNativeContextField(int index) { ...@@ -3680,11 +3665,7 @@ Node* AstGraphBuilder::BuildLoadNativeContextField(int index) {
Node* AstGraphBuilder::BuildToBoolean(Node* input, TypeFeedbackId feedback_id) { Node* AstGraphBuilder::BuildToBoolean(Node* input, TypeFeedbackId feedback_id) {
if (Node* node = TryFastToBoolean(input)) return node; if (Node* node = TryFastToBoolean(input)) return node;
ToBooleanHints hints; ToBooleanHints hints = ToBooleanHint::kAny;
if (!type_hint_analysis_ ||
!type_hint_analysis_->GetToBooleanHints(feedback_id, &hints)) {
hints = ToBooleanHint::kAny;
}
return NewNode(javascript()->ToBoolean(hints), input); return NewNode(javascript()->ToBoolean(hints), input);
} }
...@@ -3797,11 +3778,7 @@ Node* AstGraphBuilder::BuildThrow(Node* exception_value) { ...@@ -3797,11 +3778,7 @@ Node* AstGraphBuilder::BuildThrow(Node* exception_value) {
Node* AstGraphBuilder::BuildBinaryOp(Node* left, Node* right, Token::Value op, Node* AstGraphBuilder::BuildBinaryOp(Node* left, Node* right, Token::Value op,
TypeFeedbackId feedback_id) { TypeFeedbackId feedback_id) {
const Operator* js_op; const Operator* js_op;
BinaryOperationHint hint; BinaryOperationHint hint = BinaryOperationHint::kAny;
if (!type_hint_analysis_ ||
!type_hint_analysis_->GetBinaryOperationHint(feedback_id, &hint)) {
hint = BinaryOperationHint::kAny;
}
switch (op) { switch (op) {
case Token::BIT_OR: case Token::BIT_OR:
js_op = javascript()->BitwiseOr(hint); js_op = javascript()->BitwiseOr(hint);
...@@ -4365,10 +4342,9 @@ Node* AstGraphBuilder::MergeValue(Node* value, Node* other, Node* control) { ...@@ -4365,10 +4342,9 @@ Node* AstGraphBuilder::MergeValue(Node* value, Node* other, Node* control) {
AstGraphBuilderWithPositions::AstGraphBuilderWithPositions( AstGraphBuilderWithPositions::AstGraphBuilderWithPositions(
Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph, Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph,
float invocation_frequency, LoopAssignmentAnalysis* loop_assignment, float invocation_frequency, LoopAssignmentAnalysis* loop_assignment,
TypeHintAnalysis* type_hint_analysis, SourcePositionTable* source_positions, SourcePositionTable* source_positions, int inlining_id)
int inlining_id)
: AstGraphBuilder(local_zone, info, jsgraph, invocation_frequency, : AstGraphBuilder(local_zone, info, jsgraph, invocation_frequency,
loop_assignment, type_hint_analysis), loop_assignment),
source_positions_(source_positions), source_positions_(source_positions),
start_position_(info->shared_info()->start_position(), inlining_id) {} start_position_(info->shared_info()->start_position(), inlining_id) {}
......
...@@ -26,7 +26,6 @@ class Graph; ...@@ -26,7 +26,6 @@ class Graph;
class LoopAssignmentAnalysis; class LoopAssignmentAnalysis;
class LoopBuilder; class LoopBuilder;
class Node; class Node;
class TypeHintAnalysis;
// The AstGraphBuilder produces a high-level IR graph, based on an // The AstGraphBuilder produces a high-level IR graph, based on an
...@@ -39,8 +38,7 @@ class AstGraphBuilder : public AstVisitor<AstGraphBuilder> { ...@@ -39,8 +38,7 @@ class AstGraphBuilder : public AstVisitor<AstGraphBuilder> {
public: public:
AstGraphBuilder(Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph, AstGraphBuilder(Zone* local_zone, CompilationInfo* info, JSGraph* jsgraph,
float invocation_frequency, float invocation_frequency,
LoopAssignmentAnalysis* loop_assignment = nullptr, LoopAssignmentAnalysis* loop_assignment = nullptr);
TypeHintAnalysis* type_hint_analysis = nullptr);
virtual ~AstGraphBuilder() {} virtual ~AstGraphBuilder() {}
// Creates a graph by visiting the entire AST. // Creates a graph by visiting the entire AST.
...@@ -119,9 +117,6 @@ class AstGraphBuilder : public AstVisitor<AstGraphBuilder> { ...@@ -119,9 +117,6 @@ class AstGraphBuilder : public AstVisitor<AstGraphBuilder> {
// Result of loop assignment analysis performed before graph creation. // Result of loop assignment analysis performed before graph creation.
LoopAssignmentAnalysis* loop_assignment_analysis_; LoopAssignmentAnalysis* loop_assignment_analysis_;
// Result of type hint analysis performed before graph creation.
TypeHintAnalysis* type_hint_analysis_;
// Cache for StateValues nodes for frame states. // Cache for StateValues nodes for frame states.
StateValuesCache state_values_cache_; StateValuesCache state_values_cache_;
...@@ -622,7 +617,6 @@ class AstGraphBuilderWithPositions final : public AstGraphBuilder { ...@@ -622,7 +617,6 @@ class AstGraphBuilderWithPositions final : public AstGraphBuilder {
AstGraphBuilderWithPositions(Zone* local_zone, CompilationInfo* info, AstGraphBuilderWithPositions(Zone* local_zone, CompilationInfo* info,
JSGraph* jsgraph, float invocation_frequency, JSGraph* jsgraph, float invocation_frequency,
LoopAssignmentAnalysis* loop_assignment, LoopAssignmentAnalysis* loop_assignment,
TypeHintAnalysis* type_hint_analysis,
SourcePositionTable* source_positions, SourcePositionTable* source_positions,
int inlining_id = SourcePosition::kNotInlined); int inlining_id = SourcePosition::kNotInlined);
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "src/compiler/js-graph.h" #include "src/compiler/js-graph.h"
#include "src/compiler/liveness-analyzer.h" #include "src/compiler/liveness-analyzer.h"
#include "src/compiler/state-values-utils.h" #include "src/compiler/state-values-utils.h"
#include "src/compiler/type-hint-analyzer.h"
#include "src/interpreter/bytecode-array-iterator.h" #include "src/interpreter/bytecode-array-iterator.h"
#include "src/interpreter/bytecode-flags.h" #include "src/interpreter/bytecode-flags.h"
#include "src/interpreter/bytecodes.h" #include "src/interpreter/bytecodes.h"
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include "src/compiler/node-properties.h" #include "src/compiler/node-properties.h"
#include "src/compiler/operator-properties.h" #include "src/compiler/operator-properties.h"
#include "src/compiler/simplified-operator.h" #include "src/compiler/simplified-operator.h"
#include "src/compiler/type-hint-analyzer.h"
#include "src/isolate-inl.h" #include "src/isolate-inl.h"
#include "src/parsing/parse-info.h" #include "src/parsing/parse-info.h"
#include "src/parsing/rewriter.h" #include "src/parsing/rewriter.h"
...@@ -488,7 +487,6 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) { ...@@ -488,7 +487,6 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) {
ParseInfo parse_info(&zone, shared_info); ParseInfo parse_info(&zone, shared_info);
CompilationInfo info(&parse_info, function); CompilationInfo info(&parse_info, function);
if (info_->is_deoptimization_enabled()) info.MarkAsDeoptimizationEnabled(); if (info_->is_deoptimization_enabled()) info.MarkAsDeoptimizationEnabled();
if (info_->is_type_feedback_enabled()) info.MarkAsTypeFeedbackEnabled();
if (info_->is_optimizing_from_bytecode()) info.MarkAsOptimizeFromBytecode(); if (info_->is_optimizing_from_bytecode()) info.MarkAsOptimizeFromBytecode();
if (info.is_optimizing_from_bytecode() && !Compiler::EnsureBytecode(&info)) { if (info.is_optimizing_from_bytecode() && !Compiler::EnsureBytecode(&info)) {
...@@ -557,16 +555,11 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) { ...@@ -557,16 +555,11 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) {
LoopAssignmentAnalysis* loop_assignment = LoopAssignmentAnalysis* loop_assignment =
loop_assignment_analyzer.Analyze(); loop_assignment_analyzer.Analyze();
// Run the type hint analyzer on the inlinee.
TypeHintAnalyzer type_hint_analyzer(&zone);
TypeHintAnalysis* type_hint_analysis =
type_hint_analyzer.Analyze(handle(shared_info->code(), info.isolate()));
// Run the AstGraphBuilder to create the subgraph. // Run the AstGraphBuilder to create the subgraph.
Graph::SubgraphScope scope(graph()); Graph::SubgraphScope scope(graph());
AstGraphBuilderWithPositions graph_builder( AstGraphBuilderWithPositions graph_builder(
&zone, &info, jsgraph(), call.frequency(), loop_assignment, &zone, &info, jsgraph(), call.frequency(), loop_assignment,
type_hint_analysis, source_positions_, inlining_id); source_positions_, inlining_id);
graph_builder.CreateGraph(false); graph_builder.CreateGraph(false);
// Extract the inlinee start/end nodes. // Extract the inlinee start/end nodes.
......
...@@ -65,7 +65,6 @@ ...@@ -65,7 +65,6 @@
#include "src/compiler/simplified-operator.h" #include "src/compiler/simplified-operator.h"
#include "src/compiler/store-store-elimination.h" #include "src/compiler/store-store-elimination.h"
#include "src/compiler/tail-call-optimization.h" #include "src/compiler/tail-call-optimization.h"
#include "src/compiler/type-hint-analyzer.h"
#include "src/compiler/typed-optimization.h" #include "src/compiler/typed-optimization.h"
#include "src/compiler/typer.h" #include "src/compiler/typer.h"
#include "src/compiler/value-numbering-reducer.h" #include "src/compiler/value-numbering-reducer.h"
...@@ -199,12 +198,6 @@ class PipelineData { ...@@ -199,12 +198,6 @@ class PipelineData {
loop_assignment_ = loop_assignment; loop_assignment_ = loop_assignment;
} }
TypeHintAnalysis* type_hint_analysis() const { return type_hint_analysis_; }
void set_type_hint_analysis(TypeHintAnalysis* type_hint_analysis) {
DCHECK_NULL(type_hint_analysis_);
type_hint_analysis_ = type_hint_analysis;
}
Schedule* schedule() const { return schedule_; } Schedule* schedule() const { return schedule_; }
void set_schedule(Schedule* schedule) { void set_schedule(Schedule* schedule) {
DCHECK(!schedule_); DCHECK(!schedule_);
...@@ -240,7 +233,6 @@ class PipelineData { ...@@ -240,7 +233,6 @@ class PipelineData {
graph_ = nullptr; graph_ = nullptr;
source_positions_ = nullptr; source_positions_ = nullptr;
loop_assignment_ = nullptr; loop_assignment_ = nullptr;
type_hint_analysis_ = nullptr;
simplified_ = nullptr; simplified_ = nullptr;
machine_ = nullptr; machine_ = nullptr;
common_ = nullptr; common_ = nullptr;
...@@ -325,7 +317,6 @@ class PipelineData { ...@@ -325,7 +317,6 @@ class PipelineData {
Graph* graph_ = nullptr; Graph* graph_ = nullptr;
SourcePositionTable* source_positions_ = nullptr; SourcePositionTable* source_positions_ = nullptr;
LoopAssignmentAnalysis* loop_assignment_ = nullptr; LoopAssignmentAnalysis* loop_assignment_ = nullptr;
TypeHintAnalysis* type_hint_analysis_ = nullptr;
SimplifiedOperatorBuilder* simplified_ = nullptr; SimplifiedOperatorBuilder* simplified_ = nullptr;
MachineOperatorBuilder* machine_ = nullptr; MachineOperatorBuilder* machine_ = nullptr;
CommonOperatorBuilder* common_ = nullptr; CommonOperatorBuilder* common_ = nullptr;
...@@ -572,9 +563,6 @@ PipelineCompilationJob::Status PipelineCompilationJob::PrepareJobImpl() { ...@@ -572,9 +563,6 @@ PipelineCompilationJob::Status PipelineCompilationJob::PrepareJobImpl() {
} }
} }
if (!info()->is_optimizing_from_bytecode()) { if (!info()->is_optimizing_from_bytecode()) {
if (info()->is_deoptimization_enabled() && FLAG_turbo_type_feedback) {
info()->MarkAsTypeFeedbackEnabled();
}
if (!Compiler::EnsureDeoptimizationSupport(info())) return FAILED; if (!Compiler::EnsureDeoptimizationSupport(info())) return FAILED;
} }
...@@ -694,20 +682,6 @@ struct LoopAssignmentAnalysisPhase { ...@@ -694,20 +682,6 @@ struct LoopAssignmentAnalysisPhase {
}; };
struct TypeHintAnalysisPhase {
static const char* phase_name() { return "type hint analysis"; }
void Run(PipelineData* data, Zone* temp_zone) {
if (data->info()->is_type_feedback_enabled()) {
TypeHintAnalyzer analyzer(data->graph_zone());
Handle<Code> code(data->info()->shared_info()->code(), data->isolate());
TypeHintAnalysis* type_hint_analysis = analyzer.Analyze(code);
data->set_type_hint_analysis(type_hint_analysis);
}
}
};
struct GraphBuilderPhase { struct GraphBuilderPhase {
static const char* phase_name() { return "graph builder"; } static const char* phase_name() { return "graph builder"; }
...@@ -722,8 +696,7 @@ struct GraphBuilderPhase { ...@@ -722,8 +696,7 @@ struct GraphBuilderPhase {
} else { } else {
AstGraphBuilderWithPositions graph_builder( AstGraphBuilderWithPositions graph_builder(
temp_zone, data->info(), data->jsgraph(), 1.0f, temp_zone, data->info(), data->jsgraph(), 1.0f,
data->loop_assignment(), data->type_hint_analysis(), data->loop_assignment(), data->source_positions());
data->source_positions());
succeeded = graph_builder.CreateGraph(); succeeded = graph_builder.CreateGraph();
} }
...@@ -1475,8 +1448,6 @@ bool PipelineImpl::CreateGraph() { ...@@ -1475,8 +1448,6 @@ bool PipelineImpl::CreateGraph() {
Run<LoopAssignmentAnalysisPhase>(); Run<LoopAssignmentAnalysisPhase>();
} }
Run<TypeHintAnalysisPhase>();
Run<GraphBuilderPhase>(); Run<GraphBuilderPhase>();
if (data->compilation_failed()) { if (data->compilation_failed()) {
data->EndPhaseKind(); data->EndPhaseKind();
......
// Copyright 2015 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.
#include "src/compiler/type-hint-analyzer.h"
#include "src/assembler.h"
#include "src/code-stubs.h"
#include "src/ic/ic-state.h"
#include "src/type-hints.h"
namespace v8 {
namespace internal {
namespace compiler {
namespace {
BinaryOperationHint ToBinaryOperationHint(Token::Value op,
BinaryOpICState::Kind kind) {
switch (kind) {
case BinaryOpICState::NONE:
return BinaryOperationHint::kNone;
case BinaryOpICState::SMI:
return BinaryOperationHint::kSignedSmall;
case BinaryOpICState::INT32:
return (Token::IsTruncatingBinaryOp(op) && SmiValuesAre31Bits())
? BinaryOperationHint::kNumberOrOddball
: BinaryOperationHint::kSigned32;
case BinaryOpICState::NUMBER:
return BinaryOperationHint::kNumberOrOddball;
case BinaryOpICState::STRING:
return BinaryOperationHint::kString;
case BinaryOpICState::GENERIC:
return BinaryOperationHint::kAny;
}
UNREACHABLE();
return BinaryOperationHint::kNone;
}
CompareOperationHint ToCompareOperationHint(Token::Value op,
CompareICState::State state) {
switch (state) {
case CompareICState::UNINITIALIZED:
return CompareOperationHint::kNone;
case CompareICState::SMI:
return CompareOperationHint::kSignedSmall;
case CompareICState::NUMBER:
return Token::IsOrderedRelationalCompareOp(op)
? CompareOperationHint::kNumberOrOddball
: CompareOperationHint::kNumber;
case CompareICState::STRING:
case CompareICState::INTERNALIZED_STRING:
return CompareOperationHint::kString;
case CompareICState::UNIQUE_NAME:
case CompareICState::RECEIVER:
case CompareICState::KNOWN_RECEIVER:
case CompareICState::BOOLEAN:
case CompareICState::GENERIC:
return CompareOperationHint::kAny;
}
UNREACHABLE();
return CompareOperationHint::kNone;
}
} // namespace
bool TypeHintAnalysis::GetBinaryOperationHint(TypeFeedbackId id,
BinaryOperationHint* hint) const {
auto i = infos_.find(id);
if (i == infos_.end()) return false;
Handle<Code> code = i->second;
DCHECK_EQ(Code::BINARY_OP_IC, code->kind());
BinaryOpICState state(code->GetIsolate(), code->extra_ic_state());
*hint = ToBinaryOperationHint(state.op(), state.kind());
return true;
}
bool TypeHintAnalysis::GetCompareOperationHint(
TypeFeedbackId id, CompareOperationHint* hint) const {
auto i = infos_.find(id);
if (i == infos_.end()) return false;
Handle<Code> code = i->second;
DCHECK_EQ(Code::COMPARE_IC, code->kind());
CompareICStub stub(code->stub_key(), code->GetIsolate());
*hint = ToCompareOperationHint(stub.op(), stub.state());
return true;
}
bool TypeHintAnalysis::GetToBooleanHints(TypeFeedbackId id,
ToBooleanHints* hints) const {
auto i = infos_.find(id);
if (i == infos_.end()) return false;
Handle<Code> code = i->second;
DCHECK_EQ(Code::TO_BOOLEAN_IC, code->kind());
ToBooleanICStub stub(code->GetIsolate(), code->extra_ic_state());
*hints = stub.hints();
return true;
}
TypeHintAnalysis* TypeHintAnalyzer::Analyze(Handle<Code> code) {
DisallowHeapAllocation no_gc;
TypeHintAnalysis::Infos infos(zone());
Isolate* const isolate = code->GetIsolate();
int const mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID);
for (RelocIterator it(*code, mask); !it.done(); it.next()) {
RelocInfo* rinfo = it.rinfo();
Address target_address = rinfo->target_address();
Code* target = Code::GetCodeFromTargetAddress(target_address);
switch (target->kind()) {
case Code::BINARY_OP_IC:
case Code::COMPARE_IC:
case Code::TO_BOOLEAN_IC: {
// Add this feedback to the {infos}.
TypeFeedbackId id(static_cast<unsigned>(rinfo->data()));
infos.insert(std::make_pair(id, handle(target, isolate)));
break;
}
default:
// Ignore the remaining code objects.
break;
}
}
return new (zone()) TypeHintAnalysis(infos, zone());
}
} // namespace compiler
} // namespace internal
} // namespace v8
// Copyright 2015 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_TYPE_HINT_ANALYZER_H_
#define V8_COMPILER_TYPE_HINT_ANALYZER_H_
#include "src/handles.h"
#include "src/type-hints.h"
#include "src/zone/zone-containers.h"
namespace v8 {
namespace internal {
namespace compiler {
// The result of analyzing type hints.
class TypeHintAnalysis final : public ZoneObject {
public:
typedef ZoneMap<TypeFeedbackId, Handle<Code>> Infos;
explicit TypeHintAnalysis(Infos const& infos, Zone* zone)
: infos_(infos), zone_(zone) {}
bool GetBinaryOperationHint(TypeFeedbackId id,
BinaryOperationHint* hint) const;
bool GetCompareOperationHint(TypeFeedbackId id,
CompareOperationHint* hint) const;
bool GetToBooleanHints(TypeFeedbackId id, ToBooleanHints* hints) const;
private:
Zone* zone() const { return zone_; }
Infos const infos_;
Zone* zone_;
};
// The class that performs type hint analysis on the fullcodegen code object.
class TypeHintAnalyzer final {
public:
explicit TypeHintAnalyzer(Zone* zone) : zone_(zone) {}
TypeHintAnalysis* Analyze(Handle<Code> code);
private:
Zone* zone() const { return zone_; }
Zone* const zone_;
DISALLOW_COPY_AND_ASSIGN(TypeHintAnalyzer);
};
} // namespace compiler
} // namespace internal
} // namespace v8
#endif // V8_COMPILER_TYPE_HINT_ANALYZER_H_
...@@ -449,8 +449,6 @@ DEFINE_BOOL(turbo_stats, false, "print TurboFan statistics") ...@@ -449,8 +449,6 @@ DEFINE_BOOL(turbo_stats, false, "print TurboFan statistics")
DEFINE_BOOL(turbo_stats_nvp, false, DEFINE_BOOL(turbo_stats_nvp, false,
"print TurboFan statistics in machine-readable format") "print TurboFan statistics in machine-readable format")
DEFINE_BOOL(turbo_splitting, true, "split nodes during scheduling in TurboFan") DEFINE_BOOL(turbo_splitting, true, "split nodes during scheduling in TurboFan")
DEFINE_BOOL(turbo_type_feedback, true,
"use typed feedback for representation inference in Turbofan")
DEFINE_BOOL(function_context_specialization, false, DEFINE_BOOL(function_context_specialization, false,
"enable function context specialization in TurboFan") "enable function context specialization in TurboFan")
DEFINE_BOOL(turbo_inlining, true, "enable inlining in TurboFan") DEFINE_BOOL(turbo_inlining, true, "enable inlining in TurboFan")
......
...@@ -724,8 +724,6 @@ ...@@ -724,8 +724,6 @@
'compiler/types.h', 'compiler/types.h',
'compiler/type-cache.cc', 'compiler/type-cache.cc',
'compiler/type-cache.h', 'compiler/type-cache.h',
'compiler/type-hint-analyzer.cc',
'compiler/type-hint-analyzer.h',
'compiler/typed-optimization.cc', 'compiler/typed-optimization.cc',
'compiler/typed-optimization.h', 'compiler/typed-optimization.h',
'compiler/typer.cc', 'compiler/typer.cc',
......
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