[turbofan] Add DebugBreak machine operator and support
Review-Url: https://codereview.chromium.org/1995543003 Cr-Commit-Position: refs/heads/master@{#36355}
This commit is contained in:
parent
452b7f2483
commit
78b1585f1d
@ -22,6 +22,18 @@ CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone,
|
||||
const char* name)
|
||||
: compiler::CodeAssembler(isolate, zone, parameter_count, flags, name) {}
|
||||
|
||||
void CodeStubAssembler::Assert(Node* condition) {
|
||||
#if defined(DEBUG)
|
||||
Label ok(this);
|
||||
Label not_ok(this);
|
||||
Branch(condition, &ok, ¬_ok);
|
||||
Bind(¬_ok);
|
||||
DebugBreak();
|
||||
Goto(&ok);
|
||||
Bind(&ok);
|
||||
#endif
|
||||
}
|
||||
|
||||
Node* CodeStubAssembler::BooleanMapConstant() {
|
||||
return HeapConstant(isolate()->factory()->boolean_map());
|
||||
}
|
||||
|
@ -75,6 +75,8 @@ class CodeStubAssembler : public compiler::CodeAssembler {
|
||||
compiler::Node* InnerAllocate(compiler::Node* previous,
|
||||
compiler::Node* offset);
|
||||
|
||||
void Assert(compiler::Node* condition);
|
||||
|
||||
// Check a value for smi-ness
|
||||
compiler::Node* WordIsSmi(compiler::Node* a);
|
||||
// Check that the value is a positive smi.
|
||||
|
@ -584,6 +584,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
AssembleArchTableSwitch(instr);
|
||||
DCHECK_EQ(LeaveCC, i.OutputSBit());
|
||||
break;
|
||||
case kArchDebugBreak:
|
||||
__ stop("kArchDebugBreak");
|
||||
break;
|
||||
case kArchNop:
|
||||
case kArchThrowTerminator:
|
||||
// don't emit code for nops.
|
||||
|
@ -711,6 +711,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
case kArchLookupSwitch:
|
||||
AssembleArchLookupSwitch(instr);
|
||||
break;
|
||||
case kArchDebugBreak:
|
||||
__ Debug("kArchDebugBreak", 0, BREAK);
|
||||
break;
|
||||
case kArchNop:
|
||||
case kArchThrowTerminator:
|
||||
// don't emit code for nops.
|
||||
|
@ -131,6 +131,8 @@ void CodeAssembler::Return(Node* value) {
|
||||
return raw_assembler_->Return(value);
|
||||
}
|
||||
|
||||
void CodeAssembler::DebugBreak() { raw_assembler_->DebugBreak(); }
|
||||
|
||||
void CodeAssembler::Bind(CodeAssembler::Label* label) { return label->Bind(); }
|
||||
|
||||
Node* CodeAssembler::LoadFramePointer() {
|
||||
|
@ -203,6 +203,8 @@ class CodeAssembler {
|
||||
Node* Parameter(int value);
|
||||
void Return(Node* value);
|
||||
|
||||
void DebugBreak();
|
||||
|
||||
void Bind(Label* label);
|
||||
void Goto(Label* label);
|
||||
void GotoIf(Node* condition, Label* true_label);
|
||||
|
@ -539,6 +539,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
case kArchTableSwitch:
|
||||
AssembleArchTableSwitch(instr);
|
||||
break;
|
||||
case kArchDebugBreak:
|
||||
__ int3();
|
||||
break;
|
||||
case kArchNop:
|
||||
case kArchThrowTerminator:
|
||||
// don't emit code for nops.
|
||||
|
@ -56,6 +56,7 @@ enum class RecordWriteMode { kValueIsMap, kValueIsPointer, kValueIsAny };
|
||||
V(ArchLookupSwitch) \
|
||||
V(ArchTableSwitch) \
|
||||
V(ArchNop) \
|
||||
V(ArchDebugBreak) \
|
||||
V(ArchThrowTerminator) \
|
||||
V(ArchDeoptimize) \
|
||||
V(ArchRet) \
|
||||
|
@ -222,6 +222,7 @@ int InstructionScheduler::GetInstructionFlags(const Instruction* instr) const {
|
||||
case kArchParentFramePointer:
|
||||
case kArchTruncateDoubleToI:
|
||||
case kArchStackSlot:
|
||||
case kArchDebugBreak:
|
||||
return kNoOpcodeFlags;
|
||||
|
||||
case kArchStackPointer:
|
||||
|
@ -900,6 +900,9 @@ void InstructionSelector::VisitNode(Node* node) {
|
||||
case IrOpcode::kStateValues:
|
||||
case IrOpcode::kObjectState:
|
||||
return;
|
||||
case IrOpcode::kDebugBreak:
|
||||
VisitDebugBreak();
|
||||
return;
|
||||
case IrOpcode::kLoad: {
|
||||
LoadRepresentation type = LoadRepresentationOf(node->op());
|
||||
MarkAsRepresentation(type.representation(), node);
|
||||
@ -1785,6 +1788,10 @@ void InstructionSelector::VisitThrow(Node* value) {
|
||||
Emit(kArchThrowTerminator, g.NoOutput());
|
||||
}
|
||||
|
||||
void InstructionSelector::VisitDebugBreak() {
|
||||
OperandGenerator g(this);
|
||||
Emit(kArchDebugBreak, g.NoOutput());
|
||||
}
|
||||
|
||||
FrameStateDescriptor* InstructionSelector::GetFrameStateDescriptor(
|
||||
Node* state) {
|
||||
|
@ -263,6 +263,7 @@ class InstructionSelector final {
|
||||
void VisitDeoptimize(DeoptimizeKind kind, Node* value);
|
||||
void VisitReturn(Node* ret);
|
||||
void VisitThrow(Node* value);
|
||||
void VisitDebugBreak();
|
||||
|
||||
void EmitPrepareArguments(ZoneVector<compiler::PushParameter>* arguments,
|
||||
const CallDescriptor* descriptor, Node* node);
|
||||
|
@ -526,6 +526,13 @@ struct MachineOperatorGlobalCache {
|
||||
AtomicStore##Type##Operator kAtomicStore##Type;
|
||||
ATOMIC_REPRESENTATION_LIST(ATOMIC_STORE)
|
||||
#undef STORE
|
||||
|
||||
struct DebugBreakOperator : public Operator {
|
||||
DebugBreakOperator()
|
||||
: Operator(IrOpcode::kDebugBreak, Operator::kNoThrow, "DebugBreak", 0,
|
||||
0, 0, 0, 0, 0) {}
|
||||
};
|
||||
DebugBreakOperator kDebugBreak;
|
||||
};
|
||||
|
||||
|
||||
@ -604,6 +611,9 @@ const Operator* MachineOperatorBuilder::Store(StoreRepresentation store_rep) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const Operator* MachineOperatorBuilder::DebugBreak() {
|
||||
return &cache_.kDebugBreak;
|
||||
}
|
||||
|
||||
const Operator* MachineOperatorBuilder::CheckedLoad(
|
||||
CheckedLoadRepresentation rep) {
|
||||
|
@ -128,6 +128,8 @@ class MachineOperatorBuilder final : public ZoneObject {
|
||||
MachineRepresentation word = MachineType::PointerRepresentation(),
|
||||
Flags supportedOperators = kNoFlags);
|
||||
|
||||
const Operator* DebugBreak();
|
||||
|
||||
const Operator* Word32And();
|
||||
const Operator* Word32Or();
|
||||
const Operator* Word32Xor();
|
||||
|
@ -652,6 +652,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
case kArchTableSwitch:
|
||||
AssembleArchTableSwitch(instr);
|
||||
break;
|
||||
case kArchDebugBreak:
|
||||
__ stop("kArchDebugBreak");
|
||||
break;
|
||||
case kArchNop:
|
||||
case kArchThrowTerminator:
|
||||
// don't emit code for nops.
|
||||
|
@ -661,6 +661,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
case kArchTableSwitch:
|
||||
AssembleArchTableSwitch(instr);
|
||||
break;
|
||||
case kArchDebugBreak:
|
||||
__ stop("kArchDebugBreak");
|
||||
break;
|
||||
case kArchNop:
|
||||
case kArchThrowTerminator:
|
||||
// don't emit code for nops.
|
||||
|
@ -242,6 +242,7 @@
|
||||
|
||||
#define MACHINE_OP_LIST(V) \
|
||||
MACHINE_COMPARE_BINOP_LIST(V) \
|
||||
V(DebugBreak) \
|
||||
V(Load) \
|
||||
V(Store) \
|
||||
V(StackSlot) \
|
||||
|
@ -135,6 +135,7 @@ void RawMachineAssembler::Return(Node* v1, Node* v2, Node* v3) {
|
||||
current_block_ = nullptr;
|
||||
}
|
||||
|
||||
void RawMachineAssembler::DebugBreak() { AddNode(machine()->DebugBreak()); }
|
||||
|
||||
Node* RawMachineAssembler::CallN(CallDescriptor* desc, Node* function,
|
||||
Node** args) {
|
||||
|
@ -697,6 +697,7 @@ class RawMachineAssembler {
|
||||
void Return(Node* v1, Node* v2, Node* v3);
|
||||
void Bind(RawMachineLabel* label);
|
||||
void Deoptimize(Node* state);
|
||||
void DebugBreak();
|
||||
|
||||
// Variables.
|
||||
Node* Phi(MachineRepresentation rep, Node* n1, Node* n2) {
|
||||
|
@ -2008,6 +2008,8 @@ Type* Typer::Visitor::TypeObjectIsUndetectable(Node* node) {
|
||||
|
||||
// Machine operators.
|
||||
|
||||
Type* Typer::Visitor::TypeDebugBreak(Node* node) { return Type::None(); }
|
||||
|
||||
Type* Typer::Visitor::TypeLoad(Node* node) { return Type::Any(); }
|
||||
|
||||
Type* Typer::Visitor::TypeStackSlot(Node* node) { return Type::Any(); }
|
||||
|
@ -641,6 +641,10 @@ void Verifier::Visitor::Check(Node* node) {
|
||||
CheckNotTyped(node);
|
||||
break;
|
||||
|
||||
case IrOpcode::kDebugBreak:
|
||||
CheckNotTyped(node);
|
||||
break;
|
||||
|
||||
// Simplified operators
|
||||
// -------------------------------
|
||||
case IrOpcode::kBooleanNot:
|
||||
|
@ -763,6 +763,9 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
case kArchTableSwitch:
|
||||
AssembleArchTableSwitch(instr);
|
||||
break;
|
||||
case kArchDebugBreak:
|
||||
__ int3();
|
||||
break;
|
||||
case kArchNop:
|
||||
case kArchThrowTerminator:
|
||||
// don't emit code for nops.
|
||||
|
Loading…
Reference in New Issue
Block a user