Revision: 22873
Author: [email protected]
Date: Tue Aug 5 13:19:32 2014 UTC
Log: Undo some unintended changes from the Turbofan merge
[email protected]
BUG=
Review URL: https://codereview.chromium.org/435423002
http://code.google.com/p/v8/source/detail?r=22873
Modified:
/branches/bleeding_edge/src/compiler/typer.cc
/branches/bleeding_edge/src/types.cc
/branches/bleeding_edge/src/types.h
=======================================
--- /branches/bleeding_edge/src/compiler/typer.cc Mon Aug 4 11:34:54 2014
UTC
+++ /branches/bleeding_edge/src/compiler/typer.cc Tue Aug 5 13:19:32 2014
UTC
@@ -69,9 +69,7 @@
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 @@
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 @@
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 @@
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 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 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::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 @@
// 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 @@
private:
Typer* typer_;
};
+
}
void Typer::DecorateGraph(Graph* graph) {
graph->AddDecorator(new (zone()) TyperDecorator(this));
}
+
}
}
} // namespace v8::internal::compiler
=======================================
--- /branches/bleeding_edge/src/types.cc Tue Aug 5 11:27:26 2014 UTC
+++ /branches/bleeding_edge/src/types.cc Tue Aug 5 13:19:32 2014 UTC
@@ -123,21 +123,31 @@
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;
}
=======================================
--- /branches/bleeding_edge/src/types.h Mon Aug 4 11:34:54 2014 UTC
+++ /branches/bleeding_edge/src/types.h Tue Aug 5 13:19:32 2014 UTC
@@ -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 @@
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);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.