Commit 9a2bc761 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[CSA][cleanup] Variable to TVARIABLE in src/interpreter

I was using a regex to find VARIABLE (with upper case) so I missed cases where
the macro was not used, but still was an untyped variable.

Bug: v8:6949, v8:9396
Change-Id: I39e3090410b3ac49a4eaaf6fafa32b33ba0f1543
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1800569
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63730}
parent cbf028e8
...@@ -206,8 +206,9 @@ void InterpreterAssembler::GotoIfHasContextExtensionUpToDepth( ...@@ -206,8 +206,9 @@ void InterpreterAssembler::GotoIfHasContextExtensionUpToDepth(
TVARIABLE(Context, cur_context, context); TVARIABLE(Context, cur_context, context);
TVARIABLE(Uint32T, cur_depth, depth); TVARIABLE(Uint32T, cur_depth, depth);
Variable* context_search_loop_variables[2] = {&cur_depth, &cur_context}; VariableList context_search_loop_variables({&cur_depth, &cur_context},
Label context_search(this, 2, context_search_loop_variables); zone());
Label context_search(this, context_search_loop_variables);
// Loop until the depth is 0. // Loop until the depth is 0.
Goto(&context_search); Goto(&context_search);
...@@ -1626,8 +1627,8 @@ void InterpreterAssembler::ToNumberOrNumeric(Object::Conversion mode) { ...@@ -1626,8 +1627,8 @@ void InterpreterAssembler::ToNumberOrNumeric(Object::Conversion mode) {
TNode<Object> object = GetAccumulator(); TNode<Object> object = GetAccumulator();
TNode<Context> context = GetContext(); TNode<Context> context = GetContext();
Variable var_type_feedback(this, MachineRepresentation::kTaggedSigned); TVARIABLE(Smi, var_type_feedback);
Variable var_result(this, MachineRepresentation::kTagged); TVARIABLE(Numeric, var_result);
Label if_done(this), if_objectissmi(this), if_objectisheapnumber(this), Label if_done(this), if_objectissmi(this), if_objectisheapnumber(this),
if_objectisother(this, Label::kDeferred); if_objectisother(this, Label::kDeferred);
...@@ -1636,15 +1637,15 @@ void InterpreterAssembler::ToNumberOrNumeric(Object::Conversion mode) { ...@@ -1636,15 +1637,15 @@ void InterpreterAssembler::ToNumberOrNumeric(Object::Conversion mode) {
BIND(&if_objectissmi); BIND(&if_objectissmi);
{ {
var_result.Bind(object); var_result = CAST(object);
var_type_feedback.Bind(SmiConstant(BinaryOperationFeedback::kSignedSmall)); var_type_feedback = SmiConstant(BinaryOperationFeedback::kSignedSmall);
Goto(&if_done); Goto(&if_done);
} }
BIND(&if_objectisheapnumber); BIND(&if_objectisheapnumber);
{ {
var_result.Bind(object); var_result = CAST(object);
var_type_feedback.Bind(SmiConstant(BinaryOperationFeedback::kNumber)); var_type_feedback = SmiConstant(BinaryOperationFeedback::kNumber);
Goto(&if_done); Goto(&if_done);
} }
...@@ -1657,16 +1658,16 @@ void InterpreterAssembler::ToNumberOrNumeric(Object::Conversion mode) { ...@@ -1657,16 +1658,16 @@ void InterpreterAssembler::ToNumberOrNumeric(Object::Conversion mode) {
Label not_bigint(this); Label not_bigint(this);
GotoIfNot(IsBigInt(CAST(object)), &not_bigint); GotoIfNot(IsBigInt(CAST(object)), &not_bigint);
{ {
var_result.Bind(object); var_result = CAST(object);
var_type_feedback.Bind(SmiConstant(BinaryOperationFeedback::kBigInt)); var_type_feedback = SmiConstant(BinaryOperationFeedback::kBigInt);
Goto(&if_done); Goto(&if_done);
} }
BIND(&not_bigint); BIND(&not_bigint);
} }
// Convert {object} by calling out to the appropriate builtin. // Convert {object} by calling out to the appropriate builtin.
var_result.Bind(CallBuiltin(builtin, context, object)); var_result = CAST(CallBuiltin(builtin, context, object));
var_type_feedback.Bind(SmiConstant(BinaryOperationFeedback::kAny)); var_type_feedback = SmiConstant(BinaryOperationFeedback::kAny);
Goto(&if_done); Goto(&if_done);
} }
......
...@@ -35,7 +35,6 @@ namespace { ...@@ -35,7 +35,6 @@ namespace {
using compiler::Node; using compiler::Node;
using Label = CodeStubAssembler::Label; using Label = CodeStubAssembler::Label;
using Variable = CodeStubAssembler::Variable;
#define IGNITION_HANDLER(Name, BaseAssembler) \ #define IGNITION_HANDLER(Name, BaseAssembler) \
class Name##Assembler : public BaseAssembler { \ class Name##Assembler : public BaseAssembler { \
...@@ -454,7 +453,7 @@ IGNITION_HANDLER(StaLookupSlot, InterpreterAssembler) { ...@@ -454,7 +453,7 @@ IGNITION_HANDLER(StaLookupSlot, InterpreterAssembler) {
TNode<Name> name = CAST(LoadConstantPoolEntryAtOperandIndex(0)); TNode<Name> name = CAST(LoadConstantPoolEntryAtOperandIndex(0));
TNode<Uint32T> bytecode_flags = BytecodeOperandFlag(1); TNode<Uint32T> bytecode_flags = BytecodeOperandFlag(1);
TNode<Context> context = GetContext(); TNode<Context> context = GetContext();
Variable var_result(this, MachineRepresentation::kTagged); TVARIABLE(Object, var_result);
Label sloppy(this), strict(this), end(this); Label sloppy(this), strict(this), end(this);
DCHECK_EQ(0, LanguageMode::kSloppy); DCHECK_EQ(0, LanguageMode::kSloppy);
...@@ -468,8 +467,8 @@ IGNITION_HANDLER(StaLookupSlot, InterpreterAssembler) { ...@@ -468,8 +467,8 @@ IGNITION_HANDLER(StaLookupSlot, InterpreterAssembler) {
{ {
CSA_ASSERT(this, IsClearWord32<StoreLookupSlotFlags::LookupHoistingModeBit>( CSA_ASSERT(this, IsClearWord32<StoreLookupSlotFlags::LookupHoistingModeBit>(
bytecode_flags)); bytecode_flags));
var_result.Bind( var_result =
CallRuntime(Runtime::kStoreLookupSlot_Strict, context, name, value)); CallRuntime(Runtime::kStoreLookupSlot_Strict, context, name, value);
Goto(&end); Goto(&end);
} }
...@@ -482,15 +481,15 @@ IGNITION_HANDLER(StaLookupSlot, InterpreterAssembler) { ...@@ -482,15 +481,15 @@ IGNITION_HANDLER(StaLookupSlot, InterpreterAssembler) {
BIND(&hoisting); BIND(&hoisting);
{ {
var_result.Bind(CallRuntime(Runtime::kStoreLookupSlot_SloppyHoisting, var_result = CallRuntime(Runtime::kStoreLookupSlot_SloppyHoisting,
context, name, value)); context, name, value);
Goto(&end); Goto(&end);
} }
BIND(&ordinary); BIND(&ordinary);
{ {
var_result.Bind( var_result =
CallRuntime(Runtime::kStoreLookupSlot_Sloppy, context, name, value)); CallRuntime(Runtime::kStoreLookupSlot_Sloppy, context, name, value);
Goto(&end); Goto(&end);
} }
} }
...@@ -521,7 +520,7 @@ IGNITION_HANDLER(LdaNamedProperty, InterpreterAssembler) { ...@@ -521,7 +520,7 @@ IGNITION_HANDLER(LdaNamedProperty, InterpreterAssembler) {
LazyNode<Context> context = [=] { return GetContext(); }; LazyNode<Context> context = [=] { return GetContext(); };
Label done(this); Label done(this);
Variable var_result(this, MachineRepresentation::kTagged); TVARIABLE(Object, var_result);
ExitPoint exit_point(this, &done, &var_result); ExitPoint exit_point(this, &done, &var_result);
AccessorAssembler::LazyLoadICParameters params(context, recv, name, smi_slot, AccessorAssembler::LazyLoadICParameters params(context, recv, name, smi_slot,
...@@ -1191,8 +1190,9 @@ class UnaryNumericOpAssembler : public InterpreterAssembler { ...@@ -1191,8 +1190,9 @@ class UnaryNumericOpAssembler : public InterpreterAssembler {
virtual ~UnaryNumericOpAssembler() = default; virtual ~UnaryNumericOpAssembler() = default;
// Must return a tagged value. // Must return a tagged value.
virtual TNode<Number> SmiOp(TNode<Smi> smi_value, Variable* var_feedback, virtual TNode<Number> SmiOp(TNode<Smi> smi_value,
Label* do_float_op, Variable* var_float) = 0; TVariable<Smi>* var_feedback, Label* do_float_op,
TVariable<Float64T>* var_float) = 0;
// Must return a Float64 value. // Must return a Float64 value.
virtual TNode<Float64T> FloatOp(TNode<Float64T> float_value) = 0; virtual TNode<Float64T> FloatOp(TNode<Float64T> float_value) = 0;
// Must return a tagged value. // Must return a tagged value.
...@@ -1203,8 +1203,8 @@ class UnaryNumericOpAssembler : public InterpreterAssembler { ...@@ -1203,8 +1203,8 @@ class UnaryNumericOpAssembler : public InterpreterAssembler {
TVARIABLE(Object, var_result); TVARIABLE(Object, var_result);
TVARIABLE(Float64T, var_float_value); TVARIABLE(Float64T, var_float_value);
TVARIABLE(Smi, var_feedback, SmiConstant(BinaryOperationFeedback::kNone)); TVARIABLE(Smi, var_feedback, SmiConstant(BinaryOperationFeedback::kNone));
Variable* loop_vars[] = {&var_value, &var_feedback}; VariableList loop_vars({&var_value, &var_feedback}, zone());
Label start(this, arraysize(loop_vars), loop_vars), end(this); Label start(this, loop_vars), end(this);
Label do_float_op(this, &var_float_value); Label do_float_op(this, &var_float_value);
Goto(&start); Goto(&start);
// We might have to try again after ToNumeric conversion. // We might have to try again after ToNumeric conversion.
...@@ -1295,8 +1295,9 @@ class NegateAssemblerImpl : public UnaryNumericOpAssembler { ...@@ -1295,8 +1295,9 @@ class NegateAssemblerImpl : public UnaryNumericOpAssembler {
OperandScale operand_scale) OperandScale operand_scale)
: UnaryNumericOpAssembler(state, bytecode, operand_scale) {} : UnaryNumericOpAssembler(state, bytecode, operand_scale) {}
TNode<Number> SmiOp(TNode<Smi> smi_value, Variable* var_feedback, TNode<Number> SmiOp(TNode<Smi> smi_value, TVariable<Smi>* var_feedback,
Label* do_float_op, Variable* var_float) override { Label* do_float_op,
TVariable<Float64T>* var_float) override {
TVARIABLE(Number, var_result); TVARIABLE(Number, var_result);
Label if_zero(this), if_min_smi(this), end(this); Label if_zero(this), if_min_smi(this), end(this);
// Return -0 if operand is 0. // Return -0 if operand is 0.
...@@ -1316,7 +1317,7 @@ class NegateAssemblerImpl : public UnaryNumericOpAssembler { ...@@ -1316,7 +1317,7 @@ class NegateAssemblerImpl : public UnaryNumericOpAssembler {
Goto(&end); Goto(&end);
BIND(&if_min_smi); BIND(&if_min_smi);
var_float->Bind(SmiToFloat64(smi_value)); *var_float = SmiToFloat64(smi_value);
Goto(do_float_op); Goto(do_float_op);
BIND(&end); BIND(&end);
...@@ -1393,8 +1394,9 @@ class IncDecAssembler : public UnaryNumericOpAssembler { ...@@ -1393,8 +1394,9 @@ class IncDecAssembler : public UnaryNumericOpAssembler {
return op_; return op_;
} }
TNode<Number> SmiOp(TNode<Smi> value, Variable* var_feedback, TNode<Number> SmiOp(TNode<Smi> value, TVariable<Smi>* var_feedback,
Label* do_float_op, Variable* var_float) override { Label* do_float_op,
TVariable<Float64T>* var_float) override {
TNode<Smi> one = SmiConstant(1); TNode<Smi> one = SmiConstant(1);
Label if_overflow(this), if_notoverflow(this); Label if_overflow(this), if_notoverflow(this);
TNode<Smi> result = op() == Operation::kIncrement TNode<Smi> result = op() == Operation::kIncrement
...@@ -1404,7 +1406,7 @@ class IncDecAssembler : public UnaryNumericOpAssembler { ...@@ -1404,7 +1406,7 @@ class IncDecAssembler : public UnaryNumericOpAssembler {
BIND(&if_overflow); BIND(&if_overflow);
{ {
var_float->Bind(SmiToFloat64(value)); *var_float = SmiToFloat64(value);
Goto(do_float_op); Goto(do_float_op);
} }
...@@ -1454,17 +1456,17 @@ IGNITION_HANDLER(Dec, IncDecAssembler) { DecWithFeedback(); } ...@@ -1454,17 +1456,17 @@ IGNITION_HANDLER(Dec, IncDecAssembler) { DecWithFeedback(); }
// accumulator to a boolean value if required. // accumulator to a boolean value if required.
IGNITION_HANDLER(ToBooleanLogicalNot, InterpreterAssembler) { IGNITION_HANDLER(ToBooleanLogicalNot, InterpreterAssembler) {
TNode<Object> value = GetAccumulator(); TNode<Object> value = GetAccumulator();
Variable result(this, MachineRepresentation::kTagged); TVARIABLE(Oddball, result);
Label if_true(this), if_false(this), end(this); Label if_true(this), if_false(this), end(this);
BranchIfToBooleanIsTrue(value, &if_true, &if_false); BranchIfToBooleanIsTrue(value, &if_true, &if_false);
BIND(&if_true); BIND(&if_true);
{ {
result.Bind(FalseConstant()); result = FalseConstant();
Goto(&end); Goto(&end);
} }
BIND(&if_false); BIND(&if_false);
{ {
result.Bind(TrueConstant()); result = TrueConstant();
Goto(&end); Goto(&end);
} }
BIND(&end); BIND(&end);
...@@ -1478,20 +1480,20 @@ IGNITION_HANDLER(ToBooleanLogicalNot, InterpreterAssembler) { ...@@ -1478,20 +1480,20 @@ IGNITION_HANDLER(ToBooleanLogicalNot, InterpreterAssembler) {
// value. // value.
IGNITION_HANDLER(LogicalNot, InterpreterAssembler) { IGNITION_HANDLER(LogicalNot, InterpreterAssembler) {
TNode<Object> value = GetAccumulator(); TNode<Object> value = GetAccumulator();
Variable result(this, MachineRepresentation::kTagged); TVARIABLE(Oddball, result);
Label if_true(this), if_false(this), end(this); Label if_true(this), if_false(this), end(this);
TNode<Oddball> true_value = TrueConstant(); TNode<Oddball> true_value = TrueConstant();
TNode<Oddball> false_value = FalseConstant(); TNode<Oddball> false_value = FalseConstant();
Branch(TaggedEqual(value, true_value), &if_true, &if_false); Branch(TaggedEqual(value, true_value), &if_true, &if_false);
BIND(&if_true); BIND(&if_true);
{ {
result.Bind(false_value); result = false_value;
Goto(&end); Goto(&end);
} }
BIND(&if_false); BIND(&if_false);
{ {
CSA_ASSERT(this, TaggedEqual(value, false_value)); CSA_ASSERT(this, TaggedEqual(value, false_value));
result.Bind(true_value); result = true_value;
Goto(&end); Goto(&end);
} }
BIND(&end); BIND(&end);
...@@ -1808,7 +1810,7 @@ class InterpreterCompareOpAssembler : public InterpreterAssembler { ...@@ -1808,7 +1810,7 @@ class InterpreterCompareOpAssembler : public InterpreterAssembler {
TNode<Object> rhs = GetAccumulator(); TNode<Object> rhs = GetAccumulator();
TNode<Context> context = GetContext(); TNode<Context> context = GetContext();
Variable var_type_feedback(this, MachineRepresentation::kTagged); TVARIABLE(Smi, var_type_feedback);
Node* result; Node* result;
switch (compare_op) { switch (compare_op) {
case Operation::kEqual: case Operation::kEqual:
...@@ -2630,9 +2632,9 @@ IGNITION_HANDLER(CloneObject, InterpreterAssembler) { ...@@ -2630,9 +2632,9 @@ IGNITION_HANDLER(CloneObject, InterpreterAssembler) {
TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector(); TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector();
TNode<Context> context = GetContext(); TNode<Context> context = GetContext();
Variable var_result(this, MachineRepresentation::kTagged); TVARIABLE(Object, var_result);
var_result.Bind(CallBuiltin(Builtins::kCloneObjectIC, context, source, var_result = CallBuiltin(Builtins::kCloneObjectIC, context, source, smi_flags,
smi_flags, smi_slot, maybe_feedback_vector)); smi_slot, maybe_feedback_vector);
SetAccumulator(var_result.value()); SetAccumulator(var_result.value());
Dispatch(); Dispatch();
} }
......
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