Commit cae6842a authored by rossberg@chromium.org's avatar rossberg@chromium.org

Undo some unintended changes from the Turbofan merge

R=mstarzinger@chromium.org
BUG=

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22873 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6b7f9dba
......@@ -69,9 +69,7 @@ class Typer::Visitor : public NullNodeVisitor {
Bounds TypeNode(Node* node) {
switch (node->opcode()) {
#define DECLARE_CASE(x) \
case IrOpcode::k##x: \
return Type##x(node);
#define DECLARE_CASE(x) case IrOpcode::k##x: return Type##x(node);
VALUE_OP_LIST(DECLARE_CASE)
#undef DECLARE_CASE
......@@ -119,12 +117,11 @@ class Typer::RunVisitor : public Typer::Visitor {
phis(NodeSet::key_compare(), NodeSet::allocator_type(typer->zone())) {}
GenericGraphVisit::Control Pre(Node* node) {
return NodeProperties::IsControl(node) &&
node->opcode() != IrOpcode::kEnd &&
node->opcode() != IrOpcode::kMerge &&
node->opcode() != IrOpcode::kReturn
? GenericGraphVisit::SKIP
: GenericGraphVisit::CONTINUE;
return NodeProperties::IsControl(node)
&& node->opcode() != IrOpcode::kEnd
&& node->opcode() != IrOpcode::kMerge
&& node->opcode() != IrOpcode::kReturn
? GenericGraphVisit::SKIP : GenericGraphVisit::CONTINUE;
}
GenericGraphVisit::Control Post(Node* node) {
......@@ -153,8 +150,8 @@ class Typer::NarrowVisitor : public Typer::Visitor {
NodeProperties::SetBounds(node, Bounds::Both(bounds, previous, zone()));
DCHECK(bounds.Narrows(previous));
// Stop when nothing changed (but allow reentry in case it does later).
return previous.Narrows(bounds) ? GenericGraphVisit::DEFER
: GenericGraphVisit::REENTER;
return previous.Narrows(bounds)
? GenericGraphVisit::DEFER : GenericGraphVisit::REENTER;
}
GenericGraphVisit::Control Post(Node* node) {
......@@ -175,8 +172,8 @@ class Typer::WidenVisitor : public Typer::Visitor {
DCHECK(previous.upper->Is(bounds.upper));
NodeProperties::SetBounds(node, bounds); // TODO(rossberg): Either?
// Stop when nothing changed (but allow reentry in case it does later).
return bounds.Narrows(previous) ? GenericGraphVisit::DEFER
: GenericGraphVisit::REENTER;
return bounds.Narrows(previous)
? GenericGraphVisit::DEFER : GenericGraphVisit::REENTER;
}
GenericGraphVisit::Control Post(Node* node) {
......@@ -344,23 +341,19 @@ Bounds Typer::Visitor::TypeJSAdd(Node* node) {
Bounds left = OperandType(node, 0);
Bounds right = OperandType(node, 1);
Type* lower =
left.lower->Is(Type::None()) || right.lower->Is(Type::None())
? Type::None(zone())
: left.lower->Is(Type::Number()) && right.lower->Is(Type::Number())
? Type::SignedSmall(zone())
: left.lower->Is(Type::String()) ||
right.lower->Is(Type::String())
? Type::String(zone())
: Type::None(zone());
left.lower->Is(Type::None()) || right.lower->Is(Type::None()) ?
Type::None(zone()) :
left.lower->Is(Type::Number()) && right.lower->Is(Type::Number()) ?
Type::SignedSmall(zone()) :
left.lower->Is(Type::String()) || right.lower->Is(Type::String()) ?
Type::String(zone()) : Type::None(zone());
Type* upper =
left.upper->Is(Type::None()) && right.upper->Is(Type::None())
? Type::None(zone())
: left.upper->Is(Type::Number()) && right.upper->Is(Type::Number())
? Type::Number(zone())
: left.upper->Is(Type::String()) ||
right.upper->Is(Type::String())
? Type::String(zone())
: Type::NumberOrString(zone());
left.upper->Is(Type::None()) && right.upper->Is(Type::None()) ?
Type::None(zone()) :
left.upper->Is(Type::Number()) && right.upper->Is(Type::Number()) ?
Type::Number(zone()) :
left.upper->Is(Type::String()) || right.upper->Is(Type::String()) ?
Type::String(zone()) : Type::NumberOrString(zone());
return Bounds(lower, upper);
}
......@@ -437,12 +430,12 @@ Bounds Typer::Visitor::TypeJSLoadProperty(Node* node) {
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())) {
result.lower = Type::Union(object.lower->AsArray()->Element(),
Type::Undefined(zone()), zone());
result.lower = Type::Union(
object.lower->AsArray()->Element(), Type::Undefined(zone()), zone());
}
if (object.upper->IsArray() && name.upper->Is(Type::Integral32())) {
result.upper = Type::Union(object.upper->AsArray()->Element(),
Type::Undefined(zone()), zone());
result.upper = Type::Union(
object.upper->AsArray()->Element(), Type::Undefined(zone()), zone());
}
return result;
}
......@@ -572,10 +565,10 @@ Bounds Typer::Visitor::TypeJSCallConstruct(Node* node) {
Bounds Typer::Visitor::TypeJSCallFunction(Node* node) {
Bounds fun = OperandType(node, 0);
Type* lower = fun.lower->IsFunction() ? fun.lower->AsFunction()->Result()
: Type::None(zone());
Type* upper = fun.upper->IsFunction() ? fun.upper->AsFunction()->Result()
: Type::Any(zone());
Type* lower = fun.lower->IsFunction()
? fun.lower->AsFunction()->Result() : Type::None(zone());
Type* upper = fun.upper->IsFunction()
? fun.upper->AsFunction()->Result() : Type::Any(zone());
return Bounds(lower, upper);
}
......@@ -751,7 +744,7 @@ Bounds Typer::Visitor::TypeStoreElement(Node* node) {
// TODO(rossberg): implement
#define DEFINE_METHOD(x) \
Bounds Typer::Visitor::Type##x(Node* node) { return Bounds(Type::None()); }
Bounds Typer::Visitor::Type##x(Node* node) { return Bounds(Type::None()); }
MACHINE_OP_LIST(DEFINE_METHOD)
#undef DEFINE_METHOD
......@@ -831,12 +824,14 @@ class TyperDecorator : public GraphDecorator {
private:
Typer* typer_;
};
}
void Typer::DecorateGraph(Graph* graph) {
graph->AddDecorator(new (zone()) TyperDecorator(this));
}
}
}
} // namespace v8::internal::compiler
......@@ -123,21 +123,31 @@ int TypeImpl<Config>::BitsetType::Lub(double value) {
DisallowHeapAllocation no_allocation;
if (i::IsMinusZero(value)) return kMinusZero;
if (std::isnan(value)) return kNaN;
if (IsUint32Double(value)) {
uint32_t u = FastD2UI(value);
if (u < 0x40000000u) return kUnsignedSmall;
if (u < 0x80000000u) {
return i::SmiValuesAre31Bits() ? kOtherUnsigned31 : kUnsignedSmall;
}
return kOtherUnsigned32;
if (IsUint32Double(value)) return Lub(FastD2UI(value));
if (IsInt32Double(value)) return Lub(FastD2I(value));
return kOtherNumber;
}
template<class Config>
int TypeImpl<Config>::BitsetType::Lub(int32_t value) {
if (value >= 0x40000000) {
return i::SmiValuesAre31Bits() ? kOtherUnsigned31 : kUnsignedSmall;
}
if (IsInt32Double(value)) {
int32_t i = FastD2I(value);
DCHECK(i < 0);
if (i >= -0x40000000) return kOtherSignedSmall;
return i::SmiValuesAre31Bits() ? kOtherSigned32 : kOtherSignedSmall;
if (value >= 0) return kUnsignedSmall;
if (value >= -0x40000000) return kOtherSignedSmall;
return i::SmiValuesAre31Bits() ? kOtherSigned32 : kOtherSignedSmall;
}
template<class Config>
int TypeImpl<Config>::BitsetType::Lub(uint32_t value) {
DisallowHeapAllocation no_allocation;
if (value >= 0x80000000u) return kOtherUnsigned32;
if (value >= 0x40000000u) {
return i::SmiValuesAre31Bits() ? kOtherUnsigned31 : kUnsignedSmall;
}
return kOtherNumber;
return kUnsignedSmall;
}
......
......@@ -7,12 +7,11 @@
#include "src/factory.h"
#include "src/handles.h"
#include "src/ostreams.h"
namespace v8 {
namespace internal {
class OStream;
// SUMMARY
//
// A simple type system for compiler-internal use. It is based entirely on
......@@ -512,6 +511,8 @@ class TypeImpl<Config>::BitsetType : public TypeImpl<Config> {
static int Lub(TypeImpl* type); // least upper bound that's a bitset
static int Lub(i::Object* value);
static int Lub(double value);
static int Lub(int32_t value);
static int Lub(uint32_t value);
static int Lub(i::Map* map);
static int InherentLub(TypeImpl* type);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment