Commit 8ff8ddba authored by Maya Lekova's avatar Maya Lekova Committed by Commit Bot

[turbofan] Further brokerize BytecodeGraphBuilder

Replace all usages of VectorSlotPair with FeedbackSource.

Bug: v8:7790
Change-Id: I0ac6e9cd8f5730154cc1842e267ca1ebfdebc874
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1763536
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63378}
parent bad6116e
......@@ -1783,6 +1783,8 @@ v8_compiler_sources = [
"src/compiler/escape-analysis-reducer.h",
"src/compiler/escape-analysis.cc",
"src/compiler/escape-analysis.h",
"src/compiler/feedback-source.cc",
"src/compiler/feedback-source.h",
"src/compiler/frame-states.cc",
"src/compiler/frame-states.h",
"src/compiler/frame.cc",
......@@ -1923,8 +1925,6 @@ v8_compiler_sources = [
"src/compiler/types.h",
"src/compiler/value-numbering-reducer.cc",
"src/compiler/value-numbering-reducer.h",
"src/compiler/vector-slot-pair.cc",
"src/compiler/vector-slot-pair.h",
"src/compiler/verifier.cc",
"src/compiler/verifier.h",
"src/compiler/wasm-compiler.cc",
......
......@@ -1070,9 +1070,9 @@ DeoptimizationExit* CodeGenerator::BuildTranslation(
update_feedback_count, zone());
if (entry.feedback().IsValid()) {
DeoptimizationLiteral literal =
DeoptimizationLiteral(entry.feedback().vector());
DeoptimizationLiteral(entry.feedback().vector);
int literal_id = DefineDeoptimizationLiteral(literal);
translation.AddUpdateFeedback(literal_id, entry.feedback().slot().ToInt());
translation.AddUpdateFeedback(literal_id, entry.feedback().slot.ToInt());
}
InstructionOperandIterator iter(instr, frame_state_offset);
BuildTranslationForFrameStateDescriptor(descriptor, &iter, &translation,
......
......@@ -762,7 +762,7 @@ Instruction* InstructionSelector::EmitWithContinuation(
void InstructionSelector::AppendDeoptimizeArguments(
InstructionOperandVector* args, DeoptimizeKind kind,
DeoptimizeReason reason, VectorSlotPair const& feedback,
DeoptimizeReason reason, FeedbackSource const& feedback,
Node* frame_state) {
OperandGenerator g(this);
FrameStateDescriptor* const descriptor = GetFrameStateDescriptor(frame_state);
......@@ -779,7 +779,7 @@ void InstructionSelector::AppendDeoptimizeArguments(
Instruction* InstructionSelector::EmitDeoptimize(
InstructionCode opcode, size_t output_count, InstructionOperand* outputs,
size_t input_count, InstructionOperand* inputs, DeoptimizeKind kind,
DeoptimizeReason reason, VectorSlotPair const& feedback,
DeoptimizeReason reason, FeedbackSource const& feedback,
Node* frame_state) {
InstructionOperandVector args(instruction_zone());
for (size_t i = 0; i < input_count; ++i) {
......@@ -990,7 +990,7 @@ void InstructionSelector::InitializeCallBuffer(Node* call, CallBuffer* buffer,
int const state_id = sequence()->AddDeoptimizationEntry(
buffer->frame_state_descriptor, DeoptimizeKind::kLazy,
DeoptimizeReason::kUnknown, VectorSlotPair());
DeoptimizeReason::kUnknown, FeedbackSource());
buffer->instruction_args.push_back(g.TempImmediate(state_id));
StateObjectDeduplicator deduplicator(instruction_zone());
......@@ -2978,7 +2978,7 @@ void InstructionSelector::EmitIdentity(Node* node) {
void InstructionSelector::VisitDeoptimize(DeoptimizeKind kind,
DeoptimizeReason reason,
VectorSlotPair const& feedback,
FeedbackSource const& feedback,
Node* value) {
EmitDeoptimize(kArchDeoptimize, 0, nullptr, 0, nullptr, kind, reason,
feedback, value);
......
......@@ -12,6 +12,7 @@
#include "src/compiler/backend/instruction-scheduler.h"
#include "src/compiler/backend/instruction.h"
#include "src/compiler/common-operator.h"
#include "src/compiler/feedback-source.h"
#include "src/compiler/linkage.h"
#include "src/compiler/machine-operator.h"
#include "src/compiler/node.h"
......@@ -60,7 +61,7 @@ class FlagsContinuation final {
static FlagsContinuation ForDeoptimize(FlagsCondition condition,
DeoptimizeKind kind,
DeoptimizeReason reason,
VectorSlotPair const& feedback,
FeedbackSource const& feedback,
Node* frame_state) {
return FlagsContinuation(kFlags_deoptimize, condition, kind, reason,
feedback, frame_state);
......@@ -69,7 +70,7 @@ class FlagsContinuation final {
// Creates a new flags continuation for an eager deoptimization exit.
static FlagsContinuation ForDeoptimizeAndPoison(
FlagsCondition condition, DeoptimizeKind kind, DeoptimizeReason reason,
VectorSlotPair const& feedback, Node* frame_state) {
FeedbackSource const& feedback, Node* frame_state) {
return FlagsContinuation(kFlags_deoptimize_and_poison, condition, kind,
reason, feedback, frame_state);
}
......@@ -110,7 +111,7 @@ class FlagsContinuation final {
DCHECK(IsDeoptimize());
return reason_;
}
VectorSlotPair const& feedback() const {
FeedbackSource const& feedback() const {
DCHECK(IsDeoptimize());
return feedback_;
}
......@@ -196,7 +197,7 @@ class FlagsContinuation final {
FlagsContinuation(FlagsMode mode, FlagsCondition condition,
DeoptimizeKind kind, DeoptimizeReason reason,
VectorSlotPair const& feedback, Node* frame_state)
FeedbackSource const& feedback, Node* frame_state)
: mode_(mode),
condition_(condition),
kind_(kind),
......@@ -226,7 +227,7 @@ class FlagsContinuation final {
FlagsCondition condition_;
DeoptimizeKind kind_; // Only valid if mode_ == kFlags_deoptimize*
DeoptimizeReason reason_; // Only valid if mode_ == kFlags_deoptimize*
VectorSlotPair feedback_; // Only valid if mode_ == kFlags_deoptimize*
FeedbackSource feedback_; // Only valid if mode_ == kFlags_deoptimize*
Node* frame_state_or_result_; // Only valid if mode_ == kFlags_deoptimize*
// or mode_ == kFlags_set.
BasicBlock* true_block_; // Only valid if mode_ == kFlags_branch*.
......@@ -352,7 +353,7 @@ class V8_EXPORT_PRIVATE InstructionSelector final {
InstructionOperand* outputs, size_t input_count,
InstructionOperand* inputs, DeoptimizeKind kind,
DeoptimizeReason reason,
VectorSlotPair const& feedback,
FeedbackSource const& feedback,
Node* frame_state);
// ===========================================================================
......@@ -497,7 +498,7 @@ class V8_EXPORT_PRIVATE InstructionSelector final {
void AppendDeoptimizeArguments(InstructionOperandVector* args,
DeoptimizeKind kind, DeoptimizeReason reason,
VectorSlotPair const& feedback,
FeedbackSource const& feedback,
Node* frame_state);
void EmitTableSwitch(
......@@ -631,7 +632,7 @@ class V8_EXPORT_PRIVATE InstructionSelector final {
void VisitBranch(Node* input, BasicBlock* tbranch, BasicBlock* fbranch);
void VisitSwitch(Node* node, const SwitchInfo& sw);
void VisitDeoptimize(DeoptimizeKind kind, DeoptimizeReason reason,
VectorSlotPair const& feedback, Node* value);
FeedbackSource const& feedback, Node* value);
void VisitReturn(Node* ret);
void VisitThrow(Node* node);
void VisitRetain(Node* node);
......
......@@ -944,7 +944,7 @@ void InstructionSequence::MarkAsRepresentation(MachineRepresentation rep,
int InstructionSequence::AddDeoptimizationEntry(
FrameStateDescriptor* descriptor, DeoptimizeKind kind,
DeoptimizeReason reason, VectorSlotPair const& feedback) {
DeoptimizeReason reason, FeedbackSource const& feedback) {
int deoptimization_id = static_cast<int>(deoptimization_entries_.size());
deoptimization_entries_.push_back(
DeoptimizationEntry(descriptor, kind, reason, feedback));
......
......@@ -17,6 +17,7 @@
#include "src/common/globals.h"
#include "src/compiler/backend/instruction-codes.h"
#include "src/compiler/common-operator.h"
#include "src/compiler/feedback-source.h"
#include "src/compiler/frame.h"
#include "src/compiler/opcodes.h"
#include "src/numbers/double.h"
......@@ -1312,7 +1313,7 @@ class DeoptimizationEntry final {
public:
DeoptimizationEntry() = default;
DeoptimizationEntry(FrameStateDescriptor* descriptor, DeoptimizeKind kind,
DeoptimizeReason reason, VectorSlotPair const& feedback)
DeoptimizeReason reason, FeedbackSource const& feedback)
: descriptor_(descriptor),
kind_(kind),
reason_(reason),
......@@ -1321,13 +1322,13 @@ class DeoptimizationEntry final {
FrameStateDescriptor* descriptor() const { return descriptor_; }
DeoptimizeKind kind() const { return kind_; }
DeoptimizeReason reason() const { return reason_; }
VectorSlotPair const& feedback() const { return feedback_; }
FeedbackSource const& feedback() const { return feedback_; }
private:
FrameStateDescriptor* descriptor_ = nullptr;
DeoptimizeKind kind_ = DeoptimizeKind::kEager;
DeoptimizeReason reason_ = DeoptimizeReason::kUnknown;
VectorSlotPair feedback_ = VectorSlotPair();
FeedbackSource feedback_ = FeedbackSource();
};
using DeoptimizationVector = ZoneVector<DeoptimizationEntry>;
......@@ -1592,7 +1593,7 @@ class V8_EXPORT_PRIVATE InstructionSequence final
int AddDeoptimizationEntry(FrameStateDescriptor* descriptor,
DeoptimizeKind kind, DeoptimizeReason reason,
VectorSlotPair const& feedback);
FeedbackSource const& feedback);
DeoptimizationEntry const& GetDeoptimizationEntry(int deoptimization_id);
int GetDeoptimizationEntryCount() const {
return static_cast<int>(deoptimization_entries_.size());
......
This diff is collapsed.
......@@ -99,7 +99,8 @@ bool operator!=(DeoptimizeParameters lhs, DeoptimizeParameters rhs) {
}
size_t hash_value(DeoptimizeParameters p) {
return base::hash_combine(p.kind(), p.reason(), p.feedback(),
FeedbackSource::Hash feebdack_hash;
return base::hash_combine(p.kind(), p.reason(), feebdack_hash(p.feedback()),
p.is_safety_check());
}
......@@ -728,7 +729,7 @@ struct CommonOperatorGlobalCache final {
Operator::kFoldable | Operator::kNoThrow, // properties
"Deoptimize", // name
1, 1, 1, 0, 0, 1, // counts
DeoptimizeParameters(kKind, kReason, VectorSlotPair(),
DeoptimizeParameters(kKind, kReason, FeedbackSource(),
IsSafetyCheck::kNoSafetyCheck)) {}
};
#define CACHED_DEOPTIMIZE(Kind, Reason) \
......@@ -746,7 +747,7 @@ struct CommonOperatorGlobalCache final {
Operator::kFoldable | Operator::kNoThrow, // properties
"DeoptimizeIf", // name
2, 1, 1, 0, 1, 1, // counts
DeoptimizeParameters(kKind, kReason, VectorSlotPair(),
DeoptimizeParameters(kKind, kReason, FeedbackSource(),
is_safety_check)) {}
};
#define CACHED_DEOPTIMIZE_IF(Kind, Reason, IsCheck) \
......@@ -766,7 +767,7 @@ struct CommonOperatorGlobalCache final {
Operator::kFoldable | Operator::kNoThrow, // properties
"DeoptimizeUnless", // name
2, 1, 1, 0, 1, 1, // counts
DeoptimizeParameters(kKind, kReason, VectorSlotPair(),
DeoptimizeParameters(kKind, kReason, FeedbackSource(),
is_safety_check)) {}
};
#define CACHED_DEOPTIMIZE_UNLESS(Kind, Reason, IsCheck) \
......@@ -947,7 +948,7 @@ const Operator* CommonOperatorBuilder::Branch(BranchHint hint,
const Operator* CommonOperatorBuilder::Deoptimize(
DeoptimizeKind kind, DeoptimizeReason reason,
VectorSlotPair const& feedback) {
FeedbackSource const& feedback) {
#define CACHED_DEOPTIMIZE(Kind, Reason) \
if (kind == DeoptimizeKind::k##Kind && \
reason == DeoptimizeReason::k##Reason && !feedback.IsValid()) { \
......@@ -968,7 +969,7 @@ const Operator* CommonOperatorBuilder::Deoptimize(
const Operator* CommonOperatorBuilder::DeoptimizeIf(
DeoptimizeKind kind, DeoptimizeReason reason,
VectorSlotPair const& feedback, IsSafetyCheck is_safety_check) {
FeedbackSource const& feedback, IsSafetyCheck is_safety_check) {
#define CACHED_DEOPTIMIZE_IF(Kind, Reason, IsCheck) \
if (kind == DeoptimizeKind::k##Kind && \
reason == DeoptimizeReason::k##Reason && \
......@@ -989,7 +990,7 @@ const Operator* CommonOperatorBuilder::DeoptimizeIf(
const Operator* CommonOperatorBuilder::DeoptimizeUnless(
DeoptimizeKind kind, DeoptimizeReason reason,
VectorSlotPair const& feedback, IsSafetyCheck is_safety_check) {
FeedbackSource const& feedback, IsSafetyCheck is_safety_check) {
#define CACHED_DEOPTIMIZE_UNLESS(Kind, Reason, IsCheck) \
if (kind == DeoptimizeKind::k##Kind && \
reason == DeoptimizeReason::k##Reason && \
......
......@@ -10,8 +10,8 @@
#include "src/codegen/reloc-info.h"
#include "src/codegen/string-constants.h"
#include "src/common/globals.h"
#include "src/compiler/feedback-source.h"
#include "src/compiler/frame-states.h"
#include "src/compiler/vector-slot-pair.h"
#include "src/deoptimizer/deoptimize-reason.h"
#include "src/zone/zone-containers.h"
#include "src/zone/zone-handle-set.h"
......@@ -104,7 +104,7 @@ int ValueInputCountOfReturn(Operator const* const op);
class DeoptimizeParameters final {
public:
DeoptimizeParameters(DeoptimizeKind kind, DeoptimizeReason reason,
VectorSlotPair const& feedback,
FeedbackSource const& feedback,
IsSafetyCheck is_safety_check)
: kind_(kind),
reason_(reason),
......@@ -113,13 +113,13 @@ class DeoptimizeParameters final {
DeoptimizeKind kind() const { return kind_; }
DeoptimizeReason reason() const { return reason_; }
const VectorSlotPair& feedback() const { return feedback_; }
const FeedbackSource& feedback() const { return feedback_; }
IsSafetyCheck is_safety_check() const { return is_safety_check_; }
private:
DeoptimizeKind const kind_;
DeoptimizeReason const reason_;
VectorSlotPair const feedback_;
FeedbackSource const feedback_;
IsSafetyCheck is_safety_check_;
};
......@@ -468,14 +468,14 @@ class V8_EXPORT_PRIVATE CommonOperatorBuilder final
const Operator* IfDefault(BranchHint hint = BranchHint::kNone);
const Operator* Throw();
const Operator* Deoptimize(DeoptimizeKind kind, DeoptimizeReason reason,
VectorSlotPair const& feedback);
FeedbackSource const& feedback);
const Operator* DeoptimizeIf(
DeoptimizeKind kind, DeoptimizeReason reason,
VectorSlotPair const& feedback,
FeedbackSource const& feedback,
IsSafetyCheck is_safety_check = IsSafetyCheck::kSafetyCheck);
const Operator* DeoptimizeUnless(
DeoptimizeKind kind, DeoptimizeReason reason,
VectorSlotPair const& feedback,
FeedbackSource const& feedback,
IsSafetyCheck is_safety_check = IsSafetyCheck::kSafetyCheck);
const Operator* TrapIf(TrapId trap_id);
const Operator* TrapUnless(TrapId trap_id);
......
This diff is collapsed.
// Copyright 2019 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/feedback-source.h"
namespace v8 {
namespace internal {
namespace compiler {
FeedbackSource::FeedbackSource(Handle<FeedbackVector> vector_,
FeedbackSlot slot_)
: vector(vector_), slot(slot_) {
DCHECK(!slot.IsInvalid());
}
FeedbackSource::FeedbackSource(FeedbackVectorRef vector_, FeedbackSlot slot_)
: FeedbackSource(vector_.object(), slot_) {}
FeedbackSource::FeedbackSource(FeedbackNexus const& nexus)
: FeedbackSource(nexus.vector_handle(), nexus.slot()) {}
int FeedbackSource::index() const {
CHECK(IsValid());
return FeedbackVector::GetIndex(slot);
}
bool operator==(FeedbackSource const& lhs, FeedbackSource const& rhs) {
return FeedbackSource::Equal()(lhs, rhs);
}
bool operator!=(FeedbackSource const& lhs, FeedbackSource const& rhs) {
return !(lhs == rhs);
}
std::ostream& operator<<(std::ostream& os, const FeedbackSource& p) {
if (p.IsValid()) {
return os << "FeedbackSource(" << p.slot << ")";
}
return os << "FeedbackSource(INVALID)";
}
} // namespace compiler
} // namespace internal
} // namespace v8
// Copyright 2019 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_FEEDBACK_SOURCE_H_
#define V8_COMPILER_FEEDBACK_SOURCE_H_
#include "src/compiler/heap-refs.h"
#include "src/objects/feedback-vector.h"
namespace v8 {
namespace internal {
namespace compiler {
struct FeedbackSource {
FeedbackSource() { DCHECK(!IsValid()); }
V8_EXPORT_PRIVATE FeedbackSource(Handle<FeedbackVector> vector_,
FeedbackSlot slot_);
FeedbackSource(FeedbackVectorRef vector_, FeedbackSlot slot_);
explicit FeedbackSource(FeedbackNexus const& nexus);
bool IsValid() const { return !vector.is_null() && !slot.IsInvalid(); }
int index() const;
Handle<FeedbackVector> vector;
FeedbackSlot slot;
struct Hash {
size_t operator()(FeedbackSource const& source) const {
return base::hash_combine(source.vector.address(), source.slot);
}
};
struct Equal {
bool operator()(FeedbackSource const& lhs,
FeedbackSource const& rhs) const {
return lhs.vector.equals(rhs.vector) && lhs.slot == rhs.slot;
}
};
};
bool operator==(FeedbackSource const&, FeedbackSource const&);
bool operator!=(FeedbackSource const&, FeedbackSource const&);
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
FeedbackSource const&);
} // namespace compiler
} // namespace internal
} // namespace v8
#endif // V8_COMPILER_FEEDBACK_SOURCE_H_
......@@ -248,7 +248,7 @@ Node* GraphAssembler::Word32PoisonOnSpeculation(Node* value) {
}
Node* GraphAssembler::DeoptimizeIf(DeoptimizeReason reason,
VectorSlotPair const& feedback,
FeedbackSource const& feedback,
Node* condition, Node* frame_state,
IsSafetyCheck is_safety_check) {
return current_control_ = current_effect_ = graph()->NewNode(
......@@ -258,7 +258,7 @@ Node* GraphAssembler::DeoptimizeIf(DeoptimizeReason reason,
}
Node* GraphAssembler::DeoptimizeIfNot(DeoptimizeReason reason,
VectorSlotPair const& feedback,
FeedbackSource const& feedback,
Node* condition, Node* frame_state,
IsSafetyCheck is_safety_check) {
return current_control_ = current_effect_ = graph()->NewNode(
......
......@@ -5,10 +5,10 @@
#ifndef V8_COMPILER_GRAPH_ASSEMBLER_H_
#define V8_COMPILER_GRAPH_ASSEMBLER_H_
#include "src/compiler/feedback-source.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/node.h"
#include "src/compiler/simplified-operator.h"
#include "src/compiler/vector-slot-pair.h"
namespace v8 {
namespace internal {
......@@ -254,11 +254,11 @@ class GraphAssembler {
Node* Word32PoisonOnSpeculation(Node* value);
Node* DeoptimizeIf(
DeoptimizeReason reason, VectorSlotPair const& feedback, Node* condition,
DeoptimizeReason reason, FeedbackSource const& feedback, Node* condition,
Node* frame_state,
IsSafetyCheck is_safety_check = IsSafetyCheck::kSafetyCheck);
Node* DeoptimizeIfNot(
DeoptimizeReason reason, VectorSlotPair const& feedback, Node* condition,
DeoptimizeReason reason, FeedbackSource const& feedback, Node* condition,
Node* frame_state,
IsSafetyCheck is_safety_check = IsSafetyCheck::kSafetyCheck);
template <typename... Args>
......
......@@ -27,7 +27,6 @@ class JSRegExp;
class JSTypedArray;
class NativeContext;
class ScriptContextTable;
class VectorSlotPair;
namespace compiler {
......
......@@ -14,6 +14,7 @@
#include "src/compiler/access-info.h"
#include "src/compiler/allocation-builder.h"
#include "src/compiler/compilation-dependencies.h"
#include "src/compiler/feedback-source.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/linkage.h"
#include "src/compiler/map-inference.h"
......@@ -21,7 +22,6 @@
#include "src/compiler/property-access-builder.h"
#include "src/compiler/simplified-operator.h"
#include "src/compiler/type-cache.h"
#include "src/compiler/vector-slot-pair.h"
#include "src/ic/call-optimization.h"
#include "src/logging/counters.h"
#include "src/objects/arguments-inl.h"
......@@ -390,11 +390,11 @@ Reduction JSCallReducer::ReduceFunctionPrototypeApply(Node* node) {
// TODO(mslekova): Since this introduces a Call that will get optimized by
// the JSCallReducer, we basically might have to do all the serialization
// that we do for that here as well. The only difference is that here we
// disable speculation (cf. the empty VectorSlotPair above), causing the
// disable speculation (cf. the empty FeedbackSource above), causing the
// JSCallReducer to do much less work. We should revisit this later.
NodeProperties::ChangeOp(
node,
javascript()->Call(arity, p.frequency(), VectorSlotPair(), convert_mode));
javascript()->Call(arity, p.frequency(), FeedbackSource(), convert_mode));
// Try to further reduce the JSCall {node}.
Reduction const reduction = ReduceJSCall(node);
return reduction.Changed() ? reduction : Changed(node);
......@@ -574,7 +574,7 @@ Reduction JSCallReducer::ReduceFunctionPrototypeCall(Node* node) {
}
NodeProperties::ChangeOp(
node,
javascript()->Call(arity, p.frequency(), VectorSlotPair(), convert_mode));
javascript()->Call(arity, p.frequency(), FeedbackSource(), convert_mode));
// Try to further reduce the JSCall {node}.
Reduction const reduction = ReduceJSCall(node);
return reduction.Changed() ? reduction : Changed(node);
......@@ -981,7 +981,7 @@ Reduction JSCallReducer::ReduceReflectHas(Node* node) {
{
// TODO(magardn): collect feedback so this can be optimized
vtrue = etrue = if_true =
graph()->NewNode(javascript()->HasProperty(VectorSlotPair()), target,
graph()->NewNode(javascript()->HasProperty(FeedbackSource()), target,
key, context, frame_state, etrue, if_true);
}
......@@ -2162,7 +2162,7 @@ Node* JSCallReducer::DoFilterPostCallbackWork(ElementsKind kind, Node** control,
IsDoubleElementsKind(kind) ? GrowFastElementsMode::kDoubleElements
: GrowFastElementsMode::kSmiOrObjectElements;
elements = etrue = graph()->NewNode(
simplified()->MaybeGrowFastElements(mode, VectorSlotPair()), a,
simplified()->MaybeGrowFastElements(mode, FeedbackSource()), a,
elements, checked_to, elements_length, etrue, if_true);
// Update the length of {a}.
......@@ -2232,7 +2232,7 @@ void JSCallReducer::RewirePostCallbackExceptionEdges(Node* check_throw,
Node* JSCallReducer::SafeLoadElement(ElementsKind kind, Node* receiver,
Node* control, Node** effect, Node** k,
const VectorSlotPair& feedback) {
const FeedbackSource& feedback) {
// Make sure that the access is still in bounds, since the callback could
// have changed the array's size.
Node* length = *effect = graph()->NewNode(
......@@ -3007,7 +3007,7 @@ bool IsSafeArgumentsElements(Node* node) {
Reduction JSCallReducer::ReduceCallOrConstructWithArrayLikeOrSpread(
Node* node, int arity, CallFrequency const& frequency,
VectorSlotPair const& feedback) {
FeedbackSource const& feedback) {
DCHECK(node->opcode() == IrOpcode::kJSCallWithArrayLike ||
node->opcode() == IrOpcode::kJSCallWithSpread ||
node->opcode() == IrOpcode::kJSConstructWithArrayLike ||
......@@ -3289,7 +3289,7 @@ Reduction JSCallReducer::ReduceJSCall(Node* node) {
}
NodeProperties::ChangeOp(
node, javascript()->Call(arity, p.frequency(), VectorSlotPair(),
node, javascript()->Call(arity, p.frequency(), FeedbackSource(),
convert_mode));
// Try to further reduce the JSCall {node}.
......@@ -3337,7 +3337,7 @@ Reduction JSCallReducer::ReduceJSCall(Node* node) {
? ConvertReceiverMode::kAny
: ConvertReceiverMode::kNotNullOrUndefined;
NodeProperties::ChangeOp(
node, javascript()->Call(arity, p.frequency(), VectorSlotPair(),
node, javascript()->Call(arity, p.frequency(), FeedbackSource(),
convert_mode));
// Try to further reduce the JSCall {node}.
......@@ -3738,9 +3738,8 @@ Reduction JSCallReducer::ReduceJSCall(Node* node,
Reduction JSCallReducer::ReduceJSCallWithArrayLike(Node* node) {
DCHECK_EQ(IrOpcode::kJSCallWithArrayLike, node->opcode());
CallFrequency frequency = CallFrequencyOf(node->op());
VectorSlotPair feedback;
return ReduceCallOrConstructWithArrayLikeOrSpread(node, 2, frequency,
feedback);
FeedbackSource());
}
Reduction JSCallReducer::ReduceJSCallWithSpread(Node* node) {
......@@ -3749,7 +3748,7 @@ Reduction JSCallReducer::ReduceJSCallWithSpread(Node* node) {
DCHECK_LE(3u, p.arity());
int arity = static_cast<int>(p.arity() - 1);
CallFrequency frequency = p.frequency();
VectorSlotPair feedback = p.feedback();
FeedbackSource feedback = p.feedback();
return ReduceCallOrConstructWithArrayLikeOrSpread(node, arity, frequency,
feedback);
}
......@@ -3766,7 +3765,7 @@ Reduction JSCallReducer::ReduceJSConstruct(Node* node) {
if (p.feedback().IsValid()) {
ProcessedFeedback const& feedback =
broker()->GetFeedbackForCall(FeedbackSource(p.feedback()));
broker()->GetFeedbackForCall(p.feedback());
if (feedback.IsInsufficient()) {
return ReduceSoftDeoptimize(
node, DeoptimizeReason::kInsufficientTypeFeedbackForConstruct);
......@@ -3936,7 +3935,7 @@ Reduction JSCallReducer::ReduceJSConstruct(Node* node) {
// Update the JSConstruct operator on {node}.
NodeProperties::ChangeOp(
node,
javascript()->Construct(arity + 2, p.frequency(), VectorSlotPair()));
javascript()->Construct(arity + 2, p.frequency(), FeedbackSource()));
// Try to further reduce the JSConstruct {node}.
Reduction const reduction = ReduceJSConstruct(node);
......@@ -3977,7 +3976,7 @@ Reduction JSCallReducer::ReduceJSConstruct(Node* node) {
// Update the JSConstruct operator on {node}.
NodeProperties::ChangeOp(
node,
javascript()->Construct(arity + 2, p.frequency(), VectorSlotPair()));
javascript()->Construct(arity + 2, p.frequency(), FeedbackSource()));
// Try to further reduce the JSConstruct {node}.
Reduction const reduction = ReduceJSConstruct(node);
......@@ -4297,9 +4296,8 @@ Reduction JSCallReducer::ReduceStringPrototypeSubstr(Node* node) {
Reduction JSCallReducer::ReduceJSConstructWithArrayLike(Node* node) {
DCHECK_EQ(IrOpcode::kJSConstructWithArrayLike, node->opcode());
CallFrequency frequency = CallFrequencyOf(node->op());
VectorSlotPair feedback;
return ReduceCallOrConstructWithArrayLikeOrSpread(node, 1, frequency,
feedback);
FeedbackSource());
}
Reduction JSCallReducer::ReduceJSConstructWithSpread(Node* node) {
......@@ -4308,7 +4306,7 @@ Reduction JSCallReducer::ReduceJSConstructWithSpread(Node* node) {
DCHECK_LE(3u, p.arity());
int arity = static_cast<int>(p.arity() - 2);
CallFrequency frequency = p.frequency();
VectorSlotPair feedback = p.feedback();
FeedbackSource feedback = p.feedback();
return ReduceCallOrConstructWithArrayLikeOrSpread(node, arity, frequency,
feedback);
}
......@@ -4329,7 +4327,7 @@ Reduction JSCallReducer::ReduceSoftDeoptimize(Node* node,
Node* frame_state =
NodeProperties::FindFrameStateBefore(node, jsgraph()->Dead());
Node* deoptimize = graph()->NewNode(
common()->Deoptimize(DeoptimizeKind::kSoft, reason, VectorSlotPair()),
common()->Deoptimize(DeoptimizeKind::kSoft, reason, FeedbackSource()),
frame_state, effect, control);
// TODO(bmeurer): This should be on the AdvancedReducer somehow.
NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
......@@ -5769,7 +5767,7 @@ Reduction JSCallReducer::ReducePromiseConstructor(Node* node) {
// 9. Call executor with both resolving functions
effect = control = graph()->NewNode(
javascript()->Call(4, p.frequency(), VectorSlotPair(),
javascript()->Call(4, p.frequency(), FeedbackSource(),
ConvertReceiverMode::kNullOrUndefined,
SpeculationMode::kDisallowSpeculation),
executor, jsgraph()->UndefinedConstant(), resolve, reject, context,
......@@ -5782,7 +5780,7 @@ Reduction JSCallReducer::ReducePromiseConstructor(Node* node) {
common()->IfException(), exception_control, exception_effect);
// 10a. Call reject if the call to executor threw.
exception_effect = exception_control = graph()->NewNode(
javascript()->Call(3, p.frequency(), VectorSlotPair(),
javascript()->Call(3, p.frequency(), FeedbackSource(),
ConvertReceiverMode::kNullOrUndefined,
SpeculationMode::kDisallowSpeculation),
reject, jsgraph()->UndefinedConstant(), reason, context, frame_state,
......
......@@ -17,7 +17,6 @@ namespace internal {
// Forward declarations.
class Factory;
class JSGlobalProxy;
class VectorSlotPair;
namespace compiler {
......@@ -25,6 +24,7 @@ namespace compiler {
class CallFrequency;
class CommonOperatorBuilder;
class CompilationDependencies;
struct FeedbackSource;
struct FieldAccess;
class JSGraph;
class JSHeapBroker;
......@@ -106,7 +106,7 @@ class V8_EXPORT_PRIVATE JSCallReducer final : public AdvancedReducer {
Reduction ReduceCallOrConstructWithArrayLikeOrSpread(
Node* node, int arity, CallFrequency const& frequency,
VectorSlotPair const& feedback);
FeedbackSource const& feedback);
Reduction ReduceJSConstruct(Node* node);
Reduction ReduceJSConstructWithArrayLike(Node* node);
Reduction ReduceJSConstructWithSpread(Node* node);
......@@ -233,7 +233,7 @@ class V8_EXPORT_PRIVATE JSCallReducer final : public AdvancedReducer {
// k is thusly changed, and the effect is changed as well.
Node* SafeLoadElement(ElementsKind kind, Node* receiver, Node* control,
Node** effect, Node** k,
const VectorSlotPair& feedback);
const FeedbackSource& feedback);
Node* CreateArtificialFrameState(Node* node, Node* outer_frame_state,
int parameter_count, BailoutId bailout_id,
......
......@@ -471,7 +471,7 @@ Reduction JSCreateLowering::ReduceNewArray(
// This has to be kept in sync with src/runtime/runtime-array.cc,
// where this limit is protected.
length = effect = graph()->NewNode(
simplified()->CheckBounds(VectorSlotPair()), length,
simplified()->CheckBounds(FeedbackSource()), length,
jsgraph()->Constant(JSArray::kInitialMaxFastElementArray), effect,
control);
......@@ -566,14 +566,14 @@ Reduction JSCreateLowering::ReduceNewArray(
for (auto& value : values) {
if (!NodeProperties::GetType(value).Is(Type::SignedSmall())) {
value = effect = graph()->NewNode(
simplified()->CheckSmi(VectorSlotPair()), value, effect, control);
simplified()->CheckSmi(FeedbackSource()), value, effect, control);
}
}
} else if (IsDoubleElementsKind(elements_kind)) {
for (auto& value : values) {
if (!NodeProperties::GetType(value).Is(Type::Number())) {
value = effect =
graph()->NewNode(simplified()->CheckNumber(VectorSlotPair()), value,
graph()->NewNode(simplified()->CheckNumber(FeedbackSource()), value,
effect, control);
}
// Make sure we do not store signaling NaNs into double arrays.
......@@ -1073,8 +1073,12 @@ Reduction JSCreateLowering::ReduceJSCreateLiteralArrayOrObject(Node* node) {
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
FeedbackVectorRef feedback_vector(broker(), p.feedback().vector());
ObjectRef feedback = feedback_vector.get(p.feedback().slot());
FeedbackVectorRef feedback_vector(broker(), p.feedback().vector);
ObjectRef feedback = feedback_vector.get(p.feedback().slot);
// TODO(turbofan): we should consider creating a ProcessedFeedback for
// allocation sites/boiler plates so that we use GetFeedback here. Then
// we can eventually get rid of the additional copy of feedback slots that
// we currently have in FeedbackVectorData.
if (feedback.IsAllocationSite()) {
AllocationSiteRef site = feedback.AsAllocationSite();
if (site.IsFastLiteral()) {
......@@ -1096,8 +1100,12 @@ Reduction JSCreateLowering::ReduceJSCreateLiteralArrayOrObject(Node* node) {
Reduction JSCreateLowering::ReduceJSCreateEmptyLiteralArray(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreateEmptyLiteralArray, node->opcode());
FeedbackParameter const& p = FeedbackParameterOf(node->op());
FeedbackVectorRef fv(broker(), p.feedback().vector());
ObjectRef feedback = fv.get(p.feedback().slot());
FeedbackVectorRef fv(broker(), p.feedback().vector);
ObjectRef feedback = fv.get(p.feedback().slot);
// TODO(turbofan): we should consider creating a ProcessedFeedback for
// allocation sites/boiler plates so that we use GetFeedback here. Then
// we can eventually get rid of the additional copy of feedback slots that
// we currently have in FeedbackVectorData.
if (feedback.IsAllocationSite()) {
AllocationSiteRef site = feedback.AsAllocationSite();
DCHECK(!site.PointsToLiteral());
......@@ -1154,8 +1162,12 @@ Reduction JSCreateLowering::ReduceJSCreateLiteralRegExp(Node* node) {
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
FeedbackVectorRef feedback_vector(broker(), p.feedback().vector());
ObjectRef feedback = feedback_vector.get(p.feedback().slot());
FeedbackVectorRef feedback_vector(broker(), p.feedback().vector);
ObjectRef feedback = feedback_vector.get(p.feedback().slot);
// TODO(turbofan): we should consider creating a ProcessedFeedback for
// allocation sites/boiler plates so that we use GetFeedback here. Then
// we can eventually get rid of the additional copy of feedback slots that
// we currently have in FeedbackVectorData.
if (feedback.IsJSRegExp()) {
JSRegExpRef boilerplate = feedback.AsJSRegExp();
Node* value = effect = AllocateLiteralRegExp(effect, control, boilerplate);
......
......@@ -148,13 +148,14 @@ void JSGenericLowering::LowerJSStrictEqual(Node* node) {
}
namespace {
bool ShouldUseMegamorphicLoadBuiltin(VectorSlotPair const& vector_slot_pair,
bool ShouldUseMegamorphicLoadBuiltin(FeedbackSource const& source,
JSHeapBroker* broker) {
if (!FLAG_concurrent_inlining) {
return vector_slot_pair.ic_state() == MEGAMORPHIC;
AllowHandleDereference allow_deref;
FeedbackNexus nexus(source.vector, source.slot);
return nexus.ic_state() == MEGAMORPHIC;
}
ProcessedFeedback const& feedback =
broker->GetFeedback(FeedbackSource(vector_slot_pair));
ProcessedFeedback const& feedback = broker->GetFeedback(source);
if (feedback.kind() == ProcessedFeedback::kElementAccess) {
return feedback.AsElementAccess().transition_groups().empty();
......@@ -184,7 +185,7 @@ void JSGenericLowering::LowerJSLoadProperty(Node* node) {
isolate(), ShouldUseMegamorphicLoadBuiltin(p.feedback(), broker())
? Builtins::kKeyedLoadIC_Megamorphic
: Builtins::kKeyedLoadIC);
Node* vector = jsgraph()->HeapConstant(p.feedback().vector());
Node* vector = jsgraph()->HeapConstant(p.feedback().vector);
node->InsertInput(zone(), 3, vector);
ReplaceWithStubCall(node, callable, flags);
}
......@@ -214,7 +215,7 @@ void JSGenericLowering::LowerJSLoadNamed(Node* node) {
isolate(), ShouldUseMegamorphicLoadBuiltin(p.feedback(), broker())
? Builtins::kLoadIC_Megamorphic
: Builtins::kLoadIC);
Node* vector = jsgraph()->HeapConstant(p.feedback().vector());
Node* vector = jsgraph()->HeapConstant(p.feedback().vector);
node->InsertInput(zone(), 3, vector);
ReplaceWithStubCall(node, callable, flags);
}
......@@ -233,7 +234,7 @@ void JSGenericLowering::LowerJSLoadGlobal(Node* node) {
} else {
Callable callable =
CodeFactory::LoadGlobalICInOptimizedCode(isolate(), p.typeof_mode());
Node* vector = jsgraph()->HeapConstant(p.feedback().vector());
Node* vector = jsgraph()->HeapConstant(p.feedback().vector);
node->InsertInput(zone(), 2, vector);
ReplaceWithStubCall(node, callable, flags);
}
......@@ -243,7 +244,7 @@ void JSGenericLowering::LowerJSGetIterator(Node* node) {
CallDescriptor::Flags flags = FrameStateFlagForCall(node);
const PropertyAccess& p = PropertyAccessOf(node->op());
node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.feedback().index()));
Node* vector = jsgraph()->HeapConstant(p.feedback().vector());
Node* vector = jsgraph()->HeapConstant(p.feedback().vector);
node->InsertInput(zone(), 2, vector);
Callable callable =
Builtins::CallableFor(isolate(), Builtins::kGetIteratorWithFeedback);
......@@ -263,7 +264,7 @@ void JSGenericLowering::LowerJSStoreProperty(Node* node) {
} else {
Callable callable =
Builtins::CallableFor(isolate(), Builtins::kKeyedStoreIC);
Node* vector = jsgraph()->HeapConstant(p.feedback().vector());
Node* vector = jsgraph()->HeapConstant(p.feedback().vector);
node->InsertInput(zone(), 4, vector);
ReplaceWithStubCall(node, callable, flags);
}
......@@ -286,7 +287,7 @@ void JSGenericLowering::LowerJSStoreNamed(Node* node) {
ReplaceWithStubCall(node, callable, flags);
} else {
Callable callable = Builtins::CallableFor(isolate(), Builtins::kStoreIC);
Node* vector = jsgraph()->HeapConstant(p.feedback().vector());
Node* vector = jsgraph()->HeapConstant(p.feedback().vector);
node->InsertInput(zone(), 4, vector);
ReplaceWithStubCall(node, callable, flags);
}
......@@ -304,7 +305,7 @@ void JSGenericLowering::LowerJSStoreNamedOwn(Node* node) {
ReplaceWithStubCall(node, callable, flags);
} else {
Callable callable = CodeFactory::StoreOwnICInOptimizedCode(isolate());
Node* vector = jsgraph()->HeapConstant(p.feedback().vector());
Node* vector = jsgraph()->HeapConstant(p.feedback().vector);
node->InsertInput(zone(), 4, vector);
ReplaceWithStubCall(node, callable, flags);
}
......@@ -324,7 +325,7 @@ void JSGenericLowering::LowerJSStoreGlobal(Node* node) {
} else {
Callable callable =
Builtins::CallableFor(isolate(), Builtins::kStoreGlobalIC);
Node* vector = jsgraph()->HeapConstant(p.feedback().vector());
Node* vector = jsgraph()->HeapConstant(p.feedback().vector);
node->InsertInput(zone(), 3, vector);
ReplaceWithStubCall(node, callable, flags);
}
......@@ -334,7 +335,7 @@ void JSGenericLowering::LowerJSStoreDataPropertyInLiteral(Node* node) {
FeedbackParameter const& p = FeedbackParameterOf(node->op());
RelaxControls(node);
node->InsertInputs(zone(), 4, 2);
node->ReplaceInput(4, jsgraph()->HeapConstant(p.feedback().vector()));
node->ReplaceInput(4, jsgraph()->HeapConstant(p.feedback().vector));
node->ReplaceInput(5, jsgraph()->SmiConstant(p.feedback().index()));
ReplaceWithRuntimeCall(node, Runtime::kDefineDataPropertyInLiteral);
}
......@@ -346,7 +347,7 @@ void JSGenericLowering::LowerJSStoreInArrayLiteral(Node* node) {
FeedbackParameter const& p = FeedbackParameterOf(node->op());
RelaxControls(node);
node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.feedback().index()));
node->InsertInput(zone(), 4, jsgraph()->HeapConstant(p.feedback().vector()));
node->InsertInput(zone(), 4, jsgraph()->HeapConstant(p.feedback().vector));
ReplaceWithStubCall(node, callable, flags);
}
......@@ -548,7 +549,7 @@ void JSGenericLowering::LowerJSCreateTypedArray(Node* node) {
void JSGenericLowering::LowerJSCreateLiteralArray(Node* node) {
CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op());
CallDescriptor::Flags flags = FrameStateFlagForCall(node);
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.feedback().vector()));
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.feedback().vector));
node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.feedback().index()));
node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant()));
......@@ -568,7 +569,7 @@ void JSGenericLowering::LowerJSCreateLiteralArray(Node* node) {
void JSGenericLowering::LowerJSCreateEmptyLiteralArray(Node* node) {
CallDescriptor::Flags flags = FrameStateFlagForCall(node);
FeedbackParameter const& p = FeedbackParameterOf(node->op());
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.feedback().vector()));
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.feedback().vector));
node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.feedback().index()));
node->RemoveInput(4); // control
Callable callable =
......@@ -586,7 +587,7 @@ void JSGenericLowering::LowerJSCreateArrayFromIterable(Node* node) {
void JSGenericLowering::LowerJSCreateLiteralObject(Node* node) {
CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op());
CallDescriptor::Flags flags = FrameStateFlagForCall(node);
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.feedback().vector()));
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.feedback().vector));
node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.feedback().index()));
node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant()));
node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags()));
......@@ -611,7 +612,7 @@ void JSGenericLowering::LowerJSCloneObject(Node* node) {
Builtins::CallableFor(isolate(), Builtins::kCloneObjectIC);
node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.flags()));
node->InsertInput(zone(), 2, jsgraph()->SmiConstant(p.feedback().index()));
node->InsertInput(zone(), 3, jsgraph()->HeapConstant(p.feedback().vector()));
node->InsertInput(zone(), 3, jsgraph()->HeapConstant(p.feedback().vector));
ReplaceWithStubCall(node, callable, flags);
}
......@@ -624,7 +625,7 @@ void JSGenericLowering::LowerJSCreateLiteralRegExp(Node* node) {
CallDescriptor::Flags flags = FrameStateFlagForCall(node);
Callable callable =
Builtins::CallableFor(isolate(), Builtins::kCreateRegExpLiteral);
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.feedback().vector()));
node->InsertInput(zone(), 0, jsgraph()->HeapConstant(p.feedback().vector));
node->InsertInput(zone(), 1, jsgraph()->SmiConstant(p.feedback().index()));
node->InsertInput(zone(), 2, jsgraph()->HeapConstant(p.constant()));
node->InsertInput(zone(), 3, jsgraph()->SmiConstant(p.flags()));
......
This diff is collapsed.
......@@ -9,6 +9,7 @@
#include "src/base/optional.h"
#include "src/common/globals.h"
#include "src/compiler/access-info.h"
#include "src/compiler/feedback-source.h"
#include "src/compiler/processed-feedback.h"
#include "src/compiler/refs-map.h"
#include "src/handles/handles.h"
......@@ -27,29 +28,6 @@ class BytecodeAnalysis;
class ObjectRef;
std::ostream& operator<<(std::ostream& os, const ObjectRef& ref);
struct FeedbackSource {
FeedbackSource(Handle<FeedbackVector> vector_, FeedbackSlot slot_);
FeedbackSource(FeedbackVectorRef vector_, FeedbackSlot slot_);
explicit FeedbackSource(FeedbackNexus const& nexus);
explicit FeedbackSource(VectorSlotPair const& pair);
Handle<FeedbackVector> const vector;
FeedbackSlot const slot;
struct Hash {
size_t operator()(FeedbackSource const& source) const {
return base::hash_combine(source.vector.address(), source.slot);
}
};
struct Equal {
bool operator()(FeedbackSource const& lhs,
FeedbackSource const& rhs) const {
return lhs.vector.equals(rhs.vector) && lhs.slot == rhs.slot;
}
};
};
#define TRACE_BROKER(broker, x) \
do { \
if (broker->tracing_enabled() && FLAG_trace_heap_broker_verbose) \
......@@ -117,15 +95,15 @@ class V8_EXPORT_PRIVATE JSHeapBroker {
bool IsArrayOrObjectPrototype(const JSObjectRef& object) const;
bool HasFeedback(FeedbackSource const& source) const;
// The processed {feedback} can be {nullptr}, indicating that the original
// feedback didn't contain information relevant for Turbofan.
void SetFeedback(FeedbackSource const& source,
ProcessedFeedback const* feedback);
ProcessedFeedback const& GetFeedback(FeedbackSource const& source) const;
FeedbackSlotKind GetFeedbackSlotKind(FeedbackSource const& source) const;
// TODO(neis): Move these into serializer when we're always in the background.
ElementAccessFeedback const& ProcessFeedbackMapsForElementAccess(
MapHandles const& maps, KeyedAccessMode const& keyed_mode);
MapHandles const& maps, KeyedAccessMode const& keyed_mode,
FeedbackSlotKind slot_kind);
BytecodeAnalysis const& GetBytecodeAnalysis(
Handle<BytecodeArray> bytecode_array, BailoutId osr_offset,
bool analyze_liveness,
......
......@@ -86,7 +86,7 @@ Reduction JSHeapCopyReducer::Reduce(Node* node) {
case IrOpcode::kJSCreateEmptyLiteralArray: {
if (!FLAG_concurrent_inlining) {
FeedbackParameter const& p = FeedbackParameterOf(node->op());
FeedbackVectorRef(broker(), p.feedback().vector()).SerializeSlots();
FeedbackVectorRef(broker(), p.feedback().vector).SerializeSlots();
}
break;
}
......@@ -103,7 +103,7 @@ Reduction JSHeapCopyReducer::Reduce(Node* node) {
if (!FLAG_concurrent_inlining) {
CreateLiteralParameters const& p =
CreateLiteralParametersOf(node->op());
FeedbackVectorRef(broker(), p.feedback().vector()).SerializeSlots();
FeedbackVectorRef(broker(), p.feedback().vector).SerializeSlots();
}
break;
}
......@@ -111,7 +111,7 @@ Reduction JSHeapCopyReducer::Reduce(Node* node) {
if (!FLAG_concurrent_inlining) {
CreateLiteralParameters const& p =
CreateLiteralParametersOf(node->op());
FeedbackVectorRef(broker(), p.feedback().vector()).SerializeSlots();
FeedbackVectorRef(broker(), p.feedback().vector).SerializeSlots();
}
break;
}
......
......@@ -111,7 +111,7 @@ Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) {
// TODO(bmeurer): Move MergeControlToEnd() to the AdvancedReducer.
Node* deoptimize = graph()->NewNode(
common()->Deoptimize(DeoptimizeKind::kEager,
DeoptimizeReason::kDeoptimizeNow, VectorSlotPair()),
DeoptimizeReason::kDeoptimizeNow, FeedbackSource()),
frame_state, effect, control);
NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
Revisit(graph()->end());
......
This diff is collapsed.
This diff is collapsed.
......@@ -449,7 +449,7 @@ JSTypeHintLowering::LoweringResult JSTypeHintLowering::ReduceToNumberOperation(
if (BinaryOperationHintToNumberOperationHint(GetBinaryOperationHint(slot),
&hint)) {
Node* node = jsgraph()->graph()->NewNode(
jsgraph()->simplified()->SpeculativeToNumber(hint, VectorSlotPair()),
jsgraph()->simplified()->SpeculativeToNumber(hint, FeedbackSource()),
input, effect, control);
return LoweringResult::SideEffectFree(node, node, control);
}
......@@ -549,7 +549,7 @@ Node* JSTypeHintLowering::TryBuildSoftDeopt(FeedbackSlot slot, Node* effect,
Node* deoptimize = jsgraph()->graph()->NewNode(
jsgraph()->common()->Deoptimize(DeoptimizeKind::kSoft, reason,
VectorSlotPair()),
FeedbackSource()),
jsgraph()->Dead(), effect, control);
Node* frame_state =
NodeProperties::FindFrameStateBefore(deoptimize, jsgraph()->Dead());
......
......@@ -200,14 +200,14 @@ class JSBinopReduction final {
void CheckInputsToString() {
if (!left_type().Is(Type::String())) {
Node* left_input =
graph()->NewNode(simplified()->CheckString(VectorSlotPair()), left(),
graph()->NewNode(simplified()->CheckString(FeedbackSource()), left(),
effect(), control());
node_->ReplaceInput(0, left_input);
update_effect(left_input);
}
if (!right_type().Is(Type::String())) {
Node* right_input =
graph()->NewNode(simplified()->CheckString(VectorSlotPair()), right(),
graph()->NewNode(simplified()->CheckString(FeedbackSource()), right(),
effect(), control());
node_->ReplaceInput(1, right_input);
update_effect(right_input);
......@@ -576,7 +576,7 @@ Reduction JSTypedLowering::ReduceJSAdd(Node* node) {
// and thus potentially reduces the number of live ranges and allows for
// more truncations.
length = effect = graph()->NewNode(
simplified()->CheckBounds(VectorSlotPair()), length,
simplified()->CheckBounds(FeedbackSource()), length,
jsgraph()->Constant(String::kMaxLength + 1), effect, control);
} else {
// Check if we would overflow the allowed maximum string length.
......
......@@ -5,9 +5,9 @@
#include "src/compiler/map-inference.h"
#include "src/compiler/compilation-dependencies.h"
#include "src/compiler/feedback-source.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/simplified-operator.h"
#include "src/compiler/vector-slot-pair.h"
#include "src/objects/map-inl.h"
#include "src/zone/zone-handle-set.h"
......@@ -93,7 +93,7 @@ MapHandles const& MapInference::GetMaps() {
void MapInference::InsertMapChecks(JSGraph* jsgraph, Node** effect,
Node* control,
const VectorSlotPair& feedback) {
const FeedbackSource& feedback) {
CHECK(HaveMaps());
CHECK(feedback.IsValid());
ZoneHandleSet<Map> maps;
......@@ -112,7 +112,7 @@ bool MapInference::RelyOnMapsViaStability(
bool MapInference::RelyOnMapsPreferStability(
CompilationDependencies* dependencies, JSGraph* jsgraph, Node** effect,
Node* control, const VectorSlotPair& feedback) {
Node* control, const FeedbackSource& feedback) {
CHECK(HaveMaps());
if (Safe()) return false;
if (RelyOnMapsViaStability(dependencies)) return true;
......@@ -123,7 +123,7 @@ bool MapInference::RelyOnMapsPreferStability(
bool MapInference::RelyOnMapsHelper(CompilationDependencies* dependencies,
JSGraph* jsgraph, Node** effect,
Node* control,
const VectorSlotPair& feedback) {
const FeedbackSource& feedback) {
if (Safe()) return true;
auto is_stable = [this](Handle<Map> map) {
......
......@@ -13,11 +13,11 @@
namespace v8 {
namespace internal {
class VectorSlotPair;
namespace compiler {
class CompilationDependencies;
struct FeedbackSource;
class JSGraph;
class JSHeapBroker;
class Node;
......@@ -67,10 +67,10 @@ class MapInference {
// dependencies were taken.
bool RelyOnMapsPreferStability(CompilationDependencies* dependencies,
JSGraph* jsgraph, Node** effect, Node* control,
const VectorSlotPair& feedback);
const FeedbackSource& feedback);
// Inserts map checks even if maps were already reliable.
void InsertMapChecks(JSGraph* jsgraph, Node** effect, Node* control,
const VectorSlotPair& feedback);
const FeedbackSource& feedback);
// Internally marks the maps as reliable (thus bypassing the safety check) and
// returns the NoChange reduction. USE THIS ONLY WHEN RETURNING, e.g.:
......@@ -98,7 +98,7 @@ class MapInference {
std::function<bool(InstanceType)> f) const;
V8_WARN_UNUSED_RESULT bool RelyOnMapsHelper(
CompilationDependencies* dependencies, JSGraph* jsgraph, Node** effect,
Node* control, const VectorSlotPair& feedback);
Node* control, const FeedbackSource& feedback);
};
} // namespace compiler
......
......@@ -35,6 +35,7 @@ class ProcessedFeedback : public ZoneObject {
};
Kind kind() const { return kind_; }
FeedbackSlotKind slot_kind() const { return slot_kind_; }
bool IsInsufficient() const { return kind() == kInsufficient; }
BinaryOperationFeedback const& AsBinaryOperation() const;
......@@ -47,23 +48,24 @@ class ProcessedFeedback : public ZoneObject {
NamedAccessFeedback const& AsNamedAccess() const;
protected:
explicit ProcessedFeedback(Kind kind) : kind_(kind) {}
ProcessedFeedback(Kind kind, FeedbackSlotKind slot_kind);
private:
Kind const kind_;
FeedbackSlotKind const slot_kind_;
};
class InsufficientFeedback final : public ProcessedFeedback {
public:
InsufficientFeedback();
explicit InsufficientFeedback(FeedbackSlotKind slot_kind);
};
class GlobalAccessFeedback : public ProcessedFeedback {
public:
explicit GlobalAccessFeedback(PropertyCellRef cell);
GlobalAccessFeedback(PropertyCellRef cell, FeedbackSlotKind slot_kind);
GlobalAccessFeedback(ContextRef script_context, int slot_index,
bool immutable);
GlobalAccessFeedback(); // Megamorphic
bool immutable, FeedbackSlotKind slot_kind);
explicit GlobalAccessFeedback(FeedbackSlotKind slot_kind); // Megamorphic
bool IsMegamorphic() const;
......@@ -107,7 +109,8 @@ class KeyedAccessMode {
class ElementAccessFeedback : public ProcessedFeedback {
public:
ElementAccessFeedback(Zone* zone, KeyedAccessMode const& keyed_mode);
ElementAccessFeedback(Zone* zone, KeyedAccessMode const& keyed_mode,
FeedbackSlotKind slot_kind);
KeyedAccessMode keyed_mode() const;
......@@ -145,7 +148,8 @@ class ElementAccessFeedback : public ProcessedFeedback {
class NamedAccessFeedback : public ProcessedFeedback {
public:
NamedAccessFeedback(NameRef const& name, ZoneVector<Handle<Map>> const& maps);
NamedAccessFeedback(NameRef const& name, ZoneVector<Handle<Map>> const& maps,
FeedbackSlotKind slot_kind);
NameRef const& name() const { return name_; }
ZoneVector<Handle<Map>> const& maps() const { return maps_; }
......@@ -158,8 +162,8 @@ class NamedAccessFeedback : public ProcessedFeedback {
class CallFeedback : public ProcessedFeedback {
public:
CallFeedback(base::Optional<HeapObjectRef> target, float frequency,
SpeculationMode mode)
: ProcessedFeedback(kCall),
SpeculationMode mode, FeedbackSlotKind slot_kind)
: ProcessedFeedback(kCall, slot_kind),
target_(target),
frequency_(frequency),
mode_(mode) {}
......@@ -177,7 +181,14 @@ class CallFeedback : public ProcessedFeedback {
template <class T, ProcessedFeedback::Kind K>
class SingleValueFeedback : public ProcessedFeedback {
public:
explicit SingleValueFeedback(T value) : ProcessedFeedback(K), value_(value) {}
explicit SingleValueFeedback(T value, FeedbackSlotKind slot_kind)
: ProcessedFeedback(K, slot_kind), value_(value) {
DCHECK(
(K == kBinaryOperation && slot_kind == FeedbackSlotKind::kBinaryOp) ||
(K == kCompareOperation && slot_kind == FeedbackSlotKind::kCompareOp) ||
(K == kForIn && slot_kind == FeedbackSlotKind::kForIn) ||
(K == kInstanceOf && slot_kind == FeedbackSlotKind::kInstanceOf));
}
T value() const { return value_; }
......
......@@ -61,7 +61,7 @@ bool PropertyAccessBuilder::TryBuildStringCheck(
// Monormorphic string access (ignoring the fact that there are multiple
// String maps).
*receiver = *effect =
graph()->NewNode(simplified()->CheckString(VectorSlotPair()), *receiver,
graph()->NewNode(simplified()->CheckString(FeedbackSource()), *receiver,
*effect, control);
return true;
}
......@@ -74,7 +74,7 @@ bool PropertyAccessBuilder::TryBuildNumberCheck(
if (HasOnlyNumberMaps(broker, maps)) {
// Monomorphic number access (we also deal with Smis here).
*receiver = *effect =
graph()->NewNode(simplified()->CheckNumber(VectorSlotPair()), *receiver,
graph()->NewNode(simplified()->CheckNumber(FeedbackSource()), *receiver,
*effect, control);
return true;
}
......
......@@ -1778,7 +1778,7 @@ Node* RepresentationChanger::InsertChangeCompressedToTagged(Node* node) {
}
Node* RepresentationChanger::InsertCheckedFloat64ToInt32(
Node* node, CheckForMinusZeroMode check, const VectorSlotPair& feedback,
Node* node, CheckForMinusZeroMode check, const FeedbackSource& feedback,
Node* use_node) {
return InsertConversion(
node, simplified()->CheckedFloat64ToInt32(check, feedback), use_node);
......
......@@ -5,6 +5,7 @@
#ifndef V8_COMPILER_REPRESENTATION_CHANGE_H_
#define V8_COMPILER_REPRESENTATION_CHANGE_H_
#include "src/compiler/feedback-source.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/simplified-operator.h"
......@@ -165,7 +166,7 @@ class UseInfo {
public:
UseInfo(MachineRepresentation representation, Truncation truncation,
TypeCheckKind type_check = TypeCheckKind::kNone,
const VectorSlotPair& feedback = VectorSlotPair())
const FeedbackSource& feedback = FeedbackSource())
: representation_(representation),
truncation_(truncation),
type_check_(type_check),
......@@ -176,7 +177,7 @@ class UseInfo {
static UseInfo TruncatingWord64() {
return UseInfo(MachineRepresentation::kWord64, Truncation::Word64());
}
static UseInfo CheckedBigIntTruncatingWord64(const VectorSlotPair& feedback) {
static UseInfo CheckedBigIntTruncatingWord64(const FeedbackSource& feedback) {
return UseInfo(MachineRepresentation::kWord64, Truncation::Word64(),
TypeCheckKind::kBigInt, feedback);
}
......@@ -219,59 +220,59 @@ class UseInfo {
// Possibly deoptimizing conversions.
static UseInfo CheckedHeapObjectAsTaggedPointer(
const VectorSlotPair& feedback) {
const FeedbackSource& feedback) {
return UseInfo(MachineRepresentation::kTaggedPointer, Truncation::Any(),
TypeCheckKind::kHeapObject, feedback);
}
static UseInfo CheckedBigIntAsTaggedPointer(const VectorSlotPair& feedback) {
static UseInfo CheckedBigIntAsTaggedPointer(const FeedbackSource& feedback) {
return UseInfo(MachineRepresentation::kTaggedPointer, Truncation::Any(),
TypeCheckKind::kBigInt, feedback);
}
static UseInfo CheckedSignedSmallAsTaggedSigned(
const VectorSlotPair& feedback,
const FeedbackSource& feedback,
IdentifyZeros identify_zeros = kDistinguishZeros) {
return UseInfo(MachineRepresentation::kTaggedSigned,
Truncation::Any(identify_zeros), TypeCheckKind::kSignedSmall,
feedback);
}
static UseInfo CheckedSignedSmallAsWord32(IdentifyZeros identify_zeros,
const VectorSlotPair& feedback) {
const FeedbackSource& feedback) {
return UseInfo(MachineRepresentation::kWord32,
Truncation::Any(identify_zeros), TypeCheckKind::kSignedSmall,
feedback);
}
static UseInfo CheckedSigned32AsWord32(IdentifyZeros identify_zeros,
const VectorSlotPair& feedback) {
const FeedbackSource& feedback) {
return UseInfo(MachineRepresentation::kWord32,
Truncation::Any(identify_zeros), TypeCheckKind::kSigned32,
feedback);
}
static UseInfo CheckedSigned64AsWord64(IdentifyZeros identify_zeros,
const VectorSlotPair& feedback) {
const FeedbackSource& feedback) {
return UseInfo(MachineRepresentation::kWord64,
Truncation::Any(identify_zeros), TypeCheckKind::kSigned64,
feedback);
}
static UseInfo CheckedNumberAsFloat64(IdentifyZeros identify_zeros,
const VectorSlotPair& feedback) {
const FeedbackSource& feedback) {
return UseInfo(MachineRepresentation::kFloat64,
Truncation::Any(identify_zeros), TypeCheckKind::kNumber,
feedback);
}
static UseInfo CheckedNumberAsWord32(const VectorSlotPair& feedback) {
static UseInfo CheckedNumberAsWord32(const FeedbackSource& feedback) {
return UseInfo(MachineRepresentation::kWord32, Truncation::Word32(),
TypeCheckKind::kNumber, feedback);
}
static UseInfo CheckedNumberOrOddballAsFloat64(
IdentifyZeros identify_zeros, const VectorSlotPair& feedback) {
IdentifyZeros identify_zeros, const FeedbackSource& feedback) {
return UseInfo(MachineRepresentation::kFloat64,
Truncation::Any(identify_zeros),
TypeCheckKind::kNumberOrOddball, feedback);
}
static UseInfo CheckedNumberOrOddballAsWord32(
const VectorSlotPair& feedback) {
const FeedbackSource& feedback) {
return UseInfo(MachineRepresentation::kWord32, Truncation::Word32(),
TypeCheckKind::kNumberOrOddball, feedback);
}
......@@ -297,13 +298,13 @@ class UseInfo {
? CheckForMinusZeroMode::kDontCheckForMinusZero
: CheckForMinusZeroMode::kCheckForMinusZero;
}
const VectorSlotPair& feedback() const { return feedback_; }
const FeedbackSource& feedback() const { return feedback_; }
private:
MachineRepresentation representation_;
Truncation truncation_;
TypeCheckKind type_check_;
VectorSlotPair feedback_;
FeedbackSource feedback_;
};
// Contains logic related to changing the representation of values for constants
......@@ -399,7 +400,7 @@ class V8_EXPORT_PRIVATE RepresentationChanger final {
Node* InsertChangeCompressedSignedToTaggedSigned(Node* node);
Node* InsertChangeCompressedToTagged(Node* node);
Node* InsertCheckedFloat64ToInt32(Node* node, CheckForMinusZeroMode check,
const VectorSlotPair& feedback,
const FeedbackSource& feedback,
Node* use_node);
Node* InsertConversion(Node* node, const Operator* op, Node* use_node);
Node* InsertTruncateInt64ToInt32(Node* node);
......
......@@ -11,7 +11,6 @@
#include "src/compiler/bytecode-analysis.h"
#include "src/compiler/compilation-dependencies.h"
#include "src/compiler/js-heap-broker.h"
#include "src/compiler/vector-slot-pair.h"
#include "src/handles/handles-inl.h"
#include "src/ic/call-optimization.h"
#include "src/interpreter/bytecode-array-iterator.h"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
// Copyright 2017 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/vector-slot-pair.h"
#include "src/objects/feedback-vector.h"
namespace v8 {
namespace internal {
VectorSlotPair::VectorSlotPair() = default;
int VectorSlotPair::index() const {
return vector_.is_null() ? -1 : FeedbackVector::GetIndex(slot_);
}
bool operator==(VectorSlotPair const& lhs, VectorSlotPair const& rhs) {
return lhs.slot() == rhs.slot() &&
lhs.vector().location() == rhs.vector().location() &&
lhs.ic_state() == rhs.ic_state();
}
bool operator!=(VectorSlotPair const& lhs, VectorSlotPair const& rhs) {
return !(lhs == rhs);
}
std::ostream& operator<<(std::ostream& os, const VectorSlotPair& p) {
if (p.IsValid()) {
return os << "VectorSlotPair(" << p.slot() << ", "
<< InlineCacheState2String(p.ic_state()) << ")";
}
return os << "VectorSlotPair(INVALID)";
}
size_t hash_value(VectorSlotPair const& p) {
return base::hash_combine(p.slot(), p.vector().location(), p.ic_state());
}
} // namespace internal
} // namespace v8
// Copyright 2017 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_VECTOR_SLOT_PAIR_H_
#define V8_COMPILER_VECTOR_SLOT_PAIR_H_
#include "src/common/globals.h"
#include "src/handles/handles.h"
#include "src/utils/utils.h"
namespace v8 {
namespace internal {
class FeedbackVector;
// Defines a pair of {FeedbackVector} and {FeedbackSlot}, which
// is used to access the type feedback for a certain {Node}.
class V8_EXPORT_PRIVATE VectorSlotPair {
public:
VectorSlotPair();
VectorSlotPair(Handle<FeedbackVector> vector, FeedbackSlot slot,
InlineCacheState ic_state)
: vector_(vector), slot_(slot), ic_state_(ic_state) {}
bool IsValid() const { return !vector_.is_null() && !slot_.IsInvalid(); }
Handle<FeedbackVector> vector() const { return vector_; }
FeedbackSlot slot() const { return slot_; }
InlineCacheState ic_state() const { return ic_state_; }
int index() const;
private:
Handle<FeedbackVector> vector_;
FeedbackSlot slot_;
InlineCacheState ic_state_ = UNINITIALIZED;
};
bool operator==(VectorSlotPair const&, VectorSlotPair const&);
bool operator!=(VectorSlotPair const&, VectorSlotPair const&);
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
VectorSlotPair const&);
size_t hash_value(VectorSlotPair const&);
} // namespace internal
} // namespace v8
#endif // V8_COMPILER_VECTOR_SLOT_PAIR_H_
......@@ -76,7 +76,7 @@ TEST(DeoptInMiddleOfBasicBlock) {
// Dummy node for FlagsContinuation::ForDeoptimize (which won't accept
// nullptr).
Node* node = Node::New(zone, 0, nullptr, 0, nullptr, false);
VectorSlotPair feedback;
FeedbackSource feedback;
FlagsContinuation cont = FlagsContinuation::ForDeoptimize(
kEqual, DeoptimizeKind::kEager, DeoptimizeReason::kUnknown, feedback,
node);
......
......@@ -401,11 +401,11 @@ TEST(Word64) {
CheckChange(
IrOpcode::kCheckedInt64ToInt32, MachineRepresentation::kWord64,
TypeCache::Get()->kSafeInteger, MachineRepresentation::kWord32,
UseInfo::CheckedSigned32AsWord32(kIdentifyZeros, VectorSlotPair()));
UseInfo::CheckedSigned32AsWord32(kIdentifyZeros, FeedbackSource()));
CheckChange(
IrOpcode::kCheckedUint64ToInt32, MachineRepresentation::kWord64,
TypeCache::Get()->kPositiveSafeInteger, MachineRepresentation::kWord32,
UseInfo::CheckedSigned32AsWord32(kIdentifyZeros, VectorSlotPair()));
UseInfo::CheckedSigned32AsWord32(kIdentifyZeros, FeedbackSource()));
CheckChange(IrOpcode::kChangeFloat64ToInt64, MachineRepresentation::kFloat64,
Type::Signed32(), MachineRepresentation::kWord64);
......@@ -420,7 +420,7 @@ TEST(Word64) {
CheckChange(
IrOpcode::kCheckedFloat64ToInt64, MachineRepresentation::kFloat64,
Type::Number(), MachineRepresentation::kWord64,
UseInfo::CheckedSigned64AsWord64(kIdentifyZeros, VectorSlotPair()));
UseInfo::CheckedSigned64AsWord64(kIdentifyZeros, FeedbackSource()));
CheckChange(IrOpcode::kChangeInt64ToFloat64, MachineRepresentation::kWord64,
Type::Signed32(), MachineRepresentation::kFloat64);
......@@ -449,7 +449,7 @@ TEST(Word64) {
IrOpcode::kChangeFloat32ToFloat64, IrOpcode::kCheckedFloat64ToInt64,
MachineRepresentation::kFloat32, Type::Number(),
MachineRepresentation::kWord64,
UseInfo::CheckedSigned64AsWord64(kIdentifyZeros, VectorSlotPair()));
UseInfo::CheckedSigned64AsWord64(kIdentifyZeros, FeedbackSource()));
CheckTwoChanges(IrOpcode::kChangeInt64ToFloat64,
IrOpcode::kTruncateFloat64ToFloat32,
......@@ -470,11 +470,11 @@ TEST(Word64) {
CheckChange(
IrOpcode::kCheckedTaggedToInt64, MachineRepresentation::kTagged,
Type::Number(), MachineRepresentation::kWord64,
UseInfo::CheckedSigned64AsWord64(kIdentifyZeros, VectorSlotPair()));
UseInfo::CheckedSigned64AsWord64(kIdentifyZeros, FeedbackSource()));
CheckChange(
IrOpcode::kCheckedTaggedToInt64, MachineRepresentation::kTaggedPointer,
Type::Number(), MachineRepresentation::kWord64,
UseInfo::CheckedSigned64AsWord64(kIdentifyZeros, VectorSlotPair()));
UseInfo::CheckedSigned64AsWord64(kIdentifyZeros, FeedbackSource()));
CheckTwoChanges(IrOpcode::kTruncateInt64ToInt32,
IrOpcode::kChangeInt31ToTaggedSigned,
......@@ -507,12 +507,12 @@ TEST(Word64) {
CheckChange(IrOpcode::kCheckedInt64ToTaggedSigned,
MachineRepresentation::kWord64, TypeCache::Get()->kSafeInteger,
MachineRepresentation::kTaggedSigned,
UseInfo::CheckedSignedSmallAsTaggedSigned(VectorSlotPair()));
UseInfo::CheckedSignedSmallAsTaggedSigned(FeedbackSource()));
CheckChange(IrOpcode::kCheckedUint64ToTaggedSigned,
MachineRepresentation::kWord64,
TypeCache::Get()->kPositiveSafeInteger,
MachineRepresentation::kTaggedSigned,
UseInfo::CheckedSignedSmallAsTaggedSigned(VectorSlotPair()));
UseInfo::CheckedSignedSmallAsTaggedSigned(FeedbackSource()));
CheckTwoChanges(
IrOpcode::kChangeInt64ToFloat64, IrOpcode::kChangeFloat64ToTaggedPointer,
......@@ -630,7 +630,7 @@ TEST(SignednessInWord32) {
CheckChange(IrOpcode::kCheckedTruncateTaggedToWord32,
MachineRepresentation::kTagged, Type::NonInternal(),
MachineRepresentation::kWord32,
UseInfo::CheckedNumberOrOddballAsWord32(VectorSlotPair()));
UseInfo::CheckedNumberOrOddballAsWord32(FeedbackSource()));
CheckTwoChanges(IrOpcode::kChangeInt32ToFloat64,
IrOpcode::kTruncateFloat64ToFloat32,
......@@ -644,7 +644,7 @@ TEST(SignednessInWord32) {
CheckChange(
IrOpcode::kCheckedUint32ToInt32, MachineRepresentation::kWord32,
Type::Unsigned32(),
UseInfo::CheckedSigned32AsWord32(kIdentifyZeros, VectorSlotPair()));
UseInfo::CheckedSigned32AsWord32(kIdentifyZeros, FeedbackSource()));
}
TEST(CompressedAndTagged) {
......@@ -698,19 +698,19 @@ static void TestMinusZeroCheck(IrOpcode::Value expected, Type from_type) {
CheckChange(
expected, MachineRepresentation::kFloat64, from_type,
UseInfo::CheckedSignedSmallAsWord32(kDistinguishZeros, VectorSlotPair()));
UseInfo::CheckedSignedSmallAsWord32(kDistinguishZeros, FeedbackSource()));
CheckChange(
expected, MachineRepresentation::kFloat64, from_type,
UseInfo::CheckedSignedSmallAsWord32(kIdentifyZeros, VectorSlotPair()));
UseInfo::CheckedSignedSmallAsWord32(kIdentifyZeros, FeedbackSource()));
CheckChange(
expected, MachineRepresentation::kFloat64, from_type,
UseInfo::CheckedSigned32AsWord32(kDistinguishZeros, VectorSlotPair()));
UseInfo::CheckedSigned32AsWord32(kDistinguishZeros, FeedbackSource()));
CheckChange(
expected, MachineRepresentation::kFloat64, from_type,
UseInfo::CheckedSigned32AsWord32(kDistinguishZeros, VectorSlotPair()));
UseInfo::CheckedSigned32AsWord32(kDistinguishZeros, FeedbackSource()));
}
TEST(MinusZeroCheck) {
......
......@@ -6,6 +6,7 @@
#include "src/codegen/tick-counter.h"
#include "src/compiler/compilation-dependencies.h"
#include "src/compiler/feedback-source.h"
#include "src/compiler/js-call-reducer.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/simplified-operator.h"
......@@ -113,7 +114,7 @@ class JSCallReducerTest : public TypedGraphTest {
ClosureFeedbackCellArray::New(isolate(), shared);
Handle<FeedbackVector> vector =
FeedbackVector::New(isolate(), shared, closure_feedback_cell_array);
VectorSlotPair feedback(vector, FeedbackSlot(0), UNINITIALIZED);
FeedbackSource feedback(vector, FeedbackSlot(0));
return javascript()->Call(arity, CallFrequency(), feedback,
ConvertReceiverMode::kAny,
SpeculationMode::kAllowSpeculation);
......
......@@ -375,7 +375,7 @@ TEST_F(JSTypedLoweringTest, JSStoreContext) {
TEST_F(JSTypedLoweringTest, JSLoadNamedStringLength) {
VectorSlotPair feedback;
FeedbackSource feedback;
Handle<Name> name = factory()->length_string();
Node* const receiver = Parameter(Type::String(), 0);
Node* const context = UndefinedConstant();
......
......@@ -360,7 +360,7 @@ TEST_F(SimplifiedOperatorReducerTest, CheckedFloat64ToInt32WithConstant) {
TRACED_FOREACH(int32_t, n, kInt32Values) {
Reduction r = Reduce(graph()->NewNode(
simplified()->CheckedFloat64ToInt32(
CheckForMinusZeroMode::kDontCheckForMinusZero, VectorSlotPair()),
CheckForMinusZeroMode::kDontCheckForMinusZero, FeedbackSource()),
Float64Constant(n), effect, control));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsInt32Constant(n));
......@@ -418,7 +418,7 @@ TEST_F(SimplifiedOperatorReducerTest, CheckSmiWithChangeInt31ToTaggedSigned) {
Node* value =
graph()->NewNode(simplified()->ChangeInt31ToTaggedSigned(), param0);
Reduction reduction = Reduce(graph()->NewNode(
simplified()->CheckSmi(VectorSlotPair()), value, effect, control));
simplified()->CheckSmi(FeedbackSource()), value, effect, control));
ASSERT_TRUE(reduction.Changed());
EXPECT_EQ(value, reduction.replacement());
}
......@@ -428,7 +428,7 @@ TEST_F(SimplifiedOperatorReducerTest, CheckSmiWithNumberConstant) {
Node* control = graph()->start();
Node* value = NumberConstant(1.0);
Reduction reduction = Reduce(graph()->NewNode(
simplified()->CheckSmi(VectorSlotPair()), value, effect, control));
simplified()->CheckSmi(FeedbackSource()), value, effect, control));
ASSERT_TRUE(reduction.Changed());
EXPECT_EQ(value, reduction.replacement());
}
......@@ -438,9 +438,9 @@ TEST_F(SimplifiedOperatorReducerTest, CheckSmiWithCheckSmi) {
Node* effect = graph()->start();
Node* control = graph()->start();
Node* value = effect = graph()->NewNode(
simplified()->CheckSmi(VectorSlotPair()), param0, effect, control);
simplified()->CheckSmi(FeedbackSource()), param0, effect, control);
Reduction reduction = Reduce(graph()->NewNode(
simplified()->CheckSmi(VectorSlotPair()), value, effect, control));
simplified()->CheckSmi(FeedbackSource()), value, effect, control));
ASSERT_TRUE(reduction.Changed());
EXPECT_EQ(value, reduction.replacement());
}
......
......@@ -463,7 +463,7 @@ TEST_MONOTONICITY(Add)
#undef TEST_MONOTONICITY
TEST_F(TyperTest, Monotonicity_InstanceOf) {
TestBinaryMonotonicity(javascript_.InstanceOf(VectorSlotPair()));
TestBinaryMonotonicity(javascript_.InstanceOf(FeedbackSource()));
}
// JS BINOPS without hint
......
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