| Index: src/objects.h
|
| ===================================================================
|
| --- src/objects.h (revision 7267)
|
| +++ src/objects.h (working copy)
|
| @@ -729,6 +729,7 @@
|
| // Oddball testing.
|
| INLINE(bool IsUndefined());
|
| INLINE(bool IsNull());
|
| + INLINE(bool IsTheHole()); // Shadows MaybeObject's implementation.
|
| INLINE(bool IsTrue());
|
| INLINE(bool IsFalse());
|
| inline bool IsArgumentsMarker();
|
| @@ -885,7 +886,7 @@
|
| enum Type {
|
| RETRY_AFTER_GC = 0,
|
| EXCEPTION = 1, // Returning this marker tells the real exception
|
| - // is in Top::pending_exception.
|
| + // is in Isolate::pending_exception.
|
| INTERNAL_ERROR = 2,
|
| OUT_OF_MEMORY_EXCEPTION = 3
|
| };
|
| @@ -1073,6 +1074,14 @@
|
| inline MapWord map_word();
|
| inline void set_map_word(MapWord map_word);
|
|
|
| + // The Heap the object was allocated in. Used also to access Isolate.
|
| + // This method can not be used during GC, it ASSERTs this.
|
| + inline Heap* GetHeap();
|
| + // Convenience method to get current isolate. This method can be
|
| + // accessed only when its result is the same as
|
| + // Isolate::Current(), it ASSERTs this. See also comment for GetHeap.
|
| + inline Isolate* GetIsolate();
|
| +
|
| // Converts an address to a HeapObject pointer.
|
| static inline HeapObject* FromAddress(Address address);
|
|
|
| @@ -1892,13 +1901,18 @@
|
|
|
| // Setters for frequently used oddballs located in old space.
|
| inline void set_undefined(int index);
|
| + // TODO(isolates): duplicate.
|
| + inline void set_undefined(Heap* heap, int index);
|
| inline void set_null(int index);
|
| + // TODO(isolates): duplicate.
|
| + inline void set_null(Heap* heap, int index);
|
| inline void set_the_hole(int index);
|
|
|
| // Setters with less debug checks for the GC to use.
|
| inline void set_unchecked(int index, Smi* value);
|
| - inline void set_null_unchecked(int index);
|
| - inline void set_unchecked(int index, Object* value, WriteBarrierMode mode);
|
| + inline void set_null_unchecked(Heap* heap, int index);
|
| + inline void set_unchecked(Heap* heap, int index, Object* value,
|
| + WriteBarrierMode mode);
|
|
|
| // Gives access to raw memory which stores the array's data.
|
| inline Object** data_start();
|
| @@ -1993,7 +2007,9 @@
|
|
|
| // Returns the number of descriptors in the array.
|
| int number_of_descriptors() {
|
| - return IsEmpty() ? 0 : length() - kFirstIndex;
|
| + ASSERT(length() > kFirstIndex || IsEmpty());
|
| + int len = length();
|
| + return len <= kFirstIndex ? 0 : len - kFirstIndex;
|
| }
|
|
|
| int NextEnumerationIndex() {
|
| @@ -2285,7 +2301,8 @@
|
| (FixedArray::kMaxLength - kElementsStartOffset) / kEntrySize;
|
|
|
| // Find entry for key otherwise return kNotFound.
|
| - int FindEntry(Key key);
|
| + inline int FindEntry(Key key);
|
| + int FindEntry(Isolate* isolate, Key key);
|
|
|
| protected:
|
|
|
| @@ -2357,16 +2374,16 @@
|
|
|
| class SymbolTableShape {
|
| public:
|
| - static bool IsMatch(HashTableKey* key, Object* value) {
|
| + static inline bool IsMatch(HashTableKey* key, Object* value) {
|
| return key->IsMatch(value);
|
| }
|
| - static uint32_t Hash(HashTableKey* key) {
|
| + static inline uint32_t Hash(HashTableKey* key) {
|
| return key->Hash();
|
| }
|
| - static uint32_t HashForObject(HashTableKey* key, Object* object) {
|
| + static inline uint32_t HashForObject(HashTableKey* key, Object* object) {
|
| return key->HashForObject(object);
|
| }
|
| - MUST_USE_RESULT static MaybeObject* AsObject(HashTableKey* key) {
|
| + MUST_USE_RESULT static inline MaybeObject* AsObject(HashTableKey* key) {
|
| return key->AsObject();
|
| }
|
|
|
| @@ -2409,18 +2426,18 @@
|
|
|
| class MapCacheShape {
|
| public:
|
| - static bool IsMatch(HashTableKey* key, Object* value) {
|
| + static inline bool IsMatch(HashTableKey* key, Object* value) {
|
| return key->IsMatch(value);
|
| }
|
| - static uint32_t Hash(HashTableKey* key) {
|
| + static inline uint32_t Hash(HashTableKey* key) {
|
| return key->Hash();
|
| }
|
|
|
| - static uint32_t HashForObject(HashTableKey* key, Object* object) {
|
| + static inline uint32_t HashForObject(HashTableKey* key, Object* object) {
|
| return key->HashForObject(object);
|
| }
|
|
|
| - MUST_USE_RESULT static MaybeObject* AsObject(HashTableKey* key) {
|
| + MUST_USE_RESULT static inline MaybeObject* AsObject(HashTableKey* key) {
|
| return key->AsObject();
|
| }
|
|
|
| @@ -3430,7 +3447,7 @@
|
| inline void CodeIterateBody(ObjectVisitor* v);
|
|
|
| template<typename StaticVisitor>
|
| - inline void CodeIterateBody();
|
| + inline void CodeIterateBody(Heap* heap);
|
| #ifdef OBJECT_PRINT
|
| inline void CodePrint() {
|
| CodePrint(stdout);
|
| @@ -3718,7 +3735,7 @@
|
| // Code cache operations.
|
|
|
| // Clears the code cache.
|
| - inline void ClearCodeCache();
|
| + inline void ClearCodeCache(Heap* heap);
|
|
|
| // Update code cache.
|
| MUST_USE_RESULT MaybeObject* UpdateCodeCache(String* name, Code* code);
|
| @@ -3742,7 +3759,7 @@
|
| // Also, restore the original prototype on the targets of these
|
| // transitions, so that we do not process this map again while
|
| // following back pointers.
|
| - void ClearNonLiveTransitions(Object* real_prototype);
|
| + void ClearNonLiveTransitions(Heap* heap, Object* real_prototype);
|
|
|
| // Dispatched behavior.
|
| #ifdef OBJECT_PRINT
|
| @@ -3759,6 +3776,9 @@
|
| inline int visitor_id();
|
| inline void set_visitor_id(int visitor_id);
|
|
|
| + // Returns the heap this map belongs to.
|
| + inline Heap* heap();
|
| +
|
| typedef void (*TraverseCallback)(Map* map, void* data);
|
|
|
| void TraverseTransitionTree(TraverseCallback callback, void* data);
|
| @@ -5804,11 +5824,8 @@
|
| // iterating or updating after gc.
|
| class Relocatable BASE_EMBEDDED {
|
| public:
|
| - inline Relocatable() : prev_(top_) { top_ = this; }
|
| - virtual ~Relocatable() {
|
| - ASSERT_EQ(top_, this);
|
| - top_ = prev_;
|
| - }
|
| + explicit inline Relocatable(Isolate* isolate);
|
| + inline virtual ~Relocatable();
|
| virtual void IterateInstance(ObjectVisitor* v) { }
|
| virtual void PostGarbageCollection() { }
|
|
|
| @@ -5820,7 +5837,7 @@
|
| static void Iterate(ObjectVisitor* v, Relocatable* top);
|
| static char* Iterate(ObjectVisitor* v, char* t);
|
| private:
|
| - static Relocatable* top_;
|
| + Isolate* isolate_;
|
| Relocatable* prev_;
|
| };
|
|
|
| @@ -5830,8 +5847,8 @@
|
| // must be valid as long as the reader is being used.
|
| class FlatStringReader : public Relocatable {
|
| public:
|
| - explicit FlatStringReader(Handle<String> str);
|
| - explicit FlatStringReader(Vector<const char> input);
|
| + FlatStringReader(Isolate* isolate, Handle<String> str);
|
| + FlatStringReader(Isolate* isolate, Vector<const char> input);
|
| void PostGarbageCollection();
|
| inline uc32 Get(int index);
|
| int length() { return length_; }
|
| @@ -5894,6 +5911,9 @@
|
| // [to_number]: Cached to_number computed at startup.
|
| DECL_ACCESSORS(to_number, Object)
|
|
|
| + inline byte kind();
|
| + inline void set_kind(byte kind);
|
| +
|
| // Casting.
|
| static inline Oddball* cast(Object* obj);
|
|
|
| @@ -5904,13 +5924,24 @@
|
|
|
| // Initialize the fields.
|
| MUST_USE_RESULT MaybeObject* Initialize(const char* to_string,
|
| - Object* to_number);
|
| + Object* to_number,
|
| + byte kind);
|
|
|
| // Layout description.
|
| static const int kToStringOffset = HeapObject::kHeaderSize;
|
| static const int kToNumberOffset = kToStringOffset + kPointerSize;
|
| - static const int kSize = kToNumberOffset + kPointerSize;
|
| + static const int kKindOffset = kToNumberOffset + kPointerSize;
|
| + static const int kSize = kKindOffset + kPointerSize;
|
|
|
| + static const byte kFalse = 0;
|
| + static const byte kTrue = 1;
|
| + static const byte kNotBooleanMask = ~1;
|
| + static const byte kTheHole = 2;
|
| + static const byte kNull = 3;
|
| + static const byte kArgumentMarker = 4;
|
| + static const byte kUndefined = 5;
|
| + static const byte kOther = 6;
|
| +
|
| typedef FixedBodyDescriptor<kToStringOffset,
|
| kToNumberOffset + kPointerSize,
|
| kSize> BodyDescriptor;
|
|
|