[turbofan] Get rid of type lower bounds.
Review URL: https://codereview.chromium.org/1348073002 Cr-Commit-Position: refs/heads/master@{#30764}
This commit is contained in:
parent
1025d34acf
commit
92903d0a19
@ -157,7 +157,7 @@ Reduction ChangeLowering::ChangeFloat64ToTagged(Node* value, Node* control) {
|
|||||||
|
|
||||||
Reduction ChangeLowering::ChangeInt32ToTagged(Node* value, Node* control) {
|
Reduction ChangeLowering::ChangeInt32ToTagged(Node* value, Node* control) {
|
||||||
if (machine()->Is64() ||
|
if (machine()->Is64() ||
|
||||||
NodeProperties::GetBounds(value).upper->Is(Type::SignedSmall())) {
|
NodeProperties::GetType(value)->Is(Type::SignedSmall())) {
|
||||||
return Replace(ChangeInt32ToSmi(value));
|
return Replace(ChangeInt32ToSmi(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ Reduction ChangeLowering::ChangeInt32ToTagged(Node* value, Node* control) {
|
|||||||
|
|
||||||
Reduction ChangeLowering::ChangeTaggedToUI32(Node* value, Node* control,
|
Reduction ChangeLowering::ChangeTaggedToUI32(Node* value, Node* control,
|
||||||
Signedness signedness) {
|
Signedness signedness) {
|
||||||
if (NodeProperties::GetBounds(value).upper->Is(Type::TaggedSigned())) {
|
if (NodeProperties::GetType(value)->Is(Type::TaggedSigned())) {
|
||||||
return Replace(ChangeSmiToInt32(value));
|
return Replace(ChangeSmiToInt32(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ Reduction ChangeLowering::ChangeTaggedToUI32(Node* value, Node* control,
|
|||||||
? machine()->ChangeFloat64ToInt32()
|
? machine()->ChangeFloat64ToInt32()
|
||||||
: machine()->ChangeFloat64ToUint32();
|
: machine()->ChangeFloat64ToUint32();
|
||||||
|
|
||||||
if (NodeProperties::GetBounds(value).upper->Is(Type::TaggedPointer())) {
|
if (NodeProperties::GetType(value)->Is(Type::TaggedPointer())) {
|
||||||
return Replace(graph()->NewNode(op, LoadHeapNumberValue(value, control)));
|
return Replace(graph()->NewNode(op, LoadHeapNumberValue(value, control)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,7 +312,7 @@ Reduction ChangeLowering::ChangeTaggedToFloat64(Node* value, Node* control) {
|
|||||||
|
|
||||||
|
|
||||||
Reduction ChangeLowering::ChangeUint32ToTagged(Node* value, Node* control) {
|
Reduction ChangeLowering::ChangeUint32ToTagged(Node* value, Node* control) {
|
||||||
if (NodeProperties::GetBounds(value).upper->Is(Type::UnsignedSmall())) {
|
if (NodeProperties::GetType(value)->Is(Type::UnsignedSmall())) {
|
||||||
return Replace(ChangeUint32ToSmi(value));
|
return Replace(ChangeUint32ToSmi(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,13 +127,10 @@ class JSONGraphNodeWriter {
|
|||||||
os_ << ",\"control\":" << (NodeProperties::IsControl(node) ? "true"
|
os_ << ",\"control\":" << (NodeProperties::IsControl(node) ? "true"
|
||||||
: "false");
|
: "false");
|
||||||
if (NodeProperties::IsTyped(node)) {
|
if (NodeProperties::IsTyped(node)) {
|
||||||
Bounds bounds = NodeProperties::GetBounds(node);
|
Type* type = NodeProperties::GetType(node);
|
||||||
std::ostringstream upper;
|
std::ostringstream type_out;
|
||||||
bounds.upper->PrintTo(upper);
|
type->PrintTo(type_out);
|
||||||
std::ostringstream lower;
|
os_ << ",\"type\":\"" << Escaped(type_out, "\"") << "\"";
|
||||||
bounds.lower->PrintTo(lower);
|
|
||||||
os_ << ",\"upper_type\":\"" << Escaped(upper, "\"") << "\"";
|
|
||||||
os_ << ",\"lower_type\":\"" << Escaped(lower, "\"") << "\"";
|
|
||||||
}
|
}
|
||||||
os_ << "}";
|
os_ << "}";
|
||||||
}
|
}
|
||||||
@ -302,12 +299,10 @@ void GraphVisualizer::PrintNode(Node* node, bool gray) {
|
|||||||
os_ << "}";
|
os_ << "}";
|
||||||
|
|
||||||
if (FLAG_trace_turbo_types && NodeProperties::IsTyped(node)) {
|
if (FLAG_trace_turbo_types && NodeProperties::IsTyped(node)) {
|
||||||
Bounds bounds = NodeProperties::GetBounds(node);
|
Type* type = NodeProperties::GetType(node);
|
||||||
std::ostringstream upper;
|
std::ostringstream type_out;
|
||||||
bounds.upper->PrintTo(upper);
|
type->PrintTo(type_out);
|
||||||
std::ostringstream lower;
|
os_ << "|" << Escaped(type_out);
|
||||||
bounds.lower->PrintTo(lower);
|
|
||||||
os_ << "|" << Escaped(upper) << "|" << Escaped(lower);
|
|
||||||
}
|
}
|
||||||
os_ << "}\"\n";
|
os_ << "}\"\n";
|
||||||
|
|
||||||
@ -545,11 +540,9 @@ void GraphC1Visualizer::PrintInputs(Node* node) {
|
|||||||
|
|
||||||
void GraphC1Visualizer::PrintType(Node* node) {
|
void GraphC1Visualizer::PrintType(Node* node) {
|
||||||
if (NodeProperties::IsTyped(node)) {
|
if (NodeProperties::IsTyped(node)) {
|
||||||
Bounds bounds = NodeProperties::GetBounds(node);
|
Type* type = NodeProperties::GetType(node);
|
||||||
os_ << " type:";
|
os_ << " type:";
|
||||||
bounds.upper->PrintTo(os_);
|
type->PrintTo(os_);
|
||||||
os_ << "..";
|
|
||||||
bounds.lower->PrintTo(os_);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,20 +45,20 @@ class JSCallReduction {
|
|||||||
// Determines whether the call takes one input of the given type.
|
// Determines whether the call takes one input of the given type.
|
||||||
bool InputsMatchOne(Type* t1) {
|
bool InputsMatchOne(Type* t1) {
|
||||||
return GetJSCallArity() == 1 &&
|
return GetJSCallArity() == 1 &&
|
||||||
NodeProperties::GetBounds(GetJSCallInput(0)).upper->Is(t1);
|
NodeProperties::GetType(GetJSCallInput(0))->Is(t1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determines whether the call takes two inputs of the given types.
|
// Determines whether the call takes two inputs of the given types.
|
||||||
bool InputsMatchTwo(Type* t1, Type* t2) {
|
bool InputsMatchTwo(Type* t1, Type* t2) {
|
||||||
return GetJSCallArity() == 2 &&
|
return GetJSCallArity() == 2 &&
|
||||||
NodeProperties::GetBounds(GetJSCallInput(0)).upper->Is(t1) &&
|
NodeProperties::GetType(GetJSCallInput(0))->Is(t1) &&
|
||||||
NodeProperties::GetBounds(GetJSCallInput(1)).upper->Is(t2);
|
NodeProperties::GetType(GetJSCallInput(1))->Is(t2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determines whether the call takes inputs all of the given type.
|
// Determines whether the call takes inputs all of the given type.
|
||||||
bool InputsMatchAll(Type* t) {
|
bool InputsMatchAll(Type* t) {
|
||||||
for (int i = 0; i < GetJSCallArity(); i++) {
|
for (int i = 0; i < GetJSCallArity(); i++) {
|
||||||
if (!NodeProperties::GetBounds(GetJSCallInput(i)).upper->Is(t)) {
|
if (!NodeProperties::GetType(GetJSCallInput(i))->Is(t)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -309,7 +309,7 @@ Reduction JSIntrinsicLowering::ReduceSeqStringSetChar(
|
|||||||
node->ReplaceInput(3, effect);
|
node->ReplaceInput(3, effect);
|
||||||
node->ReplaceInput(4, control);
|
node->ReplaceInput(4, control);
|
||||||
node->TrimInputCount(5);
|
node->TrimInputCount(5);
|
||||||
NodeProperties::RemoveBounds(node);
|
NodeProperties::RemoveType(node);
|
||||||
ReplaceWithValue(node, string, node);
|
ReplaceWithValue(node, string, node);
|
||||||
return Changed(node);
|
return Changed(node);
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ Reduction JSTypeFeedbackLowering::Reduce(Node* node) {
|
|||||||
Reduction JSTypeFeedbackLowering::ReduceJSLoadNamed(Node* node) {
|
Reduction JSTypeFeedbackLowering::ReduceJSLoadNamed(Node* node) {
|
||||||
DCHECK_EQ(IrOpcode::kJSLoadNamed, node->opcode());
|
DCHECK_EQ(IrOpcode::kJSLoadNamed, node->opcode());
|
||||||
Node* receiver = NodeProperties::GetValueInput(node, 0);
|
Node* receiver = NodeProperties::GetValueInput(node, 0);
|
||||||
Type* receiver_type = NodeProperties::GetBounds(receiver).upper;
|
Type* receiver_type = NodeProperties::GetType(receiver);
|
||||||
Node* frame_state = NodeProperties::GetFrameStateInput(node, 1);
|
Node* frame_state = NodeProperties::GetFrameStateInput(node, 1);
|
||||||
Node* effect = NodeProperties::GetEffectInput(node);
|
Node* effect = NodeProperties::GetEffectInput(node);
|
||||||
Node* control = NodeProperties::GetControlInput(node);
|
Node* control = NodeProperties::GetControlInput(node);
|
||||||
|
@ -167,8 +167,8 @@ class JSBinopReduction final {
|
|||||||
|
|
||||||
// TODO(jarin): Replace the explicit typing hack with a call to some method
|
// TODO(jarin): Replace the explicit typing hack with a call to some method
|
||||||
// that encapsulates changing the operator and re-typing.
|
// that encapsulates changing the operator and re-typing.
|
||||||
Bounds const bounds = NodeProperties::GetBounds(node_);
|
Type* node_type = NodeProperties::GetType(node_);
|
||||||
NodeProperties::SetBounds(node_, Bounds::NarrowUpper(bounds, type, zone()));
|
NodeProperties::SetType(node_, Type::Intersect(node_type, type, zone()));
|
||||||
|
|
||||||
if (invert) {
|
if (invert) {
|
||||||
// Insert an boolean not to invert the value.
|
// Insert an boolean not to invert the value.
|
||||||
@ -206,12 +206,8 @@ class JSBinopReduction final {
|
|||||||
Node* context() { return NodeProperties::GetContextInput(node_); }
|
Node* context() { return NodeProperties::GetContextInput(node_); }
|
||||||
Node* left() { return NodeProperties::GetValueInput(node_, 0); }
|
Node* left() { return NodeProperties::GetValueInput(node_, 0); }
|
||||||
Node* right() { return NodeProperties::GetValueInput(node_, 1); }
|
Node* right() { return NodeProperties::GetValueInput(node_, 1); }
|
||||||
Type* left_type() {
|
Type* left_type() { return NodeProperties::GetType(node_->InputAt(0)); }
|
||||||
return NodeProperties::GetBounds(node_->InputAt(0)).upper;
|
Type* right_type() { return NodeProperties::GetType(node_->InputAt(1)); }
|
||||||
}
|
|
||||||
Type* right_type() {
|
|
||||||
return NodeProperties::GetBounds(node_->InputAt(1)).upper;
|
|
||||||
}
|
|
||||||
|
|
||||||
SimplifiedOperatorBuilder* simplified() { return lowering_->simplified(); }
|
SimplifiedOperatorBuilder* simplified() { return lowering_->simplified(); }
|
||||||
Graph* graph() const { return lowering_->graph(); }
|
Graph* graph() const { return lowering_->graph(); }
|
||||||
@ -305,7 +301,7 @@ class JSBinopReduction final {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Node* ConvertPlainPrimitiveToNumber(Node* node) {
|
Node* ConvertPlainPrimitiveToNumber(Node* node) {
|
||||||
DCHECK(NodeProperties::GetBounds(node).upper->Is(Type::PlainPrimitive()));
|
DCHECK(NodeProperties::GetType(node)->Is(Type::PlainPrimitive()));
|
||||||
// Avoid inserting too many eager ToNumber() operations.
|
// Avoid inserting too many eager ToNumber() operations.
|
||||||
Reduction const reduction = lowering_->ReduceJSToNumberInput(node);
|
Reduction const reduction = lowering_->ReduceJSToNumberInput(node);
|
||||||
if (reduction.Changed()) return reduction.replacement();
|
if (reduction.Changed()) return reduction.replacement();
|
||||||
@ -316,7 +312,7 @@ class JSBinopReduction final {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Node* ConvertSingleInputToNumber(Node* node, Node* frame_state) {
|
Node* ConvertSingleInputToNumber(Node* node, Node* frame_state) {
|
||||||
DCHECK(!NodeProperties::GetBounds(node).upper->Is(Type::PlainPrimitive()));
|
DCHECK(!NodeProperties::GetType(node)->Is(Type::PlainPrimitive()));
|
||||||
Node* const n = graph()->NewNode(javascript()->ToNumber(), node, context(),
|
Node* const n = graph()->NewNode(javascript()->ToNumber(), node, context(),
|
||||||
frame_state, effect(), control());
|
frame_state, effect(), control());
|
||||||
NodeProperties::ReplaceUses(node_, node_, node_, n, n);
|
NodeProperties::ReplaceUses(node_, node_, node_, n, n);
|
||||||
@ -363,7 +359,7 @@ class JSBinopReduction final {
|
|||||||
if (NodeProperties::IsEffectEdge(edge)) edge.UpdateTo(exception_effect);
|
if (NodeProperties::IsEffectEdge(edge)) edge.UpdateTo(exception_effect);
|
||||||
if (NodeProperties::IsValueEdge(edge)) edge.UpdateTo(exception_value);
|
if (NodeProperties::IsValueEdge(edge)) edge.UpdateTo(exception_value);
|
||||||
}
|
}
|
||||||
NodeProperties::RemoveBounds(exception_merge);
|
NodeProperties::RemoveType(exception_merge);
|
||||||
exception_merge->ReplaceInput(0, left_exception);
|
exception_merge->ReplaceInput(0, left_exception);
|
||||||
exception_merge->ReplaceInput(1, right_exception);
|
exception_merge->ReplaceInput(1, right_exception);
|
||||||
exception_merge->set_op(common()->Merge(2));
|
exception_merge->set_op(common()->Merge(2));
|
||||||
@ -374,7 +370,7 @@ class JSBinopReduction final {
|
|||||||
|
|
||||||
Node* ConvertToUI32(Node* node, Signedness signedness) {
|
Node* ConvertToUI32(Node* node, Signedness signedness) {
|
||||||
// Avoid introducing too many eager NumberToXXnt32() operations.
|
// Avoid introducing too many eager NumberToXXnt32() operations.
|
||||||
Type* type = NodeProperties::GetBounds(node).upper;
|
Type* type = NodeProperties::GetType(node);
|
||||||
if (signedness == kSigned) {
|
if (signedness == kSigned) {
|
||||||
if (!type->Is(Type::Signed32())) {
|
if (!type->Is(Type::Signed32())) {
|
||||||
node = graph()->NewNode(simplified()->NumberToInt32(), node);
|
node = graph()->NewNode(simplified()->NumberToInt32(), node);
|
||||||
@ -630,7 +626,7 @@ Reduction JSTypedLowering::ReduceJSStrictEqual(Node* node, bool invert) {
|
|||||||
|
|
||||||
Reduction JSTypedLowering::ReduceJSUnaryNot(Node* node) {
|
Reduction JSTypedLowering::ReduceJSUnaryNot(Node* node) {
|
||||||
Node* const input = node->InputAt(0);
|
Node* const input = node->InputAt(0);
|
||||||
Type* const input_type = NodeProperties::GetBounds(input).upper;
|
Type* const input_type = NodeProperties::GetType(input);
|
||||||
if (input_type->Is(Type::Boolean())) {
|
if (input_type->Is(Type::Boolean())) {
|
||||||
// JSUnaryNot(x:boolean) => BooleanNot(x)
|
// JSUnaryNot(x:boolean) => BooleanNot(x)
|
||||||
node->set_op(simplified()->BooleanNot());
|
node->set_op(simplified()->BooleanNot());
|
||||||
@ -662,7 +658,7 @@ Reduction JSTypedLowering::ReduceJSUnaryNot(Node* node) {
|
|||||||
|
|
||||||
Reduction JSTypedLowering::ReduceJSToBoolean(Node* node) {
|
Reduction JSTypedLowering::ReduceJSToBoolean(Node* node) {
|
||||||
Node* const input = node->InputAt(0);
|
Node* const input = node->InputAt(0);
|
||||||
Type* const input_type = NodeProperties::GetBounds(input).upper;
|
Type* const input_type = NodeProperties::GetType(input);
|
||||||
if (input_type->Is(Type::Boolean())) {
|
if (input_type->Is(Type::Boolean())) {
|
||||||
// JSToBoolean(x:boolean) => x
|
// JSToBoolean(x:boolean) => x
|
||||||
return Replace(input);
|
return Replace(input);
|
||||||
@ -698,7 +694,7 @@ Reduction JSTypedLowering::ReduceJSToNumberInput(Node* input) {
|
|||||||
return Changed(input); // JSToNumber(JSToNumber(x)) => JSToNumber(x)
|
return Changed(input); // JSToNumber(JSToNumber(x)) => JSToNumber(x)
|
||||||
}
|
}
|
||||||
// Check if we have a cached conversion.
|
// Check if we have a cached conversion.
|
||||||
Type* input_type = NodeProperties::GetBounds(input).upper;
|
Type* input_type = NodeProperties::GetType(input);
|
||||||
if (input_type->Is(Type::Number())) {
|
if (input_type->Is(Type::Number())) {
|
||||||
// JSToNumber(x:number) => x
|
// JSToNumber(x:number) => x
|
||||||
return Changed(input);
|
return Changed(input);
|
||||||
@ -728,7 +724,7 @@ Reduction JSTypedLowering::ReduceJSToNumber(Node* node) {
|
|||||||
ReplaceWithValue(node, reduction.replacement());
|
ReplaceWithValue(node, reduction.replacement());
|
||||||
return reduction;
|
return reduction;
|
||||||
}
|
}
|
||||||
Type* const input_type = NodeProperties::GetBounds(input).upper;
|
Type* const input_type = NodeProperties::GetType(input);
|
||||||
if (input_type->Is(Type::PlainPrimitive())) {
|
if (input_type->Is(Type::PlainPrimitive())) {
|
||||||
if (NodeProperties::GetContextInput(node) !=
|
if (NodeProperties::GetContextInput(node) !=
|
||||||
jsgraph()->NoContextConstant() ||
|
jsgraph()->NoContextConstant() ||
|
||||||
@ -757,7 +753,7 @@ Reduction JSTypedLowering::ReduceJSToStringInput(Node* input) {
|
|||||||
if (result.Changed()) return result;
|
if (result.Changed()) return result;
|
||||||
return Changed(input); // JSToString(JSToString(x)) => JSToString(x)
|
return Changed(input); // JSToString(JSToString(x)) => JSToString(x)
|
||||||
}
|
}
|
||||||
Type* input_type = NodeProperties::GetBounds(input).upper;
|
Type* input_type = NodeProperties::GetType(input);
|
||||||
if (input_type->Is(Type::String())) {
|
if (input_type->Is(Type::String())) {
|
||||||
return Changed(input); // JSToString(x:string) => x
|
return Changed(input); // JSToString(x:string) => x
|
||||||
}
|
}
|
||||||
@ -801,7 +797,7 @@ Reduction JSTypedLowering::ReduceJSLoadGlobal(Node* node) {
|
|||||||
Reduction JSTypedLowering::ReduceJSLoadNamed(Node* node) {
|
Reduction JSTypedLowering::ReduceJSLoadNamed(Node* node) {
|
||||||
DCHECK_EQ(IrOpcode::kJSLoadNamed, node->opcode());
|
DCHECK_EQ(IrOpcode::kJSLoadNamed, node->opcode());
|
||||||
Node* receiver = NodeProperties::GetValueInput(node, 0);
|
Node* receiver = NodeProperties::GetValueInput(node, 0);
|
||||||
Type* receiver_type = NodeProperties::GetBounds(receiver).upper;
|
Type* receiver_type = NodeProperties::GetType(receiver);
|
||||||
Node* effect = NodeProperties::GetEffectInput(node);
|
Node* effect = NodeProperties::GetEffectInput(node);
|
||||||
Node* control = NodeProperties::GetControlInput(node);
|
Node* control = NodeProperties::GetControlInput(node);
|
||||||
Handle<Name> name = LoadNamedParametersOf(node->op()).name();
|
Handle<Name> name = LoadNamedParametersOf(node->op()).name();
|
||||||
@ -822,7 +818,7 @@ Reduction JSTypedLowering::ReduceJSLoadNamed(Node* node) {
|
|||||||
Reduction JSTypedLowering::ReduceJSLoadProperty(Node* node) {
|
Reduction JSTypedLowering::ReduceJSLoadProperty(Node* node) {
|
||||||
Node* key = NodeProperties::GetValueInput(node, 1);
|
Node* key = NodeProperties::GetValueInput(node, 1);
|
||||||
Node* base = NodeProperties::GetValueInput(node, 0);
|
Node* base = NodeProperties::GetValueInput(node, 0);
|
||||||
Type* key_type = NodeProperties::GetBounds(key).upper;
|
Type* key_type = NodeProperties::GetType(key);
|
||||||
HeapObjectMatcher mbase(base);
|
HeapObjectMatcher mbase(base);
|
||||||
if (mbase.HasValue() && mbase.Value()->IsJSTypedArray()) {
|
if (mbase.HasValue() && mbase.Value()->IsJSTypedArray()) {
|
||||||
Handle<JSTypedArray> const array =
|
Handle<JSTypedArray> const array =
|
||||||
@ -867,8 +863,8 @@ Reduction JSTypedLowering::ReduceJSStoreProperty(Node* node) {
|
|||||||
Node* key = NodeProperties::GetValueInput(node, 1);
|
Node* key = NodeProperties::GetValueInput(node, 1);
|
||||||
Node* base = NodeProperties::GetValueInput(node, 0);
|
Node* base = NodeProperties::GetValueInput(node, 0);
|
||||||
Node* value = NodeProperties::GetValueInput(node, 2);
|
Node* value = NodeProperties::GetValueInput(node, 2);
|
||||||
Type* key_type = NodeProperties::GetBounds(key).upper;
|
Type* key_type = NodeProperties::GetType(key);
|
||||||
Type* value_type = NodeProperties::GetBounds(value).upper;
|
Type* value_type = NodeProperties::GetType(value);
|
||||||
HeapObjectMatcher mbase(base);
|
HeapObjectMatcher mbase(base);
|
||||||
if (mbase.HasValue() && mbase.Value()->IsJSTypedArray()) {
|
if (mbase.HasValue() && mbase.Value()->IsJSTypedArray()) {
|
||||||
Handle<JSTypedArray> const array =
|
Handle<JSTypedArray> const array =
|
||||||
@ -1190,7 +1186,7 @@ Reduction JSTypedLowering::ReduceJSCreateLiteralObject(Node* node) {
|
|||||||
Reduction JSTypedLowering::ReduceJSCreateWithContext(Node* node) {
|
Reduction JSTypedLowering::ReduceJSCreateWithContext(Node* node) {
|
||||||
DCHECK_EQ(IrOpcode::kJSCreateWithContext, node->opcode());
|
DCHECK_EQ(IrOpcode::kJSCreateWithContext, node->opcode());
|
||||||
Node* const input = NodeProperties::GetValueInput(node, 0);
|
Node* const input = NodeProperties::GetValueInput(node, 0);
|
||||||
Type* input_type = NodeProperties::GetBounds(input).upper;
|
Type* input_type = NodeProperties::GetType(input);
|
||||||
if (FLAG_turbo_allocate && input_type->Is(Type::Receiver())) {
|
if (FLAG_turbo_allocate && input_type->Is(Type::Receiver())) {
|
||||||
// JSCreateWithContext(o:receiver, f)
|
// JSCreateWithContext(o:receiver, f)
|
||||||
Node* const effect = NodeProperties::GetEffectInput(node);
|
Node* const effect = NodeProperties::GetEffectInput(node);
|
||||||
@ -1209,7 +1205,7 @@ Reduction JSTypedLowering::ReduceJSCreateWithContext(Node* node) {
|
|||||||
a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), input);
|
a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), input);
|
||||||
a.Store(AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX), load);
|
a.Store(AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX), load);
|
||||||
// TODO(mstarzinger): We could mutate {node} into the allocation instead.
|
// TODO(mstarzinger): We could mutate {node} into the allocation instead.
|
||||||
NodeProperties::SetBounds(a.allocation(), NodeProperties::GetBounds(node));
|
NodeProperties::SetType(a.allocation(), NodeProperties::GetType(node));
|
||||||
ReplaceWithValue(node, node, a.effect());
|
ReplaceWithValue(node, node, a.effect());
|
||||||
node->ReplaceInput(0, a.allocation());
|
node->ReplaceInput(0, a.allocation());
|
||||||
node->ReplaceInput(1, a.effect());
|
node->ReplaceInput(1, a.effect());
|
||||||
@ -1248,7 +1244,7 @@ Reduction JSTypedLowering::ReduceJSCreateBlockContext(Node* node) {
|
|||||||
a.Store(AccessBuilder::ForContextSlot(i), jsgraph()->TheHoleConstant());
|
a.Store(AccessBuilder::ForContextSlot(i), jsgraph()->TheHoleConstant());
|
||||||
}
|
}
|
||||||
// TODO(mstarzinger): We could mutate {node} into the allocation instead.
|
// TODO(mstarzinger): We could mutate {node} into the allocation instead.
|
||||||
NodeProperties::SetBounds(a.allocation(), NodeProperties::GetBounds(node));
|
NodeProperties::SetType(a.allocation(), NodeProperties::GetType(node));
|
||||||
ReplaceWithValue(node, node, a.effect());
|
ReplaceWithValue(node, node, a.effect());
|
||||||
node->ReplaceInput(0, a.allocation());
|
node->ReplaceInput(0, a.allocation());
|
||||||
node->ReplaceInput(1, a.effect());
|
node->ReplaceInput(1, a.effect());
|
||||||
@ -1265,9 +1261,9 @@ Reduction JSTypedLowering::ReduceJSCallFunction(Node* node) {
|
|||||||
CallFunctionParameters const& p = CallFunctionParametersOf(node->op());
|
CallFunctionParameters const& p = CallFunctionParametersOf(node->op());
|
||||||
int const arity = static_cast<int>(p.arity() - 2);
|
int const arity = static_cast<int>(p.arity() - 2);
|
||||||
Node* const function = NodeProperties::GetValueInput(node, 0);
|
Node* const function = NodeProperties::GetValueInput(node, 0);
|
||||||
Type* const function_type = NodeProperties::GetBounds(function).upper;
|
Type* const function_type = NodeProperties::GetType(function);
|
||||||
Node* const receiver = NodeProperties::GetValueInput(node, 1);
|
Node* const receiver = NodeProperties::GetValueInput(node, 1);
|
||||||
Type* const receiver_type = NodeProperties::GetBounds(receiver).upper;
|
Type* const receiver_type = NodeProperties::GetType(receiver);
|
||||||
Node* const effect = NodeProperties::GetEffectInput(node);
|
Node* const effect = NodeProperties::GetEffectInput(node);
|
||||||
Node* const control = NodeProperties::GetControlInput(node);
|
Node* const control = NodeProperties::GetControlInput(node);
|
||||||
|
|
||||||
@ -1567,7 +1563,7 @@ Reduction JSTypedLowering::Reduce(Node* node) {
|
|||||||
// result value and can simply replace the node if it's eliminable.
|
// result value and can simply replace the node if it's eliminable.
|
||||||
if (!NodeProperties::IsConstant(node) && NodeProperties::IsTyped(node) &&
|
if (!NodeProperties::IsConstant(node) && NodeProperties::IsTyped(node) &&
|
||||||
node->op()->HasProperty(Operator::kEliminatable)) {
|
node->op()->HasProperty(Operator::kEliminatable)) {
|
||||||
Type* upper = NodeProperties::GetBounds(node).upper;
|
Type* upper = NodeProperties::GetType(node);
|
||||||
if (upper->IsConstant()) {
|
if (upper->IsConstant()) {
|
||||||
Node* replacement = jsgraph()->Constant(upper->AsConstant()->Value());
|
Node* replacement = jsgraph()->Constant(upper->AsConstant()->Value());
|
||||||
ReplaceWithValue(node, replacement);
|
ReplaceWithValue(node, replacement);
|
||||||
|
@ -108,23 +108,18 @@ class NodeProperties final {
|
|||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Type Bounds.
|
// Type.
|
||||||
|
|
||||||
static bool IsTyped(Node* node) {
|
static bool IsTyped(Node* node) { return node->type() != nullptr; }
|
||||||
Bounds const bounds = node->bounds();
|
static Type* GetType(Node* node) {
|
||||||
DCHECK(!bounds.lower == !bounds.upper);
|
|
||||||
return bounds.upper;
|
|
||||||
}
|
|
||||||
static Bounds GetBounds(Node* node) {
|
|
||||||
DCHECK(IsTyped(node));
|
DCHECK(IsTyped(node));
|
||||||
return node->bounds();
|
return node->type();
|
||||||
}
|
}
|
||||||
static void SetBounds(Node* node, Bounds bounds) {
|
static void SetType(Node* node, Type* type) {
|
||||||
DCHECK_NOT_NULL(bounds.lower);
|
DCHECK_NOT_NULL(type);
|
||||||
DCHECK_NOT_NULL(bounds.upper);
|
node->set_type(type);
|
||||||
node->set_bounds(bounds);
|
|
||||||
}
|
}
|
||||||
static void RemoveBounds(Node* node) { node->set_bounds(Bounds()); }
|
static void RemoveType(Node* node) { node->set_type(nullptr); }
|
||||||
static bool AllValueInputsAreTyped(Node* node);
|
static bool AllValueInputsAreTyped(Node* node);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -112,7 +112,7 @@ Node* Node::Clone(Zone* zone, NodeId id, const Node* node) {
|
|||||||
? node->inputs_.inline_
|
? node->inputs_.inline_
|
||||||
: node->inputs_.outline_->inputs_;
|
: node->inputs_.outline_->inputs_;
|
||||||
Node* const clone = New(zone, id, node->op(), input_count, inputs, false);
|
Node* const clone = New(zone, id, node->op(), input_count, inputs, false);
|
||||||
clone->set_bounds(node->bounds());
|
clone->set_type(node->type());
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,6 +273,7 @@ bool Node::OwnedBy(Node const* owner1, Node const* owner2) const {
|
|||||||
|
|
||||||
Node::Node(NodeId id, const Operator* op, int inline_count, int inline_capacity)
|
Node::Node(NodeId id, const Operator* op, int inline_count, int inline_capacity)
|
||||||
: op_(op),
|
: op_(op),
|
||||||
|
type_(nullptr),
|
||||||
mark_(0),
|
mark_(0),
|
||||||
bit_field_(IdField::encode(id) | InlineCountField::encode(inline_count) |
|
bit_field_(IdField::encode(id) | InlineCountField::encode(inline_count) |
|
||||||
InlineCapacityField::encode(inline_capacity)),
|
InlineCapacityField::encode(inline_capacity)),
|
||||||
|
@ -284,9 +284,9 @@ class Node final {
|
|||||||
|
|
||||||
void* operator new(size_t, void* location) { return location; }
|
void* operator new(size_t, void* location) { return location; }
|
||||||
|
|
||||||
// Only NodeProperties should manipulate the bounds.
|
// Only NodeProperties should manipulate the type.
|
||||||
Bounds bounds() const { return bounds_; }
|
Type* type() const { return type_; }
|
||||||
void set_bounds(Bounds b) { bounds_ = b; }
|
void set_type(Type* type) { type_ = type; }
|
||||||
|
|
||||||
// Only NodeMarkers should manipulate the marks on nodes.
|
// Only NodeMarkers should manipulate the marks on nodes.
|
||||||
Mark mark() { return mark_; }
|
Mark mark() { return mark_; }
|
||||||
@ -306,7 +306,7 @@ class Node final {
|
|||||||
static const int kMaxInlineCapacity = InlineCapacityField::kMax - 1;
|
static const int kMaxInlineCapacity = InlineCapacityField::kMax - 1;
|
||||||
|
|
||||||
const Operator* op_;
|
const Operator* op_;
|
||||||
Bounds bounds_;
|
Type* type_;
|
||||||
Mark mark_;
|
Mark mark_;
|
||||||
uint32_t bit_field_;
|
uint32_t bit_field_;
|
||||||
Use* first_use_;
|
Use* first_use_;
|
||||||
|
@ -99,7 +99,7 @@ static void PeelOuterLoopsForOsr(Graph* graph, CommonOperatorBuilder* common,
|
|||||||
}
|
}
|
||||||
copy = graph->NewNode(orig->op(), orig->InputCount(), &tmp_inputs[0]);
|
copy = graph->NewNode(orig->op(), orig->InputCount(), &tmp_inputs[0]);
|
||||||
if (NodeProperties::IsTyped(orig)) {
|
if (NodeProperties::IsTyped(orig)) {
|
||||||
NodeProperties::SetBounds(copy, NodeProperties::GetBounds(orig));
|
NodeProperties::SetType(copy, NodeProperties::GetType(orig));
|
||||||
}
|
}
|
||||||
mapping->at(orig->id()) = copy;
|
mapping->at(orig->id()) = copy;
|
||||||
TRACE(" copy #%d:%s -> #%d\n", orig->id(), orig->op()->mnemonic(),
|
TRACE(" copy #%d:%s -> #%d\n", orig->id(), orig->op()->mnemonic(),
|
||||||
|
@ -30,7 +30,9 @@ class RepresentationChanger {
|
|||||||
type_error_(false) {}
|
type_error_(false) {}
|
||||||
|
|
||||||
// TODO(titzer): should Word64 also be implicitly convertable to others?
|
// TODO(titzer): should Word64 also be implicitly convertable to others?
|
||||||
static const MachineTypeUnion rWord = kRepWord8 | kRepWord16 | kRepWord32;
|
static bool IsWord(MachineTypeUnion type) {
|
||||||
|
return (type & (kRepWord8 | kRepWord16 | kRepWord32)) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
Node* GetRepresentationFor(Node* node, MachineTypeUnion output_type,
|
Node* GetRepresentationFor(Node* node, MachineTypeUnion output_type,
|
||||||
MachineTypeUnion use_type) {
|
MachineTypeUnion use_type) {
|
||||||
@ -42,7 +44,7 @@ class RepresentationChanger {
|
|||||||
// Representations are the same. That's a no-op.
|
// Representations are the same. That's a no-op.
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
if ((use_type & rWord) && (output_type & rWord)) {
|
if (IsWord(use_type) && IsWord(output_type)) {
|
||||||
// Both are words less than or equal to 32-bits.
|
// Both are words less than or equal to 32-bits.
|
||||||
// Since loads of integers from memory implicitly sign or zero extend the
|
// Since loads of integers from memory implicitly sign or zero extend the
|
||||||
// value to the full machine word size and stores implicitly truncate,
|
// value to the full machine word size and stores implicitly truncate,
|
||||||
@ -57,7 +59,7 @@ class RepresentationChanger {
|
|||||||
return GetFloat64RepresentationFor(node, output_type);
|
return GetFloat64RepresentationFor(node, output_type);
|
||||||
} else if (use_type & kRepBit) {
|
} else if (use_type & kRepBit) {
|
||||||
return GetBitRepresentationFor(node, output_type);
|
return GetBitRepresentationFor(node, output_type);
|
||||||
} else if (use_type & rWord) {
|
} else if (IsWord(use_type)) {
|
||||||
return GetWord32RepresentationFor(node, output_type,
|
return GetWord32RepresentationFor(node, output_type,
|
||||||
use_type & kTypeUint32);
|
use_type & kTypeUint32);
|
||||||
} else if (use_type & kRepWord64) {
|
} else if (use_type & kRepWord64) {
|
||||||
@ -97,7 +99,7 @@ class RepresentationChanger {
|
|||||||
const Operator* op;
|
const Operator* op;
|
||||||
if (output_type & kRepBit) {
|
if (output_type & kRepBit) {
|
||||||
op = simplified()->ChangeBitToBool();
|
op = simplified()->ChangeBitToBool();
|
||||||
} else if (output_type & rWord) {
|
} else if (IsWord(output_type)) {
|
||||||
if (output_type & kTypeUint32) {
|
if (output_type & kTypeUint32) {
|
||||||
op = simplified()->ChangeUint32ToTagged();
|
op = simplified()->ChangeUint32ToTagged();
|
||||||
} else if (output_type & kTypeInt32) {
|
} else if (output_type & kTypeInt32) {
|
||||||
@ -140,7 +142,7 @@ class RepresentationChanger {
|
|||||||
const Operator* op;
|
const Operator* op;
|
||||||
if (output_type & kRepBit) {
|
if (output_type & kRepBit) {
|
||||||
return TypeError(node, output_type, kRepFloat32);
|
return TypeError(node, output_type, kRepFloat32);
|
||||||
} else if (output_type & rWord) {
|
} else if (IsWord(output_type)) {
|
||||||
if (output_type & kTypeUint32) {
|
if (output_type & kTypeUint32) {
|
||||||
op = machine()->ChangeUint32ToFloat64();
|
op = machine()->ChangeUint32ToFloat64();
|
||||||
} else {
|
} else {
|
||||||
@ -186,7 +188,7 @@ class RepresentationChanger {
|
|||||||
const Operator* op;
|
const Operator* op;
|
||||||
if (output_type & kRepBit) {
|
if (output_type & kRepBit) {
|
||||||
return TypeError(node, output_type, kRepFloat64);
|
return TypeError(node, output_type, kRepFloat64);
|
||||||
} else if (output_type & rWord) {
|
} else if (IsWord(output_type)) {
|
||||||
if (output_type & kTypeUint32) {
|
if (output_type & kTypeUint32) {
|
||||||
op = machine()->ChangeUint32ToFloat64();
|
op = machine()->ChangeUint32ToFloat64();
|
||||||
} else {
|
} else {
|
||||||
|
@ -345,13 +345,9 @@ std::ostream& operator<<(std::ostream& os, const Schedule& s) {
|
|||||||
for (Node* node : *block) {
|
for (Node* node : *block) {
|
||||||
os << " " << *node;
|
os << " " << *node;
|
||||||
if (NodeProperties::IsTyped(node)) {
|
if (NodeProperties::IsTyped(node)) {
|
||||||
Bounds bounds = NodeProperties::GetBounds(node);
|
Type* type = NodeProperties::GetType(node);
|
||||||
os << " : ";
|
os << " : ";
|
||||||
bounds.lower->PrintTo(os);
|
type->PrintTo(os);
|
||||||
if (!bounds.upper->Is(bounds.lower)) {
|
|
||||||
os << "..";
|
|
||||||
bounds.upper->PrintTo(os);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
os << "\n";
|
os << "\n";
|
||||||
}
|
}
|
||||||
|
@ -178,8 +178,8 @@ class RepresentationSelector {
|
|||||||
|
|
||||||
bool BothInputsAre(Node* node, Type* type) {
|
bool BothInputsAre(Node* node, Type* type) {
|
||||||
DCHECK_EQ(2, node->InputCount());
|
DCHECK_EQ(2, node->InputCount());
|
||||||
return NodeProperties::GetBounds(node->InputAt(0)).upper->Is(type) &&
|
return NodeProperties::GetType(node->InputAt(0))->Is(type) &&
|
||||||
NodeProperties::GetBounds(node->InputAt(1)).upper->Is(type);
|
NodeProperties::GetType(node->InputAt(1))->Is(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessTruncateWord32Input(Node* node, int index, MachineTypeUnion use) {
|
void ProcessTruncateWord32Input(Node* node, int index, MachineTypeUnion use) {
|
||||||
@ -313,7 +313,7 @@ class RepresentationSelector {
|
|||||||
// Infer representation for phi-like nodes.
|
// Infer representation for phi-like nodes.
|
||||||
MachineType GetRepresentationForPhi(Node* node, MachineTypeUnion use) {
|
MachineType GetRepresentationForPhi(Node* node, MachineTypeUnion use) {
|
||||||
// Phis adapt to the output representation their uses demand.
|
// Phis adapt to the output representation their uses demand.
|
||||||
Type* upper = NodeProperties::GetBounds(node).upper;
|
Type* upper = NodeProperties::GetType(node);
|
||||||
if ((use & kRepMask) == kRepFloat32) {
|
if ((use & kRepMask) == kRepFloat32) {
|
||||||
// only float32 uses.
|
// only float32 uses.
|
||||||
return kRepFloat32;
|
return kRepFloat32;
|
||||||
@ -355,7 +355,7 @@ class RepresentationSelector {
|
|||||||
ProcessInput(node, 0, kRepBit);
|
ProcessInput(node, 0, kRepBit);
|
||||||
MachineType output = GetRepresentationForPhi(node, use);
|
MachineType output = GetRepresentationForPhi(node, use);
|
||||||
|
|
||||||
Type* upper = NodeProperties::GetBounds(node).upper;
|
Type* upper = NodeProperties::GetType(node);
|
||||||
MachineType output_type =
|
MachineType output_type =
|
||||||
static_cast<MachineType>(changer_->TypeFromUpperBound(upper) | output);
|
static_cast<MachineType>(changer_->TypeFromUpperBound(upper) | output);
|
||||||
SetOutput(node, output_type);
|
SetOutput(node, output_type);
|
||||||
@ -385,7 +385,7 @@ class RepresentationSelector {
|
|||||||
SimplifiedLowering* lowering) {
|
SimplifiedLowering* lowering) {
|
||||||
MachineType output = GetRepresentationForPhi(node, use);
|
MachineType output = GetRepresentationForPhi(node, use);
|
||||||
|
|
||||||
Type* upper = NodeProperties::GetBounds(node).upper;
|
Type* upper = NodeProperties::GetType(node);
|
||||||
MachineType output_type =
|
MachineType output_type =
|
||||||
static_cast<MachineType>(changer_->TypeFromUpperBound(upper) | output);
|
static_cast<MachineType>(changer_->TypeFromUpperBound(upper) | output);
|
||||||
SetOutput(node, output_type);
|
SetOutput(node, output_type);
|
||||||
@ -470,7 +470,7 @@ class RepresentationSelector {
|
|||||||
bool CanLowerToInt32Binop(Node* node, MachineTypeUnion use) {
|
bool CanLowerToInt32Binop(Node* node, MachineTypeUnion use) {
|
||||||
return BothInputsAre(node, Type::Signed32()) &&
|
return BothInputsAre(node, Type::Signed32()) &&
|
||||||
(!CanObserveNonInt32(use) ||
|
(!CanObserveNonInt32(use) ||
|
||||||
NodeProperties::GetBounds(node).upper->Is(Type::Signed32()));
|
NodeProperties::GetType(node)->Is(Type::Signed32()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CanLowerToInt32AdditiveBinop(Node* node, MachineTypeUnion use) {
|
bool CanLowerToInt32AdditiveBinop(Node* node, MachineTypeUnion use) {
|
||||||
@ -481,7 +481,7 @@ class RepresentationSelector {
|
|||||||
bool CanLowerToUint32Binop(Node* node, MachineTypeUnion use) {
|
bool CanLowerToUint32Binop(Node* node, MachineTypeUnion use) {
|
||||||
return BothInputsAre(node, Type::Unsigned32()) &&
|
return BothInputsAre(node, Type::Unsigned32()) &&
|
||||||
(!CanObserveNonUint32(use) ||
|
(!CanObserveNonUint32(use) ||
|
||||||
NodeProperties::GetBounds(node).upper->Is(Type::Unsigned32()));
|
NodeProperties::GetType(node)->Is(Type::Unsigned32()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CanLowerToUint32AdditiveBinop(Node* node, MachineTypeUnion use) {
|
bool CanLowerToUint32AdditiveBinop(Node* node, MachineTypeUnion use) {
|
||||||
@ -523,7 +523,7 @@ class RepresentationSelector {
|
|||||||
return VisitLeaf(node, 0);
|
return VisitLeaf(node, 0);
|
||||||
case IrOpcode::kParameter: {
|
case IrOpcode::kParameter: {
|
||||||
// TODO(titzer): use representation from linkage.
|
// TODO(titzer): use representation from linkage.
|
||||||
Type* upper = NodeProperties::GetBounds(node).upper;
|
Type* upper = NodeProperties::GetType(node);
|
||||||
ProcessInput(node, 0, 0);
|
ProcessInput(node, 0, 0);
|
||||||
SetOutput(node, kRepTagged | changer_->TypeFromUpperBound(upper));
|
SetOutput(node, kRepTagged | changer_->TypeFromUpperBound(upper));
|
||||||
return;
|
return;
|
||||||
@ -731,7 +731,7 @@ class RepresentationSelector {
|
|||||||
case IrOpcode::kNumberToInt32: {
|
case IrOpcode::kNumberToInt32: {
|
||||||
MachineTypeUnion use_rep = use & kRepMask;
|
MachineTypeUnion use_rep = use & kRepMask;
|
||||||
Node* input = node->InputAt(0);
|
Node* input = node->InputAt(0);
|
||||||
Type* in_upper = NodeProperties::GetBounds(input).upper;
|
Type* in_upper = NodeProperties::GetType(input);
|
||||||
MachineTypeUnion in = GetInfo(input)->output;
|
MachineTypeUnion in = GetInfo(input)->output;
|
||||||
if (in_upper->Is(Type::Signed32())) {
|
if (in_upper->Is(Type::Signed32())) {
|
||||||
// If the input has type int32, pass through representation.
|
// If the input has type int32, pass through representation.
|
||||||
@ -761,7 +761,7 @@ class RepresentationSelector {
|
|||||||
case IrOpcode::kNumberToUint32: {
|
case IrOpcode::kNumberToUint32: {
|
||||||
MachineTypeUnion use_rep = use & kRepMask;
|
MachineTypeUnion use_rep = use & kRepMask;
|
||||||
Node* input = node->InputAt(0);
|
Node* input = node->InputAt(0);
|
||||||
Type* in_upper = NodeProperties::GetBounds(input).upper;
|
Type* in_upper = NodeProperties::GetType(input);
|
||||||
MachineTypeUnion in = GetInfo(input)->output;
|
MachineTypeUnion in = GetInfo(input)->output;
|
||||||
if (in_upper->Is(Type::Unsigned32())) {
|
if (in_upper->Is(Type::Unsigned32())) {
|
||||||
// If the input has type uint32, pass through representation.
|
// If the input has type uint32, pass through representation.
|
||||||
@ -1228,7 +1228,7 @@ void SimplifiedLowering::DoLoadField(Node* node) {
|
|||||||
|
|
||||||
void SimplifiedLowering::DoStoreField(Node* node) {
|
void SimplifiedLowering::DoStoreField(Node* node) {
|
||||||
const FieldAccess& access = FieldAccessOf(node->op());
|
const FieldAccess& access = FieldAccessOf(node->op());
|
||||||
Type* type = NodeProperties::GetBounds(node->InputAt(1)).upper;
|
Type* type = NodeProperties::GetType(node->InputAt(1));
|
||||||
WriteBarrierKind kind =
|
WriteBarrierKind kind =
|
||||||
ComputeWriteBarrierKind(access.base_is_tagged, access.machine_type, type);
|
ComputeWriteBarrierKind(access.base_is_tagged, access.machine_type, type);
|
||||||
node->set_op(
|
node->set_op(
|
||||||
@ -1335,7 +1335,7 @@ void SimplifiedLowering::DoLoadElement(Node* node) {
|
|||||||
|
|
||||||
void SimplifiedLowering::DoStoreElement(Node* node) {
|
void SimplifiedLowering::DoStoreElement(Node* node) {
|
||||||
const ElementAccess& access = ElementAccessOf(node->op());
|
const ElementAccess& access = ElementAccessOf(node->op());
|
||||||
Type* type = NodeProperties::GetBounds(node->InputAt(2)).upper;
|
Type* type = NodeProperties::GetType(node->InputAt(2));
|
||||||
node->set_op(machine()->Store(
|
node->set_op(machine()->Store(
|
||||||
StoreRepresentation(access.machine_type,
|
StoreRepresentation(access.machine_type,
|
||||||
ComputeWriteBarrierKind(access.base_is_tagged,
|
ComputeWriteBarrierKind(access.base_is_tagged,
|
||||||
@ -1614,7 +1614,7 @@ Node* SimplifiedLowering::Uint32Mod(Node* const node) {
|
|||||||
void SimplifiedLowering::DoShift(Node* node, Operator const* op) {
|
void SimplifiedLowering::DoShift(Node* node, Operator const* op) {
|
||||||
node->set_op(op);
|
node->set_op(op);
|
||||||
Node* const rhs = NodeProperties::GetValueInput(node, 1);
|
Node* const rhs = NodeProperties::GetValueInput(node, 1);
|
||||||
Type* const rhs_type = NodeProperties::GetBounds(rhs).upper;
|
Type* const rhs_type = NodeProperties::GetType(rhs);
|
||||||
if (!rhs_type->Is(zero_thirtyone_range_)) {
|
if (!rhs_type->Is(zero_thirtyone_range_)) {
|
||||||
node->ReplaceInput(1, graph()->NewNode(machine()->Word32And(), rhs,
|
node->ReplaceInput(1, graph()->NewNode(machine()->Word32And(), rhs,
|
||||||
jsgraph()->Int32Constant(0x1f)));
|
jsgraph()->Int32Constant(0x1f)));
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -52,7 +52,7 @@ class Verifier::Visitor {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// TODO(rossberg): Get rid of these once we got rid of NodeProperties.
|
// TODO(rossberg): Get rid of these once we got rid of NodeProperties.
|
||||||
Bounds bounds(Node* node) { return NodeProperties::GetBounds(node); }
|
Type* type_of(Node* node) { return NodeProperties::GetType(node); }
|
||||||
Node* ValueInput(Node* node, int i = 0) {
|
Node* ValueInput(Node* node, int i = 0) {
|
||||||
return NodeProperties::GetValueInput(node, i);
|
return NodeProperties::GetValueInput(node, i);
|
||||||
}
|
}
|
||||||
@ -65,22 +65,22 @@ class Verifier::Visitor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void CheckUpperIs(Node* node, Type* type) {
|
void CheckUpperIs(Node* node, Type* type) {
|
||||||
if (typing == TYPED && !bounds(node).upper->Is(type)) {
|
if (typing == TYPED && !type_of(node)->Is(type)) {
|
||||||
std::ostringstream str;
|
std::ostringstream str;
|
||||||
str << "TypeError: node #" << node->id() << ":" << *node->op()
|
str << "TypeError: node #" << node->id() << ":" << *node->op()
|
||||||
<< " upper bound ";
|
<< " type ";
|
||||||
bounds(node).upper->PrintTo(str);
|
type_of(node)->PrintTo(str);
|
||||||
str << " is not ";
|
str << " is not ";
|
||||||
type->PrintTo(str);
|
type->PrintTo(str);
|
||||||
FATAL(str.str().c_str());
|
FATAL(str.str().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void CheckUpperMaybe(Node* node, Type* type) {
|
void CheckUpperMaybe(Node* node, Type* type) {
|
||||||
if (typing == TYPED && !bounds(node).upper->Maybe(type)) {
|
if (typing == TYPED && !type_of(node)->Maybe(type)) {
|
||||||
std::ostringstream str;
|
std::ostringstream str;
|
||||||
str << "TypeError: node #" << node->id() << ":" << *node->op()
|
str << "TypeError: node #" << node->id() << ":" << *node->op()
|
||||||
<< " upper bound ";
|
<< " type ";
|
||||||
bounds(node).upper->PrintTo(str);
|
type_of(node)->PrintTo(str);
|
||||||
str << " must intersect ";
|
str << " must intersect ";
|
||||||
type->PrintTo(str);
|
type->PrintTo(str);
|
||||||
FATAL(str.str().c_str());
|
FATAL(str.str().c_str());
|
||||||
@ -88,12 +88,12 @@ class Verifier::Visitor {
|
|||||||
}
|
}
|
||||||
void CheckValueInputIs(Node* node, int i, Type* type) {
|
void CheckValueInputIs(Node* node, int i, Type* type) {
|
||||||
Node* input = ValueInput(node, i);
|
Node* input = ValueInput(node, i);
|
||||||
if (typing == TYPED && !bounds(input).upper->Is(type)) {
|
if (typing == TYPED && !type_of(input)->Is(type)) {
|
||||||
std::ostringstream str;
|
std::ostringstream str;
|
||||||
str << "TypeError: node #" << node->id() << ":" << *node->op()
|
str << "TypeError: node #" << node->id() << ":" << *node->op()
|
||||||
<< "(input @" << i << " = " << input->opcode() << ":"
|
<< "(input @" << i << " = " << input->opcode() << ":"
|
||||||
<< input->op()->mnemonic() << ") upper bound ";
|
<< input->op()->mnemonic() << ") type ";
|
||||||
bounds(input).upper->PrintTo(str);
|
type_of(input)->PrintTo(str);
|
||||||
str << " is not ";
|
str << " is not ";
|
||||||
type->PrintTo(str);
|
type->PrintTo(str);
|
||||||
FATAL(str.str().c_str());
|
FATAL(str.str().c_str());
|
||||||
@ -398,9 +398,7 @@ void Verifier::Visitor::Check(Node* node) {
|
|||||||
// TODO(rossberg): for now at least, narrowing does not really hold.
|
// TODO(rossberg): for now at least, narrowing does not really hold.
|
||||||
/*
|
/*
|
||||||
for (int i = 0; i < value_count; ++i) {
|
for (int i = 0; i < value_count; ++i) {
|
||||||
// TODO(rossberg, jarin): Figure out what to do about lower bounds.
|
CHECK(type_of(ValueInput(node, i))->Is(type_of(node)));
|
||||||
// CHECK(bounds(node).lower->Is(bounds(ValueInput(node, i)).lower));
|
|
||||||
CHECK(bounds(ValueInput(node, i)).upper->Is(bounds(node).upper));
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
@ -427,8 +425,7 @@ void Verifier::Visitor::Check(Node* node) {
|
|||||||
// TODO(rossberg): what are the constraints on these?
|
// TODO(rossberg): what are the constraints on these?
|
||||||
// Type must be subsumed by input type.
|
// Type must be subsumed by input type.
|
||||||
if (typing == TYPED) {
|
if (typing == TYPED) {
|
||||||
CHECK(bounds(ValueInput(node)).lower->Is(bounds(node).lower));
|
CHECK(type_of(ValueInput(node))->Is(type_of(node)));
|
||||||
CHECK(bounds(ValueInput(node)).upper->Is(bounds(node).upper));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -568,7 +565,7 @@ void Verifier::Visitor::Check(Node* node) {
|
|||||||
// TODO(rossberg): This should really be Is(Internal), but the typer
|
// TODO(rossberg): This should really be Is(Internal), but the typer
|
||||||
// currently can't do backwards propagation.
|
// currently can't do backwards propagation.
|
||||||
CheckUpperMaybe(context, Type::Internal());
|
CheckUpperMaybe(context, Type::Internal());
|
||||||
if (typing == TYPED) CHECK(bounds(node).upper->IsContext());
|
if (typing == TYPED) CHECK(type_of(node)->IsContext());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class JSConstantCacheTester : public HandleAndZoneScope,
|
|||||||
main_typer_.Run();
|
main_typer_.Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
Type* upper(Node* node) { return NodeProperties::GetBounds(node).upper; }
|
Type* TypeOf(Node* node) { return NodeProperties::GetType(node); }
|
||||||
|
|
||||||
Handle<HeapObject> handle(Node* node) {
|
Handle<HeapObject> handle(Node* node) {
|
||||||
CHECK_EQ(IrOpcode::kHeapConstant, node->opcode());
|
CHECK_EQ(IrOpcode::kHeapConstant, node->opcode());
|
||||||
@ -69,7 +69,7 @@ TEST(ZeroConstant1) {
|
|||||||
CHECK_NE(zero, T.Float64Constant(0));
|
CHECK_NE(zero, T.Float64Constant(0));
|
||||||
CHECK_NE(zero, T.Int32Constant(0));
|
CHECK_NE(zero, T.Int32Constant(0));
|
||||||
|
|
||||||
Type* t = T.upper(zero);
|
Type* t = T.TypeOf(zero);
|
||||||
|
|
||||||
CHECK(t->Is(Type::Number()));
|
CHECK(t->Is(Type::Number()));
|
||||||
CHECK(t->Is(Type::Integral32()));
|
CHECK(t->Is(Type::Integral32()));
|
||||||
@ -90,7 +90,7 @@ TEST(MinusZeroConstant) {
|
|||||||
CHECK_EQ(minus_zero, T.Constant(-0.0));
|
CHECK_EQ(minus_zero, T.Constant(-0.0));
|
||||||
CHECK_NE(zero, minus_zero);
|
CHECK_NE(zero, minus_zero);
|
||||||
|
|
||||||
Type* t = T.upper(minus_zero);
|
Type* t = T.TypeOf(minus_zero);
|
||||||
|
|
||||||
CHECK(t->Is(Type::Number()));
|
CHECK(t->Is(Type::Number()));
|
||||||
CHECK(t->Is(Type::MinusZero()));
|
CHECK(t->Is(Type::MinusZero()));
|
||||||
@ -123,7 +123,7 @@ TEST(ZeroConstant2) {
|
|||||||
CHECK_NE(zero, T.Float64Constant(0));
|
CHECK_NE(zero, T.Float64Constant(0));
|
||||||
CHECK_NE(zero, T.Int32Constant(0));
|
CHECK_NE(zero, T.Int32Constant(0));
|
||||||
|
|
||||||
Type* t = T.upper(zero);
|
Type* t = T.TypeOf(zero);
|
||||||
|
|
||||||
CHECK(t->Is(Type::Number()));
|
CHECK(t->Is(Type::Number()));
|
||||||
CHECK(t->Is(Type::Integral32()));
|
CHECK(t->Is(Type::Integral32()));
|
||||||
@ -148,7 +148,7 @@ TEST(OneConstant1) {
|
|||||||
CHECK_NE(one, T.Float64Constant(1.0));
|
CHECK_NE(one, T.Float64Constant(1.0));
|
||||||
CHECK_NE(one, T.Int32Constant(1));
|
CHECK_NE(one, T.Int32Constant(1));
|
||||||
|
|
||||||
Type* t = T.upper(one);
|
Type* t = T.TypeOf(one);
|
||||||
|
|
||||||
CHECK(t->Is(Type::Number()));
|
CHECK(t->Is(Type::Number()));
|
||||||
CHECK(t->Is(Type::Integral32()));
|
CHECK(t->Is(Type::Integral32()));
|
||||||
@ -173,7 +173,7 @@ TEST(OneConstant2) {
|
|||||||
CHECK_NE(one, T.Float64Constant(1.0));
|
CHECK_NE(one, T.Float64Constant(1.0));
|
||||||
CHECK_NE(one, T.Int32Constant(1));
|
CHECK_NE(one, T.Int32Constant(1));
|
||||||
|
|
||||||
Type* t = T.upper(one);
|
Type* t = T.TypeOf(one);
|
||||||
|
|
||||||
CHECK(t->Is(Type::Number()));
|
CHECK(t->Is(Type::Number()));
|
||||||
CHECK(t->Is(Type::Integral32()));
|
CHECK(t->Is(Type::Integral32()));
|
||||||
@ -233,7 +233,7 @@ TEST(NumberTypes) {
|
|||||||
FOR_FLOAT64_INPUTS(i) {
|
FOR_FLOAT64_INPUTS(i) {
|
||||||
double value = *i;
|
double value = *i;
|
||||||
Node* node = T.Constant(value);
|
Node* node = T.Constant(value);
|
||||||
CHECK(T.upper(node)->Is(Type::Of(value, T.main_zone())));
|
CHECK(T.TypeOf(node)->Is(Type::Of(value, T.main_zone())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,15 +280,15 @@ TEST(OddballValues) {
|
|||||||
TEST(OddballTypes) {
|
TEST(OddballTypes) {
|
||||||
JSConstantCacheTester T;
|
JSConstantCacheTester T;
|
||||||
|
|
||||||
CHECK(T.upper(T.UndefinedConstant())->Is(Type::Undefined()));
|
CHECK(T.TypeOf(T.UndefinedConstant())->Is(Type::Undefined()));
|
||||||
// TODO(dcarney): figure this out.
|
// TODO(dcarney): figure this out.
|
||||||
// CHECK(T.upper(T.TheHoleConstant())->Is(Type::Internal()));
|
// CHECK(T.TypeOf(T.TheHoleConstant())->Is(Type::Internal()));
|
||||||
CHECK(T.upper(T.TrueConstant())->Is(Type::Boolean()));
|
CHECK(T.TypeOf(T.TrueConstant())->Is(Type::Boolean()));
|
||||||
CHECK(T.upper(T.FalseConstant())->Is(Type::Boolean()));
|
CHECK(T.TypeOf(T.FalseConstant())->Is(Type::Boolean()));
|
||||||
CHECK(T.upper(T.NullConstant())->Is(Type::Null()));
|
CHECK(T.TypeOf(T.NullConstant())->Is(Type::Null()));
|
||||||
CHECK(T.upper(T.ZeroConstant())->Is(Type::Number()));
|
CHECK(T.TypeOf(T.ZeroConstant())->Is(Type::Number()));
|
||||||
CHECK(T.upper(T.OneConstant())->Is(Type::Number()));
|
CHECK(T.TypeOf(T.OneConstant())->Is(Type::Number()));
|
||||||
CHECK(T.upper(T.NaNConstant())->Is(Type::NaN()));
|
CHECK(T.TypeOf(T.NaNConstant())->Is(Type::NaN()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
|
|||||||
|
|
||||||
Node* Parameter(Type* t, int32_t index = 0) {
|
Node* Parameter(Type* t, int32_t index = 0) {
|
||||||
Node* n = graph.NewNode(common.Parameter(index), graph.start());
|
Node* n = graph.NewNode(common.Parameter(index), graph.start());
|
||||||
NodeProperties::SetBounds(n, Bounds(Type::None(), t));
|
NodeProperties::SetType(n, t);
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,8 +296,8 @@ TEST_WITH_STRONG(NumberBinops) {
|
|||||||
|
|
||||||
|
|
||||||
static void CheckToI32(Node* old_input, Node* new_input, bool is_signed) {
|
static void CheckToI32(Node* old_input, Node* new_input, bool is_signed) {
|
||||||
Type* old_type = NodeProperties::GetBounds(old_input).upper;
|
Type* old_type = NodeProperties::GetType(old_input);
|
||||||
Type* new_type = NodeProperties::GetBounds(new_input).upper;
|
Type* new_type = NodeProperties::GetType(new_input);
|
||||||
Type* expected_type = I32Type(is_signed);
|
Type* expected_type = I32Type(is_signed);
|
||||||
CHECK(new_type->Is(expected_type));
|
CHECK(new_type->Is(expected_type));
|
||||||
if (old_type->Is(expected_type)) {
|
if (old_type->Is(expected_type)) {
|
||||||
@ -489,7 +489,7 @@ TEST(JSToNumberOfConstant) {
|
|||||||
// Note that either outcome below is correct. It only depends on whether
|
// Note that either outcome below is correct. It only depends on whether
|
||||||
// the types of constants are eagerly computed or only computed by the
|
// the types of constants are eagerly computed or only computed by the
|
||||||
// typing pass.
|
// typing pass.
|
||||||
if (NodeProperties::GetBounds(n).upper->Is(Type::Number())) {
|
if (NodeProperties::GetType(n)->Is(Type::Number())) {
|
||||||
// If number constants are eagerly typed, then reduction should
|
// If number constants are eagerly typed, then reduction should
|
||||||
// remove the ToNumber.
|
// remove the ToNumber.
|
||||||
CHECK_EQ(n, r);
|
CHECK_EQ(n, r);
|
||||||
@ -624,9 +624,9 @@ TEST_WITH_STRONG(StringComparison) {
|
|||||||
|
|
||||||
|
|
||||||
static void CheckIsConvertedToNumber(Node* val, Node* converted) {
|
static void CheckIsConvertedToNumber(Node* val, Node* converted) {
|
||||||
if (NodeProperties::GetBounds(val).upper->Is(Type::Number())) {
|
if (NodeProperties::GetType(val)->Is(Type::Number())) {
|
||||||
CHECK_EQ(val, converted);
|
CHECK_EQ(val, converted);
|
||||||
} else if (NodeProperties::GetBounds(val).upper->Is(Type::Boolean())) {
|
} else if (NodeProperties::GetType(val)->Is(Type::Boolean())) {
|
||||||
CHECK_EQ(IrOpcode::kBooleanToNumber, converted->opcode());
|
CHECK_EQ(IrOpcode::kBooleanToNumber, converted->opcode());
|
||||||
CHECK_EQ(val, converted->InputAt(0));
|
CHECK_EQ(val, converted->InputAt(0));
|
||||||
} else {
|
} else {
|
||||||
|
@ -101,7 +101,7 @@ TEST(RunNumberToInt32_float64) {
|
|||||||
FieldAccess load = {kUntaggedBase, 0, Handle<Name>(), Type::Number(),
|
FieldAccess load = {kUntaggedBase, 0, Handle<Name>(), Type::Number(),
|
||||||
kMachFloat64};
|
kMachFloat64};
|
||||||
Node* loaded = t.LoadField(load, t.PointerConstant(&input));
|
Node* loaded = t.LoadField(load, t.PointerConstant(&input));
|
||||||
NodeProperties::SetBounds(loaded, Bounds(Type::Number()));
|
NodeProperties::SetType(loaded, Type::Number());
|
||||||
Node* convert = t.NumberToInt32(loaded);
|
Node* convert = t.NumberToInt32(loaded);
|
||||||
FieldAccess store = {kUntaggedBase, 0, Handle<Name>(), Type::Signed32(),
|
FieldAccess store = {kUntaggedBase, 0, Handle<Name>(), Type::Signed32(),
|
||||||
kMachInt32};
|
kMachInt32};
|
||||||
@ -128,7 +128,7 @@ TEST(RunNumberToUint32_float64) {
|
|||||||
FieldAccess load = {kUntaggedBase, 0, Handle<Name>(), Type::Number(),
|
FieldAccess load = {kUntaggedBase, 0, Handle<Name>(), Type::Number(),
|
||||||
kMachFloat64};
|
kMachFloat64};
|
||||||
Node* loaded = t.LoadField(load, t.PointerConstant(&input));
|
Node* loaded = t.LoadField(load, t.PointerConstant(&input));
|
||||||
NodeProperties::SetBounds(loaded, Bounds(Type::Number()));
|
NodeProperties::SetType(loaded, Type::Number());
|
||||||
Node* convert = t.NumberToUint32(loaded);
|
Node* convert = t.NumberToUint32(loaded);
|
||||||
FieldAccess store = {kUntaggedBase, 0, Handle<Name>(), Type::Unsigned32(),
|
FieldAccess store = {kUntaggedBase, 0, Handle<Name>(), Type::Unsigned32(),
|
||||||
kMachUint32};
|
kMachUint32};
|
||||||
@ -687,9 +687,9 @@ class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders {
|
|||||||
p1 = graph()->NewNode(common()->Parameter(1), start);
|
p1 = graph()->NewNode(common()->Parameter(1), start);
|
||||||
p2 = graph()->NewNode(common()->Parameter(2), start);
|
p2 = graph()->NewNode(common()->Parameter(2), start);
|
||||||
typer.Run();
|
typer.Run();
|
||||||
NodeProperties::SetBounds(p0, Bounds(p0_type));
|
NodeProperties::SetType(p0, p0_type);
|
||||||
NodeProperties::SetBounds(p1, Bounds(p1_type));
|
NodeProperties::SetType(p1, p1_type);
|
||||||
NodeProperties::SetBounds(p2, Bounds(p2_type));
|
NodeProperties::SetType(p2, p2_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckLoweringBinop(IrOpcode::Value expected, const Operator* op) {
|
void CheckLoweringBinop(IrOpcode::Value expected, const Operator* op) {
|
||||||
@ -1120,7 +1120,7 @@ TEST(LowerNumberToUint32_to_TruncateFloat64ToInt32) {
|
|||||||
TestingGraph t(Type::Number());
|
TestingGraph t(Type::Number());
|
||||||
Node* p0 = t.ExampleWithOutput(kMachFloat64);
|
Node* p0 = t.ExampleWithOutput(kMachFloat64);
|
||||||
// TODO(titzer): run the typer here, or attach machine type to param.
|
// TODO(titzer): run the typer here, or attach machine type to param.
|
||||||
NodeProperties::SetBounds(p0, Bounds(Type::Number()));
|
NodeProperties::SetType(p0, Type::Number());
|
||||||
Node* trunc = t.graph()->NewNode(t.simplified()->NumberToUint32(), p0);
|
Node* trunc = t.graph()->NewNode(t.simplified()->NumberToUint32(), p0);
|
||||||
Node* use = t.Use(trunc, kMachUint32);
|
Node* use = t.Use(trunc, kMachUint32);
|
||||||
t.Return(use);
|
t.Return(use);
|
||||||
@ -1981,8 +1981,8 @@ TEST(PhiRepresentation) {
|
|||||||
Node* phi =
|
Node* phi =
|
||||||
t.graph()->NewNode(t.common()->Phi(kMachAnyTagged, 2), t.p0, t.p1, m);
|
t.graph()->NewNode(t.common()->Phi(kMachAnyTagged, 2), t.p0, t.p1, m);
|
||||||
|
|
||||||
Bounds phi_bounds = Bounds::Either(Bounds(d.arg1), Bounds(d.arg2), z);
|
Type* phi_type = Type::Union(d.arg1, d.arg2, z);
|
||||||
NodeProperties::SetBounds(phi, phi_bounds);
|
NodeProperties::SetType(phi, phi_type);
|
||||||
|
|
||||||
Node* use = t.Use(phi, d.use);
|
Node* use = t.Use(phi, d.use);
|
||||||
t.Return(use);
|
t.Return(use);
|
||||||
|
@ -55,7 +55,7 @@ Node* GraphTest::NumberConstant(volatile double value) {
|
|||||||
Node* GraphTest::HeapConstant(const Handle<HeapObject>& value) {
|
Node* GraphTest::HeapConstant(const Handle<HeapObject>& value) {
|
||||||
Node* node = graph()->NewNode(common()->HeapConstant(value));
|
Node* node = graph()->NewNode(common()->HeapConstant(value));
|
||||||
Type* type = Type::Constant(value, zone());
|
Type* type = Type::Constant(value, zone());
|
||||||
NodeProperties::SetBounds(node, Bounds(type));
|
NodeProperties::SetType(node, type);
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ TypedGraphTest::~TypedGraphTest() {}
|
|||||||
|
|
||||||
Node* TypedGraphTest::Parameter(Type* type, int32_t index) {
|
Node* TypedGraphTest::Parameter(Type* type, int32_t index) {
|
||||||
Node* node = GraphTest::Parameter(index);
|
Node* node = GraphTest::Parameter(index);
|
||||||
NodeProperties::SetBounds(node, Bounds(type));
|
NodeProperties::SetType(node, type);
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,11 +58,11 @@ class TyperTest : public TypedGraphTest {
|
|||||||
Type* TypeBinaryOp(const Operator* op, Type* lhs, Type* rhs) {
|
Type* TypeBinaryOp(const Operator* op, Type* lhs, Type* rhs) {
|
||||||
Node* p0 = Parameter(0);
|
Node* p0 = Parameter(0);
|
||||||
Node* p1 = Parameter(1);
|
Node* p1 = Parameter(1);
|
||||||
NodeProperties::SetBounds(p0, Bounds(lhs));
|
NodeProperties::SetType(p0, lhs);
|
||||||
NodeProperties::SetBounds(p1, Bounds(rhs));
|
NodeProperties::SetType(p1, rhs);
|
||||||
Node* n = graph()->NewNode(op, p0, p1, context_node_, graph()->start(),
|
Node* n = graph()->NewNode(op, p0, p1, context_node_, graph()->start(),
|
||||||
graph()->start());
|
graph()->start());
|
||||||
return NodeProperties::GetBounds(n).upper;
|
return NodeProperties::GetType(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
Type* RandomRange(bool int32 = false) {
|
Type* RandomRange(bool int32 = false) {
|
||||||
@ -399,7 +399,7 @@ TEST_F(TyperTest, TypeRegressInt32Constant) {
|
|||||||
int values[] = {-5, 10};
|
int values[] = {-5, 10};
|
||||||
for (auto i : values) {
|
for (auto i : values) {
|
||||||
Node* c = graph()->NewNode(common()->Int32Constant(i));
|
Node* c = graph()->NewNode(common()->Int32Constant(i));
|
||||||
Type* type = NodeProperties::GetBounds(c).upper;
|
Type* type = NodeProperties::GetType(c);
|
||||||
EXPECT_TRUE(type->Is(NewRange(i, i)));
|
EXPECT_TRUE(type->Is(NewRange(i, i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user