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

Unified Diff: src/types.h

Issue 16562003: Allow smis for singleton types (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments Created 7 years, 6 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
« no previous file with comments | « src/objects-printer.cc ('k') | src/types.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/types.h
diff --git a/src/types.h b/src/types.h
index 018969f18bf6d0c5eee237e0abe13e69366c6657..6db9bfbb6a4d8daaee77a06e0c723b6f0fa05bd7 100644
--- a/src/types.h
+++ b/src/types.h
@@ -79,8 +79,8 @@ namespace internal {
// existing assumptions or tests.
//
// Internally, all 'primitive' types, and their unions, are represented as
-// bitsets via smis. Class and Constant are heap pointers to the respective
-// argument. Only unions containing Class'es or Constant's require allocation.
+// bitsets via smis. Class is a heap pointer to the respective map. Only
+// Constant's, or unions containing Class'es or Constant's, require allocation.
//
// The type representation is heap-allocated, so cannot (currently) be used in
// a parallel compilation context.
@@ -113,8 +113,10 @@ class Type : public Object {
static Type* Class(Handle<Map> map) { return from_handle(map); }
static Type* Constant(Handle<HeapObject> value) {
- ASSERT(!value->IsMap() && !value->IsFixedArray());
- return from_handle(value);
+ return Constant(value, value->GetIsolate());
+ }
+ static Type* Constant(Handle<v8::internal::Object> value, Isolate* isolate) {
+ return from_handle(isolate->factory()->NewBox(value));
}
static Type* Union(Handle<Type> type1, Handle<Type> type2);
@@ -159,15 +161,12 @@ class Type : public Object {
bool is_bitset() { return this->IsSmi(); }
bool is_class() { return this->IsMap(); }
- bool is_constant() { return !(is_bitset() || is_class() || is_union()); }
+ bool is_constant() { return this->IsBox(); }
bool is_union() { return this->IsFixedArray(); }
int as_bitset() { return Smi::cast(this)->value(); }
Handle<Map> as_class() { return Handle<Map>::cast(handle()); }
- Handle<HeapObject> as_constant() {
- ASSERT(is_constant());
- return Handle<HeapObject>::cast(handle());
- }
+ Handle<Box> as_constant() { return Handle<Box>::cast(handle()); }
Handle<Unioned> as_union() { return Handle<Unioned>::cast(handle()); }
Handle<Type> handle() { return handle_via_isolate_of(this); }
« no previous file with comments | « src/objects-printer.cc ('k') | src/types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698