[turbofan] Next step towards shared operators.

TEST=compiler-unittests,cctest
R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/555283004

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23837 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
bmeurer@chromium.org 2014-09-10 12:23:45 +00:00
parent 8d35f22795
commit 6bb08db27e
37 changed files with 420 additions and 384 deletions

View File

@ -31,7 +31,7 @@ AstGraphBuilder::AstGraphBuilder(CompilationInfo* info, JSGraph* jsgraph)
Node* AstGraphBuilder::GetFunctionClosure() {
if (!function_closure_.is_set()) {
// Parameter -1 is special for the function closure
Operator* op = common()->Parameter(-1);
const Operator* op = common()->Parameter(-1);
Node* node = NewNode(op, graph()->start());
function_closure_.set(node);
}
@ -42,7 +42,7 @@ Node* AstGraphBuilder::GetFunctionClosure() {
Node* AstGraphBuilder::GetFunctionContext() {
if (!function_context_.is_set()) {
// Parameter (arity + 1) is special for the outer context of the function
Operator* op = common()->Parameter(info()->num_parameters() + 1);
const Operator* op = common()->Parameter(info()->num_parameters() + 1);
Node* node = NewNode(op, graph()->start());
function_context_.set(node);
}
@ -211,7 +211,7 @@ void AstGraphBuilder::Environment::UpdateStateValues(Node** state_values,
}
}
if (should_update) {
Operator* op = common()->StateValues(count);
const Operator* op = common()->StateValues(count);
(*state_values) = graph()->NewNode(op, count, env_values);
}
}
@ -224,7 +224,7 @@ Node* AstGraphBuilder::Environment::Checkpoint(
UpdateStateValues(&stack_node_, parameters_count() + locals_count(),
stack_height());
Operator* op = common()->FrameState(ast_id, combine);
const Operator* op = common()->FrameState(ast_id, combine);
return graph()->NewNode(op, parameters_node_, locals_node_, stack_node_,
GetContext(),
@ -374,7 +374,7 @@ void AstGraphBuilder::VisitVariableDeclaration(VariableDeclaration* decl) {
case Variable::CONTEXT:
if (hole_init) {
Node* value = jsgraph()->TheHoleConstant();
Operator* op = javascript()->StoreContext(0, variable->index());
const Operator* op = javascript()->StoreContext(0, variable->index());
NewNode(op, current_context(), value);
}
break;
@ -406,7 +406,7 @@ void AstGraphBuilder::VisitFunctionDeclaration(FunctionDeclaration* decl) {
case Variable::CONTEXT: {
VisitForValue(decl->fun());
Node* value = environment()->Pop();
Operator* op = javascript()->StoreContext(0, variable->index());
const Operator* op = javascript()->StoreContext(0, variable->index());
NewNode(op, current_context(), value);
break;
}
@ -453,7 +453,7 @@ void AstGraphBuilder::VisitBlock(Block* stmt) {
// Visit statements in the same scope, no declarations.
VisitStatements(stmt->statements());
} else {
Operator* op = javascript()->CreateBlockContext();
const Operator* op = javascript()->CreateBlockContext();
Node* scope_info = jsgraph()->Constant(stmt->scope()->GetScopeInfo());
Node* context = NewNode(op, scope_info, GetFunctionClosure());
ContextScope scope(this, stmt->scope(), context);
@ -519,7 +519,7 @@ void AstGraphBuilder::VisitReturnStatement(ReturnStatement* stmt) {
void AstGraphBuilder::VisitWithStatement(WithStatement* stmt) {
VisitForValue(stmt->expression());
Node* value = environment()->Pop();
Operator* op = javascript()->CreateWithContext();
const Operator* op = javascript()->CreateWithContext();
Node* context = NewNode(op, value, GetFunctionClosure());
ContextScope scope(this, stmt->scope(), context);
Visit(stmt->statement());
@ -551,7 +551,7 @@ void AstGraphBuilder::VisitSwitchStatement(SwitchStatement* stmt) {
// value is still on the operand stack while the label is evaluated.
VisitForValue(clause->label());
Node* label = environment()->Pop();
Operator* op = javascript()->StrictEqual();
const Operator* op = javascript()->StrictEqual();
Node* condition = NewNode(op, tag, label);
compare_switch.BeginLabel(i, condition);
@ -806,7 +806,7 @@ void AstGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) {
Node* info = jsgraph()->Constant(shared_info);
Node* pretenure = expr->pretenure() ? jsgraph()->TrueConstant()
: jsgraph()->FalseConstant();
Operator* op = javascript()->Runtime(Runtime::kNewClosure, 3);
const Operator* op = javascript()->Runtime(Runtime::kNewClosure, 3);
Node* value = NewNode(op, context, info, pretenure);
ast_context()->ProduceValue(value);
}
@ -852,7 +852,8 @@ void AstGraphBuilder::VisitRegExpLiteral(RegExpLiteral* expr) {
Node* literal_index = jsgraph()->Constant(expr->literal_index());
Node* pattern = jsgraph()->Constant(expr->pattern());
Node* flags = jsgraph()->Constant(expr->flags());
Operator* op = javascript()->Runtime(Runtime::kMaterializeRegExpLiteral, 4);
const Operator* op =
javascript()->Runtime(Runtime::kMaterializeRegExpLiteral, 4);
Node* literal = NewNode(op, literals_array, literal_index, pattern, flags);
ast_context()->ProduceValue(literal);
}
@ -868,7 +869,7 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
Node* literal_index = jsgraph()->Constant(expr->literal_index());
Node* constants = jsgraph()->Constant(expr->constant_properties());
Node* flags = jsgraph()->Constant(expr->ComputeFlags());
Operator* op = javascript()->Runtime(Runtime::kCreateObjectLiteral, 4);
const Operator* op = javascript()->Runtime(Runtime::kCreateObjectLiteral, 4);
Node* literal = NewNode(op, literals_array, literal_index, constants, flags);
// The object is expected on the operand stack during computation of the
@ -917,7 +918,7 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
Node* receiver = environment()->Pop();
if (property->emit_store()) {
Node* strict = jsgraph()->Constant(SLOPPY);
Operator* op = javascript()->Runtime(Runtime::kSetProperty, 4);
const Operator* op = javascript()->Runtime(Runtime::kSetProperty, 4);
NewNode(op, receiver, key, value, strict);
}
break;
@ -928,7 +929,7 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
Node* value = environment()->Pop();
Node* receiver = environment()->Pop();
if (property->emit_store()) {
Operator* op = javascript()->Runtime(Runtime::kSetPrototype, 2);
const Operator* op = javascript()->Runtime(Runtime::kSetPrototype, 2);
NewNode(op, receiver, value);
}
break;
@ -953,14 +954,14 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
Node* getter = environment()->Pop();
Node* name = environment()->Pop();
Node* attr = jsgraph()->Constant(NONE);
Operator* op =
const Operator* op =
javascript()->Runtime(Runtime::kDefineAccessorPropertyUnchecked, 5);
NewNode(op, literal, name, getter, setter, attr);
}
// Transform literals that contain functions to fast properties.
if (expr->has_function()) {
Operator* op = javascript()->Runtime(Runtime::kToFastProperties, 1);
const Operator* op = javascript()->Runtime(Runtime::kToFastProperties, 1);
NewNode(op, literal);
}
@ -978,7 +979,7 @@ void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
Node* literal_index = jsgraph()->Constant(expr->literal_index());
Node* constants = jsgraph()->Constant(expr->constant_elements());
Node* flags = jsgraph()->Constant(expr->ComputeFlags());
Operator* op = javascript()->Runtime(Runtime::kCreateArrayLiteral, 4);
const Operator* op = javascript()->Runtime(Runtime::kCreateArrayLiteral, 4);
Node* literal = NewNode(op, literals_array, literal_index, constants, flags);
// The array and the literal index are both expected on the operand stack
@ -1154,7 +1155,7 @@ void AstGraphBuilder::VisitYield(Yield* expr) {
void AstGraphBuilder::VisitThrow(Throw* expr) {
VisitForValue(expr->exception());
Node* exception = environment()->Pop();
Operator* op = javascript()->Runtime(Runtime::kThrow, 1);
const Operator* op = javascript()->Runtime(Runtime::kThrow, 1);
Node* value = NewNode(op, exception);
ast_context()->ProduceValue(value);
}
@ -1200,7 +1201,7 @@ void AstGraphBuilder::VisitCall(Call* expr) {
Variable* variable = callee->AsVariableProxy()->var();
DCHECK(variable->location() == Variable::LOOKUP);
Node* name = jsgraph()->Constant(variable->name());
Operator* op = javascript()->Runtime(Runtime::kLoadLookupSlot, 2);
const Operator* op = javascript()->Runtime(Runtime::kLoadLookupSlot, 2);
Node* pair = NewNode(op, current_context(), name);
callee_value = NewNode(common()->Projection(0), pair);
receiver_value = NewNode(common()->Projection(1), pair);
@ -1260,7 +1261,7 @@ void AstGraphBuilder::VisitCall(Call* expr) {
Node* receiver = environment()->Lookup(info()->scope()->receiver());
Node* strict = jsgraph()->Constant(strict_mode());
Node* position = jsgraph()->Constant(info()->scope()->start_position());
Operator* op =
const Operator* op =
javascript()->Runtime(Runtime::kResolvePossiblyDirectEval, 5);
Node* pair = NewNode(op, callee, source, receiver, strict, position);
Node* new_callee = NewNode(common()->Projection(0), pair);
@ -1272,7 +1273,7 @@ void AstGraphBuilder::VisitCall(Call* expr) {
}
// Create node to perform the function call.
Operator* call = javascript()->Call(args->length() + 2, flags);
const Operator* call = javascript()->Call(args->length() + 2, flags);
Node* value = ProcessArguments(call, args->length() + 2);
PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine());
ast_context()->ProduceValue(value);
@ -1287,7 +1288,7 @@ void AstGraphBuilder::VisitCallNew(CallNew* expr) {
VisitForValues(args);
// Create node to perform the construct call.
Operator* call = javascript()->CallNew(args->length() + 1);
const Operator* call = javascript()->CallNew(args->length() + 1);
Node* value = ProcessArguments(call, args->length() + 1);
PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine());
ast_context()->ProduceValue(value);
@ -1314,7 +1315,7 @@ void AstGraphBuilder::VisitCallJSRuntime(CallRuntime* expr) {
VisitForValues(args);
// Create node to perform the JS runtime call.
Operator* call = javascript()->Call(args->length() + 2, flags);
const Operator* call = javascript()->Call(args->length() + 2, flags);
Node* value = ProcessArguments(call, args->length() + 2);
PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine());
ast_context()->ProduceValue(value);
@ -1337,7 +1338,7 @@ void AstGraphBuilder::VisitCallRuntime(CallRuntime* expr) {
// Create node to perform the runtime call.
Runtime::FunctionId functionId = function->function_id;
Operator* call = javascript()->Runtime(functionId, args->length());
const Operator* call = javascript()->Runtime(functionId, args->length());
Node* value = ProcessArguments(call, args->length());
PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine());
ast_context()->ProduceValue(value);
@ -1471,7 +1472,7 @@ void AstGraphBuilder::VisitBinaryOperation(BinaryOperation* expr) {
void AstGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
Operator* op;
const Operator* op;
switch (expr->op()) {
case Token::EQ:
op = javascript()->Equal();
@ -1543,7 +1544,7 @@ void AstGraphBuilder::VisitDeclarations(ZoneList<Declaration*>* declarations) {
DeclareGlobalsStrictMode::encode(strict_mode());
Node* flags = jsgraph()->Constant(encoded_flags);
Node* pairs = jsgraph()->Constant(data);
Operator* op = javascript()->Runtime(Runtime::kDeclareGlobals, 3);
const Operator* op = javascript()->Runtime(Runtime::kDeclareGlobals, 3);
NewNode(op, current_context(), pairs, flags);
globals()->Rewind(0);
}
@ -1650,7 +1651,7 @@ void AstGraphBuilder::VisitLogicalExpression(BinaryOperation* expr) {
}
Node* AstGraphBuilder::ProcessArguments(Operator* op, int arity) {
Node* AstGraphBuilder::ProcessArguments(const Operator* op, int arity) {
DCHECK(environment()->stack_height() >= arity);
Node** all = info()->zone()->NewArray<Node*>(arity);
for (int i = arity - 1; i >= 0; --i) {
@ -1667,7 +1668,7 @@ Node* AstGraphBuilder::BuildLocalFunctionContext(Node* context, Node* closure) {
set_current_context(context);
// Allocate a new local context.
Operator* op = javascript()->CreateFunctionContext();
const Operator* op = javascript()->CreateFunctionContext();
Node* local_context = NewNode(op, closure);
set_current_context(local_context);
@ -1681,7 +1682,7 @@ Node* AstGraphBuilder::BuildLocalFunctionContext(Node* context, Node* closure) {
Node* parameter = NewNode(common()->Parameter(i + 1), graph()->start());
// Context variable (at bottom of the context chain).
DCHECK_EQ(0, info()->scope()->ContextChainLength(variable->scope()));
Operator* op = javascript()->StoreContext(0, variable->index());
const Operator* op = javascript()->StoreContext(0, variable->index());
NewNode(op, local_context, parameter);
}
@ -1694,7 +1695,7 @@ Node* AstGraphBuilder::BuildArgumentsObject(Variable* arguments) {
// Allocate and initialize a new arguments object.
Node* callee = GetFunctionClosure();
Operator* op = javascript()->Runtime(Runtime::kNewArguments, 1);
const Operator* op = javascript()->Runtime(Runtime::kNewArguments, 1);
Node* object = NewNode(op, callee);
// Assign the object to the arguments variable.
@ -1746,7 +1747,7 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable,
// Global var, const, or let variable.
Node* global = BuildLoadGlobalObject();
Unique<Name> name = MakeUnique(variable->name());
Operator* op = javascript()->LoadNamed(name, contextual_mode);
const Operator* op = javascript()->LoadNamed(name, contextual_mode);
Node* node = NewNode(op, global);
PrepareFrameState(node, bailout_id, kPushOutput);
return node;
@ -1777,7 +1778,7 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable,
// Context variable (potentially up the context chain).
int depth = current_scope()->ContextChainLength(variable->scope());
bool immutable = variable->maybe_assigned() == kNotAssigned;
Operator* op =
const Operator* op =
javascript()->LoadContext(depth, variable->index(), immutable);
Node* value = NewNode(op, current_context());
// TODO(titzer): initialization checks are redundant for already
@ -1800,7 +1801,7 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable,
(contextual_mode == CONTEXTUAL)
? Runtime::kLoadLookupSlot
: Runtime::kLoadLookupSlotNoReferenceError;
Operator* op = javascript()->Runtime(function_id, 2);
const Operator* op = javascript()->Runtime(function_id, 2);
Node* pair = NewNode(op, current_context(), name);
return NewNode(common()->Projection(0), pair);
}
@ -1816,7 +1817,7 @@ Node* AstGraphBuilder::BuildVariableDelete(Variable* variable) {
// Global var, const, or let variable.
Node* global = BuildLoadGlobalObject();
Node* name = jsgraph()->Constant(variable->name());
Operator* op = javascript()->DeleteProperty(strict_mode());
const Operator* op = javascript()->DeleteProperty(strict_mode());
return NewNode(op, global, name);
}
case Variable::PARAMETER:
@ -1828,7 +1829,7 @@ Node* AstGraphBuilder::BuildVariableDelete(Variable* variable) {
case Variable::LOOKUP: {
// Dynamic lookup of context variable (anywhere in the chain).
Node* name = jsgraph()->Constant(variable->name());
Operator* op = javascript()->Runtime(Runtime::kDeleteLookupSlot, 2);
const Operator* op = javascript()->Runtime(Runtime::kDeleteLookupSlot, 2);
return NewNode(op, current_context(), name);
}
}
@ -1847,7 +1848,7 @@ Node* AstGraphBuilder::BuildVariableAssignment(Variable* variable, Node* value,
// Global var, const, or let variable.
Node* global = BuildLoadGlobalObject();
Unique<Name> name = MakeUnique(variable->name());
Operator* op = javascript()->StoreNamed(strict_mode(), name);
const Operator* op = javascript()->StoreNamed(strict_mode(), name);
Node* store = NewNode(op, global, value);
PrepareFrameState(store, bailout_id);
return store;
@ -1886,7 +1887,7 @@ Node* AstGraphBuilder::BuildVariableAssignment(Variable* variable, Node* value,
int depth = current_scope()->ContextChainLength(variable->scope());
if (mode == CONST_LEGACY && op == Token::INIT_CONST_LEGACY) {
// Perform an initialization check for legacy const variables.
Operator* op =
const Operator* op =
javascript()->LoadContext(depth, variable->index(), false);
Node* current = NewNode(op, current_context());
value = BuildHoleCheckSilent(current, value, current);
@ -1895,7 +1896,7 @@ Node* AstGraphBuilder::BuildVariableAssignment(Variable* variable, Node* value,
return value;
} else if (mode == LET && op != Token::INIT_LET) {
// Perform an initialization check for let declared variables.
Operator* op =
const Operator* op =
javascript()->LoadContext(depth, variable->index(), false);
Node* current = NewNode(op, current_context());
value = BuildHoleCheckThrow(current, variable, value);
@ -1903,7 +1904,7 @@ Node* AstGraphBuilder::BuildVariableAssignment(Variable* variable, Node* value,
// All assignments to const variables are early errors.
UNREACHABLE();
}
Operator* op = javascript()->StoreContext(depth, variable->index());
const Operator* op = javascript()->StoreContext(depth, variable->index());
return NewNode(op, current_context(), value);
}
case Variable::LOOKUP: {
@ -1912,7 +1913,7 @@ Node* AstGraphBuilder::BuildVariableAssignment(Variable* variable, Node* value,
Node* strict = jsgraph()->Constant(strict_mode());
// TODO(mstarzinger): Use Runtime::kInitializeLegacyConstLookupSlot for
// initializations of const declarations.
Operator* op = javascript()->Runtime(Runtime::kStoreLookupSlot, 4);
const Operator* op = javascript()->Runtime(Runtime::kStoreLookupSlot, 4);
return NewNode(op, value, current_context(), name, strict);
}
}
@ -1940,7 +1941,7 @@ Node* AstGraphBuilder::BuildLoadBuiltinsObject() {
Node* AstGraphBuilder::BuildLoadGlobalObject() {
Node* context = GetFunctionContext();
Operator* load_op =
const Operator* load_op =
javascript()->LoadContext(0, Context::GLOBAL_OBJECT_INDEX, true);
return NewNode(load_op, context);
}
@ -1955,13 +1956,13 @@ Node* AstGraphBuilder::BuildToBoolean(Node* value) {
Node* AstGraphBuilder::BuildThrowReferenceError(Variable* variable) {
// TODO(mstarzinger): Should be unified with the VisitThrow implementation.
Node* variable_name = jsgraph()->Constant(variable->name());
Operator* op = javascript()->Runtime(Runtime::kThrowReferenceError, 1);
const Operator* op = javascript()->Runtime(Runtime::kThrowReferenceError, 1);
return NewNode(op, variable_name);
}
Node* AstGraphBuilder::BuildBinaryOp(Node* left, Node* right, Token::Value op) {
Operator* js_op;
const Operator* js_op;
switch (op) {
case Token::BIT_OR:
js_op = javascript()->BitwiseOr();

View File

@ -140,7 +140,7 @@ class AstGraphBuilder : public StructuredGraphBuilder, public AstVisitor {
// Process arguments to a call by popping {arity} elements off the operand
// stack and build a call node using the given call operator.
Node* ProcessArguments(Operator* op, int arity);
Node* ProcessArguments(const Operator* op, int arity);
// Visit statements.
void VisitIfNotNull(Statement* stmt);

View File

@ -168,8 +168,9 @@ Reduction ChangeLowering::ChangeTaggedToUI32(Node* val, Node* control,
Node* branch = graph()->NewNode(common()->Branch(), tag, control);
Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
Operator* op = (signedness == kSigned) ? machine()->ChangeFloat64ToInt32()
: machine()->ChangeFloat64ToUint32();
const Operator* op = (signedness == kSigned)
? machine()->ChangeFloat64ToInt32()
: machine()->ChangeFloat64ToUint32();
Node* change = graph()->NewNode(op, LoadHeapNumberValue(val, if_true));
Node* if_false = graph()->NewNode(common()->IfFalse(), branch);

View File

@ -30,7 +30,7 @@ const int kArguments[] = {1, 5, 6, 42, 100, 10000, kMaxInt};
TEST_F(CommonOperatorTest, ControlEffect) {
Operator* op = common()->ControlEffect();
const Operator* op = common()->ControlEffect();
EXPECT_EQ(1, OperatorProperties::GetControlInputCount(op));
EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op));
EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
@ -41,7 +41,7 @@ TEST_F(CommonOperatorTest, ControlEffect) {
TEST_F(CommonOperatorTest, ValueEffect) {
TRACED_FOREACH(int, arguments, kArguments) {
Operator* op = common()->ValueEffect(arguments);
const Operator* op = common()->ValueEffect(arguments);
EXPECT_EQ(arguments, OperatorProperties::GetValueInputCount(op));
EXPECT_EQ(arguments, OperatorProperties::GetTotalInputCount(op));
EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
@ -53,7 +53,7 @@ TEST_F(CommonOperatorTest, ValueEffect) {
TEST_F(CommonOperatorTest, Finish) {
TRACED_FOREACH(int, arguments, kArguments) {
Operator* op = common()->Finish(arguments);
const Operator* op = common()->Finish(arguments);
EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op));
EXPECT_EQ(arguments, OperatorProperties::GetEffectInputCount(op));
EXPECT_EQ(arguments + 1, OperatorProperties::GetTotalInputCount(op));

View File

@ -81,104 +81,105 @@ class CommonOperatorBuilder {
return new (zone_) ControlOperator(IrOpcode::k##name, Operator::kFoldable, \
inputs, 0, controls, #name);
Operator* Start(int num_formal_parameters) {
const Operator* Start(int num_formal_parameters) {
// Outputs are formal parameters, plus context, receiver, and JSFunction.
int outputs = num_formal_parameters + 3;
return new (zone_) ControlOperator(IrOpcode::kStart, Operator::kFoldable, 0,
outputs, 0, "Start");
}
Operator* Dead() { CONTROL_OP(Dead, 0, 0); }
Operator* End() { CONTROL_OP(End, 0, 1); }
Operator* Branch() { CONTROL_OP(Branch, 1, 1); }
Operator* IfTrue() { CONTROL_OP(IfTrue, 0, 1); }
Operator* IfFalse() { CONTROL_OP(IfFalse, 0, 1); }
Operator* Throw() { CONTROL_OP(Throw, 1, 1); }
const Operator* Dead() { CONTROL_OP(Dead, 0, 0); }
const Operator* End() { CONTROL_OP(End, 0, 1); }
const Operator* Branch() { CONTROL_OP(Branch, 1, 1); }
const Operator* IfTrue() { CONTROL_OP(IfTrue, 0, 1); }
const Operator* IfFalse() { CONTROL_OP(IfFalse, 0, 1); }
const Operator* Throw() { CONTROL_OP(Throw, 1, 1); }
Operator* Return() {
const Operator* Return() {
return new (zone_) ControlOperator(
IrOpcode::kReturn, Operator::kNoProperties, 1, 0, 1, "Return");
}
Operator* Merge(int controls) {
const Operator* Merge(int controls) {
return new (zone_) ControlOperator(IrOpcode::kMerge, Operator::kFoldable, 0,
0, controls, "Merge");
}
Operator* Loop(int controls) {
const Operator* Loop(int controls) {
return new (zone_) ControlOperator(IrOpcode::kLoop, Operator::kFoldable, 0,
0, controls, "Loop");
}
Operator* Parameter(int index) {
const Operator* Parameter(int index) {
return new (zone_) Operator1<int>(IrOpcode::kParameter, Operator::kPure, 1,
1, "Parameter", index);
}
Operator* Int32Constant(int32_t value) {
const Operator* Int32Constant(int32_t value) {
return new (zone_)
Operator1<int32_t>(IrOpcode::kInt32Constant, Operator::kPure, 0, 1,
"Int32Constant", value);
}
Operator* Int64Constant(int64_t value) {
const Operator* Int64Constant(int64_t value) {
return new (zone_)
Operator1<int64_t>(IrOpcode::kInt64Constant, Operator::kPure, 0, 1,
"Int64Constant", value);
}
Operator* Float64Constant(double value) {
const Operator* Float64Constant(double value) {
return new (zone_)
Operator1<double>(IrOpcode::kFloat64Constant, Operator::kPure, 0, 1,
"Float64Constant", value);
}
Operator* ExternalConstant(ExternalReference value) {
const Operator* ExternalConstant(ExternalReference value) {
return new (zone_) Operator1<ExternalReference>(IrOpcode::kExternalConstant,
Operator::kPure, 0, 1,
"ExternalConstant", value);
}
Operator* NumberConstant(double value) {
const Operator* NumberConstant(double value) {
return new (zone_)
Operator1<double>(IrOpcode::kNumberConstant, Operator::kPure, 0, 1,
"NumberConstant", value);
}
Operator* HeapConstant(Unique<Object> value) {
const Operator* HeapConstant(Unique<Object> value) {
return new (zone_) Operator1<Unique<Object> >(
IrOpcode::kHeapConstant, Operator::kPure, 0, 1, "HeapConstant", value);
}
Operator* Phi(MachineType type, int arguments) {
const Operator* Phi(MachineType type, int arguments) {
DCHECK(arguments > 0); // Disallow empty phis.
return new (zone_) Operator1<MachineType>(IrOpcode::kPhi, Operator::kPure,
arguments, 1, "Phi", type);
}
Operator* EffectPhi(int arguments) {
const Operator* EffectPhi(int arguments) {
DCHECK(arguments > 0); // Disallow empty phis.
return new (zone_) Operator1<int>(IrOpcode::kEffectPhi, Operator::kPure, 0,
0, "EffectPhi", arguments);
}
Operator* ControlEffect() {
const Operator* ControlEffect() {
return new (zone_) SimpleOperator(IrOpcode::kControlEffect, Operator::kPure,
0, 0, "ControlEffect");
}
Operator* ValueEffect(int arguments) {
const Operator* ValueEffect(int arguments) {
DCHECK(arguments > 0); // Disallow empty value effects.
return new (zone_) SimpleOperator(IrOpcode::kValueEffect, Operator::kPure,
arguments, 0, "ValueEffect");
}
Operator* Finish(int arguments) {
const Operator* Finish(int arguments) {
DCHECK(arguments > 0); // Disallow empty finishes.
return new (zone_) Operator1<int>(IrOpcode::kFinish, Operator::kPure, 1, 1,
"Finish", arguments);
}
Operator* StateValues(int arguments) {
const Operator* StateValues(int arguments) {
return new (zone_) Operator1<int>(IrOpcode::kStateValues, Operator::kPure,
arguments, 1, "StateValues", arguments);
}
Operator* FrameState(BailoutId bailout_id, OutputFrameStateCombine combine) {
const Operator* FrameState(BailoutId bailout_id,
OutputFrameStateCombine combine) {
return new (zone_) Operator1<FrameStateCallInfo>(
IrOpcode::kFrameState, Operator::kPure, 4, 1, "FrameState",
FrameStateCallInfo(bailout_id, combine));
}
Operator* Call(CallDescriptor* descriptor) {
const Operator* Call(CallDescriptor* descriptor) {
return new (zone_) CallOperator(descriptor, "Call");
}
Operator* Projection(size_t index) {
const Operator* Projection(size_t index) {
return new (zone_) Operator1<size_t>(IrOpcode::kProjection, Operator::kPure,
1, 1, "Projection", index);
}

View File

@ -28,7 +28,8 @@ StructuredGraphBuilder::StructuredGraphBuilder(Graph* graph,
exit_control_(NULL) {}
Node* StructuredGraphBuilder::MakeNode(Operator* op, int value_input_count,
Node* StructuredGraphBuilder::MakeNode(const Operator* op,
int value_input_count,
Node** value_inputs) {
DCHECK(op->InputCount() == value_input_count);
@ -161,7 +162,7 @@ void StructuredGraphBuilder::Environment::PrepareForLoop() {
Node* StructuredGraphBuilder::NewPhi(int count, Node* input, Node* control) {
Operator* phi_op = common()->Phi(kMachAnyTagged, count);
const Operator* phi_op = common()->Phi(kMachAnyTagged, count);
Node** buffer = zone()->NewArray<Node*>(count + 1);
MemsetPointer(buffer, input, count);
buffer[count] = control;
@ -172,7 +173,7 @@ Node* StructuredGraphBuilder::NewPhi(int count, Node* input, Node* control) {
// TODO(mstarzinger): Revisit this once we have proper effect states.
Node* StructuredGraphBuilder::NewEffectPhi(int count, Node* input,
Node* control) {
Operator* phi_op = common()->EffectPhi(count);
const Operator* phi_op = common()->EffectPhi(count);
Node** buffer = zone()->NewArray<Node*>(count + 1);
MemsetPointer(buffer, input, count);
buffer[count] = control;
@ -184,17 +185,17 @@ Node* StructuredGraphBuilder::MergeControl(Node* control, Node* other) {
int inputs = OperatorProperties::GetControlInputCount(control->op()) + 1;
if (control->opcode() == IrOpcode::kLoop) {
// Control node for loop exists, add input.
Operator* op = common()->Loop(inputs);
const Operator* op = common()->Loop(inputs);
control->AppendInput(zone(), other);
control->set_op(op);
} else if (control->opcode() == IrOpcode::kMerge) {
// Control node for merge exists, add input.
Operator* op = common()->Merge(inputs);
const Operator* op = common()->Merge(inputs);
control->AppendInput(zone(), other);
control->set_op(op);
} else {
// Control node is a singleton, introduce a merge.
Operator* op = common()->Merge(inputs);
const Operator* op = common()->Merge(inputs);
control = graph()->NewNode(op, control, other);
}
return control;

View File

@ -24,40 +24,41 @@ class GraphBuilder {
explicit GraphBuilder(Graph* graph) : graph_(graph) {}
virtual ~GraphBuilder() {}
Node* NewNode(Operator* op) {
Node* NewNode(const Operator* op) {
return MakeNode(op, 0, static_cast<Node**>(NULL));
}
Node* NewNode(Operator* op, Node* n1) { return MakeNode(op, 1, &n1); }
Node* NewNode(const Operator* op, Node* n1) { return MakeNode(op, 1, &n1); }
Node* NewNode(Operator* op, Node* n1, Node* n2) {
Node* NewNode(const Operator* op, Node* n1, Node* n2) {
Node* buffer[] = {n1, n2};
return MakeNode(op, arraysize(buffer), buffer);
}
Node* NewNode(Operator* op, Node* n1, Node* n2, Node* n3) {
Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3) {
Node* buffer[] = {n1, n2, n3};
return MakeNode(op, arraysize(buffer), buffer);
}
Node* NewNode(Operator* op, Node* n1, Node* n2, Node* n3, Node* n4) {
Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4) {
Node* buffer[] = {n1, n2, n3, n4};
return MakeNode(op, arraysize(buffer), buffer);
}
Node* NewNode(Operator* op, Node* n1, Node* n2, Node* n3, Node* n4,
Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4,
Node* n5) {
Node* buffer[] = {n1, n2, n3, n4, n5};
return MakeNode(op, arraysize(buffer), buffer);
}
Node* NewNode(Operator* op, Node* n1, Node* n2, Node* n3, Node* n4, Node* n5,
Node* n6) {
Node* NewNode(const Operator* op, Node* n1, Node* n2, Node* n3, Node* n4,
Node* n5, Node* n6) {
Node* nodes[] = {n1, n2, n3, n4, n5, n6};
return MakeNode(op, arraysize(nodes), nodes);
}
Node* NewNode(Operator* op, int value_input_count, Node** value_inputs) {
Node* NewNode(const Operator* op, int value_input_count,
Node** value_inputs) {
return MakeNode(op, value_input_count, value_inputs);
}
@ -65,7 +66,7 @@ class GraphBuilder {
protected:
// Base implementation used by all factory methods.
virtual Node* MakeNode(Operator* op, int value_input_count,
virtual Node* MakeNode(const Operator* op, int value_input_count,
Node** value_inputs) = 0;
private:
@ -107,8 +108,8 @@ class StructuredGraphBuilder : public GraphBuilder {
// The following method creates a new node having the specified operator and
// ensures effect and control dependencies are wired up. The dependencies
// tracked by the environment might be mutated.
virtual Node* MakeNode(Operator* op, int value_input_count,
Node** value_inputs);
virtual Node* MakeNode(const Operator* op, int value_input_count,
Node** value_inputs) FINAL;
Environment* environment() const { return environment_; }
void set_environment(Environment* env) { environment_ = env; }

View File

@ -81,8 +81,8 @@ Reduction JSContextSpecializer::ReduceJSLoadContext(Node* node) {
if (access.depth() == 0) {
return Reducer::NoChange();
}
Operator* op = jsgraph_->javascript()->LoadContext(0, access.index(),
access.immutable());
const Operator* op = jsgraph_->javascript()->LoadContext(
0, access.index(), access.immutable());
node->set_op(op);
Handle<Object> context_handle = Handle<Object>(context, info_->isolate());
node->ReplaceInput(0, jsgraph_->Constant(context_handle));
@ -128,13 +128,14 @@ Reduction JSContextSpecializer::ReduceJSStoreContext(Node* node) {
context = context->previous();
}
Operator* op = jsgraph_->javascript()->StoreContext(0, access.index());
const Operator* op = jsgraph_->javascript()->StoreContext(0, access.index());
node->set_op(op);
Handle<Object> new_context_handle = Handle<Object>(context, info_->isolate());
node->ReplaceInput(0, jsgraph_->Constant(new_context_handle));
return Reducer::Changed(node);
}
}
}
} // namespace v8::internal::compiler
} // namespace compiler
} // namespace internal
} // namespace v8

View File

@ -120,7 +120,7 @@ JSGenericLowering::JSGenericLowering(CompilationInfo* info, JSGraph* jsgraph,
machine_(machine) {}
void JSGenericLowering::PatchOperator(Node* node, Operator* op) {
void JSGenericLowering::PatchOperator(Node* node, const Operator* op) {
node->set_op(op);
}

View File

@ -50,7 +50,7 @@ class JSGenericLowering : public Reducer {
Node* ExternalConstant(ExternalReference ref);
// Helpers to patch existing nodes in the graph.
void PatchOperator(Node* node, Operator* new_op);
void PatchOperator(Node* node, const Operator* new_op);
void PatchInsertInput(Node* node, int index, Node* input);
// Helpers to replace existing nodes with a generic call.

View File

@ -16,7 +16,7 @@ Node* JSGraph::ImmovableHeapConstant(Handle<Object> object) {
}
Node* JSGraph::NewNode(Operator* op) {
Node* JSGraph::NewNode(const Operator* op) {
Node* node = graph()->NewNode(op);
typer_->Init(node);
return node;

View File

@ -99,7 +99,7 @@ class JSGraph : public ZoneObject {
Node* ImmovableHeapConstant(Handle<Object> value);
Node* NumberConstant(double value);
Node* NewNode(Operator* op);
Node* NewNode(const Operator* op);
Factory* factory() { return isolate()->factory(); }
};

View File

@ -121,8 +121,9 @@ void Inlinee::UnifyReturn() {
int predecessors =
OperatorProperties::GetControlInputCount(final_merge->op());
Operator* op_phi = jsgraph_->common()->Phi(kMachAnyTagged, predecessors);
Operator* op_ephi = jsgraph_->common()->EffectPhi(predecessors);
const Operator* op_phi =
jsgraph_->common()->Phi(kMachAnyTagged, predecessors);
const Operator* op_ephi = jsgraph_->common()->EffectPhi(predecessors);
NodeVector values(jsgraph_->zone());
NodeVector effects(jsgraph_->zone());

View File

@ -81,100 +81,106 @@ class JSOperatorBuilder {
#define PURE_BINOP(name) SIMPLE(name, Operator::kPure, 2, 1)
Operator* Equal() { BINOP(JSEqual); }
Operator* NotEqual() { BINOP(JSNotEqual); }
Operator* StrictEqual() { PURE_BINOP(JSStrictEqual); }
Operator* StrictNotEqual() { PURE_BINOP(JSStrictNotEqual); }
Operator* LessThan() { BINOP(JSLessThan); }
Operator* GreaterThan() { BINOP(JSGreaterThan); }
Operator* LessThanOrEqual() { BINOP(JSLessThanOrEqual); }
Operator* GreaterThanOrEqual() { BINOP(JSGreaterThanOrEqual); }
Operator* BitwiseOr() { BINOP(JSBitwiseOr); }
Operator* BitwiseXor() { BINOP(JSBitwiseXor); }
Operator* BitwiseAnd() { BINOP(JSBitwiseAnd); }
Operator* ShiftLeft() { BINOP(JSShiftLeft); }
Operator* ShiftRight() { BINOP(JSShiftRight); }
Operator* ShiftRightLogical() { BINOP(JSShiftRightLogical); }
Operator* Add() { BINOP(JSAdd); }
Operator* Subtract() { BINOP(JSSubtract); }
Operator* Multiply() { BINOP(JSMultiply); }
Operator* Divide() { BINOP(JSDivide); }
Operator* Modulus() { BINOP(JSModulus); }
const Operator* Equal() { BINOP(JSEqual); }
const Operator* NotEqual() { BINOP(JSNotEqual); }
const Operator* StrictEqual() { PURE_BINOP(JSStrictEqual); }
const Operator* StrictNotEqual() { PURE_BINOP(JSStrictNotEqual); }
const Operator* LessThan() { BINOP(JSLessThan); }
const Operator* GreaterThan() { BINOP(JSGreaterThan); }
const Operator* LessThanOrEqual() { BINOP(JSLessThanOrEqual); }
const Operator* GreaterThanOrEqual() { BINOP(JSGreaterThanOrEqual); }
const Operator* BitwiseOr() { BINOP(JSBitwiseOr); }
const Operator* BitwiseXor() { BINOP(JSBitwiseXor); }
const Operator* BitwiseAnd() { BINOP(JSBitwiseAnd); }
const Operator* ShiftLeft() { BINOP(JSShiftLeft); }
const Operator* ShiftRight() { BINOP(JSShiftRight); }
const Operator* ShiftRightLogical() { BINOP(JSShiftRightLogical); }
const Operator* Add() { BINOP(JSAdd); }
const Operator* Subtract() { BINOP(JSSubtract); }
const Operator* Multiply() { BINOP(JSMultiply); }
const Operator* Divide() { BINOP(JSDivide); }
const Operator* Modulus() { BINOP(JSModulus); }
Operator* UnaryNot() { UNOP(JSUnaryNot); }
Operator* ToBoolean() { UNOP(JSToBoolean); }
Operator* ToNumber() { UNOP(JSToNumber); }
Operator* ToString() { UNOP(JSToString); }
Operator* ToName() { UNOP(JSToName); }
Operator* ToObject() { UNOP(JSToObject); }
Operator* Yield() { UNOP(JSYield); }
const Operator* UnaryNot() { UNOP(JSUnaryNot); }
const Operator* ToBoolean() { UNOP(JSToBoolean); }
const Operator* ToNumber() { UNOP(JSToNumber); }
const Operator* ToString() { UNOP(JSToString); }
const Operator* ToName() { UNOP(JSToName); }
const Operator* ToObject() { UNOP(JSToObject); }
const Operator* Yield() { UNOP(JSYield); }
Operator* Create() { SIMPLE(JSCreate, Operator::kEliminatable, 0, 1); }
const Operator* Create() { SIMPLE(JSCreate, Operator::kEliminatable, 0, 1); }
Operator* Call(int arguments, CallFunctionFlags flags) {
const Operator* Call(int arguments, CallFunctionFlags flags) {
CallParameters parameters = {arguments, flags};
OP1(JSCallFunction, CallParameters, parameters, Operator::kNoProperties,
arguments, 1);
}
Operator* CallNew(int arguments) {
const Operator* CallNew(int arguments) {
return new (zone_)
Operator1<int>(IrOpcode::kJSCallConstruct, Operator::kNoProperties,
arguments, 1, "JSCallConstruct", arguments);
}
Operator* LoadProperty() { BINOP(JSLoadProperty); }
Operator* LoadNamed(Unique<Name> name,
ContextualMode contextual_mode = NOT_CONTEXTUAL) {
const Operator* LoadProperty() { BINOP(JSLoadProperty); }
const Operator* LoadNamed(Unique<Name> name,
ContextualMode contextual_mode = NOT_CONTEXTUAL) {
LoadNamedParameters parameters = {name, contextual_mode};
OP1(JSLoadNamed, LoadNamedParameters, parameters, Operator::kNoProperties,
1, 1);
}
Operator* StoreProperty(StrictMode strict_mode) {
const Operator* StoreProperty(StrictMode strict_mode) {
OP1(JSStoreProperty, StrictMode, strict_mode, Operator::kNoProperties, 3,
0);
}
Operator* StoreNamed(StrictMode strict_mode, Unique<Name> name) {
const Operator* StoreNamed(StrictMode strict_mode, Unique<Name> name) {
StoreNamedParameters parameters = {strict_mode, name};
OP1(JSStoreNamed, StoreNamedParameters, parameters, Operator::kNoProperties,
2, 0);
}
Operator* DeleteProperty(StrictMode strict_mode) {
const Operator* DeleteProperty(StrictMode strict_mode) {
OP1(JSDeleteProperty, StrictMode, strict_mode, Operator::kNoProperties, 2,
1);
}
Operator* HasProperty() { NOPROPS(JSHasProperty, 2, 1); }
const Operator* HasProperty() { NOPROPS(JSHasProperty, 2, 1); }
Operator* LoadContext(uint16_t depth, uint32_t index, bool immutable) {
const Operator* LoadContext(uint16_t depth, uint32_t index, bool immutable) {
ContextAccess access(depth, index, immutable);
OP1(JSLoadContext, ContextAccess, access,
Operator::kEliminatable | Operator::kNoWrite, 1, 1);
}
Operator* StoreContext(uint16_t depth, uint32_t index) {
const Operator* StoreContext(uint16_t depth, uint32_t index) {
ContextAccess access(depth, index, false);
OP1(JSStoreContext, ContextAccess, access, Operator::kNoProperties, 2, 0);
}
Operator* TypeOf() { SIMPLE(JSTypeOf, Operator::kPure, 1, 1); }
Operator* InstanceOf() { NOPROPS(JSInstanceOf, 2, 1); }
Operator* Debugger() { NOPROPS(JSDebugger, 0, 0); }
const Operator* TypeOf() { SIMPLE(JSTypeOf, Operator::kPure, 1, 1); }
const Operator* InstanceOf() { NOPROPS(JSInstanceOf, 2, 1); }
const Operator* Debugger() { NOPROPS(JSDebugger, 0, 0); }
// TODO(titzer): nail down the static parts of each of these context flavors.
Operator* CreateFunctionContext() { NOPROPS(JSCreateFunctionContext, 1, 1); }
Operator* CreateCatchContext(Unique<String> name) {
const Operator* CreateFunctionContext() {
NOPROPS(JSCreateFunctionContext, 1, 1);
}
const Operator* CreateCatchContext(Unique<String> name) {
OP1(JSCreateCatchContext, Unique<String>, name, Operator::kNoProperties, 1,
1);
}
Operator* CreateWithContext() { NOPROPS(JSCreateWithContext, 2, 1); }
Operator* CreateBlockContext() { NOPROPS(JSCreateBlockContext, 2, 1); }
Operator* CreateModuleContext() { NOPROPS(JSCreateModuleContext, 2, 1); }
Operator* CreateGlobalContext() { NOPROPS(JSCreateGlobalContext, 2, 1); }
const Operator* CreateWithContext() { NOPROPS(JSCreateWithContext, 2, 1); }
const Operator* CreateBlockContext() { NOPROPS(JSCreateBlockContext, 2, 1); }
const Operator* CreateModuleContext() {
NOPROPS(JSCreateModuleContext, 2, 1);
}
const Operator* CreateGlobalContext() {
NOPROPS(JSCreateGlobalContext, 2, 1);
}
Operator* Runtime(Runtime::FunctionId function, int arguments) {
const Operator* Runtime(Runtime::FunctionId function, int arguments) {
const Runtime::Function* f = Runtime::FunctionForId(function);
DCHECK(f->nargs == -1 || f->nargs == arguments);
OP1(JSCallRuntime, Runtime::FunctionId, function, Operator::kNoProperties,
@ -219,8 +225,9 @@ struct StaticParameterTraits<Runtime::FunctionId> {
return a == b;
}
};
}
}
} // namespace v8::internal::compiler
} // namespace compiler
} // namespace internal
} // namespace v8
#endif // V8_COMPILER_JS_OPERATOR_H_

View File

@ -79,7 +79,7 @@ class JSBinopReduction {
// Remove all effect and control inputs and outputs to this node and change
// to the pure operator {op}, possibly inserting a boolean inversion.
Reduction ChangeToPureOperator(Operator* op, bool invert = false) {
Reduction ChangeToPureOperator(const Operator* op, bool invert = false) {
DCHECK_EQ(0, OperatorProperties::GetEffectInputCount(op));
DCHECK_EQ(false, OperatorProperties::HasContextInput(op));
DCHECK_EQ(0, OperatorProperties::GetControlInputCount(op));
@ -205,8 +205,8 @@ class JSBinopReduction {
if (input_type->Is(type)) return node; // already in the value range.
Operator* op = is_signed ? simplified()->NumberToInt32()
: simplified()->NumberToUint32();
const Operator* op = is_signed ? simplified()->NumberToInt32()
: simplified()->NumberToUint32();
Node* n = graph()->NewNode(op, node);
return n;
}
@ -231,7 +231,8 @@ Reduction JSTypedLowering::ReduceJSAdd(Node* node) {
}
Reduction JSTypedLowering::ReduceNumberBinop(Node* node, Operator* numberOp) {
Reduction JSTypedLowering::ReduceNumberBinop(Node* node,
const Operator* numberOp) {
JSBinopReduction r(this, node);
if (r.OneInputIs(Type::Primitive())) {
// If at least one input is a primitive, then insert appropriate conversions
@ -246,7 +247,8 @@ Reduction JSTypedLowering::ReduceNumberBinop(Node* node, Operator* numberOp) {
Reduction JSTypedLowering::ReduceI32Binop(Node* node, bool left_signed,
bool right_signed, Operator* intOp) {
bool right_signed,
const Operator* intOp) {
JSBinopReduction r(this, node);
// TODO(titzer): some Smi bitwise operations don't really require going
// all the way to int32, which can save tagging/untagging for some operations
@ -258,7 +260,7 @@ Reduction JSTypedLowering::ReduceI32Binop(Node* node, bool left_signed,
Reduction JSTypedLowering::ReduceI32Shift(Node* node, bool left_signed,
Operator* shift_op) {
const Operator* shift_op) {
JSBinopReduction r(this, node);
r.ConvertInputsForShift(left_signed);
return r.ChangeToPureOperator(shift_op);
@ -269,7 +271,7 @@ Reduction JSTypedLowering::ReduceJSComparison(Node* node) {
JSBinopReduction r(this, node);
if (r.BothInputsAre(Type::String())) {
// If both inputs are definitely strings, perform a string comparison.
Operator* stringOp;
const Operator* stringOp;
switch (node->opcode()) {
case IrOpcode::kJSLessThan:
stringOp = simplified()->StringLessThan();
@ -291,8 +293,8 @@ Reduction JSTypedLowering::ReduceJSComparison(Node* node) {
return r.ChangeToPureOperator(stringOp);
} else if (r.OneInputCannotBe(Type::String())) {
// If one input cannot be a string, then emit a number comparison.
Operator* less_than;
Operator* less_than_or_equal;
const Operator* less_than;
const Operator* less_than_or_equal;
if (r.BothInputsAre(Type::Unsigned32())) {
less_than = machine()->Uint32LessThan();
less_than_or_equal = machine()->Uint32LessThanOrEqual();
@ -305,7 +307,7 @@ Reduction JSTypedLowering::ReduceJSComparison(Node* node) {
less_than = simplified()->NumberLessThan();
less_than_or_equal = simplified()->NumberLessThanOrEqual();
}
Operator* comparison;
const Operator* comparison;
switch (node->opcode()) {
case IrOpcode::kJSLessThan:
comparison = less_than;

View File

@ -45,10 +45,11 @@ class JSTypedLowering : public Reducer {
Reduction ReduceJSToNumberInput(Node* input);
Reduction ReduceJSToStringInput(Node* input);
Reduction ReduceJSToBooleanInput(Node* input);
Reduction ReduceNumberBinop(Node* node, Operator* numberOp);
Reduction ReduceNumberBinop(Node* node, const Operator* numberOp);
Reduction ReduceI32Binop(Node* node, bool left_signed, bool right_signed,
Operator* intOp);
Reduction ReduceI32Shift(Node* node, bool left_signed, Operator* shift_op);
const Operator* intOp);
Reduction ReduceI32Shift(Node* node, bool left_signed,
const Operator* shift_op);
JSOperatorBuilder* javascript() { return jsgraph_->javascript(); }
CommonOperatorBuilder* common() { return jsgraph_->common(); }

View File

@ -164,7 +164,7 @@ static const uint32_t kUint32Values[] = {
namespace {
struct UnaryOperator {
Operator* (MachineOperatorBuilder::*constructor)();
const Operator* (MachineOperatorBuilder::*constructor)();
const char* constructor_name;
};

View File

@ -39,7 +39,7 @@ class MachineOperatorCommonTest
TEST_P(MachineOperatorCommonTest, ChangeInt32ToInt64) {
Operator* op = machine()->ChangeInt32ToInt64();
const Operator* op = machine()->ChangeInt32ToInt64();
EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op));
EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op));
EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
@ -49,7 +49,7 @@ TEST_P(MachineOperatorCommonTest, ChangeInt32ToInt64) {
TEST_P(MachineOperatorCommonTest, ChangeUint32ToUint64) {
Operator* op = machine()->ChangeUint32ToUint64();
const Operator* op = machine()->ChangeUint32ToUint64();
EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op));
EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op));
EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
@ -59,7 +59,7 @@ TEST_P(MachineOperatorCommonTest, ChangeUint32ToUint64) {
TEST_P(MachineOperatorCommonTest, TruncateFloat64ToInt32) {
Operator* op = machine()->TruncateFloat64ToInt32();
const Operator* op = machine()->TruncateFloat64ToInt32();
EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op));
EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op));
EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));
@ -69,7 +69,7 @@ TEST_P(MachineOperatorCommonTest, TruncateFloat64ToInt32) {
TEST_P(MachineOperatorCommonTest, TruncateInt64ToInt32) {
Operator* op = machine()->TruncateInt64ToInt32();
const Operator* op = machine()->TruncateInt64ToInt32();
EXPECT_EQ(1, OperatorProperties::GetValueInputCount(op));
EXPECT_EQ(1, OperatorProperties::GetTotalInputCount(op));
EXPECT_EQ(0, OperatorProperties::GetControlOutputCount(op));

View File

@ -73,101 +73,101 @@ class MachineOperatorBuilder {
#define WORD_SIZE(x) return is64() ? Word64##x() : Word32##x()
#define INT_SIZE(x) return is64() ? Int64##x() : Int32##x()
Operator* Load(MachineType rep) { // load [base + index]
const Operator* Load(MachineType rep) { // load [base + index]
OP1(Load, MachineType, rep, Operator::kNoWrite, 2, 1);
}
// store [base + index], value
Operator* Store(MachineType rep, WriteBarrierKind kind) {
const Operator* Store(MachineType rep, WriteBarrierKind kind) {
StoreRepresentation store_rep = {rep, kind};
OP1(Store, StoreRepresentation, store_rep, Operator::kNoRead, 3, 0);
}
Operator* WordAnd() { WORD_SIZE(And); }
Operator* WordOr() { WORD_SIZE(Or); }
Operator* WordXor() { WORD_SIZE(Xor); }
Operator* WordShl() { WORD_SIZE(Shl); }
Operator* WordShr() { WORD_SIZE(Shr); }
Operator* WordSar() { WORD_SIZE(Sar); }
Operator* WordRor() { WORD_SIZE(Ror); }
Operator* WordEqual() { WORD_SIZE(Equal); }
const Operator* WordAnd() { WORD_SIZE(And); }
const Operator* WordOr() { WORD_SIZE(Or); }
const Operator* WordXor() { WORD_SIZE(Xor); }
const Operator* WordShl() { WORD_SIZE(Shl); }
const Operator* WordShr() { WORD_SIZE(Shr); }
const Operator* WordSar() { WORD_SIZE(Sar); }
const Operator* WordRor() { WORD_SIZE(Ror); }
const Operator* WordEqual() { WORD_SIZE(Equal); }
Operator* Word32And() { BINOP_AC(Word32And); }
Operator* Word32Or() { BINOP_AC(Word32Or); }
Operator* Word32Xor() { BINOP_AC(Word32Xor); }
Operator* Word32Shl() { BINOP(Word32Shl); }
Operator* Word32Shr() { BINOP(Word32Shr); }
Operator* Word32Sar() { BINOP(Word32Sar); }
Operator* Word32Ror() { BINOP(Word32Ror); }
Operator* Word32Equal() { BINOP_C(Word32Equal); }
const Operator* Word32And() { BINOP_AC(Word32And); }
const Operator* Word32Or() { BINOP_AC(Word32Or); }
const Operator* Word32Xor() { BINOP_AC(Word32Xor); }
const Operator* Word32Shl() { BINOP(Word32Shl); }
const Operator* Word32Shr() { BINOP(Word32Shr); }
const Operator* Word32Sar() { BINOP(Word32Sar); }
const Operator* Word32Ror() { BINOP(Word32Ror); }
const Operator* Word32Equal() { BINOP_C(Word32Equal); }
Operator* Word64And() { BINOP_AC(Word64And); }
Operator* Word64Or() { BINOP_AC(Word64Or); }
Operator* Word64Xor() { BINOP_AC(Word64Xor); }
Operator* Word64Shl() { BINOP(Word64Shl); }
Operator* Word64Shr() { BINOP(Word64Shr); }
Operator* Word64Sar() { BINOP(Word64Sar); }
Operator* Word64Ror() { BINOP(Word64Ror); }
Operator* Word64Equal() { BINOP_C(Word64Equal); }
const Operator* Word64And() { BINOP_AC(Word64And); }
const Operator* Word64Or() { BINOP_AC(Word64Or); }
const Operator* Word64Xor() { BINOP_AC(Word64Xor); }
const Operator* Word64Shl() { BINOP(Word64Shl); }
const Operator* Word64Shr() { BINOP(Word64Shr); }
const Operator* Word64Sar() { BINOP(Word64Sar); }
const Operator* Word64Ror() { BINOP(Word64Ror); }
const Operator* Word64Equal() { BINOP_C(Word64Equal); }
Operator* Int32Add() { BINOP_AC(Int32Add); }
Operator* Int32AddWithOverflow() { BINOP_ACO(Int32AddWithOverflow); }
Operator* Int32Sub() { BINOP(Int32Sub); }
Operator* Int32SubWithOverflow() { BINOP_O(Int32SubWithOverflow); }
Operator* Int32Mul() { BINOP_AC(Int32Mul); }
Operator* Int32Div() { BINOP(Int32Div); }
Operator* Int32UDiv() { BINOP(Int32UDiv); }
Operator* Int32Mod() { BINOP(Int32Mod); }
Operator* Int32UMod() { BINOP(Int32UMod); }
Operator* Int32LessThan() { BINOP(Int32LessThan); }
Operator* Int32LessThanOrEqual() { BINOP(Int32LessThanOrEqual); }
Operator* Uint32LessThan() { BINOP(Uint32LessThan); }
Operator* Uint32LessThanOrEqual() { BINOP(Uint32LessThanOrEqual); }
const Operator* Int32Add() { BINOP_AC(Int32Add); }
const Operator* Int32AddWithOverflow() { BINOP_ACO(Int32AddWithOverflow); }
const Operator* Int32Sub() { BINOP(Int32Sub); }
const Operator* Int32SubWithOverflow() { BINOP_O(Int32SubWithOverflow); }
const Operator* Int32Mul() { BINOP_AC(Int32Mul); }
const Operator* Int32Div() { BINOP(Int32Div); }
const Operator* Int32UDiv() { BINOP(Int32UDiv); }
const Operator* Int32Mod() { BINOP(Int32Mod); }
const Operator* Int32UMod() { BINOP(Int32UMod); }
const Operator* Int32LessThan() { BINOP(Int32LessThan); }
const Operator* Int32LessThanOrEqual() { BINOP(Int32LessThanOrEqual); }
const Operator* Uint32LessThan() { BINOP(Uint32LessThan); }
const Operator* Uint32LessThanOrEqual() { BINOP(Uint32LessThanOrEqual); }
Operator* Int64Add() { BINOP_AC(Int64Add); }
Operator* Int64Sub() { BINOP(Int64Sub); }
Operator* Int64Mul() { BINOP_AC(Int64Mul); }
Operator* Int64Div() { BINOP(Int64Div); }
Operator* Int64UDiv() { BINOP(Int64UDiv); }
Operator* Int64Mod() { BINOP(Int64Mod); }
Operator* Int64UMod() { BINOP(Int64UMod); }
Operator* Int64LessThan() { BINOP(Int64LessThan); }
Operator* Int64LessThanOrEqual() { BINOP(Int64LessThanOrEqual); }
const Operator* Int64Add() { BINOP_AC(Int64Add); }
const Operator* Int64Sub() { BINOP(Int64Sub); }
const Operator* Int64Mul() { BINOP_AC(Int64Mul); }
const Operator* Int64Div() { BINOP(Int64Div); }
const Operator* Int64UDiv() { BINOP(Int64UDiv); }
const Operator* Int64Mod() { BINOP(Int64Mod); }
const Operator* Int64UMod() { BINOP(Int64UMod); }
const Operator* Int64LessThan() { BINOP(Int64LessThan); }
const Operator* Int64LessThanOrEqual() { BINOP(Int64LessThanOrEqual); }
// Signed comparison of word-sized integer values, translates to int32/int64
// comparisons depending on the word-size of the machine.
Operator* IntLessThan() { INT_SIZE(LessThan); }
Operator* IntLessThanOrEqual() { INT_SIZE(LessThanOrEqual); }
const Operator* IntLessThan() { INT_SIZE(LessThan); }
const Operator* IntLessThanOrEqual() { INT_SIZE(LessThanOrEqual); }
// Convert representation of integers between float64 and int32/uint32.
// The precise rounding mode and handling of out of range inputs are *not*
// defined for these operators, since they are intended only for use with
// integers.
Operator* ChangeInt32ToFloat64() { UNOP(ChangeInt32ToFloat64); }
Operator* ChangeUint32ToFloat64() { UNOP(ChangeUint32ToFloat64); }
Operator* ChangeFloat64ToInt32() { UNOP(ChangeFloat64ToInt32); }
Operator* ChangeFloat64ToUint32() { UNOP(ChangeFloat64ToUint32); }
const Operator* ChangeInt32ToFloat64() { UNOP(ChangeInt32ToFloat64); }
const Operator* ChangeUint32ToFloat64() { UNOP(ChangeUint32ToFloat64); }
const Operator* ChangeFloat64ToInt32() { UNOP(ChangeFloat64ToInt32); }
const Operator* ChangeFloat64ToUint32() { UNOP(ChangeFloat64ToUint32); }
// Sign/zero extend int32/uint32 to int64/uint64.
Operator* ChangeInt32ToInt64() { UNOP(ChangeInt32ToInt64); }
Operator* ChangeUint32ToUint64() { UNOP(ChangeUint32ToUint64); }
const Operator* ChangeInt32ToInt64() { UNOP(ChangeInt32ToInt64); }
const Operator* ChangeUint32ToUint64() { UNOP(ChangeUint32ToUint64); }
// Truncate double to int32 using JavaScript semantics.
Operator* TruncateFloat64ToInt32() { UNOP(TruncateFloat64ToInt32); }
const Operator* TruncateFloat64ToInt32() { UNOP(TruncateFloat64ToInt32); }
// Truncate the high order bits and convert the remaining bits to int32.
Operator* TruncateInt64ToInt32() { UNOP(TruncateInt64ToInt32); }
const Operator* TruncateInt64ToInt32() { UNOP(TruncateInt64ToInt32); }
// Floating point operators always operate with IEEE 754 round-to-nearest.
Operator* Float64Add() { BINOP_C(Float64Add); }
Operator* Float64Sub() { BINOP(Float64Sub); }
Operator* Float64Mul() { BINOP_C(Float64Mul); }
Operator* Float64Div() { BINOP(Float64Div); }
Operator* Float64Mod() { BINOP(Float64Mod); }
const Operator* Float64Add() { BINOP_C(Float64Add); }
const Operator* Float64Sub() { BINOP(Float64Sub); }
const Operator* Float64Mul() { BINOP_C(Float64Mul); }
const Operator* Float64Div() { BINOP(Float64Div); }
const Operator* Float64Mod() { BINOP(Float64Mod); }
// Floating point comparisons complying to IEEE 754.
Operator* Float64Equal() { BINOP_C(Float64Equal); }
Operator* Float64LessThan() { BINOP(Float64LessThan); }
Operator* Float64LessThanOrEqual() { BINOP(Float64LessThanOrEqual); }
const Operator* Float64Equal() { BINOP_C(Float64Equal); }
const Operator* Float64LessThan() { BINOP(Float64LessThan); }
const Operator* Float64LessThanOrEqual() { BINOP(Float64LessThanOrEqual); }
inline bool is32() const { return word_ == kRepWord32; }
inline bool is64() const { return word_ == kRepWord64; }
@ -184,8 +184,9 @@ class MachineOperatorBuilder {
Zone* zone_;
MachineType word_;
};
}
}
} // namespace v8::internal::compiler
} // namespace compiler
} // namespace internal
} // namespace v8
#endif // V8_COMPILER_MACHINE_OPERATOR_H_

View File

@ -149,7 +149,7 @@ BasicBlock* RawMachineAssembler::CurrentBlock() {
}
Node* RawMachineAssembler::MakeNode(Operator* op, int input_count,
Node* RawMachineAssembler::MakeNode(const Operator* op, int input_count,
Node** inputs) {
DCHECK(ScheduleValid());
DCHECK(current_block_ != NULL);

View File

@ -423,7 +423,8 @@ class RawMachineAssembler : public GraphBuilder {
Schedule* Export();
protected:
virtual Node* MakeNode(Operator* op, int input_count, Node** inputs);
virtual Node* MakeNode(const Operator* op, int input_count,
Node** inputs) FINAL;
bool ScheduleValid() { return schedule_ != NULL; }

View File

@ -91,7 +91,7 @@ class RepresentationChanger {
break;
}
// Select the correct X -> Tagged operator.
Operator* op;
const Operator* op;
if (output_type & kRepBit) {
op = simplified()->ChangeBitToBool();
} else if (output_type & rWord) {
@ -129,7 +129,7 @@ class RepresentationChanger {
break;
}
// Select the correct X -> Float64 operator.
Operator* op;
const Operator* op;
if (output_type & kRepBit) {
return TypeError(node, output_type, kRepFloat64);
} else if (output_type & rWord) {
@ -169,7 +169,7 @@ class RepresentationChanger {
break;
}
// Select the correct X -> Word32 operator.
Operator* op = NULL;
const Operator* op = NULL;
if (output_type & kRepFloat64) {
if (output_type & kTypeUint32 || use_unsigned) {
op = machine()->ChangeFloat64ToUint32();
@ -207,7 +207,7 @@ class RepresentationChanger {
break;
}
// Select the correct X -> Bit operator.
Operator* op;
const Operator* op;
if (output_type & rWord) {
return node; // No change necessary.
} else if (output_type & kRepWord64) {
@ -228,7 +228,7 @@ class RepresentationChanger {
return TypeError(node, output_type, kRepWord64);
}
Operator* Int32OperatorFor(IrOpcode::Value opcode) {
const Operator* Int32OperatorFor(IrOpcode::Value opcode) {
switch (opcode) {
case IrOpcode::kNumberAdd:
return machine()->Int32Add();
@ -246,7 +246,7 @@ class RepresentationChanger {
}
}
Operator* Uint32OperatorFor(IrOpcode::Value opcode) {
const Operator* Uint32OperatorFor(IrOpcode::Value opcode) {
switch (opcode) {
case IrOpcode::kNumberAdd:
return machine()->Int32Add();
@ -264,7 +264,7 @@ class RepresentationChanger {
}
}
Operator* Float64OperatorFor(IrOpcode::Value opcode) {
const Operator* Float64OperatorFor(IrOpcode::Value opcode) {
switch (opcode) {
case IrOpcode::kNumberAdd:
return machine()->Float64Add();

View File

@ -336,15 +336,15 @@ class RepresentationSelector {
}
}
Operator* Int32Op(Node* node) {
const Operator* Int32Op(Node* node) {
return changer_->Int32OperatorFor(node->opcode());
}
Operator* Uint32Op(Node* node) {
const Operator* Uint32Op(Node* node) {
return changer_->Uint32OperatorFor(node->opcode());
}
Operator* Float64Op(Node* node) {
const Operator* Float64Op(Node* node) {
return changer_->Float64OperatorFor(node->opcode());
}

View File

@ -128,7 +128,7 @@ MATCHER(IsNaN, std::string(negation ? "isn't" : "is") + " NaN") {
namespace {
struct UnaryOperator {
Operator* (SimplifiedOperatorBuilder::*constructor)() const;
const Operator* (SimplifiedOperatorBuilder::*constructor)() const;
const char* constructor_name;
};

View File

@ -102,7 +102,8 @@ Reduction SimplifiedOperatorReducer::Reduce(Node* node) {
}
Reduction SimplifiedOperatorReducer::Change(Node* node, Operator* op, Node* a) {
Reduction SimplifiedOperatorReducer::Change(Node* node, const Operator* op,
Node* a) {
node->set_op(op);
node->ReplaceInput(0, a);
return Changed(node);

View File

@ -28,7 +28,7 @@ class SimplifiedOperatorReducer FINAL : public Reducer {
virtual Reduction Reduce(Node* node) OVERRIDE;
private:
Reduction Change(Node* node, Operator* op, Node* a);
Reduction Change(Node* node, const Operator* op, Node* a);
Reduction ReplaceFloat64(double value);
Reduction ReplaceInt32(int32_t value);
Reduction ReplaceUint32(uint32_t value) {

View File

@ -133,45 +133,49 @@ class SimplifiedOperatorBuilder {
#define UNOP(name) SIMPLE(name, Operator::kPure, 1, 1)
#define BINOP(name) SIMPLE(name, Operator::kPure, 2, 1)
Operator* BooleanNot() const { UNOP(BooleanNot); }
const Operator* BooleanNot() const { UNOP(BooleanNot); }
Operator* NumberEqual() const { BINOP(NumberEqual); }
Operator* NumberLessThan() const { BINOP(NumberLessThan); }
Operator* NumberLessThanOrEqual() const { BINOP(NumberLessThanOrEqual); }
Operator* NumberAdd() const { BINOP(NumberAdd); }
Operator* NumberSubtract() const { BINOP(NumberSubtract); }
Operator* NumberMultiply() const { BINOP(NumberMultiply); }
Operator* NumberDivide() const { BINOP(NumberDivide); }
Operator* NumberModulus() const { BINOP(NumberModulus); }
Operator* NumberToInt32() const { UNOP(NumberToInt32); }
Operator* NumberToUint32() const { UNOP(NumberToUint32); }
const Operator* NumberEqual() const { BINOP(NumberEqual); }
const Operator* NumberLessThan() const { BINOP(NumberLessThan); }
const Operator* NumberLessThanOrEqual() const {
BINOP(NumberLessThanOrEqual);
}
const Operator* NumberAdd() const { BINOP(NumberAdd); }
const Operator* NumberSubtract() const { BINOP(NumberSubtract); }
const Operator* NumberMultiply() const { BINOP(NumberMultiply); }
const Operator* NumberDivide() const { BINOP(NumberDivide); }
const Operator* NumberModulus() const { BINOP(NumberModulus); }
const Operator* NumberToInt32() const { UNOP(NumberToInt32); }
const Operator* NumberToUint32() const { UNOP(NumberToUint32); }
Operator* ReferenceEqual(Type* type) const { BINOP(ReferenceEqual); }
const Operator* ReferenceEqual(Type* type) const { BINOP(ReferenceEqual); }
Operator* StringEqual() const { BINOP(StringEqual); }
Operator* StringLessThan() const { BINOP(StringLessThan); }
Operator* StringLessThanOrEqual() const { BINOP(StringLessThanOrEqual); }
Operator* StringAdd() const { BINOP(StringAdd); }
const Operator* StringEqual() const { BINOP(StringEqual); }
const Operator* StringLessThan() const { BINOP(StringLessThan); }
const Operator* StringLessThanOrEqual() const {
BINOP(StringLessThanOrEqual);
}
const Operator* StringAdd() const { BINOP(StringAdd); }
Operator* ChangeTaggedToInt32() const { UNOP(ChangeTaggedToInt32); }
Operator* ChangeTaggedToUint32() const { UNOP(ChangeTaggedToUint32); }
Operator* ChangeTaggedToFloat64() const { UNOP(ChangeTaggedToFloat64); }
Operator* ChangeInt32ToTagged() const { UNOP(ChangeInt32ToTagged); }
Operator* ChangeUint32ToTagged() const { UNOP(ChangeUint32ToTagged); }
Operator* ChangeFloat64ToTagged() const { UNOP(ChangeFloat64ToTagged); }
Operator* ChangeBoolToBit() const { UNOP(ChangeBoolToBit); }
Operator* ChangeBitToBool() const { UNOP(ChangeBitToBool); }
const Operator* ChangeTaggedToInt32() const { UNOP(ChangeTaggedToInt32); }
const Operator* ChangeTaggedToUint32() const { UNOP(ChangeTaggedToUint32); }
const Operator* ChangeTaggedToFloat64() const { UNOP(ChangeTaggedToFloat64); }
const Operator* ChangeInt32ToTagged() const { UNOP(ChangeInt32ToTagged); }
const Operator* ChangeUint32ToTagged() const { UNOP(ChangeUint32ToTagged); }
const Operator* ChangeFloat64ToTagged() const { UNOP(ChangeFloat64ToTagged); }
const Operator* ChangeBoolToBit() const { UNOP(ChangeBoolToBit); }
const Operator* ChangeBitToBool() const { UNOP(ChangeBitToBool); }
Operator* LoadField(const FieldAccess& access) const {
const Operator* LoadField(const FieldAccess& access) const {
OP1(LoadField, FieldAccess, access, Operator::kNoWrite, 1, 1);
}
Operator* StoreField(const FieldAccess& access) const {
const Operator* StoreField(const FieldAccess& access) const {
OP1(StoreField, FieldAccess, access, Operator::kNoRead, 2, 0);
}
Operator* LoadElement(const ElementAccess& access) const {
const Operator* LoadElement(const ElementAccess& access) const {
OP1(LoadElement, ElementAccess, access, Operator::kNoWrite, 2, 1);
}
Operator* StoreElement(const ElementAccess& access) const {
const Operator* StoreElement(const ElementAccess& access) const {
OP1(StoreElement, ElementAccess, access, Operator::kNoRead, 3, 0);
}

View File

@ -242,7 +242,7 @@ class CompareWrapper {
return m->NewNode(op(m->machine()), a, b);
}
Operator* op(MachineOperatorBuilder* machine) {
const Operator* op(MachineOperatorBuilder* machine) {
switch (opcode) {
case IrOpcode::kWord32Equal:
return machine->Word32Equal();

View File

@ -26,8 +26,8 @@ class DirectGraphBuilder : public GraphBuilder {
virtual ~DirectGraphBuilder() {}
protected:
virtual Node* MakeNode(Operator* op, int value_input_count,
Node** value_inputs) {
virtual Node* MakeNode(const Operator* op, int value_input_count,
Node** value_inputs) FINAL {
return graph()->NewNode(op, value_input_count, value_inputs);
}
};

View File

@ -43,7 +43,8 @@ void SimplifiedGraphBuilder::End() {
}
Node* SimplifiedGraphBuilder::MakeNode(Operator* op, int value_input_count,
Node* SimplifiedGraphBuilder::MakeNode(const Operator* op,
int value_input_count,
Node** value_inputs) {
DCHECK(op->InputCount() == value_input_count);

View File

@ -136,8 +136,8 @@ class SimplifiedGraphBuilder : public GraphBuilder {
}
protected:
virtual Node* MakeNode(Operator* op, int value_input_count,
Node** value_inputs);
virtual Node* MakeNode(const Operator* op, int value_input_count,
Node** value_inputs) FINAL;
private:
Node* effect_;

View File

@ -99,7 +99,7 @@ class ChangesLoweringTester : public GraphBuilderTester<ReturnType> {
CHECK(this->isolate()->factory()->NewNumber(expected)->SameValue(number));
}
void BuildAndLower(Operator* op) {
void BuildAndLower(const Operator* op) {
// We build a graph by hand here, because the raw machine assembler
// does not add the correct control and effect nodes.
Node* p0 = this->Parameter(0);
@ -111,7 +111,8 @@ class ChangesLoweringTester : public GraphBuilderTester<ReturnType> {
LowerChange(change);
}
void BuildStoreAndLower(Operator* op, Operator* store_op, void* location) {
void BuildStoreAndLower(const Operator* op, const Operator* store_op,
void* location) {
// We build a graph by hand here, because the raw machine assembler
// does not add the correct control and effect nodes.
Node* p0 = this->Parameter(0);
@ -126,7 +127,8 @@ class ChangesLoweringTester : public GraphBuilderTester<ReturnType> {
LowerChange(change);
}
void BuildLoadAndLower(Operator* op, Operator* load_op, void* location) {
void BuildLoadAndLower(const Operator* op, const Operator* load_op,
void* location) {
// We build a graph by hand here, because the raw machine assembler
// does not add the correct control and effect nodes.
Node* load =

View File

@ -33,8 +33,8 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
}
Isolate* isolate;
Operator* binop;
Operator* unop;
const Operator* binop;
const Operator* unop;
JSOperatorBuilder javascript;
MachineOperatorBuilder machine;
SimplifiedOperatorBuilder simplified;
@ -73,25 +73,25 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
CHECK_EQ(2, node->InputCount()); // should not have context, effect, etc.
}
void CheckPureBinop(Operator* expected, Node* node) {
void CheckPureBinop(const Operator* expected, Node* node) {
CHECK_EQ(expected->opcode(), node->op()->opcode());
CHECK_EQ(2, node->InputCount()); // should not have context, effect, etc.
}
Node* ReduceUnop(Operator* op, Type* input_type) {
Node* ReduceUnop(const Operator* op, Type* input_type) {
return reduce(Unop(op, Parameter(input_type)));
}
Node* ReduceBinop(Operator* op, Type* left_type, Type* right_type) {
Node* ReduceBinop(const Operator* op, Type* left_type, Type* right_type) {
return reduce(Binop(op, Parameter(left_type, 0), Parameter(right_type, 1)));
}
Node* Binop(Operator* op, Node* left, Node* right) {
Node* Binop(const Operator* op, Node* left, Node* right) {
// JS binops also require context, effect, and control
return graph.NewNode(op, left, right, context(), start(), control());
}
Node* Unop(Operator* op, Node* input) {
Node* Unop(const Operator* op, Node* input) {
// JS unops also require context, effect, and control
return graph.NewNode(op, input, context(), start(), control());
}
@ -206,7 +206,7 @@ TEST(AddNumber1) {
TEST(NumberBinops) {
JSTypedLoweringTester R;
Operator* ops[] = {
const Operator* ops[] = {
R.javascript.Add(), R.simplified.NumberAdd(),
R.javascript.Subtract(), R.simplified.NumberSubtract(),
R.javascript.Multiply(), R.simplified.NumberMultiply(),
@ -253,7 +253,7 @@ static void CheckToI32(Node* old_input, Node* new_input, bool is_signed) {
class JSBitwiseShiftTypedLoweringTester : public JSTypedLoweringTester {
public:
static const int kNumberOps = 6;
Operator* ops[kNumberOps];
const Operator* ops[kNumberOps];
bool signedness[kNumberOps];
JSBitwiseShiftTypedLoweringTester() {
@ -267,7 +267,7 @@ class JSBitwiseShiftTypedLoweringTester : public JSTypedLoweringTester {
}
private:
void set(int idx, Operator* op, bool s) {
void set(int idx, const Operator* op, bool s) {
ops[idx] = op;
signedness[idx] = s;
}
@ -313,7 +313,7 @@ TEST(Int32BitwiseShifts) {
class JSBitwiseTypedLoweringTester : public JSTypedLoweringTester {
public:
static const int kNumberOps = 6;
Operator* ops[kNumberOps];
const Operator* ops[kNumberOps];
bool signedness[kNumberOps];
JSBitwiseTypedLoweringTester() {
@ -327,7 +327,7 @@ class JSBitwiseTypedLoweringTester : public JSTypedLoweringTester {
}
private:
void set(int idx, Operator* op, bool s) {
void set(int idx, const Operator* op, bool s) {
ops[idx] = op;
signedness[idx] = s;
}
@ -366,7 +366,7 @@ TEST(Int32BitwiseBinops) {
TEST(JSToNumber1) {
JSTypedLoweringTester R;
Operator* ton = R.javascript.ToNumber();
const Operator* ton = R.javascript.ToNumber();
for (size_t i = 0; i < arraysize(kNumberTypes); i++) { // ToNumber(number)
Node* r = R.ReduceUnop(ton, kNumberTypes[i]);
@ -416,9 +416,10 @@ TEST(JSToNumber_replacement) {
TEST(JSToNumberOfConstant) {
JSTypedLoweringTester R;
Operator* ops[] = {R.common.NumberConstant(0), R.common.NumberConstant(-1),
R.common.NumberConstant(0.1), R.common.Int32Constant(1177),
R.common.Float64Constant(0.99)};
const Operator* ops[] = {
R.common.NumberConstant(0), R.common.NumberConstant(-1),
R.common.NumberConstant(0.1), R.common.Int32Constant(1177),
R.common.Float64Constant(0.99)};
for (size_t i = 0; i < arraysize(ops); i++) {
Node* n = R.graph.NewNode(ops[i]);
@ -455,7 +456,7 @@ TEST(JSToNumberOfNumberOrOtherPrimitive) {
TEST(JSToBoolean) {
JSTypedLoweringTester R;
Operator* op = R.javascript.ToBoolean();
const Operator* op = R.javascript.ToBoolean();
{ // ToBoolean(undefined)
Node* r = R.ReduceUnop(op, Type::Undefined());
@ -543,7 +544,7 @@ TEST(JSToString1) {
CHECK_EQ(IrOpcode::kParameter, r->opcode());
}
Operator* op = R.javascript.ToString();
const Operator* op = R.javascript.ToString();
{ // ToString(undefined) => "undefined"
Node* r = R.ReduceUnop(op, Type::Undefined());
@ -610,7 +611,7 @@ TEST(JSToString_replacement) {
TEST(StringComparison) {
JSTypedLoweringTester R;
Operator* ops[] = {
const Operator* ops[] = {
R.javascript.LessThan(), R.simplified.StringLessThan(),
R.javascript.LessThanOrEqual(), R.simplified.StringLessThanOrEqual(),
R.javascript.GreaterThan(), R.simplified.StringLessThan(),
@ -655,7 +656,7 @@ static void CheckIsConvertedToNumber(Node* val, Node* converted) {
TEST(NumberComparison) {
JSTypedLoweringTester R;
Operator* ops[] = {
const Operator* ops[] = {
R.javascript.LessThan(), R.simplified.NumberLessThan(),
R.javascript.LessThanOrEqual(), R.simplified.NumberLessThanOrEqual(),
R.javascript.GreaterThan(), R.simplified.NumberLessThan(),
@ -755,7 +756,7 @@ TEST(ObjectComparison) {
TEST(UnaryNot) {
JSTypedLoweringTester R;
Operator* opnot = R.javascript.UnaryNot();
const Operator* opnot = R.javascript.UnaryNot();
for (size_t i = 0; i < arraysize(kJSTypes); i++) {
Node* orig = R.Unop(opnot, R.Parameter(kJSTypes[i]));
@ -832,7 +833,7 @@ TEST(RemoveToNumberEffects) {
// Helper class for testing the reduction of a single binop.
class BinopEffectsTester {
public:
explicit BinopEffectsTester(Operator* op, Type* t0, Type* t1)
explicit BinopEffectsTester(const Operator* op, Type* t0, Type* t1)
: R(),
p0(R.Parameter(t0, 0)),
p1(R.Parameter(t1, 1)),
@ -961,7 +962,7 @@ TEST(StringEquality) {
TEST(RemovePureNumberBinopEffects) {
JSTypedLoweringTester R;
Operator* ops[] = {
const Operator* ops[] = {
R.javascript.Equal(), R.simplified.NumberEqual(),
R.javascript.Add(), R.simplified.NumberAdd(),
R.javascript.Subtract(), R.simplified.NumberSubtract(),
@ -989,7 +990,7 @@ TEST(RemovePureNumberBinopEffects) {
TEST(OrderNumberBinopEffects1) {
JSTypedLoweringTester R;
Operator* ops[] = {
const Operator* ops[] = {
R.javascript.Subtract(), R.simplified.NumberSubtract(),
R.javascript.Multiply(), R.simplified.NumberMultiply(),
R.javascript.Divide(), R.simplified.NumberDivide(),
@ -1015,7 +1016,7 @@ TEST(OrderNumberBinopEffects1) {
TEST(OrderNumberBinopEffects2) {
JSTypedLoweringTester R;
Operator* ops[] = {
const Operator* ops[] = {
R.javascript.Add(), R.simplified.NumberAdd(),
R.javascript.Subtract(), R.simplified.NumberSubtract(),
R.javascript.Multiply(), R.simplified.NumberMultiply(),
@ -1054,7 +1055,7 @@ TEST(OrderNumberBinopEffects2) {
TEST(OrderCompareEffects) {
JSTypedLoweringTester R;
Operator* ops[] = {
const Operator* ops[] = {
R.javascript.GreaterThan(), R.simplified.NumberLessThan(),
R.javascript.GreaterThanOrEqual(), R.simplified.NumberLessThanOrEqual(),
};
@ -1187,7 +1188,7 @@ TEST(Int32BinopEffects) {
TEST(UnaryNotEffects) {
JSTypedLoweringTester R;
Operator* opnot = R.javascript.UnaryNot();
const Operator* opnot = R.javascript.UnaryNot();
for (size_t i = 0; i < arraysize(kJSTypes); i++) {
Node* p0 = R.Parameter(kJSTypes[i], 0);
@ -1299,10 +1300,10 @@ TEST(Int32Comparisons) {
JSTypedLoweringTester R;
struct Entry {
Operator* js_op;
Operator* uint_op;
Operator* int_op;
Operator* num_op;
const Operator* js_op;
const Operator* uint_op;
const Operator* int_op;
const Operator* num_op;
bool commute;
};
@ -1330,7 +1331,7 @@ TEST(Int32Comparisons) {
Node* cmp = R.Binop(ops[o].js_op, p0, p1);
Node* r = R.reduce(cmp);
Operator* expected;
const Operator* expected;
if (t0->Is(Type::Unsigned32()) && t1->Is(Type::Unsigned32())) {
expected = ops[o].uint_op;
} else if (t0->Is(Type::Signed32()) && t1->Is(Type::Signed32())) {

View File

@ -15,17 +15,18 @@ using namespace v8::internal;
using namespace v8::internal::compiler;
template <typename T>
Operator* NewConstantOperator(CommonOperatorBuilder* common, volatile T value);
const Operator* NewConstantOperator(CommonOperatorBuilder* common,
volatile T value);
template <>
Operator* NewConstantOperator<int32_t>(CommonOperatorBuilder* common,
volatile int32_t value) {
const Operator* NewConstantOperator<int32_t>(CommonOperatorBuilder* common,
volatile int32_t value) {
return common->Int32Constant(value);
}
template <>
Operator* NewConstantOperator<double>(CommonOperatorBuilder* common,
volatile double value) {
const Operator* NewConstantOperator<double>(CommonOperatorBuilder* common,
volatile double value) {
return common->Float64Constant(value);
}
@ -63,8 +64,8 @@ class ReducerTester : public HandleAndZoneScope {
}
Isolate* isolate;
Operator* binop;
Operator* unop;
const Operator* binop;
const Operator* unop;
MachineOperatorBuilder machine;
CommonOperatorBuilder common;
Graph graph;
@ -130,7 +131,7 @@ class ReducerTester : public HandleAndZoneScope {
// Check that the reduction of this binop applied to {left} and {right} yields
// the {op_expect} applied to {left_expect} and {right_expect}.
template <typename T>
void CheckFoldBinop(volatile T left_expect, Operator* op_expect,
void CheckFoldBinop(volatile T left_expect, const Operator* op_expect,
Node* right_expect, Node* left, Node* right) {
CHECK_NE(NULL, binop);
Node* n = graph.NewNode(binop, left, right);
@ -145,7 +146,7 @@ class ReducerTester : public HandleAndZoneScope {
// Check that the reduction of this binop applied to {left} and {right} yields
// the {op_expect} applied to {left_expect} and {right_expect}.
template <typename T>
void CheckFoldBinop(Node* left_expect, Operator* op_expect,
void CheckFoldBinop(Node* left_expect, const Operator* op_expect,
volatile T right_expect, Node* left, Node* right) {
CHECK_NE(NULL, binop);
Node* n = graph.NewNode(binop, left, right);

View File

@ -58,7 +58,7 @@ static Node* Int32Input(RawMachineAssemblerTester<int32_t>* m, int index) {
TEST(CodeGenInt32Binop) {
RawMachineAssemblerTester<void> m;
Operator* ops[] = {
const Operator* ops[] = {
m.machine()->Word32And(), m.machine()->Word32Or(),
m.machine()->Word32Xor(), m.machine()->Word32Shl(),
m.machine()->Word32Shr(), m.machine()->Word32Sar(),
@ -741,8 +741,9 @@ TEST(RunInt32AddInBranch) {
}
{
RawMachineAssemblerTester<void> m;
Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
const Operator* shops[] = {m.machine()->Word32Sar(),
m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
for (size_t n = 0; n < arraysize(shops); n++) {
RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32,
kMachUint32);
@ -832,8 +833,9 @@ TEST(RunInt32AddInComparison) {
}
{
RawMachineAssemblerTester<void> m;
Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
const Operator* shops[] = {m.machine()->Word32Sar(),
m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
for (size_t n = 0; n < arraysize(shops); n++) {
RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32,
kMachUint32);
@ -1076,8 +1078,9 @@ TEST(RunInt32SubInBranch) {
}
{
RawMachineAssemblerTester<void> m;
Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
const Operator* shops[] = {m.machine()->Word32Sar(),
m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
for (size_t n = 0; n < arraysize(shops); n++) {
RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32,
kMachUint32);
@ -1167,8 +1170,9 @@ TEST(RunInt32SubInComparison) {
}
{
RawMachineAssemblerTester<void> m;
Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
const Operator* shops[] = {m.machine()->Word32Sar(),
m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
for (size_t n = 0; n < arraysize(shops); n++) {
RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32,
kMachUint32);
@ -1699,8 +1703,9 @@ TEST(RunWord32AndInBranch) {
}
{
RawMachineAssemblerTester<void> m;
Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
const Operator* shops[] = {m.machine()->Word32Sar(),
m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
for (size_t n = 0; n < arraysize(shops); n++) {
RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32,
kMachUint32);
@ -1926,8 +1931,9 @@ TEST(RunWord32OrInBranch) {
}
{
RawMachineAssemblerTester<void> m;
Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
const Operator* shops[] = {m.machine()->Word32Sar(),
m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
for (size_t n = 0; n < arraysize(shops); n++) {
RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32,
kMachUint32);
@ -2150,8 +2156,9 @@ TEST(RunWord32XorInBranch) {
}
{
RawMachineAssemblerTester<void> m;
Operator* shops[] = {m.machine()->Word32Sar(), m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
const Operator* shops[] = {m.machine()->Word32Sar(),
m.machine()->Word32Shl(),
m.machine()->Word32Shr()};
for (size_t n = 0; n < arraysize(shops); n++) {
RawMachineAssemblerTester<int32_t> m(kMachUint32, kMachInt32,
kMachUint32);
@ -2651,7 +2658,7 @@ TEST(RunDeadNodes) {
TEST(RunDeadInt32Binops) {
RawMachineAssemblerTester<int32_t> m;
Operator* ops[] = {
const Operator* ops[] = {
m.machine()->Word32And(), m.machine()->Word32Or(),
m.machine()->Word32Xor(), m.machine()->Word32Shl(),
m.machine()->Word32Shr(), m.machine()->Word32Sar(),
@ -2762,12 +2769,12 @@ TEST(RunFloat64Binop) {
RawMachineAssemblerTester<int32_t> m;
double result;
Operator* ops[] = {m.machine()->Float64Add(), m.machine()->Float64Sub(),
m.machine()->Float64Mul(), m.machine()->Float64Div(),
m.machine()->Float64Mod(), NULL};
const Operator* ops[] = {m.machine()->Float64Add(), m.machine()->Float64Sub(),
m.machine()->Float64Mul(), m.machine()->Float64Div(),
m.machine()->Float64Mod(), NULL};
double inf = V8_INFINITY;
Operator* inputs[] = {
const Operator* inputs[] = {
m.common()->Float64Constant(0), m.common()->Float64Constant(1),
m.common()->Float64Constant(1), m.common()->Float64Constant(0),
m.common()->Float64Constant(0), m.common()->Float64Constant(-1),
@ -2797,9 +2804,9 @@ TEST(RunFloat64Binop) {
TEST(RunDeadFloat64Binops) {
RawMachineAssemblerTester<int32_t> m;
Operator* ops[] = {m.machine()->Float64Add(), m.machine()->Float64Sub(),
m.machine()->Float64Mul(), m.machine()->Float64Div(),
m.machine()->Float64Mod(), NULL};
const Operator* ops[] = {m.machine()->Float64Add(), m.machine()->Float64Sub(),
m.machine()->Float64Mul(), m.machine()->Float64Div(),
m.machine()->Float64Mod(), NULL};
for (int i = 0; ops[i] != NULL; i++) {
RawMachineAssemblerTester<int32_t> m;
@ -3714,9 +3721,9 @@ TEST(RunFloat64Compare) {
TEST(RunFloat64UnorderedCompare) {
RawMachineAssemblerTester<int32_t> m;
Operator* operators[] = {m.machine()->Float64Equal(),
m.machine()->Float64LessThan(),
m.machine()->Float64LessThanOrEqual()};
const Operator* operators[] = {m.machine()->Float64Equal(),
m.machine()->Float64LessThan(),
m.machine()->Float64LessThanOrEqual()};
double nan = v8::base::OS::nan_value();

View File

@ -676,7 +676,7 @@ TEST(BuildScheduleIfSplitWithEffects) {
Graph graph(scope.main_zone());
CommonOperatorBuilder common_builder(scope.main_zone());
JSOperatorBuilder js_builder(scope.main_zone());
Operator* op;
const Operator* op;
Handle<Object> object =
Handle<Object>(isolate->heap()->undefined_value(), isolate);
@ -821,7 +821,7 @@ TEST(BuildScheduleSimpleLoop) {
Graph graph(scope.main_zone());
CommonOperatorBuilder common_builder(scope.main_zone());
JSOperatorBuilder js_builder(scope.main_zone());
Operator* op;
const Operator* op;
Handle<Object> object =
Handle<Object>(isolate->heap()->undefined_value(), isolate);
@ -933,7 +933,7 @@ TEST(BuildScheduleComplexLoops) {
Graph graph(scope.main_zone());
CommonOperatorBuilder common_builder(scope.main_zone());
JSOperatorBuilder js_builder(scope.main_zone());
Operator* op;
const Operator* op;
Handle<Object> object =
Handle<Object>(isolate->heap()->undefined_value(), isolate);
@ -1180,7 +1180,7 @@ TEST(BuildScheduleBreakAndContinue) {
Graph graph(scope.main_zone());
CommonOperatorBuilder common_builder(scope.main_zone());
JSOperatorBuilder js_builder(scope.main_zone());
Operator* op;
const Operator* op;
Handle<Object> object =
Handle<Object>(isolate->heap()->undefined_value(), isolate);
@ -1510,7 +1510,7 @@ TEST(BuildScheduleSimpleLoopWithCodeMotion) {
CommonOperatorBuilder common_builder(scope.main_zone());
JSOperatorBuilder js_builder(scope.main_zone());
MachineOperatorBuilder machine_builder(scope.main_zone());
Operator* op;
const Operator* op;
Handle<Object> object =
Handle<Object>(isolate->heap()->undefined_value(), isolate);

View File

@ -649,14 +649,14 @@ class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders {
NodeProperties::SetBounds(p1, Bounds(p1_type));
}
void CheckLoweringBinop(IrOpcode::Value expected, Operator* op) {
void CheckLoweringBinop(IrOpcode::Value expected, const Operator* op) {
Node* node = Return(graph()->NewNode(op, p0, p1));
Lower();
CHECK_EQ(expected, node->opcode());
}
void CheckLoweringTruncatedBinop(IrOpcode::Value expected, Operator* op,
Operator* trunc) {
void CheckLoweringTruncatedBinop(IrOpcode::Value expected, const Operator* op,
const Operator* trunc) {
Node* node = graph()->NewNode(op, p0, p1);
Return(graph()->NewNode(trunc, node));
Lower();
@ -1108,7 +1108,7 @@ TEST(InsertBasicChanges) {
}
static void CheckChangesAroundBinop(TestingGraph* t, Operator* op,
static void CheckChangesAroundBinop(TestingGraph* t, const Operator* op,
IrOpcode::Value input_change,
IrOpcode::Value output_change) {
Node* binop = t->graph()->NewNode(op, t->p0, t->p1);
@ -1126,11 +1126,11 @@ static void CheckChangesAroundBinop(TestingGraph* t, Operator* op,
TEST(InsertChangesAroundInt32Binops) {
TestingGraph t(Type::Signed32(), Type::Signed32());
Operator* ops[] = {t.machine()->Int32Add(), t.machine()->Int32Sub(),
t.machine()->Int32Mul(), t.machine()->Int32Div(),
t.machine()->Int32Mod(), t.machine()->Word32And(),
t.machine()->Word32Or(), t.machine()->Word32Xor(),
t.machine()->Word32Shl(), t.machine()->Word32Sar()};
const Operator* ops[] = {t.machine()->Int32Add(), t.machine()->Int32Sub(),
t.machine()->Int32Mul(), t.machine()->Int32Div(),
t.machine()->Int32Mod(), t.machine()->Word32And(),
t.machine()->Word32Or(), t.machine()->Word32Xor(),
t.machine()->Word32Shl(), t.machine()->Word32Sar()};
for (size_t i = 0; i < arraysize(ops); i++) {
CheckChangesAroundBinop(&t, ops[i], IrOpcode::kChangeTaggedToInt32,
@ -1142,8 +1142,8 @@ TEST(InsertChangesAroundInt32Binops) {
TEST(InsertChangesAroundInt32Cmp) {
TestingGraph t(Type::Signed32(), Type::Signed32());
Operator* ops[] = {t.machine()->Int32LessThan(),
t.machine()->Int32LessThanOrEqual()};
const Operator* ops[] = {t.machine()->Int32LessThan(),
t.machine()->Int32LessThanOrEqual()};
for (size_t i = 0; i < arraysize(ops); i++) {
CheckChangesAroundBinop(&t, ops[i], IrOpcode::kChangeTaggedToInt32,
@ -1155,8 +1155,8 @@ TEST(InsertChangesAroundInt32Cmp) {
TEST(InsertChangesAroundUint32Cmp) {
TestingGraph t(Type::Unsigned32(), Type::Unsigned32());
Operator* ops[] = {t.machine()->Uint32LessThan(),
t.machine()->Uint32LessThanOrEqual()};
const Operator* ops[] = {t.machine()->Uint32LessThan(),
t.machine()->Uint32LessThanOrEqual()};
for (size_t i = 0; i < arraysize(ops); i++) {
CheckChangesAroundBinop(&t, ops[i], IrOpcode::kChangeTaggedToUint32,
@ -1168,7 +1168,7 @@ TEST(InsertChangesAroundUint32Cmp) {
TEST(InsertChangesAroundFloat64Binops) {
TestingGraph t(Type::Number(), Type::Number());
Operator* ops[] = {
const Operator* ops[] = {
t.machine()->Float64Add(), t.machine()->Float64Sub(),
t.machine()->Float64Mul(), t.machine()->Float64Div(),
t.machine()->Float64Mod(),
@ -1184,9 +1184,9 @@ TEST(InsertChangesAroundFloat64Binops) {
TEST(InsertChangesAroundFloat64Cmp) {
TestingGraph t(Type::Number(), Type::Number());
Operator* ops[] = {t.machine()->Float64Equal(),
t.machine()->Float64LessThan(),
t.machine()->Float64LessThanOrEqual()};
const Operator* ops[] = {t.machine()->Float64Equal(),
t.machine()->Float64LessThan(),
t.machine()->Float64LessThanOrEqual()};
for (size_t i = 0; i < arraysize(ops); i++) {
CheckChangesAroundBinop(&t, ops[i], IrOpcode::kChangeTaggedToFloat64,