OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include "allocation.h" | 8 #include "allocation.h" |
9 #include "assert-scope.h" | 9 #include "assert-scope.h" |
10 #include "builtins.h" | 10 #include "builtins.h" |
(...skipping 1476 matching lines...) Loading... |
1487 Handle<Object> object); | 1487 Handle<Object> object); |
1488 static MaybeHandle<JSReceiver> ToObject(Isolate* isolate, | 1488 static MaybeHandle<JSReceiver> ToObject(Isolate* isolate, |
1489 Handle<Object> object, | 1489 Handle<Object> object, |
1490 Handle<Context> context); | 1490 Handle<Context> context); |
1491 | 1491 |
1492 // Converts this to a Smi if possible. | 1492 // Converts this to a Smi if possible. |
1493 // Failure is returned otherwise. | 1493 // Failure is returned otherwise. |
1494 static MUST_USE_RESULT inline Handle<Object> ToSmi(Isolate* isolate, | 1494 static MUST_USE_RESULT inline Handle<Object> ToSmi(Isolate* isolate, |
1495 Handle<Object> object); | 1495 Handle<Object> object); |
1496 | 1496 |
1497 void Lookup(Name* name, LookupResult* result); | 1497 void Lookup(Handle<Name> name, LookupResult* result); |
1498 | 1498 |
1499 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithReceiver( | 1499 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithReceiver( |
1500 Handle<Object> object, | 1500 Handle<Object> object, |
1501 Handle<Object> receiver, | 1501 Handle<Object> receiver, |
1502 Handle<Name> name, | 1502 Handle<Name> name, |
1503 PropertyAttributes* attributes); | 1503 PropertyAttributes* attributes); |
1504 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( | 1504 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( |
1505 Handle<Object> object, | 1505 Handle<Object> object, |
1506 Handle<Name> key); | 1506 Handle<Name> key); |
1507 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( | 1507 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( |
(...skipping 550 matching lines...) Loading... |
2058 // be returned in case no hash was created yet. | 2058 // be returned in case no hash was created yet. |
2059 inline Object* GetIdentityHash(); | 2059 inline Object* GetIdentityHash(); |
2060 | 2060 |
2061 // Retrieves a permanent object identity hash code. May create and store a | 2061 // Retrieves a permanent object identity hash code. May create and store a |
2062 // hash code if needed and none exists. | 2062 // hash code if needed and none exists. |
2063 inline static Handle<Object> GetOrCreateIdentityHash( | 2063 inline static Handle<Object> GetOrCreateIdentityHash( |
2064 Handle<JSReceiver> object); | 2064 Handle<JSReceiver> object); |
2065 | 2065 |
2066 // Lookup a property. If found, the result is valid and has | 2066 // Lookup a property. If found, the result is valid and has |
2067 // detailed information. | 2067 // detailed information. |
2068 void LocalLookup(Name* name, LookupResult* result, | 2068 void LocalLookup(Handle<Name> name, LookupResult* result, |
2069 bool search_hidden_prototypes = false); | 2069 bool search_hidden_prototypes = false); |
2070 void Lookup(Name* name, LookupResult* result); | 2070 void Lookup(Handle<Name> name, LookupResult* result); |
2071 | 2071 |
2072 enum KeyCollectionType { LOCAL_ONLY, INCLUDE_PROTOS }; | 2072 enum KeyCollectionType { LOCAL_ONLY, INCLUDE_PROTOS }; |
2073 | 2073 |
2074 // Computes the enumerable keys for a JSObject. Used for implementing | 2074 // Computes the enumerable keys for a JSObject. Used for implementing |
2075 // "for (n in object) { }". | 2075 // "for (n in object) { }". |
2076 MUST_USE_RESULT static MaybeHandle<FixedArray> GetKeys( | 2076 MUST_USE_RESULT static MaybeHandle<FixedArray> GetKeys( |
2077 Handle<JSReceiver> object, | 2077 Handle<JSReceiver> object, |
2078 KeyCollectionType type); | 2078 KeyCollectionType type); |
2079 | 2079 |
2080 protected: | 2080 protected: |
(...skipping 429 matching lines...) Loading... |
2510 // internal fields as well as the number of internal fields. | 2510 // internal fields as well as the number of internal fields. |
2511 inline int GetHeaderSize(); | 2511 inline int GetHeaderSize(); |
2512 | 2512 |
2513 inline int GetInternalFieldCount(); | 2513 inline int GetInternalFieldCount(); |
2514 inline int GetInternalFieldOffset(int index); | 2514 inline int GetInternalFieldOffset(int index); |
2515 inline Object* GetInternalField(int index); | 2515 inline Object* GetInternalField(int index); |
2516 inline void SetInternalField(int index, Object* value); | 2516 inline void SetInternalField(int index, Object* value); |
2517 inline void SetInternalField(int index, Smi* value); | 2517 inline void SetInternalField(int index, Smi* value); |
2518 | 2518 |
2519 // The following lookup functions skip interceptors. | 2519 // The following lookup functions skip interceptors. |
2520 void LocalLookupRealNamedProperty(Name* name, LookupResult* result); | 2520 void LocalLookupRealNamedProperty(Handle<Name> name, LookupResult* result); |
2521 void LookupRealNamedProperty(Name* name, LookupResult* result); | 2521 void LookupRealNamedProperty(Handle<Name> name, LookupResult* result); |
2522 void LookupRealNamedPropertyInPrototypes(Name* name, LookupResult* result); | 2522 void LookupRealNamedPropertyInPrototypes(Handle<Name> name, |
2523 void LookupCallbackProperty(Name* name, LookupResult* result); | 2523 LookupResult* result); |
| 2524 void LookupCallbackProperty(Handle<Name> name, LookupResult* result); |
2524 | 2525 |
2525 // Returns the number of properties on this object filtering out properties | 2526 // Returns the number of properties on this object filtering out properties |
2526 // with the specified attributes (ignoring interceptors). | 2527 // with the specified attributes (ignoring interceptors). |
2527 int NumberOfLocalProperties(PropertyAttributes filter = NONE); | 2528 int NumberOfLocalProperties(PropertyAttributes filter = NONE); |
2528 // Fill in details for properties into storage starting at the specified | 2529 // Fill in details for properties into storage starting at the specified |
2529 // index. | 2530 // index. |
2530 void GetLocalPropertyNames( | 2531 void GetLocalPropertyNames( |
2531 FixedArray* storage, int index, PropertyAttributes filter = NONE); | 2532 FixedArray* storage, int index, PropertyAttributes filter = NONE); |
2532 | 2533 |
2533 // Returns the number of properties on this object filtering out properties | 2534 // Returns the number of properties on this object filtering out properties |
(...skipping 1515 matching lines...) Loading... |
4049 } | 4050 } |
4050 | 4051 |
4051 // Copies enumerable keys to preallocated fixed array. | 4052 // Copies enumerable keys to preallocated fixed array. |
4052 void CopyEnumKeysTo(FixedArray* storage); | 4053 void CopyEnumKeysTo(FixedArray* storage); |
4053 inline static void DoGenerateNewEnumerationIndices( | 4054 inline static void DoGenerateNewEnumerationIndices( |
4054 Handle<NameDictionary> dictionary); | 4055 Handle<NameDictionary> dictionary); |
4055 | 4056 |
4056 // Find entry for key, otherwise return kNotFound. Optimized version of | 4057 // Find entry for key, otherwise return kNotFound. Optimized version of |
4057 // HashTable::FindEntry. | 4058 // HashTable::FindEntry. |
4058 int FindEntry(Handle<Name> key); | 4059 int FindEntry(Handle<Name> key); |
4059 | |
4060 // TODO(ishell): Remove this when all the callers are handlified. | |
4061 int FindEntry(Name* key); | |
4062 }; | 4060 }; |
4063 | 4061 |
4064 | 4062 |
4065 class NumberDictionaryShape : public BaseShape<uint32_t> { | 4063 class NumberDictionaryShape : public BaseShape<uint32_t> { |
4066 public: | 4064 public: |
4067 static inline bool IsMatch(uint32_t key, Object* other); | 4065 static inline bool IsMatch(uint32_t key, Object* other); |
4068 static inline Handle<Object> AsHandle(Isolate* isolate, uint32_t key); | 4066 static inline Handle<Object> AsHandle(Isolate* isolate, uint32_t key); |
4069 static const int kEntrySize = 3; | 4067 static const int kEntrySize = 3; |
4070 static const bool kIsEnumerable = false; | 4068 static const bool kIsEnumerable = false; |
4071 }; | 4069 }; |
(...skipping 7122 matching lines...) Loading... |
11194 } else { | 11192 } else { |
11195 value &= ~(1 << bit_position); | 11193 value &= ~(1 << bit_position); |
11196 } | 11194 } |
11197 return value; | 11195 return value; |
11198 } | 11196 } |
11199 }; | 11197 }; |
11200 | 11198 |
11201 } } // namespace v8::internal | 11199 } } // namespace v8::internal |
11202 | 11200 |
11203 #endif // V8_OBJECTS_H_ | 11201 #endif // V8_OBJECTS_H_ |
OLD | NEW |