Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index 42f27641adf1396910892ef0e1dbcab3cd9b5640..0a3b892bad38c564f1c78b1ef89e79a578866138 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -29,116 +29,113 @@ |
// Most object types in the V8 JavaScript are described in this file. |
// |
// Inheritance hierarchy: |
-// - MaybeObject (an object or a failure) |
-// - Failure (immediate for marking failed operation) |
-// - Object |
-// - Smi (immediate small integer) |
-// - HeapObject (superclass for everything allocated in the heap) |
-// - JSReceiver (suitable for property access) |
-// - JSObject |
-// - JSArray |
-// - JSArrayBuffer |
-// - JSArrayBufferView |
-// - JSTypedArray |
-// - JSDataView |
-// - JSSet |
-// - JSMap |
-// - JSSetIterator |
-// - JSMapIterator |
-// - JSWeakCollection |
-// - JSWeakMap |
-// - JSWeakSet |
-// - JSRegExp |
-// - JSFunction |
-// - JSGeneratorObject |
-// - JSModule |
-// - GlobalObject |
-// - JSGlobalObject |
-// - JSBuiltinsObject |
-// - JSGlobalProxy |
-// - JSValue |
-// - JSDate |
-// - JSMessageObject |
-// - JSProxy |
-// - JSFunctionProxy |
-// - FixedArrayBase |
-// - ByteArray |
-// - FixedArray |
-// - DescriptorArray |
-// - HashTable |
-// - Dictionary |
-// - StringTable |
-// - CompilationCacheTable |
-// - CodeCacheHashTable |
-// - MapCache |
-// - OrderedHashTable |
-// - OrderedHashSet |
-// - OrderedHashMap |
-// - Context |
-// - JSFunctionResultCache |
-// - ScopeInfo |
-// - TransitionArray |
-// - FixedDoubleArray |
-// - ExternalArray |
-// - ExternalUint8ClampedArray |
-// - ExternalInt8Array |
-// - ExternalUint8Array |
-// - ExternalInt16Array |
-// - ExternalUint16Array |
-// - ExternalInt32Array |
-// - ExternalUint32Array |
-// - ExternalFloat32Array |
-// - Name |
-// - String |
-// - SeqString |
-// - SeqOneByteString |
-// - SeqTwoByteString |
-// - SlicedString |
-// - ConsString |
-// - ExternalString |
-// - ExternalAsciiString |
-// - ExternalTwoByteString |
-// - InternalizedString |
-// - SeqInternalizedString |
-// - SeqOneByteInternalizedString |
-// - SeqTwoByteInternalizedString |
-// - ConsInternalizedString |
-// - ExternalInternalizedString |
-// - ExternalAsciiInternalizedString |
-// - ExternalTwoByteInternalizedString |
-// - Symbol |
-// - HeapNumber |
-// - Cell |
-// - PropertyCell |
-// - Code |
-// - Map |
-// - Oddball |
-// - Foreign |
-// - SharedFunctionInfo |
-// - Struct |
-// - Box |
-// - DeclaredAccessorDescriptor |
-// - AccessorInfo |
-// - DeclaredAccessorInfo |
-// - ExecutableAccessorInfo |
-// - AccessorPair |
-// - AccessCheckInfo |
-// - InterceptorInfo |
-// - CallHandlerInfo |
-// - TemplateInfo |
-// - FunctionTemplateInfo |
-// - ObjectTemplateInfo |
-// - Script |
-// - SignatureInfo |
-// - TypeSwitchInfo |
-// - DebugInfo |
-// - BreakPointInfo |
-// - CodeCache |
+// - Object |
+// - Smi (immediate small integer) |
+// - HeapObject (superclass for everything allocated in the heap) |
+// - JSReceiver (suitable for property access) |
+// - JSObject |
+// - JSArray |
+// - JSArrayBuffer |
+// - JSArrayBufferView |
+// - JSTypedArray |
+// - JSDataView |
+// - JSSet |
+// - JSMap |
+// - JSSetIterator |
+// - JSMapIterator |
+// - JSWeakCollection |
+// - JSWeakMap |
+// - JSWeakSet |
+// - JSRegExp |
+// - JSFunction |
+// - JSGeneratorObject |
+// - JSModule |
+// - GlobalObject |
+// - JSGlobalObject |
+// - JSBuiltinsObject |
+// - JSGlobalProxy |
+// - JSValue |
+// - JSDate |
+// - JSMessageObject |
+// - JSProxy |
+// - JSFunctionProxy |
+// - FixedArrayBase |
+// - ByteArray |
+// - FixedArray |
+// - DescriptorArray |
+// - HashTable |
+// - Dictionary |
+// - StringTable |
+// - CompilationCacheTable |
+// - CodeCacheHashTable |
+// - MapCache |
+// - OrderedHashTable |
+// - OrderedHashSet |
+// - OrderedHashMap |
+// - Context |
+// - JSFunctionResultCache |
+// - ScopeInfo |
+// - TransitionArray |
+// - FixedDoubleArray |
+// - ExternalArray |
+// - ExternalUint8ClampedArray |
+// - ExternalInt8Array |
+// - ExternalUint8Array |
+// - ExternalInt16Array |
+// - ExternalUint16Array |
+// - ExternalInt32Array |
+// - ExternalUint32Array |
+// - ExternalFloat32Array |
+// - Name |
+// - String |
+// - SeqString |
+// - SeqOneByteString |
+// - SeqTwoByteString |
+// - SlicedString |
+// - ConsString |
+// - ExternalString |
+// - ExternalAsciiString |
+// - ExternalTwoByteString |
+// - InternalizedString |
+// - SeqInternalizedString |
+// - SeqOneByteInternalizedString |
+// - SeqTwoByteInternalizedString |
+// - ConsInternalizedString |
+// - ExternalInternalizedString |
+// - ExternalAsciiInternalizedString |
+// - ExternalTwoByteInternalizedString |
+// - Symbol |
+// - HeapNumber |
+// - Cell |
+// - PropertyCell |
+// - Code |
+// - Map |
+// - Oddball |
+// - Foreign |
+// - SharedFunctionInfo |
+// - Struct |
+// - Box |
+// - DeclaredAccessorDescriptor |
+// - AccessorInfo |
+// - DeclaredAccessorInfo |
+// - ExecutableAccessorInfo |
+// - AccessorPair |
+// - AccessCheckInfo |
+// - InterceptorInfo |
+// - CallHandlerInfo |
+// - TemplateInfo |
+// - FunctionTemplateInfo |
+// - ObjectTemplateInfo |
+// - Script |
+// - SignatureInfo |
+// - TypeSwitchInfo |
+// - DebugInfo |
+// - BreakPointInfo |
+// - CodeCache |
// |
// Formats of Object*: |
// Smi: [31 bit signed int] 0 |
// HeapObject: [32 bit direct pointer] (4 byte aligned) | 01 |
-// Failure: [30 bit signed int] 11 |
namespace v8 { |
namespace internal { |
@@ -861,7 +858,6 @@ class AllocationSiteCreationContext; |
class AllocationSiteUsageContext; |
class DictionaryElementsAccessor; |
class ElementsAccessor; |
-class Failure; |
class FixedArrayBase; |
class GlobalObject; |
class ObjectVisitor; |
@@ -887,46 +883,6 @@ template <class C> inline bool Is(Object* obj); |
#define DECLARE_PRINTER(Name) |
#endif |
-class MaybeObject BASE_EMBEDDED { |
- public: |
- inline bool IsFailure(); |
- inline bool IsRetryAfterGC(); |
- inline bool ToObject(Object** obj) { |
- if (IsFailure()) return false; |
- *obj = reinterpret_cast<Object*>(this); |
- return true; |
- } |
- inline Object* ToObjectUnchecked() { |
- // TODO(jkummerow): Turn this back into an ASSERT when we can be certain |
- // that it never fires in Release mode in the wild. |
- CHECK(!IsFailure()); |
- return reinterpret_cast<Object*>(this); |
- } |
- inline Object* ToObjectChecked() { |
- CHECK(!IsFailure()); |
- return reinterpret_cast<Object*>(this); |
- } |
- |
- template<typename T> |
- inline bool To(T** obj) { |
- if (IsFailure()) return false; |
- *obj = T::cast(reinterpret_cast<Object*>(this)); |
- return true; |
- } |
- |
-#ifdef OBJECT_PRINT |
- // Prints this object with details. |
- void Print(); |
- void Print(FILE* out); |
- void PrintLn(); |
- void PrintLn(FILE* out); |
-#endif |
-#ifdef VERIFY_HEAP |
- // Verifies the object. |
- void Verify(); |
-#endif |
-}; |
- |
#define OBJECT_TYPE_LIST(V) \ |
V(Smi) \ |
@@ -1383,9 +1339,9 @@ const char* GetBailoutReason(BailoutReason reason); |
// object hierarchy. |
// Object does not use any virtual functions to avoid the |
// allocation of the C++ vtable. |
-// Since Smi and Failure are subclasses of Object no |
+// Since both Smi and HeapObject are subclasses of Object no |
// data members can be present in Object. |
-class Object : public MaybeObject { |
+class Object { |
public: |
// Type testing. |
bool IsObject() { return true; } |
@@ -1418,7 +1374,6 @@ class Object : public MaybeObject { |
INLINE(bool IsTrue()); |
INLINE(bool IsFalse()); |
inline bool IsArgumentsMarker(); |
- inline bool NonFailureIsHeapObject(); |
// Filler objects (fillers and free space objects). |
inline bool IsFiller(); |
@@ -1583,6 +1538,14 @@ class Object : public MaybeObject { |
// Layout description. |
static const int kHeaderSize = 0; // Object does not take up any space. |
+#ifdef OBJECT_PRINT |
+ // Prints this object with details. |
+ void Print(); |
+ void Print(FILE* out); |
+ void PrintLn(); |
+ void PrintLn(FILE* out); |
+#endif |
+ |
private: |
DISALLOW_IMPLICIT_CONSTRUCTORS(Object); |
}; |
@@ -1625,59 +1588,6 @@ class Smi: public Object { |
}; |
-// Failure is mainly used for reporting a situation requiring a GC. |
-// Failure objects are transient and cannot occur as part of the object graph. |
-// |
-// Failures are a single word, encoded as follows: |
-// +-------------------------+---+--+--+ |
-// |.........unused..........|sss|tt|11| |
-// +-------------------------+---+--+--+ |
-// 7 6 4 32 10 |
-// |
-// |
-// The low two bits, 0-1, are the failure tag, 11. The next two bits, |
-// 2-3, are a failure type tag 'tt' with possible values: |
-// 00 RETRY_AFTER_GC |
-// |
-// The next three bits, 4-6, are an allocation space tag 'sss'. The |
-// allocation space tag is 000 for all failure types except |
-// RETRY_AFTER_GC. For RETRY_AFTER_GC, the possible values are the |
-// allocation spaces (the encoding is found in globals.h). |
- |
-// Failure type tag info. |
-const int kFailureTypeTagSize = 2; |
-const int kFailureTypeTagMask = (1 << kFailureTypeTagSize) - 1; |
- |
-class Failure: public MaybeObject { |
- public: |
- enum Type { |
- RETRY_AFTER_GC = 0 |
- }; |
- |
- inline Type type() const; |
- |
- // Returns the space that needs to be collected for RetryAfterGC failures. |
- inline AllocationSpace allocation_space() const; |
- |
- static inline Failure* RetryAfterGC(AllocationSpace space); |
- static inline Failure* RetryAfterGC(); // NEW_SPACE |
- // Casting. |
- static inline Failure* cast(MaybeObject* object); |
- |
- // Dispatched behavior. |
- void FailurePrint(FILE* out = stdout); |
- void FailurePrint(StringStream* accumulator); |
- |
- DECLARE_VERIFIER(Failure) |
- |
- private: |
- inline intptr_t value() const; |
- static inline Failure* Construct(Type type, intptr_t value = 0); |
- |
- DISALLOW_IMPLICIT_CONSTRUCTORS(Failure); |
-}; |
- |
- |
// Heap objects typically have a map pointer in their first word. However, |
// during GC other data (e.g. mark bits, forwarding addresses) is sometimes |
// encoded in the first word. The class MapWord is an abstraction of the |