Commit a74b2491 authored by Sigurd Schneider's avatar Sigurd Schneider Committed by Commit Bot

[cleanup] Add DCHECK to uses of OpParameter<int>

Bug: v8:7517, v8:7310
Change-Id: I438bc933d51062bfbb9a419be9c5b67032707fdb
Reviewed-on: https://chromium-review.googlesource.com/946090
Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51726}
parent 06ee127b
......@@ -2566,7 +2566,7 @@ Node* EffectControlLinearizer::LowerNewSmiOrObjectElements(Node* node) {
Node* EffectControlLinearizer::LowerNewArgumentsElements(Node* node) {
Node* frame = NodeProperties::GetValueInput(node, 0);
Node* length = NodeProperties::GetValueInput(node, 1);
int mapped_count = OpParameter<int>(node->op());
int mapped_count = NewArgumentsElementsMappedCountOf(node->op());
Callable const callable =
Builtins::CallableFor(isolate(), Builtins::kNewArgumentsElements);
......
......@@ -228,8 +228,7 @@ void EscapeAnalysisReducer::VerifyReplacement() const {
void EscapeAnalysisReducer::Finalize() {
for (Node* node : arguments_elements_) {
DCHECK_EQ(IrOpcode::kNewArgumentsElements, node->opcode());
int mapped_count = OpParameter<int>(node->op());
int mapped_count = NewArgumentsElementsMappedCountOf(node->op());
Node* arguments_frame = NodeProperties::GetValueInput(node, 0);
if (arguments_frame->opcode() != IrOpcode::kArgumentsFrame) continue;
......
......@@ -947,6 +947,11 @@ const Operator* JSOperatorBuilder::GeneratorStore(int register_count) {
register_count); // parameter
}
int GeneratorStoreRegisterCountOf(const Operator* op) {
DCHECK_EQ(IrOpcode::kJSGeneratorStore, op->opcode());
return OpParameter<int>(op);
}
const Operator* JSOperatorBuilder::GeneratorRestoreRegister(int index) {
return new (zone()) Operator1<int>( // --
IrOpcode::kJSGeneratorRestoreRegister, Operator::kNoThrow, // opcode
......@@ -955,6 +960,11 @@ const Operator* JSOperatorBuilder::GeneratorRestoreRegister(int index) {
index); // parameter
}
int RestoreRegisterIndexOf(const Operator* op) {
DCHECK_EQ(IrOpcode::kJSGeneratorRestoreRegister, op->opcode());
return OpParameter<int>(op);
}
const Operator* JSOperatorBuilder::StoreNamed(LanguageMode language_mode,
Handle<Name> name,
VectorSlotPair const& feedback) {
......
......@@ -636,6 +636,9 @@ BinaryOperationHint BinaryOperationHintOf(const Operator* op);
CompareOperationHint CompareOperationHintOf(const Operator* op);
int GeneratorStoreRegisterCountOf(const Operator* op) WARN_UNUSED_RESULT;
int RestoreRegisterIndexOf(const Operator* op) WARN_UNUSED_RESULT;
// Interface for building JavaScript-level operators, e.g. directly from the
// AST. Most operators have no parameters, thus can be globally shared for all
// graphs.
......
......@@ -2039,7 +2039,7 @@ Reduction JSTypedLowering::ReduceJSGeneratorStore(Node* node) {
Node* context = NodeProperties::GetContextInput(node);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
int register_count = OpParameter<int>(node->op());
int register_count = GeneratorStoreRegisterCountOf(node->op());
FieldAccess array_field = AccessBuilder::ForJSGeneratorObjectRegisterFile();
FieldAccess context_field = AccessBuilder::ForJSGeneratorObjectContext();
......@@ -2110,7 +2110,7 @@ Reduction JSTypedLowering::ReduceJSGeneratorRestoreRegister(Node* node) {
Node* generator = NodeProperties::GetValueInput(node, 0);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
int index = OpParameter<int>(node->op());
int index = RestoreRegisterIndexOf(node->op());
FieldAccess array_field = AccessBuilder::ForJSGeneratorObjectRegisterFile();
FieldAccess element_field = AccessBuilder::ForFixedArraySlot(index);
......
......@@ -1430,6 +1430,11 @@ const Operator* SimplifiedOperatorBuilder::NewArgumentsElements(
mapped_count); // parameter
}
int NewArgumentsElementsMappedCountOf(const Operator* op) {
DCHECK_EQ(IrOpcode::kNewArgumentsElements, op->opcode());
return OpParameter<int>(op);
}
const Operator* SimplifiedOperatorBuilder::Allocate(Type* type,
PretenureFlag pretenure) {
return new (zone()) Operator1<AllocateParameters>(
......
......@@ -407,6 +407,8 @@ AbortReason AbortReasonOf(const Operator* op) WARN_UNUSED_RESULT;
DeoptimizeReason DeoptimizeReasonOf(const Operator* op) WARN_UNUSED_RESULT;
int NewArgumentsElementsMappedCountOf(const Operator* op) WARN_UNUSED_RESULT;
// Interface for building simplified operators, which represent the
// medium-level operations of V8, including adding numbers, allocating objects,
// indexing into objects and arrays, etc.
......
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