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

Side by Side Diff: src/objects.h

Issue 250773004: HashTableKey::AsObject() handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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/heap.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3630 matching lines...) Expand 10 before | Expand all | Expand 10 after
3641 // Shape must be a class with the following interface: 3641 // Shape must be a class with the following interface:
3642 // class ExampleShape { 3642 // class ExampleShape {
3643 // public: 3643 // public:
3644 // // Tells whether key matches other. 3644 // // Tells whether key matches other.
3645 // static bool IsMatch(Key key, Object* other); 3645 // static bool IsMatch(Key key, Object* other);
3646 // // Returns the hash value for key. 3646 // // Returns the hash value for key.
3647 // static uint32_t Hash(Key key); 3647 // static uint32_t Hash(Key key);
3648 // // Returns the hash value for object. 3648 // // Returns the hash value for object.
3649 // static uint32_t HashForObject(Key key, Object* object); 3649 // static uint32_t HashForObject(Key key, Object* object);
3650 // // Convert key to an object. 3650 // // Convert key to an object.
3651 // static inline Object* AsObject(Heap* heap, Key key); 3651 // static inline Handle<Object> AsHandle(Isolate* isolate, Key key);
3652 // // The prefix size indicates number of elements in the beginning 3652 // // The prefix size indicates number of elements in the beginning
3653 // // of the backing storage. 3653 // // of the backing storage.
3654 // static const int kPrefixSize = ..; 3654 // static const int kPrefixSize = ..;
3655 // // The Element size indicates number of elements per entry. 3655 // // The Element size indicates number of elements per entry.
3656 // static const int kEntrySize = ..; 3656 // static const int kEntrySize = ..;
3657 // }; 3657 // };
3658 // The prefix size indicates an amount of memory in the 3658 // The prefix size indicates an amount of memory in the
3659 // beginning of the backing storage that can be used for non-element 3659 // beginning of the backing storage that can be used for non-element
3660 // information by subclasses. 3660 // information by subclasses.
3661 3661
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
3859 // HashTableKey is an abstract superclass for virtual key behavior. 3859 // HashTableKey is an abstract superclass for virtual key behavior.
3860 class HashTableKey { 3860 class HashTableKey {
3861 public: 3861 public:
3862 // Returns whether the other object matches this key. 3862 // Returns whether the other object matches this key.
3863 virtual bool IsMatch(Object* other) = 0; 3863 virtual bool IsMatch(Object* other) = 0;
3864 // Returns the hash value for this key. 3864 // Returns the hash value for this key.
3865 virtual uint32_t Hash() = 0; 3865 virtual uint32_t Hash() = 0;
3866 // Returns the hash value for object. 3866 // Returns the hash value for object.
3867 virtual uint32_t HashForObject(Object* key) = 0; 3867 virtual uint32_t HashForObject(Object* key) = 0;
3868 // Returns the key object for storing into the hash table. 3868 // Returns the key object for storing into the hash table.
3869 // If allocations fails a failure object is returned. 3869 MUST_USE_RESULT virtual Handle<Object> AsHandle(Isolate* isolate) = 0;
3870 MUST_USE_RESULT virtual MaybeObject* AsObject(Heap* heap) = 0;
3871 // TODO(ishell): This should eventually replace AsObject().
3872 inline Handle<Object> AsHandle(Isolate* isolate);
3873 // Required. 3870 // Required.
3874 virtual ~HashTableKey() {} 3871 virtual ~HashTableKey() {}
3875 }; 3872 };
3876 3873
3877 3874
3878 class StringTableShape : public BaseShape<HashTableKey*> { 3875 class StringTableShape : public BaseShape<HashTableKey*> {
3879 public: 3876 public:
3880 static inline bool IsMatch(HashTableKey* key, Object* value) { 3877 static inline bool IsMatch(HashTableKey* key, Object* value) {
3881 return key->IsMatch(value); 3878 return key->IsMatch(value);
3882 } 3879 }
(...skipping 7391 matching lines...) Expand 10 before | Expand all | Expand 10 after
11274 } else { 11271 } else {
11275 value &= ~(1 << bit_position); 11272 value &= ~(1 << bit_position);
11276 } 11273 }
11277 return value; 11274 return value;
11278 } 11275 }
11279 }; 11276 };
11280 11277
11281 } } // namespace v8::internal 11278 } } // namespace v8::internal
11282 11279
11283 #endif // V8_OBJECTS_H_ 11280 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698