Commit 102b2624 authored by Victor Gomes's avatar Victor Gomes Committed by Commit Bot

[cleanup] Create UpdateFeedbackMode enum

Change-Id: I9f41fc97c2ca9a1c62b1de4ee8c9878d5d69b560
Bug: v8:11429
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2697195Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72772}
parent a94fd865
......@@ -698,7 +698,7 @@ TF_BUILTIN(ForInPrepare, CodeStubAssembler) {
TNode<FixedArray> cache_array;
TNode<Smi> cache_length;
ForInPrepare(enumerator, vector_index, feedback_vector, &cache_array,
&cache_length, true);
&cache_length, UpdateFeedbackMode::kGuaranteedFeedback);
Return(cache_array, cache_length);
}
......
......@@ -26,7 +26,8 @@ namespace internal {
BinaryOpAssembler binop_asm(state()); \
TNode<Object> result = \
binop_asm.Generator([&]() { return context; }, lhs, rhs, slot, \
[&]() { return feedback_vector; }, true, false); \
[&]() { return feedback_vector; }, \
UpdateFeedbackMode::kGuaranteedFeedback, false); \
\
Return(result); \
}
......@@ -45,18 +46,19 @@ DEF_BINOP(ShiftRightLogical_WithFeedback,
Generate_ShiftRightLogicalWithFeedback)
#undef DEF_BINOP
#define DEF_BINOP(Name, Generator) \
TF_BUILTIN(Name, CodeStubAssembler) { \
auto lhs = Parameter<Object>(Descriptor::kLeft); \
auto rhs = Parameter<Object>(Descriptor::kRight); \
auto slot = UncheckedParameter<UintPtrT>(Descriptor::kSlot); \
\
BinaryOpAssembler binop_asm(state()); \
TNode<Object> result = binop_asm.Generator( \
[&]() { return LoadContextFromBaseline(); }, lhs, rhs, slot, \
[&]() { return LoadFeedbackVectorFromBaseline(); }, true, false); \
\
Return(result); \
#define DEF_BINOP(Name, Generator) \
TF_BUILTIN(Name, CodeStubAssembler) { \
auto lhs = Parameter<Object>(Descriptor::kLeft); \
auto rhs = Parameter<Object>(Descriptor::kRight); \
auto slot = UncheckedParameter<UintPtrT>(Descriptor::kSlot); \
\
BinaryOpAssembler binop_asm(state()); \
TNode<Object> result = binop_asm.Generator( \
[&]() { return LoadContextFromBaseline(); }, lhs, rhs, slot, \
[&]() { return LoadFeedbackVectorFromBaseline(); }, \
UpdateFeedbackMode::kGuaranteedFeedback, false); \
\
Return(result); \
}
DEF_BINOP(Add_Baseline, Generate_AddWithFeedback)
DEF_BINOP(Subtract_Baseline, Generate_SubtractWithFeedback)
......@@ -72,19 +74,20 @@ DEF_BINOP(ShiftRight_Baseline, Generate_ShiftRightWithFeedback)
DEF_BINOP(ShiftRightLogical_Baseline, Generate_ShiftRightLogicalWithFeedback)
#undef DEF_BINOP
#define DEF_UNOP(Name, Generator) \
TF_BUILTIN(Name, CodeStubAssembler) { \
auto value = Parameter<Object>(Descriptor::kValue); \
auto context = Parameter<Context>(Descriptor::kContext); \
auto feedback_vector = \
Parameter<FeedbackVector>(Descriptor::kFeedbackVector); \
auto slot = UncheckedParameter<UintPtrT>(Descriptor::kSlot); \
\
UnaryOpAssembler a(state()); \
TNode<Object> result = \
a.Generator(context, value, slot, feedback_vector, true); \
\
Return(result); \
#define DEF_UNOP(Name, Generator) \
TF_BUILTIN(Name, CodeStubAssembler) { \
auto value = Parameter<Object>(Descriptor::kValue); \
auto context = Parameter<Context>(Descriptor::kContext); \
auto feedback_vector = \
Parameter<FeedbackVector>(Descriptor::kFeedbackVector); \
auto slot = UncheckedParameter<UintPtrT>(Descriptor::kSlot); \
\
UnaryOpAssembler a(state()); \
TNode<Object> result = \
a.Generator(context, value, slot, feedback_vector, \
UpdateFeedbackMode::kGuaranteedFeedback); \
\
Return(result); \
}
DEF_UNOP(BitwiseNot_WithFeedback, Generate_BitwiseNotWithFeedback)
DEF_UNOP(Decrement_WithFeedback, Generate_DecrementWithFeedback)
......@@ -92,18 +95,19 @@ DEF_UNOP(Increment_WithFeedback, Generate_IncrementWithFeedback)
DEF_UNOP(Negate_WithFeedback, Generate_NegateWithFeedback)
#undef DEF_UNOP
#define DEF_UNOP(Name, Generator) \
TF_BUILTIN(Name, CodeStubAssembler) { \
auto value = Parameter<Object>(Descriptor::kValue); \
auto context = LoadContextFromBaseline(); \
auto feedback_vector = LoadFeedbackVectorFromBaseline(); \
auto slot = UncheckedParameter<UintPtrT>(Descriptor::kSlot); \
\
UnaryOpAssembler a(state()); \
TNode<Object> result = \
a.Generator(context, value, slot, feedback_vector, true); \
\
Return(result); \
#define DEF_UNOP(Name, Generator) \
TF_BUILTIN(Name, CodeStubAssembler) { \
auto value = Parameter<Object>(Descriptor::kValue); \
auto context = LoadContextFromBaseline(); \
auto feedback_vector = LoadFeedbackVectorFromBaseline(); \
auto slot = UncheckedParameter<UintPtrT>(Descriptor::kSlot); \
\
UnaryOpAssembler a(state()); \
TNode<Object> result = \
a.Generator(context, value, slot, feedback_vector, \
UpdateFeedbackMode::kGuaranteedFeedback); \
\
Return(result); \
}
DEF_UNOP(BitwiseNot_Baseline, Generate_BitwiseNotWithFeedback)
DEF_UNOP(Decrement_Baseline, Generate_DecrementWithFeedback)
......
......@@ -50,18 +50,18 @@ builtin BytecodeBudgetInterruptFromCode(implicit context: Context)(
extern transitioning builtin ForInFilter(implicit context: Context)(
JSAny, HeapObject): JSAny;
extern enum ForInFeedback extends uint31 { kAny, ...}
extern macro UpdateFeedback(SmiTagged<ForInFeedback>, FeedbackVector, uintptr);
extern macro MaybeUpdateFeedback(
extern enum UpdateFeedbackMode { kOptionalFeedback, kGuaranteedFeedback }
extern macro UpdateFeedback(
SmiTagged<ForInFeedback>, Undefined | FeedbackVector, uintptr,
constexpr bool);
constexpr UpdateFeedbackMode);
@export
transitioning macro ForInNextSlow(
context: Context, slot: uintptr, receiver: JSAnyNotSmi, key: JSAny,
cacheType: Object, maybeFeedbackVector: Undefined|FeedbackVector,
guaranteedFeedback: constexpr bool): JSAny {
guaranteedFeedback: constexpr UpdateFeedbackMode): JSAny {
assert(receiver.map != cacheType); // Handled on the fast path.
MaybeUpdateFeedback(
UpdateFeedback(
SmiTag<ForInFeedback>(ForInFeedback::kAny), maybeFeedbackVector, slot,
guaranteedFeedback);
return ForInFilter(key, receiver);
......@@ -82,7 +82,8 @@ transitioning builtin ForInNext(
}
return ForInNextSlow(
context, slot, receiver, key, cacheType, feedbackVector, true);
context, slot, receiver, key, cacheType, feedbackVector,
UpdateFeedbackMode::kGuaranteedFeedback);
}
} // namespace internal
......@@ -9708,13 +9708,25 @@ CodeStubAssembler::LoadFeedbackVectorForStubWithTrampoline() {
return CAST(LoadFeedbackVector(function));
}
void CodeStubAssembler::UpdateFeedback(TNode<Smi> feedback,
TNode<HeapObject> maybe_feedback_vector,
TNode<UintPtrT> slot_id,
UpdateFeedbackMode mode) {
switch (mode) {
case UpdateFeedbackMode::kOptionalFeedback:
MaybeUpdateFeedback(feedback, maybe_feedback_vector, slot_id);
break;
case UpdateFeedbackMode::kGuaranteedFeedback:
CSA_ASSERT(this, IsFeedbackVector(maybe_feedback_vector));
UpdateFeedback(feedback, CAST(maybe_feedback_vector), slot_id);
break;
}
}
void CodeStubAssembler::MaybeUpdateFeedback(TNode<Smi> feedback,
TNode<HeapObject> maybe_vector,
TNode<UintPtrT> slot_id,
bool guaranteed_feedback) {
TNode<UintPtrT> slot_id) {
Label end(this);
// If feedback_vector is not valid, then nothing to do.
// TODO(v8:11429): Use guaranteed_feedback to skip this Goto.
GotoIf(IsUndefined(maybe_vector), &end);
{
UpdateFeedback(feedback, CAST(maybe_vector), slot_id);
......@@ -9722,6 +9734,7 @@ void CodeStubAssembler::MaybeUpdateFeedback(TNode<Smi> feedback,
}
BIND(&end);
}
void CodeStubAssembler::UpdateFeedback(TNode<Smi> feedback,
TNode<FeedbackVector> feedback_vector,
TNode<UintPtrT> slot_id) {
......@@ -12592,7 +12605,7 @@ void CodeStubAssembler::ForInPrepare(TNode<HeapObject> enumerator,
TNode<HeapObject> maybe_feedback_vector,
TNode<FixedArray>* cache_array_out,
TNode<Smi>* cache_length_out,
bool guaranteed_feedback) {
UpdateFeedbackMode update_feedback_mode) {
// Check if we're using an enum cache.
TVARIABLE(FixedArray, cache_array);
TVARIABLE(Smi, cache_length);
......@@ -12621,8 +12634,7 @@ void CodeStubAssembler::ForInPrepare(TNode<HeapObject> enumerator,
IntPtrLessThanOrEqual(enum_length, enum_indices_length),
static_cast<int>(ForInFeedback::kEnumCacheKeysAndIndices),
static_cast<int>(ForInFeedback::kEnumCacheKeys));
MaybeUpdateFeedback(feedback, maybe_feedback_vector, slot,
guaranteed_feedback);
UpdateFeedback(feedback, maybe_feedback_vector, slot, update_feedback_mode);
cache_array = enum_keys;
cache_length = SmiTag(Signed(enum_length));
......@@ -12635,8 +12647,8 @@ void CodeStubAssembler::ForInPrepare(TNode<HeapObject> enumerator,
TNode<FixedArray> array_enumerator = CAST(enumerator);
// Record the fact that we hit the for-in slow-path.
MaybeUpdateFeedback(SmiConstant(ForInFeedback::kAny), maybe_feedback_vector,
slot, guaranteed_feedback);
UpdateFeedback(SmiConstant(ForInFeedback::kAny), maybe_feedback_vector,
slot, update_feedback_mode);
cache_array = array_enumerator;
cache_length = LoadFixedArrayBaseLength(array_enumerator);
......
......@@ -3171,14 +3171,16 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<ClosureFeedbackCellArray> LoadClosureFeedbackArray(
TNode<JSFunction> closure);
// TODO(v8:11429): Change bool to enum.
void MaybeUpdateFeedback(TNode<Smi> feedback,
TNode<HeapObject> maybe_feedback_vector,
TNode<UintPtrT> slot_id, bool guaranteed_feedback);
// Update the type feedback vector.
void UpdateFeedback(TNode<Smi> feedback,
TNode<HeapObject> maybe_feedback_vector,
TNode<UintPtrT> slot_id, UpdateFeedbackMode mode);
void UpdateFeedback(TNode<Smi> feedback,
TNode<FeedbackVector> feedback_vector,
TNode<UintPtrT> slot_id);
void MaybeUpdateFeedback(TNode<Smi> feedback,
TNode<HeapObject> maybe_feedback_vector,
TNode<UintPtrT> slot_id);
// Report that there was a feedback update, performing any tasks that should
// be done after a feedback update.
......@@ -3438,7 +3440,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
void ForInPrepare(TNode<HeapObject> enumerator, TNode<UintPtrT> slot,
TNode<HeapObject> maybe_feedback_vector,
TNode<FixedArray>* cache_array_out,
TNode<Smi>* cache_length_out, bool guaranteed_feedback);
TNode<Smi>* cache_length_out,
UpdateFeedbackMode update_feedback_mode);
TNode<String> Typeof(SloppyTNode<Object> value);
......
This diff is collapsed.
......@@ -23,105 +23,105 @@ class BinaryOpAssembler : public CodeStubAssembler {
TNode<Object> Generate_AddWithFeedback(
const LazyNode<Context>& context, TNode<Object> left, TNode<Object> right,
TNode<UintPtrT> slot, const LazyNode<HeapObject>& maybe_feedback_vector,
bool guaranteed_feedback, bool rhs_known_smi);
UpdateFeedbackMode update_feedback_mode, bool rhs_known_smi);
TNode<Object> Generate_SubtractWithFeedback(
const LazyNode<Context>& context, TNode<Object> left, TNode<Object> right,
TNode<UintPtrT> slot, const LazyNode<HeapObject>& maybe_feedback_vector,
bool guaranteed_feedback, bool rhs_known_smi);
UpdateFeedbackMode update_feedback_mode, bool rhs_known_smi);
TNode<Object> Generate_MultiplyWithFeedback(
const LazyNode<Context>& context, TNode<Object> left, TNode<Object> right,
TNode<UintPtrT> slot, const LazyNode<HeapObject>& maybe_feedback_vector,
bool guaranteed_feedback, bool rhs_known_smi);
UpdateFeedbackMode update_feedback_mode, bool rhs_known_smi);
TNode<Object> Generate_DivideWithFeedback(
const LazyNode<Context>& context, TNode<Object> dividend,
TNode<Object> divisor, TNode<UintPtrT> slot,
const LazyNode<HeapObject>& maybe_feedback_vector,
bool guaranteed_feedback, bool rhs_known_smi);
UpdateFeedbackMode update_feedback_mode, bool rhs_known_smi);
TNode<Object> Generate_ModulusWithFeedback(
const LazyNode<Context>& context, TNode<Object> dividend,
TNode<Object> divisor, TNode<UintPtrT> slot,
const LazyNode<HeapObject>& maybe_feedback_vector,
bool guaranteed_feedback, bool rhs_known_smi);
UpdateFeedbackMode update_feedback_mode, bool rhs_known_smi);
TNode<Object> Generate_ExponentiateWithFeedback(
const LazyNode<Context>& context, TNode<Object> base,
TNode<Object> exponent, TNode<UintPtrT> slot,
const LazyNode<HeapObject>& maybe_feedback_vector,
bool guaranteed_feedback, bool rhs_known_smi);
UpdateFeedbackMode update_feedback_mode, bool rhs_known_smi);
TNode<Object> Generate_BitwiseOrWithFeedback(
const LazyNode<Context>& context, TNode<Object> left, TNode<Object> right,
TNode<UintPtrT> slot, const LazyNode<HeapObject>& maybe_feedback_vector,
bool guaranteed_feedback, bool /* unused */) {
UpdateFeedbackMode update_feedback_mode, bool /* unused */) {
TVARIABLE(Smi, feedback);
TNode<Object> result = Generate_BitwiseBinaryOpWithFeedback(
Operation::kBitwiseOr, left, right, context, &feedback);
MaybeUpdateFeedback(feedback.value(), maybe_feedback_vector(), slot,
guaranteed_feedback);
UpdateFeedback(feedback.value(), maybe_feedback_vector(), slot,
update_feedback_mode);
return result;
}
TNode<Object> Generate_BitwiseXorWithFeedback(
const LazyNode<Context>& context, TNode<Object> left, TNode<Object> right,
TNode<UintPtrT> slot, const LazyNode<HeapObject>& maybe_feedback_vector,
bool guaranteed_feedback, bool /* unused */) {
UpdateFeedbackMode update_feedback_mode, bool /* unused */) {
TVARIABLE(Smi, feedback);
TNode<Object> result = Generate_BitwiseBinaryOpWithFeedback(
Operation::kBitwiseXor, left, right, context, &feedback);
MaybeUpdateFeedback(feedback.value(), maybe_feedback_vector(), slot,
guaranteed_feedback);
UpdateFeedback(feedback.value(), maybe_feedback_vector(), slot,
update_feedback_mode);
return result;
}
TNode<Object> Generate_BitwiseAndWithFeedback(
const LazyNode<Context>& context, TNode<Object> left, TNode<Object> right,
TNode<UintPtrT> slot, const LazyNode<HeapObject>& maybe_feedback_vector,
bool guaranteed_feedback, bool /* unused */) {
UpdateFeedbackMode update_feedback_mode, bool /* unused */) {
TVARIABLE(Smi, feedback);
TNode<Object> result = Generate_BitwiseBinaryOpWithFeedback(
Operation::kBitwiseAnd, left, right, context, &feedback);
MaybeUpdateFeedback(feedback.value(), maybe_feedback_vector(), slot,
guaranteed_feedback);
UpdateFeedback(feedback.value(), maybe_feedback_vector(), slot,
update_feedback_mode);
return result;
}
TNode<Object> Generate_ShiftLeftWithFeedback(
const LazyNode<Context>& context, TNode<Object> left, TNode<Object> right,
TNode<UintPtrT> slot, const LazyNode<HeapObject>& maybe_feedback_vector,
bool guaranteed_feedback, bool /* unused */) {
UpdateFeedbackMode update_feedback_mode, bool /* unused */) {
TVARIABLE(Smi, feedback);
TNode<Object> result = Generate_BitwiseBinaryOpWithFeedback(
Operation::kShiftLeft, left, right, context, &feedback);
MaybeUpdateFeedback(feedback.value(), maybe_feedback_vector(), slot,
guaranteed_feedback);
UpdateFeedback(feedback.value(), maybe_feedback_vector(), slot,
update_feedback_mode);
return result;
}
TNode<Object> Generate_ShiftRightWithFeedback(
const LazyNode<Context>& context, TNode<Object> left, TNode<Object> right,
TNode<UintPtrT> slot, const LazyNode<HeapObject>& maybe_feedback_vector,
bool guaranteed_feedback, bool /* unused */) {
UpdateFeedbackMode update_feedback_mode, bool /* unused */) {
TVARIABLE(Smi, feedback);
TNode<Object> result = Generate_BitwiseBinaryOpWithFeedback(
Operation::kShiftRight, left, right, context, &feedback);
MaybeUpdateFeedback(feedback.value(), maybe_feedback_vector(), slot,
guaranteed_feedback);
UpdateFeedback(feedback.value(), maybe_feedback_vector(), slot,
update_feedback_mode);
return result;
}
TNode<Object> Generate_ShiftRightLogicalWithFeedback(
const LazyNode<Context>& context, TNode<Object> left, TNode<Object> right,
TNode<UintPtrT> slot, const LazyNode<HeapObject>& maybe_feedback_vector,
bool guaranteed_feedback, bool /* unused */) {
UpdateFeedbackMode update_feedback_mode, bool /* unused */) {
TVARIABLE(Smi, feedback);
TNode<Object> result = Generate_BitwiseBinaryOpWithFeedback(
Operation::kShiftRightLogical, left, right, context, &feedback);
MaybeUpdateFeedback(feedback.value(), maybe_feedback_vector(), slot,
guaranteed_feedback);
UpdateFeedback(feedback.value(), maybe_feedback_vector(), slot,
update_feedback_mode);
return result;
}
......@@ -150,7 +150,8 @@ class BinaryOpAssembler : public CodeStubAssembler {
const LazyNode<Context>& context, TNode<Object> left, TNode<Object> right,
TNode<UintPtrT> slot, const LazyNode<HeapObject>& maybe_feedback_vector,
const SmiOperation& smiOperation, const FloatOperation& floatOperation,
Operation op, bool guaranteed_feedback, bool rhs_known_smi);
Operation op, UpdateFeedbackMode update_feedback_mode,
bool rhs_known_smi);
TNode<Object> Generate_BitwiseBinaryOpWithOptionalFeedback(
Operation bitwise_op, TNode<Object> left, TNode<Object> right,
......
......@@ -16,11 +16,10 @@ class UnaryOpAssemblerImpl final : public CodeStubAssembler {
explicit UnaryOpAssemblerImpl(compiler::CodeAssemblerState* state)
: CodeStubAssembler(state) {}
// TODO(v8:11429): Change `bool guaranteed_feedback` to an enum.
TNode<Object> BitwiseNot(TNode<Context> context, TNode<Object> value,
TNode<UintPtrT> slot,
TNode<HeapObject> maybe_feedback_vector,
bool guaranteed_feedback) {
UpdateFeedbackMode update_feedback_mode) {
// TODO(jgruber): Make this implementation more consistent with other unary
// ops (i.e. have them all use UnaryOpWithFeedback or some other common
// mechanism).
......@@ -39,14 +38,14 @@ class UnaryOpAssemblerImpl final : public CodeStubAssembler {
TNode<Smi> result_type = SelectSmiConstant(
TaggedIsSmi(var_result.value()), BinaryOperationFeedback::kSignedSmall,
BinaryOperationFeedback::kNumber);
MaybeUpdateFeedback(SmiOr(result_type, var_feedback.value()),
maybe_feedback_vector, slot, guaranteed_feedback);
UpdateFeedback(SmiOr(result_type, var_feedback.value()),
maybe_feedback_vector, slot, update_feedback_mode);
Goto(&out);
// BigInt case.
BIND(&if_bigint);
MaybeUpdateFeedback(SmiConstant(BinaryOperationFeedback::kBigInt),
maybe_feedback_vector, slot, guaranteed_feedback);
UpdateFeedback(SmiConstant(BinaryOperationFeedback::kBigInt),
maybe_feedback_vector, slot, update_feedback_mode);
var_result =
CallRuntime(Runtime::kBigIntUnaryOp, context, var_bigint.value(),
SmiConstant(Operation::kBitwiseNot));
......@@ -59,23 +58,23 @@ class UnaryOpAssemblerImpl final : public CodeStubAssembler {
TNode<Object> Decrement(TNode<Context> context, TNode<Object> value,
TNode<UintPtrT> slot,
TNode<HeapObject> maybe_feedback_vector,
bool guaranteed_feedback) {
UpdateFeedbackMode update_feedback_mode) {
return IncrementOrDecrement<Operation::kDecrement>(
context, value, slot, maybe_feedback_vector, guaranteed_feedback);
context, value, slot, maybe_feedback_vector, update_feedback_mode);
}
TNode<Object> Increment(TNode<Context> context, TNode<Object> value,
TNode<UintPtrT> slot,
TNode<HeapObject> maybe_feedback_vector,
bool guaranteed_feedback) {
UpdateFeedbackMode update_feedback_mode) {
return IncrementOrDecrement<Operation::kIncrement>(
context, value, slot, maybe_feedback_vector, guaranteed_feedback);
context, value, slot, maybe_feedback_vector, update_feedback_mode);
}
TNode<Object> Negate(TNode<Context> context, TNode<Object> value,
TNode<UintPtrT> slot,
TNode<HeapObject> maybe_feedback_vector,
bool guaranteed_feedback) {
UpdateFeedbackMode update_feedback_mode) {
SmiOperation smi_op = [=](TNode<Smi> smi_value,
TVariable<Smi>* var_feedback, Label* do_float_op,
TVariable<Float64T>* var_float) {
......@@ -114,7 +113,7 @@ class UnaryOpAssemblerImpl final : public CodeStubAssembler {
};
return UnaryOpWithFeedback(context, value, slot, maybe_feedback_vector,
smi_op, float_op, bigint_op,
guaranteed_feedback);
update_feedback_mode);
}
private:
......@@ -132,7 +131,7 @@ class UnaryOpAssemblerImpl final : public CodeStubAssembler {
const SmiOperation& smi_op,
const FloatOperation& float_op,
const BigIntOperation& bigint_op,
bool guaranteed_feedback) {
UpdateFeedbackMode update_feedback_mode) {
TVARIABLE(Object, var_value, value);
TVARIABLE(Object, var_result);
TVARIABLE(Float64T, var_float_value);
......@@ -214,8 +213,8 @@ class UnaryOpAssemblerImpl final : public CodeStubAssembler {
}
BIND(&end);
MaybeUpdateFeedback(var_feedback.value(), maybe_feedback_vector, slot,
guaranteed_feedback);
UpdateFeedback(var_feedback.value(), maybe_feedback_vector, slot,
update_feedback_mode);
return var_result.value();
}
......@@ -223,7 +222,7 @@ class UnaryOpAssemblerImpl final : public CodeStubAssembler {
TNode<Object> IncrementOrDecrement(TNode<Context> context,
TNode<Object> value, TNode<UintPtrT> slot,
TNode<HeapObject> maybe_feedback_vector,
bool guaranteed_feedback) {
UpdateFeedbackMode update_feedback_mode) {
STATIC_ASSERT(kOperation == Operation::kIncrement ||
kOperation == Operation::kDecrement);
static constexpr int kAddValue =
......@@ -255,7 +254,7 @@ class UnaryOpAssemblerImpl final : public CodeStubAssembler {
};
return UnaryOpWithFeedback(context, value, slot, maybe_feedback_vector,
smi_op, float_op, bigint_op,
guaranteed_feedback);
update_feedback_mode);
}
};
......@@ -263,34 +262,38 @@ class UnaryOpAssemblerImpl final : public CodeStubAssembler {
TNode<Object> UnaryOpAssembler::Generate_BitwiseNotWithFeedback(
TNode<Context> context, TNode<Object> value, TNode<UintPtrT> slot,
TNode<HeapObject> maybe_feedback_vector, bool guaranteed_feedback) {
TNode<HeapObject> maybe_feedback_vector,
UpdateFeedbackMode update_feedback_mode) {
UnaryOpAssemblerImpl a(state_);
return a.BitwiseNot(context, value, slot, maybe_feedback_vector,
guaranteed_feedback);
update_feedback_mode);
}
TNode<Object> UnaryOpAssembler::Generate_DecrementWithFeedback(
TNode<Context> context, TNode<Object> value, TNode<UintPtrT> slot,
TNode<HeapObject> maybe_feedback_vector, bool guaranteed_feedback) {
TNode<HeapObject> maybe_feedback_vector,
UpdateFeedbackMode update_feedback_mode) {
UnaryOpAssemblerImpl a(state_);
return a.Decrement(context, value, slot, maybe_feedback_vector,
guaranteed_feedback);
update_feedback_mode);
}
TNode<Object> UnaryOpAssembler::Generate_IncrementWithFeedback(
TNode<Context> context, TNode<Object> value, TNode<UintPtrT> slot,
TNode<HeapObject> maybe_feedback_vector, bool guaranteed_feedback) {
TNode<HeapObject> maybe_feedback_vector,
UpdateFeedbackMode update_feedback_mode) {
UnaryOpAssemblerImpl a(state_);
return a.Increment(context, value, slot, maybe_feedback_vector,
guaranteed_feedback);
update_feedback_mode);
}
TNode<Object> UnaryOpAssembler::Generate_NegateWithFeedback(
TNode<Context> context, TNode<Object> value, TNode<UintPtrT> slot,
TNode<HeapObject> maybe_feedback_vector, bool guaranteed_feedback) {
TNode<HeapObject> maybe_feedback_vector,
UpdateFeedbackMode update_feedback_mode) {
UnaryOpAssemblerImpl a(state_);
return a.Negate(context, value, slot, maybe_feedback_vector,
guaranteed_feedback);
update_feedback_mode);
}
} // namespace internal
......
......@@ -21,19 +21,23 @@ class UnaryOpAssembler final {
TNode<Object> Generate_BitwiseNotWithFeedback(
TNode<Context> context, TNode<Object> value, TNode<UintPtrT> slot,
TNode<HeapObject> maybe_feedback_vector, bool guaranteed_feedback);
TNode<HeapObject> maybe_feedback_vector,
UpdateFeedbackMode update_feedback_mode);
TNode<Object> Generate_DecrementWithFeedback(
TNode<Context> context, TNode<Object> value, TNode<UintPtrT> slot,
TNode<HeapObject> maybe_feedback_vector, bool guaranteed_feedback);
TNode<HeapObject> maybe_feedback_vector,
UpdateFeedbackMode update_feedback_mode);
TNode<Object> Generate_IncrementWithFeedback(
TNode<Context> context, TNode<Object> value, TNode<UintPtrT> slot,
TNode<HeapObject> maybe_feedback_vector, bool guaranteed_feedback);
TNode<HeapObject> maybe_feedback_vector,
UpdateFeedbackMode update_feedback_mode);
TNode<Object> Generate_NegateWithFeedback(
TNode<Context> context, TNode<Object> value, TNode<UintPtrT> slot,
TNode<HeapObject> maybe_feedback_vector, bool guaranteed_feedback);
TNode<HeapObject> maybe_feedback_vector,
UpdateFeedbackMode update_feedback_mode);
private:
compiler::CodeAssemblerState* const state_;
......
......@@ -1524,7 +1524,7 @@ void InterpreterAssembler::ToNumberOrNumeric(Object::Conversion mode) {
TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector();
MaybeUpdateFeedback(var_type_feedback.value(), maybe_feedback_vector,
slot_index, false);
slot_index);
SetAccumulator(var_result.value());
Dispatch();
......
......@@ -846,7 +846,7 @@ class InterpreterBinaryOpAssembler : public InterpreterAssembler {
using BinaryOpGenerator = TNode<Object> (BinaryOpAssembler::*)(
const LazyNode<Context>& context, TNode<Object> left, TNode<Object> right,
TNode<UintPtrT> slot, const LazyNode<HeapObject>& maybe_feedback_vector,
bool guaranteed_feedback, bool rhs_known_smi);
UpdateFeedbackMode update_feedback_mode, bool rhs_known_smi);
void BinaryOpWithFeedback(BinaryOpGenerator generator) {
TNode<Object> lhs = LoadRegisterAtOperandIndex(0);
......@@ -856,9 +856,10 @@ class InterpreterBinaryOpAssembler : public InterpreterAssembler {
TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector();
BinaryOpAssembler binop_asm(state());
TNode<Object> result = (binop_asm.*generator)(
[=] { return context; }, lhs, rhs, slot_index,
[=] { return maybe_feedback_vector; }, false, false);
TNode<Object> result =
(binop_asm.*generator)([=] { return context; }, lhs, rhs, slot_index,
[=] { return maybe_feedback_vector; },
UpdateFeedbackMode::kOptionalFeedback, false);
SetAccumulator(result);
Dispatch();
}
......@@ -871,9 +872,10 @@ class InterpreterBinaryOpAssembler : public InterpreterAssembler {
TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector();
BinaryOpAssembler binop_asm(state());
TNode<Object> result = (binop_asm.*generator)(
[=] { return context; }, lhs, rhs, slot_index,
[=] { return maybe_feedback_vector; }, false, true);
TNode<Object> result =
(binop_asm.*generator)([=] { return context; }, lhs, rhs, slot_index,
[=] { return maybe_feedback_vector; },
UpdateFeedbackMode::kOptionalFeedback, true);
SetAccumulator(result);
Dispatch();
}
......@@ -984,8 +986,7 @@ class InterpreterBitwiseBinaryOpAssembler : public InterpreterAssembler {
TNode<Object> result = binop_asm.Generate_BitwiseBinaryOpWithFeedback(
bitwise_op, left, right, [=] { return context; }, &feedback);
MaybeUpdateFeedback(feedback.value(), maybe_feedback_vector, slot_index,
false);
MaybeUpdateFeedback(feedback.value(), maybe_feedback_vector, slot_index);
SetAccumulator(result);
Dispatch();
}
......@@ -1012,13 +1013,13 @@ class InterpreterBitwiseBinaryOpAssembler : public InterpreterAssembler {
TaggedIsSmi(result), BinaryOperationFeedback::kSignedSmall,
BinaryOperationFeedback::kNumber);
MaybeUpdateFeedback(SmiOr(result_type, var_left_feedback.value()),
maybe_feedback_vector, slot_index, false);
maybe_feedback_vector, slot_index);
SetAccumulator(result);
Dispatch();
BIND(&if_bigint_mix);
MaybeUpdateFeedback(var_left_feedback.value(), maybe_feedback_vector,
slot_index, false);
slot_index);
ThrowTypeError(context, MessageTemplate::kBigIntMixedTypes);
}
};
......@@ -1106,7 +1107,8 @@ IGNITION_HANDLER(BitwiseNot, InterpreterAssembler) {
UnaryOpAssembler unary_op_asm(state());
TNode<Object> result = unary_op_asm.Generate_BitwiseNotWithFeedback(
context, value, slot_index, maybe_feedback_vector, false);
context, value, slot_index, maybe_feedback_vector,
UpdateFeedbackMode::kOptionalFeedback);
SetAccumulator(result);
Dispatch();
......@@ -1150,7 +1152,8 @@ IGNITION_HANDLER(Negate, InterpreterAssembler) {
UnaryOpAssembler unary_op_asm(state());
TNode<Object> result = unary_op_asm.Generate_NegateWithFeedback(
context, value, slot_index, maybe_feedback_vector, false);
context, value, slot_index, maybe_feedback_vector,
UpdateFeedbackMode::kOptionalFeedback);
SetAccumulator(result);
Dispatch();
......@@ -1211,7 +1214,8 @@ IGNITION_HANDLER(Inc, InterpreterAssembler) {
UnaryOpAssembler unary_op_asm(state());
TNode<Object> result = unary_op_asm.Generate_IncrementWithFeedback(
context, value, slot_index, maybe_feedback_vector, false);
context, value, slot_index, maybe_feedback_vector,
UpdateFeedbackMode::kOptionalFeedback);
SetAccumulator(result);
Dispatch();
......@@ -1228,7 +1232,8 @@ IGNITION_HANDLER(Dec, InterpreterAssembler) {
UnaryOpAssembler unary_op_asm(state());
TNode<Object> result = unary_op_asm.Generate_DecrementWithFeedback(
context, value, slot_index, maybe_feedback_vector, false);
context, value, slot_index, maybe_feedback_vector,
UpdateFeedbackMode::kOptionalFeedback);
SetAccumulator(result);
Dispatch();
......@@ -1618,7 +1623,7 @@ class InterpreterCompareOpAssembler : public InterpreterAssembler {
TNode<UintPtrT> slot_index = BytecodeOperandIdx(1);
TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector();
MaybeUpdateFeedback(var_type_feedback.value(), maybe_feedback_vector,
slot_index, false);
slot_index);
SetAccumulator(result);
Dispatch();
}
......@@ -2846,7 +2851,7 @@ IGNITION_HANDLER(ForInPrepare, InterpreterAssembler) {
TNode<FixedArray> cache_array;
TNode<Smi> cache_length;
ForInPrepare(enumerator, vector_index, maybe_feedback_vector, &cache_array,
&cache_length, false);
&cache_length, UpdateFeedbackMode::kOptionalFeedback);
StoreRegisterTripleAtOperandIndex(cache_type, cache_array, cache_length, 0);
Dispatch();
......@@ -2879,9 +2884,9 @@ IGNITION_HANDLER(ForInNext, InterpreterAssembler) {
}
BIND(&if_slow);
{
TNode<Object> result =
ForInNextSlow(GetContext(), vector_index, receiver, key, cache_type,
maybe_feedback_vector, false);
TNode<Object> result = ForInNextSlow(GetContext(), vector_index, receiver,
key, cache_type, maybe_feedback_vector,
UpdateFeedbackMode::kOptionalFeedback);
SetAccumulator(result);
Dispatch();
}
......
......@@ -26,6 +26,8 @@ namespace internal {
class IsCompiledScope;
enum class UpdateFeedbackMode { kOptionalFeedback, kGuaranteedFeedback };
enum class FeedbackSlotKind : uint8_t {
// This kind means that the slot points to the middle of other slot
// which occupies more than one feedback vector element.
......
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