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

Side by Side Diff: src/objects.h

Issue 7553012: Prototype of mark-and-compact support for Harmony weak maps. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Removed commented stress test. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mark-compact.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2965 matching lines...) Expand 10 before | Expand all | Expand 10 after
2976 2976
2977 // Looks up the value associated with the given key. The undefined value is 2977 // Looks up the value associated with the given key. The undefined value is
2978 // returned in case the key is not present. 2978 // returned in case the key is not present.
2979 Object* Lookup(JSObject* key); 2979 Object* Lookup(JSObject* key);
2980 2980
2981 // Adds (or overwrites) the value associated with the given key. Mapping a 2981 // Adds (or overwrites) the value associated with the given key. Mapping a
2982 // key to the undefined value causes removal of the whole entry. 2982 // key to the undefined value causes removal of the whole entry.
2983 MUST_USE_RESULT MaybeObject* Put(JSObject* key, Object* value); 2983 MUST_USE_RESULT MaybeObject* Put(JSObject* key, Object* value);
2984 2984
2985 private: 2985 private:
2986 friend class MarkCompactCollector;
2987
2986 void AddEntry(int entry, JSObject* key, Object* value); 2988 void AddEntry(int entry, JSObject* key, Object* value);
2987 void RemoveEntry(int entry); 2989 void RemoveEntry(int entry, Heap* heap);
2990 inline void RemoveEntry(int entry);
2991
2992 // Returns the index to the value of an entry.
2993 static inline int EntryToValueIndex(int entry) {
2994 return EntryToIndex(entry) + 1;
2995 }
2988 }; 2996 };
2989 2997
2990 2998
2991 // JSFunctionResultCache caches results of some JSFunction invocation. 2999 // JSFunctionResultCache caches results of some JSFunction invocation.
2992 // It is a fixed array with fixed structure: 3000 // It is a fixed array with fixed structure:
2993 // [0]: factory function 3001 // [0]: factory function
2994 // [1]: finger index 3002 // [1]: finger index
2995 // [2]: current cache size 3003 // [2]: current cache size
2996 // [3]: dummy field. 3004 // [3]: dummy field.
2997 // The rest of array are key/value pairs. 3005 // The rest of array are key/value pairs.
(...skipping 3623 matching lines...) Expand 10 before | Expand all | Expand 10 after
6621 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunctionProxy); 6629 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunctionProxy);
6622 }; 6630 };
6623 6631
6624 6632
6625 // The JSWeakMap describes EcmaScript Harmony weak maps 6633 // The JSWeakMap describes EcmaScript Harmony weak maps
6626 class JSWeakMap: public JSObject { 6634 class JSWeakMap: public JSObject {
6627 public: 6635 public:
6628 // [table]: the backing hash table mapping keys to values. 6636 // [table]: the backing hash table mapping keys to values.
6629 DECL_ACCESSORS(table, ObjectHashTable) 6637 DECL_ACCESSORS(table, ObjectHashTable)
6630 6638
6639 // [next]: linked list of encountered weak maps during GC.
6640 DECL_ACCESSORS(next, Object)
6641
6642 // Unchecked accessors to be used during GC.
6643 inline ObjectHashTable* unchecked_table();
6644
6631 // Casting. 6645 // Casting.
6632 static inline JSWeakMap* cast(Object* obj); 6646 static inline JSWeakMap* cast(Object* obj);
6633 6647
6634 #ifdef OBJECT_PRINT 6648 #ifdef OBJECT_PRINT
6635 inline void JSWeakMapPrint() { 6649 inline void JSWeakMapPrint() {
6636 JSWeakMapPrint(stdout); 6650 JSWeakMapPrint(stdout);
6637 } 6651 }
6638 void JSWeakMapPrint(FILE* out); 6652 void JSWeakMapPrint(FILE* out);
6639 #endif 6653 #endif
6640 #ifdef DEBUG 6654 #ifdef DEBUG
6641 void JSWeakMapVerify(); 6655 void JSWeakMapVerify();
6642 #endif 6656 #endif
6643 6657
6644 static const int kTableOffset = JSObject::kHeaderSize; 6658 static const int kTableOffset = JSObject::kHeaderSize;
6645 static const int kSize = kTableOffset + kPointerSize; 6659 static const int kNextOffset = kTableOffset + kPointerSize;
6660 static const int kSize = kNextOffset + kPointerSize;
6646 6661
6647 private: 6662 private:
6648 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakMap); 6663 DISALLOW_IMPLICIT_CONSTRUCTORS(JSWeakMap);
6649 }; 6664 };
6650 6665
6651 6666
6652 // Foreign describes objects pointing from JavaScript to C structures. 6667 // Foreign describes objects pointing from JavaScript to C structures.
6653 // Since they cannot contain references to JS HeapObjects they can be 6668 // Since they cannot contain references to JS HeapObjects they can be
6654 // placed in old_data_space. 6669 // placed in old_data_space.
6655 class Foreign: public HeapObject { 6670 class Foreign: public HeapObject {
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
7285 } else { 7300 } else {
7286 value &= ~(1 << bit_position); 7301 value &= ~(1 << bit_position);
7287 } 7302 }
7288 return value; 7303 return value;
7289 } 7304 }
7290 }; 7305 };
7291 7306
7292 } } // namespace v8::internal 7307 } } // namespace v8::internal
7293 7308
7294 #endif // V8_OBJECTS_H_ 7309 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698