Reviewers: Jakob,
Description:
More precise type lub for numbers
R=jkumme...@chromium.org
BUG=v8:2910
Please review this at https://codereview.chromium.org/25722002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+9, -3 lines):
M src/types.cc
Index: src/types.cc
diff --git a/src/types.cc b/src/types.cc
index
70ddccd6a74eeebf9f3ee0c3b3ceb941f2c80ca8..bd617030fa9f9e84897300e6f552a5654078a4ae
100644
--- a/src/types.cc
+++ b/src/types.cc
@@ -128,11 +128,18 @@ int Type::LubBitset() {
Handle<v8::internal::Object> value = this->as_constant();
if (value->IsSmi()) return kSmi;
map = HeapObject::cast(*value)->map();
+ if (map->instance_type() == HEAP_NUMBER_TYPE) {
+ int32_t i;
+ uint32_t u;
+ if (value->ToInt32(&i)) return kOtherSigned32;
+ if (value->ToUint32(&u)) return kUnsigned32;
+ return kDouble;
+ }
if (map->instance_type() == ODDBALL_TYPE) {
if (value->IsUndefined()) return kUndefined;
if (value->IsNull()) return kNull;
if (value->IsTrue() || value->IsFalse()) return kBoolean;
- if (value->IsTheHole()) return kAny;
+ if (value->IsTheHole()) return kAny; // TODO(rossberg): kNone?
}
}
switch (map->instance_type()) {
@@ -162,9 +169,8 @@ int Type::LubBitset() {
case SYMBOL_TYPE:
return kSymbol;
case ODDBALL_TYPE:
- return kOddball;
case HEAP_NUMBER_TYPE:
- return kDouble;
+ UNREACHABLE();
case JS_VALUE_TYPE:
case JS_DATE_TYPE:
case JS_OBJECT_TYPE:
--
--
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.