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

Side by Side Diff: src/objects.h

Issue 254433002: Store JSGlobalProxy's identity hash directly on the proxy itself (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Re-introduce %UnwrapProxy to make Object.observe work Created 6 years, 8 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
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 2110 matching lines...) Expand 10 before | Expand all | Expand 10 after
2121 2121
2122 enum KeyCollectionType { LOCAL_ONLY, INCLUDE_PROTOS }; 2122 enum KeyCollectionType { LOCAL_ONLY, INCLUDE_PROTOS };
2123 2123
2124 // Computes the enumerable keys for a JSObject. Used for implementing 2124 // Computes the enumerable keys for a JSObject. Used for implementing
2125 // "for (n in object) { }". 2125 // "for (n in object) { }".
2126 MUST_USE_RESULT static MaybeHandle<FixedArray> GetKeys( 2126 MUST_USE_RESULT static MaybeHandle<FixedArray> GetKeys(
2127 Handle<JSReceiver> object, 2127 Handle<JSReceiver> object,
2128 KeyCollectionType type); 2128 KeyCollectionType type);
2129 2129
2130 protected: 2130 protected:
2131 Smi* GenerateIdentityHash();
2132
2133 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithDefinedSetter( 2131 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithDefinedSetter(
2134 Handle<JSReceiver> object, 2132 Handle<JSReceiver> object,
2135 Handle<JSReceiver> setter, 2133 Handle<JSReceiver> setter,
2136 Handle<Object> value); 2134 Handle<Object> value);
2137 2135
2138 private: 2136 private:
2139 static PropertyAttributes GetPropertyAttributeForResult( 2137 static PropertyAttributes GetPropertyAttributeForResult(
2140 Handle<JSReceiver> object, 2138 Handle<JSReceiver> object,
2141 Handle<JSReceiver> receiver, 2139 Handle<JSReceiver> receiver,
2142 LookupResult* result, 2140 LookupResult* result,
(...skipping 5704 matching lines...) Expand 10 before | Expand all | Expand 10 after
7847 // A JSGlobalProxy can be reinitialized which will preserve its identity. 7845 // A JSGlobalProxy can be reinitialized which will preserve its identity.
7848 // 7846 //
7849 // Accessing a JSGlobalProxy requires security check. 7847 // Accessing a JSGlobalProxy requires security check.
7850 7848
7851 class JSGlobalProxy : public JSObject { 7849 class JSGlobalProxy : public JSObject {
7852 public: 7850 public:
7853 // [native_context]: the owner native context of this global proxy object. 7851 // [native_context]: the owner native context of this global proxy object.
7854 // It is null value if this object is not used by any context. 7852 // It is null value if this object is not used by any context.
7855 DECL_ACCESSORS(native_context, Object) 7853 DECL_ACCESSORS(native_context, Object)
7856 7854
7855 // [hash]: The hash code property (undefined if not initialized yet).
7856 DECL_ACCESSORS(hash, Object)
7857
7857 // Casting. 7858 // Casting.
7858 static inline JSGlobalProxy* cast(Object* obj); 7859 static inline JSGlobalProxy* cast(Object* obj);
7859 7860
7860 inline bool IsDetachedFrom(GlobalObject* global); 7861 inline bool IsDetachedFrom(GlobalObject* global);
7861 7862
7862 // Dispatched behavior. 7863 // Dispatched behavior.
7863 DECLARE_PRINTER(JSGlobalProxy) 7864 DECLARE_PRINTER(JSGlobalProxy)
7864 DECLARE_VERIFIER(JSGlobalProxy) 7865 DECLARE_VERIFIER(JSGlobalProxy)
7865 7866
7866 // Layout description. 7867 // Layout description.
7867 static const int kNativeContextOffset = JSObject::kHeaderSize; 7868 static const int kNativeContextOffset = JSObject::kHeaderSize;
7868 static const int kSize = kNativeContextOffset + kPointerSize; 7869 static const int kHashOffset = kNativeContextOffset + kPointerSize;
7870 static const int kSize = kHashOffset + kPointerSize;
7869 7871
7870 private: 7872 private:
7871 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy); 7873 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy);
7872 }; 7874 };
7873 7875
7874 7876
7875 // Forward declaration. 7877 // Forward declaration.
7876 class JSBuiltinsObject; 7878 class JSBuiltinsObject;
7877 7879
7878 // Common super class for JavaScript global objects and the special 7880 // Common super class for JavaScript global objects and the special
(...skipping 3400 matching lines...) Expand 10 before | Expand all | Expand 10 after
11279 } else { 11281 } else {
11280 value &= ~(1 << bit_position); 11282 value &= ~(1 << bit_position);
11281 } 11283 }
11282 return value; 11284 return value;
11283 } 11285 }
11284 }; 11286 };
11285 11287
11286 } } // namespace v8::internal 11288 } } // namespace v8::internal
11287 11289
11288 #endif // V8_OBJECTS_H_ 11290 #endif // V8_OBJECTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698