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

Side by Side Diff: src/objects.h

Issue 197813004: Handlify PropertyAttribute lookups. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comment Created 6 years, 9 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/contexts.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 2058 matching lines...) Expand 10 before | Expand all | Expand 10 after
2069 // Tests for the fast common case for property enumeration. 2069 // Tests for the fast common case for property enumeration.
2070 bool IsSimpleEnum(); 2070 bool IsSimpleEnum();
2071 2071
2072 // Returns the class name ([[Class]] property in the specification). 2072 // Returns the class name ([[Class]] property in the specification).
2073 String* class_name(); 2073 String* class_name();
2074 2074
2075 // Returns the constructor name (the name (possibly, inferred name) of the 2075 // Returns the constructor name (the name (possibly, inferred name) of the
2076 // function that was used to instantiate the object). 2076 // function that was used to instantiate the object).
2077 String* constructor_name(); 2077 String* constructor_name();
2078 2078
2079 inline PropertyAttributes GetPropertyAttribute(Name* name); 2079 static inline PropertyAttributes GetPropertyAttribute(
2080 PropertyAttributes GetPropertyAttributeWithReceiver(JSReceiver* receiver, 2080 Handle<JSReceiver> object,
2081 Name* name); 2081 Handle<Name> name);
2082 PropertyAttributes GetLocalPropertyAttribute(Name* name); 2082 static PropertyAttributes GetPropertyAttributeWithReceiver(
2083 Handle<JSReceiver> object,
2084 Handle<JSReceiver> receiver,
2085 Handle<Name> name);
2086 static PropertyAttributes GetLocalPropertyAttribute(
2087 Handle<JSReceiver> object,
2088 Handle<Name> name);
2083 2089
2084 inline PropertyAttributes GetElementAttribute(uint32_t index); 2090 static inline PropertyAttributes GetElementAttribute(
2085 inline PropertyAttributes GetLocalElementAttribute(uint32_t index); 2091 Handle<JSReceiver> object,
2092 uint32_t index);
2093 static inline PropertyAttributes GetLocalElementAttribute(
2094 Handle<JSReceiver> object,
2095 uint32_t index);
2086 2096
2087 // Return the object's prototype (might be Heap::null_value()). 2097 // Return the object's prototype (might be Heap::null_value()).
2088 inline Object* GetPrototype(); 2098 inline Object* GetPrototype();
2089 2099
2090 // Return the constructor function (may be Heap::null_value()). 2100 // Return the constructor function (may be Heap::null_value()).
2091 inline Object* GetConstructor(); 2101 inline Object* GetConstructor();
2092 2102
2093 // Retrieves a permanent object identity hash code. The undefined value might 2103 // Retrieves a permanent object identity hash code. The undefined value might
2094 // be returned in case no hash was created yet. 2104 // be returned in case no hash was created yet.
2095 inline Object* GetIdentityHash(); 2105 inline Object* GetIdentityHash();
(...skipping 10 matching lines...) Expand all
2106 void Lookup(Name* name, LookupResult* result); 2116 void Lookup(Name* name, LookupResult* result);
2107 2117
2108 protected: 2118 protected:
2109 Smi* GenerateIdentityHash(); 2119 Smi* GenerateIdentityHash();
2110 2120
2111 static Handle<Object> SetPropertyWithDefinedSetter(Handle<JSReceiver> object, 2121 static Handle<Object> SetPropertyWithDefinedSetter(Handle<JSReceiver> object,
2112 Handle<JSReceiver> setter, 2122 Handle<JSReceiver> setter,
2113 Handle<Object> value); 2123 Handle<Object> value);
2114 2124
2115 private: 2125 private:
2116 PropertyAttributes GetPropertyAttributeForResult(JSReceiver* receiver, 2126 static PropertyAttributes GetPropertyAttributeForResult(
2117 LookupResult* result, 2127 Handle<JSReceiver> object,
2118 Name* name, 2128 Handle<JSReceiver> receiver,
2119 bool continue_search); 2129 LookupResult* result,
2130 Handle<Name> name,
2131 bool continue_search);
2120 2132
2121 static Handle<Object> SetProperty(Handle<JSReceiver> receiver, 2133 static Handle<Object> SetProperty(Handle<JSReceiver> receiver,
2122 LookupResult* result, 2134 LookupResult* result,
2123 Handle<Name> key, 2135 Handle<Name> key,
2124 Handle<Object> value, 2136 Handle<Object> value,
2125 PropertyAttributes attributes, 2137 PropertyAttributes attributes,
2126 StrictMode strict_mode, 2138 StrictMode strict_mode,
2127 StoreFromKeyed store_from_keyed); 2139 StoreFromKeyed store_from_keyed);
2128 2140
2129 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); 2141 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver);
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
2300 Handle<Object> value, 2312 Handle<Object> value,
2301 PropertyDetails details); 2313 PropertyDetails details);
2302 2314
2303 static void OptimizeAsPrototype(Handle<JSObject> object); 2315 static void OptimizeAsPrototype(Handle<JSObject> object);
2304 2316
2305 // Retrieve interceptors. 2317 // Retrieve interceptors.
2306 InterceptorInfo* GetNamedInterceptor(); 2318 InterceptorInfo* GetNamedInterceptor();
2307 InterceptorInfo* GetIndexedInterceptor(); 2319 InterceptorInfo* GetIndexedInterceptor();
2308 2320
2309 // Used from JSReceiver. 2321 // Used from JSReceiver.
2310 PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver, 2322 static PropertyAttributes GetPropertyAttributePostInterceptor(
2311 Name* name, 2323 Handle<JSObject> object,
2312 bool continue_search); 2324 Handle<JSObject> receiver,
2313 PropertyAttributes GetPropertyAttributeWithInterceptor(JSObject* receiver, 2325 Handle<Name> name,
2314 Name* name, 2326 bool continue_search);
2315 bool continue_search); 2327 static PropertyAttributes GetPropertyAttributeWithInterceptor(
2316 PropertyAttributes GetPropertyAttributeWithFailedAccessCheck( 2328 Handle<JSObject> object,
2317 Object* receiver, 2329 Handle<JSObject> receiver,
2330 Handle<Name> name,
2331 bool continue_search);
2332 static PropertyAttributes GetPropertyAttributeWithFailedAccessCheck(
2333 Handle<JSObject> object,
2318 LookupResult* result, 2334 LookupResult* result,
2319 Name* name, 2335 Handle<Name> name,
2320 bool continue_search); 2336 bool continue_search);
2321 PropertyAttributes GetElementAttributeWithReceiver(JSReceiver* receiver, 2337 static PropertyAttributes GetElementAttributeWithReceiver(
2322 uint32_t index, 2338 Handle<JSObject> object,
2323 bool continue_search); 2339 Handle<JSReceiver> receiver,
2340 uint32_t index,
2341 bool continue_search);
2324 2342
2325 // Retrieves an AccessorPair property from the given object. Might return 2343 // Retrieves an AccessorPair property from the given object. Might return
2326 // undefined if the property doesn't exist or is of a different kind. 2344 // undefined if the property doesn't exist or is of a different kind.
2327 static Handle<Object> GetAccessor(Handle<JSObject> object, 2345 static Handle<Object> GetAccessor(Handle<JSObject> object,
2328 Handle<Name> name, 2346 Handle<Name> name,
2329 AccessorComponent component); 2347 AccessorComponent component);
2330 2348
2331 // Defines an AccessorPair property on the given object. 2349 // Defines an AccessorPair property on the given object.
2332 // TODO(mstarzinger): Rename to SetAccessor() and return empty handle on 2350 // TODO(mstarzinger): Rename to SetAccessor() and return empty handle on
2333 // exception instead of letting callers check for scheduled exception. 2351 // exception instead of letting callers check for scheduled exception.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 Handle<Object> value); 2395 Handle<Object> value);
2378 // Gets the value of a hidden property with the given key. Returns the hole 2396 // Gets the value of a hidden property with the given key. Returns the hole
2379 // if the property doesn't exist (or if called on a detached proxy), 2397 // if the property doesn't exist (or if called on a detached proxy),
2380 // otherwise returns the value set for the key. 2398 // otherwise returns the value set for the key.
2381 Object* GetHiddenProperty(Name* key); 2399 Object* GetHiddenProperty(Name* key);
2382 // Deletes a hidden property. Deleting a non-existing property is 2400 // Deletes a hidden property. Deleting a non-existing property is
2383 // considered successful. 2401 // considered successful.
2384 static void DeleteHiddenProperty(Handle<JSObject> object, 2402 static void DeleteHiddenProperty(Handle<JSObject> object,
2385 Handle<Name> key); 2403 Handle<Name> key);
2386 // Returns true if the object has a property with the hidden string as name. 2404 // Returns true if the object has a property with the hidden string as name.
2387 bool HasHiddenProperties(); 2405 static bool HasHiddenProperties(Handle<JSObject> object);
2388 2406
2389 static void SetIdentityHash(Handle<JSObject> object, Handle<Smi> hash); 2407 static void SetIdentityHash(Handle<JSObject> object, Handle<Smi> hash);
2390 2408
2391 inline void ValidateElements(); 2409 inline void ValidateElements();
2392 2410
2393 // Makes sure that this object can contain HeapObject as elements. 2411 // Makes sure that this object can contain HeapObject as elements.
2394 static inline void EnsureCanContainHeapObjectElements(Handle<JSObject> obj); 2412 static inline void EnsureCanContainHeapObjectElements(Handle<JSObject> obj);
2395 2413
2396 // Makes sure that this object can contain the specified elements. 2414 // Makes sure that this object can contain the specified elements.
2397 MUST_USE_RESULT inline MaybeObject* EnsureCanContainElements( 2415 MUST_USE_RESULT inline MaybeObject* EnsureCanContainElements(
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
2750 Handle<JSObject> object, 2768 Handle<JSObject> object,
2751 Handle<Object> receiver, 2769 Handle<Object> receiver,
2752 LookupResult* result, 2770 LookupResult* result,
2753 Handle<Name> name, 2771 Handle<Name> name,
2754 PropertyAttributes* attributes); 2772 PropertyAttributes* attributes);
2755 2773
2756 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, 2774 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver,
2757 Object* structure, 2775 Object* structure,
2758 uint32_t index, 2776 uint32_t index,
2759 Object* holder); 2777 Object* holder);
2760 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor( 2778 static PropertyAttributes GetElementAttributeWithInterceptor(
2761 JSReceiver* receiver, 2779 Handle<JSObject> object,
2780 Handle<JSReceiver> receiver,
2762 uint32_t index, 2781 uint32_t index,
2763 bool continue_search); 2782 bool continue_search);
2764 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithoutInterceptor( 2783 static PropertyAttributes GetElementAttributeWithoutInterceptor(
2765 JSReceiver* receiver, 2784 Handle<JSObject> object,
2785 Handle<JSReceiver> receiver,
2766 uint32_t index, 2786 uint32_t index,
2767 bool continue_search); 2787 bool continue_search);
2768 static Handle<Object> SetElementWithCallback( 2788 static Handle<Object> SetElementWithCallback(
2769 Handle<JSObject> object, 2789 Handle<JSObject> object,
2770 Handle<Object> structure, 2790 Handle<Object> structure,
2771 uint32_t index, 2791 uint32_t index,
2772 Handle<Object> value, 2792 Handle<Object> value,
2773 Handle<JSObject> holder, 2793 Handle<JSObject> holder,
2774 StrictMode strict_mode); 2794 StrictMode strict_mode);
2775 static Handle<Object> SetElementWithInterceptor( 2795 static Handle<Object> SetElementWithInterceptor(
(...skipping 6815 matching lines...) Expand 10 before | Expand all | Expand 10 after
9591 // otherwise set it to false. 9611 // otherwise set it to false.
9592 static Handle<Object> SetPropertyViaPrototypesWithHandler( 9612 static Handle<Object> SetPropertyViaPrototypesWithHandler(
9593 Handle<JSProxy> proxy, 9613 Handle<JSProxy> proxy,
9594 Handle<JSReceiver> receiver, 9614 Handle<JSReceiver> receiver,
9595 Handle<Name> name, 9615 Handle<Name> name,
9596 Handle<Object> value, 9616 Handle<Object> value,
9597 PropertyAttributes attributes, 9617 PropertyAttributes attributes,
9598 StrictMode strict_mode, 9618 StrictMode strict_mode,
9599 bool* done); 9619 bool* done);
9600 9620
9601 MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler( 9621 static PropertyAttributes GetPropertyAttributeWithHandler(
9602 JSReceiver* receiver, 9622 Handle<JSProxy> proxy,
9603 Name* name); 9623 Handle<JSReceiver> receiver,
9604 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithHandler( 9624 Handle<Name> name);
9605 JSReceiver* receiver, 9625 static PropertyAttributes GetElementAttributeWithHandler(
9626 Handle<JSProxy> proxy,
9627 Handle<JSReceiver> receiver,
9606 uint32_t index); 9628 uint32_t index);
9607 9629
9608 // Turn the proxy into an (empty) JSObject. 9630 // Turn the proxy into an (empty) JSObject.
9609 static void Fix(Handle<JSProxy> proxy); 9631 static void Fix(Handle<JSProxy> proxy);
9610 9632
9611 // Initializes the body after the handler slot. 9633 // Initializes the body after the handler slot.
9612 inline void InitializeBody(int object_size, Object* value); 9634 inline void InitializeBody(int object_size, Object* value);
9613 9635
9614 // Invoke a trap by name. If the trap does not exist on this's handler, 9636 // Invoke a trap by name. If the trap does not exist on this's handler,
9615 // but derived_trap is non-NULL, invoke that instead. May cause GC. 9637 // but derived_trap is non-NULL, invoke that instead. May cause GC.
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
10759 } else { 10781 } else {
10760 value &= ~(1 << bit_position); 10782 value &= ~(1 << bit_position);
10761 } 10783 }
10762 return value; 10784 return value;
10763 } 10785 }
10764 }; 10786 };
10765 10787
10766 } } // namespace v8::internal 10788 } } // namespace v8::internal
10767 10789
10768 #endif // V8_OBJECTS_H_ 10790 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/contexts.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698