| Index: src/compiler/typer.cc
|
| diff --git a/src/compiler/typer.cc b/src/compiler/typer.cc
|
| index f50adbd5ed10f742dd96a1f064a949d951fa9072..061b186f236200508dc32c41840d3914e0772639 100644
|
| --- a/src/compiler/typer.cc
|
| +++ b/src/compiler/typer.cc
|
| @@ -2,6 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include "src/bootstrapper.h"
|
| #include "src/compiler/graph-inl.h"
|
| #include "src/compiler/js-operator.h"
|
| #include "src/compiler/node.h"
|
| @@ -14,7 +15,19 @@ namespace v8 {
|
| namespace internal {
|
| namespace compiler {
|
|
|
| -Typer::Typer(Zone* zone) : zone_(zone) {
|
| +class Typer::Decorator : public GraphDecorator {
|
| + public:
|
| + explicit Decorator(Typer* typer) : typer_(typer) {}
|
| + virtual void Decorate(Node* node);
|
| +
|
| + private:
|
| + Typer* typer_;
|
| +};
|
| +
|
| +
|
| +Typer::Typer(Graph* graph, MaybeHandle<Context> context)
|
| + : graph_(graph), context_(context), decorator_(NULL) {
|
| + Zone* zone = this->zone();
|
| Factory* f = zone->isolate()->factory();
|
|
|
| Type* number = Type::Number();
|
| @@ -69,13 +82,20 @@ Typer::Typer(Zone* zone) : zone_(zone) {
|
| uint32_array_fun_ = Type::Function(uint32_array, arg1, arg2, arg3, zone);
|
| float32_array_fun_ = Type::Function(float32_array, arg1, arg2, arg3, zone);
|
| float64_array_fun_ = Type::Function(float64_array, arg1, arg2, arg3, zone);
|
| +
|
| + decorator_ = new (zone) Decorator(this);
|
| + graph_->AddDecorator(decorator_);
|
| +}
|
| +
|
| +
|
| +Typer::~Typer() {
|
| + graph_->RemoveDecorator(decorator_);
|
| }
|
|
|
|
|
| class Typer::Visitor : public NullNodeVisitor {
|
| public:
|
| - Visitor(Typer* typer, MaybeHandle<Context> context)
|
| - : typer_(typer), context_(context) {}
|
| + explicit Visitor(Typer* typer) : typer_(typer) {}
|
|
|
| Bounds TypeNode(Node* node) {
|
| switch (node->opcode()) {
|
| @@ -102,49 +122,47 @@ class Typer::Visitor : public NullNodeVisitor {
|
| VALUE_OP_LIST(DECLARE_METHOD)
|
| #undef DECLARE_METHOD
|
|
|
| - Bounds OperandType(Node* node, int i) {
|
| - return NodeProperties::GetBounds(NodeProperties::GetValueInput(node, i));
|
| + Bounds BoundsOrNone(Node* node) {
|
| + return NodeProperties::IsTyped(node)
|
| + ? NodeProperties::GetBounds(node) : Bounds(Type::None(zone()));
|
| }
|
|
|
| - Type* ContextType(Node* node) {
|
| - Bounds result =
|
| - NodeProperties::GetBounds(NodeProperties::GetContextInput(node));
|
| + Bounds Operand(Node* node, int i) {
|
| + Node* operand_node = NodeProperties::GetValueInput(node, i);
|
| + return BoundsOrNone(operand_node);
|
| + }
|
| +
|
| + Bounds ContextOperand(Node* node) {
|
| + Bounds result = BoundsOrNone(NodeProperties::GetContextInput(node));
|
| DCHECK(result.upper->Maybe(Type::Internal()));
|
| // TODO(rossberg): More precisely, instead of the above assertion, we should
|
| // back-propagate the constraint that it has to be a subtype of Internal.
|
| - return result.upper;
|
| + return result;
|
| }
|
|
|
| Zone* zone() { return typer_->zone(); }
|
| Isolate* isolate() { return typer_->isolate(); }
|
| - MaybeHandle<Context> context() { return context_; }
|
| + Graph* graph() { return typer_->graph(); }
|
| + MaybeHandle<Context> context() { return typer_->context(); }
|
|
|
| private:
|
| Typer* typer_;
|
| - MaybeHandle<Context> context_;
|
| };
|
|
|
|
|
| class Typer::RunVisitor : public Typer::Visitor {
|
| public:
|
| - RunVisitor(Typer* typer, MaybeHandle<Context> context)
|
| - : Visitor(typer, context),
|
| + explicit RunVisitor(Typer* typer)
|
| + : Visitor(typer),
|
| redo(NodeSet::key_compare(), NodeSet::allocator_type(typer->zone())) {}
|
|
|
| GenericGraphVisit::Control Post(Node* node) {
|
| - if (OperatorProperties::HasValueOutput(node->op())) {
|
| + if (OperatorProperties::HasValueOutput(node->op()) &&
|
| + !NodeProperties::IsTyped(node)) {
|
| Bounds bounds = TypeNode(node);
|
| NodeProperties::SetBounds(node, bounds);
|
| // Remember incompletely typed nodes for least fixpoint iteration.
|
| - int arity = OperatorProperties::GetValueInputCount(node->op());
|
| - for (int i = 0; i < arity; ++i) {
|
| - // TODO(rossberg): change once IsTyped is available.
|
| - // if (!NodeProperties::IsTyped(NodeProperties::GetValueInput(node, i)))
|
| - if (OperandType(node, i).upper->Is(Type::None())) {
|
| - redo.insert(node);
|
| - break;
|
| - }
|
| - }
|
| + if (!NodeProperties::AllValueInputsAreTyped(node)) redo.insert(node);
|
| }
|
| return GenericGraphVisit::CONTINUE;
|
| }
|
| @@ -155,8 +173,7 @@ class Typer::RunVisitor : public Typer::Visitor {
|
|
|
| class Typer::NarrowVisitor : public Typer::Visitor {
|
| public:
|
| - NarrowVisitor(Typer* typer, MaybeHandle<Context> context)
|
| - : Visitor(typer, context) {}
|
| + explicit NarrowVisitor(Typer* typer) : Visitor(typer) {}
|
|
|
| GenericGraphVisit::Control Pre(Node* node) {
|
| if (OperatorProperties::HasValueOutput(node->op())) {
|
| @@ -180,16 +197,15 @@ class Typer::NarrowVisitor : public Typer::Visitor {
|
|
|
| class Typer::WidenVisitor : public Typer::Visitor {
|
| public:
|
| - WidenVisitor(Typer* typer, MaybeHandle<Context> context)
|
| - : Visitor(typer, context) {}
|
| + explicit WidenVisitor(Typer* typer) : Visitor(typer) {}
|
|
|
| GenericGraphVisit::Control Pre(Node* node) {
|
| if (OperatorProperties::HasValueOutput(node->op())) {
|
| - Bounds previous = NodeProperties::GetBounds(node);
|
| + Bounds previous = BoundsOrNone(node);
|
| Bounds bounds = TypeNode(node);
|
| DCHECK(previous.lower->Is(bounds.lower));
|
| DCHECK(previous.upper->Is(bounds.upper));
|
| - NodeProperties::SetBounds(node, bounds); // TODO(rossberg): Either?
|
| + NodeProperties::SetBounds(node, bounds);
|
| // Stop when nothing changed (but allow re-entry in case it does later).
|
| return bounds.Narrows(previous)
|
| ? GenericGraphVisit::DEFER : GenericGraphVisit::REENTER;
|
| @@ -204,33 +220,37 @@ class Typer::WidenVisitor : public Typer::Visitor {
|
| };
|
|
|
|
|
| -void Typer::Run(Graph* graph, MaybeHandle<Context> context) {
|
| - RunVisitor typing(this, context);
|
| - graph->VisitNodeInputsFromEnd(&typing);
|
| +void Typer::Run() {
|
| + RunVisitor typing(this);
|
| + graph_->VisitNodeInputsFromEnd(&typing);
|
| // Find least fixpoint.
|
| - for (NodeSetIter i = typing.redo.begin(); i != typing.redo.end(); ++i) {
|
| - Widen(graph, *i, context);
|
| + WidenVisitor widen(this);
|
| + for (NodeSetIter it = typing.redo.begin(); it != typing.redo.end(); ++it) {
|
| + graph_->VisitNodeUsesFrom(*it, &widen);
|
| }
|
| }
|
|
|
|
|
| -void Typer::Narrow(Graph* graph, Node* start, MaybeHandle<Context> context) {
|
| - NarrowVisitor typing(this, context);
|
| - graph->VisitNodeUsesFrom(start, &typing);
|
| +void Typer::Narrow(Node* start) {
|
| + NarrowVisitor typing(this);
|
| + graph_->VisitNodeUsesFrom(start, &typing);
|
| }
|
|
|
|
|
| -void Typer::Widen(Graph* graph, Node* start, MaybeHandle<Context> context) {
|
| - WidenVisitor typing(this, context);
|
| - graph->VisitNodeUsesFrom(start, &typing);
|
| -}
|
| -
|
| -
|
| -void Typer::Init(Node* node) {
|
| +void Typer::Decorator::Decorate(Node* node) {
|
| if (OperatorProperties::HasValueOutput(node->op())) {
|
| - Visitor typing(this, MaybeHandle<Context>());
|
| - Bounds bounds = typing.TypeNode(node);
|
| - NodeProperties::SetBounds(node, bounds);
|
| + // Only eagerly type-decorate nodes with known input types.
|
| + // Other cases will generally require a proper fixpoint iteration with Run.
|
| + bool is_typed = NodeProperties::IsTyped(node);
|
| + if (is_typed || NodeProperties::AllValueInputsAreTyped(node)) {
|
| + Visitor typing(typer_);
|
| + Bounds bounds = typing.TypeNode(node);
|
| + if (is_typed) {
|
| + bounds =
|
| + Bounds::Both(bounds, NodeProperties::GetBounds(node), typer_->zone());
|
| + }
|
| + NodeProperties::SetBounds(node, bounds);
|
| + }
|
| }
|
| }
|
|
|
| @@ -241,7 +261,7 @@ void Typer::Init(Node* node) {
|
| // Control operators.
|
|
|
| Bounds Typer::Visitor::TypeStart(Node* node) {
|
| - return Bounds(Type::Internal(zone()));
|
| + return Bounds(Type::None(zone()), Type::Internal(zone()));
|
| }
|
|
|
|
|
| @@ -289,15 +309,15 @@ Bounds Typer::Visitor::TypeHeapConstant(Node* node) {
|
|
|
|
|
| Bounds Typer::Visitor::TypeExternalConstant(Node* node) {
|
| - return Bounds(Type::Internal(zone()));
|
| + return Bounds(Type::None(zone()), Type::Internal(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypePhi(Node* node) {
|
| int arity = OperatorProperties::GetValueInputCount(node->op());
|
| - Bounds bounds = OperandType(node, 0);
|
| + Bounds bounds = Operand(node, 0);
|
| for (int i = 1; i < arity; ++i) {
|
| - bounds = Bounds::Either(bounds, OperandType(node, i), zone());
|
| + bounds = Bounds::Either(bounds, Operand(node, i), zone());
|
| }
|
| return bounds;
|
| }
|
| @@ -316,18 +336,18 @@ Bounds Typer::Visitor::TypeValueEffect(Node* node) {
|
|
|
|
|
| Bounds Typer::Visitor::TypeFinish(Node* node) {
|
| - return OperandType(node, 0);
|
| + return Operand(node, 0);
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeFrameState(Node* node) {
|
| // TODO(rossberg): Ideally FrameState wouldn't have a value output.
|
| - return Bounds(Type::Internal(zone()));
|
| + return Bounds(Type::None(zone()), Type::Internal(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeStateValues(Node* node) {
|
| - return Bounds(Type::Internal(zone()));
|
| + return Bounds(Type::None(zone()), Type::Internal(zone()));
|
| }
|
|
|
|
|
| @@ -344,9 +364,9 @@ Bounds Typer::Visitor::TypeProjection(Node* node) {
|
|
|
| // JS comparison operators.
|
|
|
| -#define DEFINE_METHOD(x) \
|
| +#define DEFINE_METHOD(x) \
|
| Bounds Typer::Visitor::Type##x(Node* node) { \
|
| - return Bounds(Type::Boolean(zone())); \
|
| + return Bounds(Type::None(zone()), Type::Boolean(zone())); \
|
| }
|
| JS_COMPARE_BINOP_LIST(DEFINE_METHOD)
|
| #undef DEFINE_METHOD
|
| @@ -355,8 +375,8 @@ JS_COMPARE_BINOP_LIST(DEFINE_METHOD)
|
| // JS bitwise operators.
|
|
|
| Bounds Typer::Visitor::TypeJSBitwiseOr(Node* node) {
|
| - Bounds left = OperandType(node, 0);
|
| - Bounds right = OperandType(node, 1);
|
| + Bounds left = Operand(node, 0);
|
| + Bounds right = Operand(node, 1);
|
| Type* upper = Type::Union(left.upper, right.upper, zone());
|
| if (!upper->Is(Type::Signed32())) upper = Type::Signed32(zone());
|
| Type* lower = Type::Intersect(Type::SignedSmall(zone()), upper, zone());
|
| @@ -365,8 +385,8 @@ Bounds Typer::Visitor::TypeJSBitwiseOr(Node* node) {
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSBitwiseAnd(Node* node) {
|
| - Bounds left = OperandType(node, 0);
|
| - Bounds right = OperandType(node, 1);
|
| + Bounds left = Operand(node, 0);
|
| + Bounds right = Operand(node, 1);
|
| Type* upper = Type::Union(left.upper, right.upper, zone());
|
| if (!upper->Is(Type::Signed32())) upper = Type::Signed32(zone());
|
| Type* lower = Type::Intersect(Type::SignedSmall(zone()), upper, zone());
|
| @@ -375,30 +395,30 @@ Bounds Typer::Visitor::TypeJSBitwiseAnd(Node* node) {
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSBitwiseXor(Node* node) {
|
| - return Bounds(Type::SignedSmall(zone()), Type::Signed32(zone()));
|
| + return Bounds(Type::None(zone()), Type::Signed32(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSShiftLeft(Node* node) {
|
| - return Bounds(Type::SignedSmall(zone()), Type::Signed32(zone()));
|
| + return Bounds(Type::None(zone()), Type::Signed32(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSShiftRight(Node* node) {
|
| - return Bounds(Type::SignedSmall(zone()), Type::Signed32(zone()));
|
| + return Bounds(Type::None(zone()), Type::Signed32(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSShiftRightLogical(Node* node) {
|
| - return Bounds(Type::UnsignedSmall(zone()), Type::Unsigned32(zone()));
|
| + return Bounds(Type::None(zone()), Type::Unsigned32(zone()));
|
| }
|
|
|
|
|
| // JS arithmetic operators.
|
|
|
| Bounds Typer::Visitor::TypeJSAdd(Node* node) {
|
| - Bounds left = OperandType(node, 0);
|
| - Bounds right = OperandType(node, 1);
|
| + Bounds left = Operand(node, 0);
|
| + Bounds right = Operand(node, 1);
|
| Type* lower =
|
| left.lower->Is(Type::None()) || right.lower->Is(Type::None()) ?
|
| Type::None(zone()) :
|
| @@ -418,46 +438,46 @@ Bounds Typer::Visitor::TypeJSAdd(Node* node) {
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSSubtract(Node* node) {
|
| - return Bounds(Type::SignedSmall(zone()), Type::Number(zone()));
|
| + return Bounds(Type::None(zone()), Type::Number(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSMultiply(Node* node) {
|
| - return Bounds(Type::SignedSmall(zone()), Type::Number(zone()));
|
| + return Bounds(Type::None(zone()), Type::Number(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSDivide(Node* node) {
|
| - return Bounds(Type::SignedSmall(zone()), Type::Number(zone()));
|
| + return Bounds(Type::None(zone()), Type::Number(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSModulus(Node* node) {
|
| - return Bounds(Type::SignedSmall(zone()), Type::Number(zone()));
|
| + return Bounds(Type::None(zone()), Type::Number(zone()));
|
| }
|
|
|
|
|
| // JS unary operators.
|
|
|
| Bounds Typer::Visitor::TypeJSUnaryNot(Node* node) {
|
| - return Bounds(Type::Boolean(zone()));
|
| + return Bounds(Type::None(zone()), Type::Boolean(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSTypeOf(Node* node) {
|
| - return Bounds(Type::InternalizedString(zone()));
|
| + return Bounds(Type::None(zone()), Type::InternalizedString(zone()));
|
| }
|
|
|
|
|
| // JS conversion operators.
|
|
|
| Bounds Typer::Visitor::TypeJSToBoolean(Node* node) {
|
| - return Bounds(Type::Boolean(zone()));
|
| + return Bounds(Type::None(zone()), Type::Boolean(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSToNumber(Node* node) {
|
| - return Bounds(Type::SignedSmall(zone()), Type::Number(zone()));
|
| + return Bounds(Type::None(zone()), Type::Number(zone()));
|
| }
|
|
|
|
|
| @@ -484,8 +504,8 @@ Bounds Typer::Visitor::TypeJSCreate(Node* node) {
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSLoadProperty(Node* node) {
|
| - Bounds object = OperandType(node, 0);
|
| - Bounds name = OperandType(node, 1);
|
| + Bounds object = Operand(node, 0);
|
| + Bounds name = Operand(node, 1);
|
| Bounds result = Bounds::Unbounded(zone());
|
| // TODO(rossberg): Use range types and sized array types to filter undefined.
|
| if (object.lower->IsArray() && name.lower->Is(Type::Integral32())) {
|
| @@ -518,24 +538,24 @@ Bounds Typer::Visitor::TypeJSStoreNamed(Node* node) {
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSDeleteProperty(Node* node) {
|
| - return Bounds(Type::Boolean(zone()));
|
| + return Bounds(Type::None(zone()), Type::Boolean(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSHasProperty(Node* node) {
|
| - return Bounds(Type::Boolean(zone()));
|
| + return Bounds(Type::None(zone()), Type::Boolean(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSInstanceOf(Node* node) {
|
| - return Bounds(Type::Boolean(zone()));
|
| + return Bounds(Type::None(zone()), Type::Boolean(zone()));
|
| }
|
|
|
|
|
| // JS context operators.
|
|
|
| Bounds Typer::Visitor::TypeJSLoadContext(Node* node) {
|
| - Bounds outer = OperandType(node, 0);
|
| + Bounds outer = Operand(node, 0);
|
| DCHECK(outer.upper->Maybe(Type::Internal()));
|
| // TODO(rossberg): More precisely, instead of the above assertion, we should
|
| // back-propagate the constraint that it has to be a subtype of Internal.
|
| @@ -580,39 +600,39 @@ Bounds Typer::Visitor::TypeJSStoreContext(Node* node) {
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSCreateFunctionContext(Node* node) {
|
| - Type* outer = ContextType(node);
|
| - return Bounds(Type::Context(outer, zone()));
|
| + Bounds outer = ContextOperand(node);
|
| + return Bounds(Type::Context(outer.upper, zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSCreateCatchContext(Node* node) {
|
| - Type* outer = ContextType(node);
|
| - return Bounds(Type::Context(outer, zone()));
|
| + Bounds outer = ContextOperand(node);
|
| + return Bounds(Type::Context(outer.upper, zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSCreateWithContext(Node* node) {
|
| - Type* outer = ContextType(node);
|
| - return Bounds(Type::Context(outer, zone()));
|
| + Bounds outer = ContextOperand(node);
|
| + return Bounds(Type::Context(outer.upper, zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSCreateBlockContext(Node* node) {
|
| - Type* outer = ContextType(node);
|
| - return Bounds(Type::Context(outer, zone()));
|
| + Bounds outer = ContextOperand(node);
|
| + return Bounds(Type::Context(outer.upper, zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSCreateModuleContext(Node* node) {
|
| // TODO(rossberg): this is probably incorrect
|
| - Type* outer = ContextType(node);
|
| - return Bounds(Type::Context(outer, zone()));
|
| + Bounds outer = ContextOperand(node);
|
| + return Bounds(Type::Context(outer.upper, zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSCreateGlobalContext(Node* node) {
|
| - Type* outer = ContextType(node);
|
| - return Bounds(Type::Context(outer, zone()));
|
| + Bounds outer = ContextOperand(node);
|
| + return Bounds(Type::Context(outer.upper, zone()));
|
| }
|
|
|
|
|
| @@ -629,7 +649,7 @@ Bounds Typer::Visitor::TypeJSCallConstruct(Node* node) {
|
|
|
|
|
| Bounds Typer::Visitor::TypeJSCallFunction(Node* node) {
|
| - Bounds fun = OperandType(node, 0);
|
| + Bounds fun = Operand(node, 0);
|
| Type* lower = fun.lower->IsFunction()
|
| ? fun.lower->AsFunction()->Result() : Type::None(zone());
|
| Type* upper = fun.upper->IsFunction()
|
| @@ -651,57 +671,57 @@ Bounds Typer::Visitor::TypeJSDebugger(Node* node) {
|
| // Simplified operators.
|
|
|
| Bounds Typer::Visitor::TypeBooleanNot(Node* node) {
|
| - return Bounds(Type::Boolean(zone()));
|
| + return Bounds(Type::None(zone()), Type::Boolean(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeBooleanToNumber(Node* node) {
|
| - return Bounds(Type::Number(zone()));
|
| + return Bounds(Type::None(zone()), Type::Number(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeNumberEqual(Node* node) {
|
| - return Bounds(Type::Boolean(zone()));
|
| + return Bounds(Type::None(zone()), Type::Boolean(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeNumberLessThan(Node* node) {
|
| - return Bounds(Type::Boolean(zone()));
|
| + return Bounds(Type::None(zone()), Type::Boolean(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeNumberLessThanOrEqual(Node* node) {
|
| - return Bounds(Type::Boolean(zone()));
|
| + return Bounds(Type::None(zone()), Type::Boolean(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeNumberAdd(Node* node) {
|
| - return Bounds(Type::Number(zone()));
|
| + return Bounds(Type::None(zone()), Type::Number(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeNumberSubtract(Node* node) {
|
| - return Bounds(Type::Number(zone()));
|
| + return Bounds(Type::None(zone()), Type::Number(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeNumberMultiply(Node* node) {
|
| - return Bounds(Type::Number(zone()));
|
| + return Bounds(Type::None(zone()), Type::Number(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeNumberDivide(Node* node) {
|
| - return Bounds(Type::Number(zone()));
|
| + return Bounds(Type::None(zone()), Type::Number(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeNumberModulus(Node* node) {
|
| - return Bounds(Type::Number(zone()));
|
| + return Bounds(Type::None(zone()), Type::Number(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeNumberToInt32(Node* node) {
|
| - Bounds arg = OperandType(node, 0);
|
| + Bounds arg = Operand(node, 0);
|
| Type* s32 = Type::Signed32(zone());
|
| Type* lower = arg.lower->Is(s32) ? arg.lower : s32;
|
| Type* upper = arg.upper->Is(s32) ? arg.upper : s32;
|
| @@ -710,7 +730,7 @@ Bounds Typer::Visitor::TypeNumberToInt32(Node* node) {
|
|
|
|
|
| Bounds Typer::Visitor::TypeNumberToUint32(Node* node) {
|
| - Bounds arg = OperandType(node, 0);
|
| + Bounds arg = Operand(node, 0);
|
| Type* u32 = Type::Unsigned32(zone());
|
| Type* lower = arg.lower->Is(u32) ? arg.lower : u32;
|
| Type* upper = arg.upper->Is(u32) ? arg.upper : u32;
|
| @@ -719,74 +739,75 @@ Bounds Typer::Visitor::TypeNumberToUint32(Node* node) {
|
|
|
|
|
| Bounds Typer::Visitor::TypeReferenceEqual(Node* node) {
|
| - return Bounds(Type::Boolean(zone()));
|
| + return Bounds(Type::None(zone()), Type::Boolean(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeStringEqual(Node* node) {
|
| - return Bounds(Type::Boolean(zone()));
|
| + return Bounds(Type::None(zone()), Type::Boolean(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeStringLessThan(Node* node) {
|
| - return Bounds(Type::Boolean(zone()));
|
| + return Bounds(Type::None(zone()), Type::Boolean(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeStringLessThanOrEqual(Node* node) {
|
| - return Bounds(Type::Boolean(zone()));
|
| + return Bounds(Type::None(zone()), Type::Boolean(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeStringAdd(Node* node) {
|
| - return Bounds(Type::String(zone()));
|
| + return Bounds(Type::None(zone()), Type::String(zone()));
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeChangeTaggedToInt32(Node* node) {
|
| // TODO(titzer): type is type of input, representation is Word32.
|
| - return Bounds(Type::Integral32());
|
| + return Bounds(Type::None(zone()), Type::Integral32());
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeChangeTaggedToUint32(Node* node) {
|
| - return Bounds(Type::Integral32()); // TODO(titzer): add appropriate rep
|
| + // TODO(titzer): add appropriate rep
|
| + return Bounds(Type::None(zone()), Type::Integral32());
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeChangeTaggedToFloat64(Node* node) {
|
| // TODO(titzer): type is type of input, representation is Float64.
|
| - return Bounds(Type::Number());
|
| + return Bounds(Type::None(zone()), Type::Number());
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeChangeInt32ToTagged(Node* node) {
|
| // TODO(titzer): type is type of input, representation is Tagged.
|
| - return Bounds(Type::Integral32());
|
| + return Bounds(Type::None(zone()), Type::Integral32());
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeChangeUint32ToTagged(Node* node) {
|
| // TODO(titzer): type is type of input, representation is Tagged.
|
| - return Bounds(Type::Unsigned32());
|
| + return Bounds(Type::None(zone()), Type::Unsigned32());
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeChangeFloat64ToTagged(Node* node) {
|
| // TODO(titzer): type is type of input, representation is Tagged.
|
| - return Bounds(Type::Number());
|
| + return Bounds(Type::None(zone()), Type::Number());
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeChangeBoolToBit(Node* node) {
|
| // TODO(titzer): type is type of input, representation is Bit.
|
| - return Bounds(Type::Boolean());
|
| + return Bounds(Type::None(zone()), Type::Boolean());
|
| }
|
|
|
|
|
| Bounds Typer::Visitor::TypeChangeBitToBool(Node* node) {
|
| // TODO(titzer): type is type of input, representation is Tagged.
|
| - return Bounds(Type::Boolean());
|
| + return Bounds(Type::None(zone()), Type::Boolean());
|
| }
|
|
|
|
|
| @@ -814,7 +835,6 @@ Bounds Typer::Visitor::TypeStoreElement(Node* node) {
|
|
|
| // Machine operators.
|
|
|
| -
|
| Bounds Typer::Visitor::TypeLoad(Node* node) {
|
| return Bounds::Unbounded(zone());
|
| }
|
| @@ -1206,25 +1226,6 @@ Type* Typer::Visitor::TypeConstant(Handle<Object> value) {
|
| return Type::Constant(value, zone());
|
| }
|
|
|
| -
|
| -namespace {
|
| -
|
| -class TyperDecorator : public GraphDecorator {
|
| - public:
|
| - explicit TyperDecorator(Typer* typer) : typer_(typer) {}
|
| - virtual void Decorate(Node* node) { typer_->Init(node); }
|
| -
|
| - private:
|
| - Typer* typer_;
|
| -};
|
| -
|
| -}
|
| -
|
| -
|
| -void Typer::DecorateGraph(Graph* graph) {
|
| - graph->AddDecorator(new (zone()) TyperDecorator(this));
|
| -}
|
| -
|
| }
|
| }
|
| } // namespace v8::internal::compiler
|
|
|