| OLD | NEW | 
|---|
| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 67 //             - JSBuiltinsObject | 67 //             - JSBuiltinsObject | 
| 68 //           - JSGlobalProxy | 68 //           - JSGlobalProxy | 
| 69 //           - JSValue | 69 //           - JSValue | 
| 70 //             - JSDate | 70 //             - JSDate | 
| 71 //           - JSMessageObject | 71 //           - JSMessageObject | 
| 72 //         - JSProxy | 72 //         - JSProxy | 
| 73 //           - JSFunctionProxy | 73 //           - JSFunctionProxy | 
| 74 //       - FixedArrayBase | 74 //       - FixedArrayBase | 
| 75 //         - ByteArray | 75 //         - ByteArray | 
| 76 //         - FixedArray | 76 //         - FixedArray | 
|  | 77 //           - HiddenPropertiesArray | 
| 77 //           - DescriptorArray | 78 //           - DescriptorArray | 
| 78 //           - HashTable | 79 //           - HashTable | 
| 79 //             - Dictionary | 80 //             - Dictionary | 
| 80 //             - SymbolTable | 81 //             - SymbolTable | 
| 81 //             - CompilationCacheTable | 82 //             - CompilationCacheTable | 
| 82 //             - CodeCacheHashTable | 83 //             - CodeCacheHashTable | 
| 83 //             - MapCache | 84 //             - MapCache | 
| 84 //           - Context | 85 //           - Context | 
| 85 //           - JSFunctionResultCache | 86 //           - JSFunctionResultCache | 
| 86 //           - ScopeInfo | 87 //           - ScopeInfo | 
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 792   V(ExternalFloatArray)                        \ | 793   V(ExternalFloatArray)                        \ | 
| 793   V(ExternalDoubleArray)                       \ | 794   V(ExternalDoubleArray)                       \ | 
| 794   V(ExternalPixelArray)                        \ | 795   V(ExternalPixelArray)                        \ | 
| 795   V(ByteArray)                                 \ | 796   V(ByteArray)                                 \ | 
| 796   V(FreeSpace)                                 \ | 797   V(FreeSpace)                                 \ | 
| 797   V(JSReceiver)                                \ | 798   V(JSReceiver)                                \ | 
| 798   V(JSObject)                                  \ | 799   V(JSObject)                                  \ | 
| 799   V(JSContextExtensionObject)                  \ | 800   V(JSContextExtensionObject)                  \ | 
| 800   V(JSModule)                                  \ | 801   V(JSModule)                                  \ | 
| 801   V(Map)                                       \ | 802   V(Map)                                       \ | 
|  | 803   V(HiddenPropertiesArray)                     \ | 
| 802   V(DescriptorArray)                           \ | 804   V(DescriptorArray)                           \ | 
| 803   V(TransitionArray)                           \ | 805   V(TransitionArray)                           \ | 
| 804   V(DeoptimizationInputData)                   \ | 806   V(DeoptimizationInputData)                   \ | 
| 805   V(DeoptimizationOutputData)                  \ | 807   V(DeoptimizationOutputData)                  \ | 
| 806   V(TypeFeedbackCells)                         \ | 808   V(TypeFeedbackCells)                         \ | 
| 807   V(FixedArray)                                \ | 809   V(FixedArray)                                \ | 
| 808   V(FixedDoubleArray)                          \ | 810   V(FixedDoubleArray)                          \ | 
| 809   V(Context)                                   \ | 811   V(Context)                                   \ | 
| 810   V(GlobalContext)                             \ | 812   V(GlobalContext)                             \ | 
| 811   V(ModuleContext)                             \ | 813   V(ModuleContext)                             \ | 
| (...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2228       Object* getter, | 2230       Object* getter, | 
| 2229       Object* setter, | 2231       Object* setter, | 
| 2230       PropertyAttributes attributes); | 2232       PropertyAttributes attributes); | 
| 2231   MUST_USE_RESULT MaybeObject* CreateAccessorPairFor(String* name); | 2233   MUST_USE_RESULT MaybeObject* CreateAccessorPairFor(String* name); | 
| 2232   MUST_USE_RESULT MaybeObject* DefinePropertyAccessor( | 2234   MUST_USE_RESULT MaybeObject* DefinePropertyAccessor( | 
| 2233       String* name, | 2235       String* name, | 
| 2234       Object* getter, | 2236       Object* getter, | 
| 2235       Object* setter, | 2237       Object* setter, | 
| 2236       PropertyAttributes attributes); | 2238       PropertyAttributes attributes); | 
| 2237 | 2239 | 
| 2238   // Returns the hidden properties backing store object, currently | 2240   // Returns the hidden properties backing store object stored on this object. | 
| 2239   // a StringDictionary, stored on this object. |  | 
| 2240   // If no hidden properties object has been put on this object, | 2241   // If no hidden properties object has been put on this object, | 
| 2241   // return undefined, unless create_if_absent is true, in which case | 2242   // return undefined, unless create_if_absent is true, in which case | 
| 2242   // a new dictionary is created, added to this object, and returned. | 2243   // a new backing store is allocated, added to this object, and returned. | 
| 2243   MUST_USE_RESULT MaybeObject* GetHiddenPropertiesDictionary( | 2244   MUST_USE_RESULT MaybeObject* GetHiddenPropertiesArray( | 
| 2244       bool create_if_absent); | 2245       bool create_if_absent); | 
| 2245   // Updates the existing hidden properties dictionary. | 2246   // Updates the existing hidden properties backing store. | 
| 2246   MUST_USE_RESULT MaybeObject* SetHiddenPropertiesDictionary( | 2247   MUST_USE_RESULT MaybeObject* SetHiddenPropertiesArray( | 
| 2247       StringDictionary* dictionary); | 2248       HiddenPropertiesArray* hidden_properties); | 
| 2248 | 2249 | 
| 2249   DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); | 2250   DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); | 
| 2250 }; | 2251 }; | 
| 2251 | 2252 | 
| 2252 | 2253 | 
| 2253 // Common superclass for FixedArrays that allow implementations to share | 2254 // Common superclass for FixedArrays that allow implementations to share | 
| 2254 // common accessors and some code paths. | 2255 // common accessors and some code paths. | 
| 2255 class FixedArrayBase: public HeapObject { | 2256 class FixedArrayBase: public HeapObject { | 
| 2256  public: | 2257  public: | 
| 2257   // [length]: length of the array. | 2258   // [length]: length of the array. | 
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2448 #endif | 2449 #endif | 
| 2449 | 2450 | 
| 2450 #ifdef DEBUG | 2451 #ifdef DEBUG | 
| 2451   void FixedDoubleArrayVerify(); | 2452   void FixedDoubleArrayVerify(); | 
| 2452 #endif | 2453 #endif | 
| 2453 | 2454 | 
| 2454  private: | 2455  private: | 
| 2455   DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray); | 2456   DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray); | 
| 2456 }; | 2457 }; | 
| 2457 | 2458 | 
|  | 2459 // HiddenPropertiesArray are fixed arrays used to store hidden properties. | 
|  | 2460 // Since we expect very few hidden properties, we use store the entries | 
|  | 2461 // linearly and use linear search for retrieval. | 
|  | 2462 class HiddenPropertiesArray: public FixedArray { | 
|  | 2463  public: | 
|  | 2464   // We allocate the backing store as FixedArray filled with holes. | 
|  | 2465   MUST_USE_RESULT static inline MaybeObject* Allocate(); | 
|  | 2466 | 
|  | 2467   // Set a hidden property.  Return the current backing store afterwards | 
|  | 2468   // (the backing store may be re-allocated when extended). | 
|  | 2469   MUST_USE_RESULT inline MaybeObject* Set(String* key, Object* value); | 
|  | 2470 | 
|  | 2471   // If the entry corresponding to the key is found, set the key of the entry | 
|  | 2472   // to the hole and the value to undefined.  This way we can distinguish | 
|  | 2473   // deleted entries from end of the list when we do linear search. | 
|  | 2474   inline void Delete(String* key); | 
|  | 2475   inline Object* Get(String* key); | 
|  | 2476   static inline HiddenPropertiesArray* cast(Object* obj); | 
|  | 2477 | 
|  | 2478  private: | 
|  | 2479   DISALLOW_IMPLICIT_CONSTRUCTORS(HiddenPropertiesArray); | 
|  | 2480 }; | 
|  | 2481 | 
| 2458 | 2482 | 
| 2459 // DescriptorArrays are fixed arrays used to hold instance descriptors. | 2483 // DescriptorArrays are fixed arrays used to hold instance descriptors. | 
| 2460 // The format of the these objects is: | 2484 // The format of the these objects is: | 
| 2461 // TODO(1399): It should be possible to make room for bit_field3 in the map | 2485 // TODO(1399): It should be possible to make room for bit_field3 in the map | 
| 2462 //             without overloading the instance descriptors field in the map | 2486 //             without overloading the instance descriptors field in the map | 
| 2463 //             (and storing it in the DescriptorArray when the map has one). | 2487 //             (and storing it in the DescriptorArray when the map has one). | 
| 2464 //   [0]: storage for bit_field3 for Map owning this object (Smi) | 2488 //   [0]: storage for bit_field3 for Map owning this object (Smi) | 
| 2465 //   [1]: point to a fixed array with (value, detail) pairs. | 2489 //   [1]: point to a fixed array with (value, detail) pairs. | 
| 2466 //   [2]: next enumeration index (Smi), or pointer to small fixed array: | 2490 //   [2]: next enumeration index (Smi), or pointer to small fixed array: | 
| 2467 //          [0]: next enumeration index (Smi) | 2491 //          [0]: next enumeration index (Smi) | 
| (...skipping 6442 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 8910     } else { | 8934     } else { | 
| 8911       value &= ~(1 << bit_position); | 8935       value &= ~(1 << bit_position); | 
| 8912     } | 8936     } | 
| 8913     return value; | 8937     return value; | 
| 8914   } | 8938   } | 
| 8915 }; | 8939 }; | 
| 8916 | 8940 | 
| 8917 } }  // namespace v8::internal | 8941 } }  // namespace v8::internal | 
| 8918 | 8942 | 
| 8919 #endif  // V8_OBJECTS_H_ | 8943 #endif  // V8_OBJECTS_H_ | 
| OLD | NEW | 
|---|