Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: src/code-stubs.cc

Issue 7497063: Simplify and optimize ToBoolean handling. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/code-stubs.cc
===================================================================
--- src/code-stubs.cc (revision 8868)
+++ src/code-stubs.cc (working copy)
@@ -340,12 +340,11 @@
if (IsEmpty()) stream->Add("None");
if (Contains(UNDEFINED)) stream->Add("Undefined");
if (Contains(BOOLEAN)) stream->Add("Bool");
+ if (Contains(NULL_TYPE)) stream->Add("Null");
if (Contains(SMI)) stream->Add("Smi");
- if (Contains(NULL_TYPE)) stream->Add("Null");
if (Contains(SPEC_OBJECT)) stream->Add("SpecObject");
if (Contains(STRING)) stream->Add("String");
if (Contains(HEAP_NUMBER)) stream->Add("HeapNumber");
- if (Contains(INTERNAL_OBJECT)) stream->Add("InternalObject");
}
@@ -385,12 +384,14 @@
return !object->IsUndetectableObject() &&
String::cast(*object)->length() != 0;
} else if (object->IsHeapNumber()) {
+ ASSERT(!object->IsUndetectableObject());
Add(HEAP_NUMBER);
double value = HeapNumber::cast(*object)->value();
- return !object->IsUndetectableObject() && value != 0 && !isnan(value);
+ return value != 0 && !isnan(value);
} else {
- Add(INTERNAL_OBJECT);
- return !object->IsUndetectableObject();
+ // We should never see an internal object at runtime here!
+ UNREACHABLE();
+ return true;
}
}
@@ -398,9 +399,14 @@
bool ToBooleanStub::Types::NeedsMap() const {
return Contains(ToBooleanStub::SPEC_OBJECT)
|| Contains(ToBooleanStub::STRING)
- || Contains(ToBooleanStub::HEAP_NUMBER)
- || Contains(ToBooleanStub::INTERNAL_OBJECT);
+ || Contains(ToBooleanStub::HEAP_NUMBER);
}
+bool ToBooleanStub::Types::CanBeUndetectable() const {
+ return Contains(ToBooleanStub::SPEC_OBJECT)
+ || Contains(ToBooleanStub::STRING);
+}
+
+
} } // namespace v8::internal
« src/apinatives.js ('K') | « src/code-stubs.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698