| 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 248 |
| 249 | 249 |
| 250 // NormalizedMapSharingMode is used to specify whether a map may be shared | 250 // NormalizedMapSharingMode is used to specify whether a map may be shared |
| 251 // by different objects with normalized properties. | 251 // by different objects with normalized properties. |
| 252 enum NormalizedMapSharingMode { | 252 enum NormalizedMapSharingMode { |
| 253 UNIQUE_NORMALIZED_MAP, | 253 UNIQUE_NORMALIZED_MAP, |
| 254 SHARED_NORMALIZED_MAP | 254 SHARED_NORMALIZED_MAP |
| 255 }; | 255 }; |
| 256 | 256 |
| 257 | 257 |
| 258 // Indicates whether a get method should implicitly create the object looked up. | |
| 259 enum CreationFlag { | |
| 260 ALLOW_CREATION, | |
| 261 OMIT_CREATION | |
| 262 }; | |
| 263 | |
| 264 | |
| 265 // Indicates whether transitions can be added to a source map or not. | 258 // Indicates whether transitions can be added to a source map or not. |
| 266 enum TransitionFlag { | 259 enum TransitionFlag { |
| 267 INSERT_TRANSITION, | 260 INSERT_TRANSITION, |
| 268 OMIT_TRANSITION | 261 OMIT_TRANSITION |
| 269 }; | 262 }; |
| 270 | 263 |
| 271 | 264 |
| 272 enum DebugExtraICState { | 265 enum DebugExtraICState { |
| 273 DEBUG_BREAK, | 266 DEBUG_BREAK, |
| 274 DEBUG_PREPARE_STEP_IN | 267 DEBUG_PREPARE_STEP_IN |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 352 V(CONS_INTERNALIZED_STRING_TYPE) \ | 345 V(CONS_INTERNALIZED_STRING_TYPE) \ |
| 353 V(CONS_ASCII_INTERNALIZED_STRING_TYPE) \ | 346 V(CONS_ASCII_INTERNALIZED_STRING_TYPE) \ |
| 354 V(EXTERNAL_INTERNALIZED_STRING_TYPE) \ | 347 V(EXTERNAL_INTERNALIZED_STRING_TYPE) \ |
| 355 V(EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \ | 348 V(EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \ |
| 356 V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ | 349 V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ |
| 357 V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \ | 350 V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \ |
| 358 V(SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \ | 351 V(SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \ |
| 359 V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ | 352 V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ |
| 360 \ | 353 \ |
| 361 V(SYMBOL_TYPE) \ | 354 V(SYMBOL_TYPE) \ |
| 355 \ |
| 362 V(MAP_TYPE) \ | 356 V(MAP_TYPE) \ |
| 363 V(CODE_TYPE) \ | 357 V(CODE_TYPE) \ |
| 364 V(ODDBALL_TYPE) \ | 358 V(ODDBALL_TYPE) \ |
| 365 V(CELL_TYPE) \ | 359 V(CELL_TYPE) \ |
| 366 V(PROPERTY_CELL_TYPE) \ | 360 V(PROPERTY_CELL_TYPE) \ |
| 367 \ | 361 \ |
| 368 V(HEAP_NUMBER_TYPE) \ | 362 V(HEAP_NUMBER_TYPE) \ |
| 369 V(FOREIGN_TYPE) \ | 363 V(FOREIGN_TYPE) \ |
| 370 V(BYTE_ARRAY_TYPE) \ | 364 V(BYTE_ARRAY_TYPE) \ |
| 371 V(FREE_SPACE_TYPE) \ | 365 V(FREE_SPACE_TYPE) \ |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 | kNotInternalizedTag, | 678 | kNotInternalizedTag, |
| 685 SHORT_EXTERNAL_STRING_TYPE = | 679 SHORT_EXTERNAL_STRING_TYPE = |
| 686 SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE | kNotInternalizedTag, | 680 SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE | kNotInternalizedTag, |
| 687 SHORT_EXTERNAL_ASCII_STRING_TYPE = | 681 SHORT_EXTERNAL_ASCII_STRING_TYPE = |
| 688 SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE | kNotInternalizedTag, | 682 SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE | kNotInternalizedTag, |
| 689 SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE = | 683 SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE = |
| 690 SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE | 684 SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE |
| 691 | kNotInternalizedTag, | 685 | kNotInternalizedTag, |
| 692 | 686 |
| 693 // Non-string names | 687 // Non-string names |
| 694 SYMBOL_TYPE = kNotStringTag, // LAST_NAME_TYPE, FIRST_NONSTRING_TYPE | 688 SYMBOL_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE, LAST_NAME_TYPE |
| 695 | 689 |
| 696 // Objects allocated in their own spaces (never in new space). | 690 // Objects allocated in their own spaces (never in new space). |
| 697 MAP_TYPE, | 691 MAP_TYPE, |
| 698 CODE_TYPE, | 692 CODE_TYPE, |
| 699 ODDBALL_TYPE, | 693 ODDBALL_TYPE, |
| 700 CELL_TYPE, | 694 CELL_TYPE, |
| 701 PROPERTY_CELL_TYPE, | 695 PROPERTY_CELL_TYPE, |
| 702 | 696 |
| 703 // "Data", objects that cannot contain non-map-word pointers to heap | 697 // "Data", objects that cannot contain non-map-word pointers to heap |
| 704 // objects. | 698 // objects. |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 class AllocationSite; | 863 class AllocationSite; |
| 870 class AllocationSiteContext; | 864 class AllocationSiteContext; |
| 871 class DictionaryElementsAccessor; | 865 class DictionaryElementsAccessor; |
| 872 class ElementsAccessor; | 866 class ElementsAccessor; |
| 873 class Failure; | 867 class Failure; |
| 874 class FixedArrayBase; | 868 class FixedArrayBase; |
| 875 class ObjectVisitor; | 869 class ObjectVisitor; |
| 876 class StringStream; | 870 class StringStream; |
| 877 class Type; | 871 class Type; |
| 878 | 872 |
| 879 struct ValueInfo : public Malloced { | |
| 880 ValueInfo() : type(FIRST_TYPE), ptr(NULL), str(NULL), number(0) { } | |
| 881 InstanceType type; | |
| 882 Object* ptr; | |
| 883 const char* str; | |
| 884 double number; | |
| 885 }; | |
| 886 | |
| 887 | 873 |
| 888 // A template-ized version of the IsXXX functions. | 874 // A template-ized version of the IsXXX functions. |
| 889 template <class C> inline bool Is(Object* obj); | 875 template <class C> inline bool Is(Object* obj); |
| 890 | 876 |
| 891 #ifdef VERIFY_HEAP | 877 #ifdef VERIFY_HEAP |
| 892 #define DECLARE_VERIFIER(Name) void Name##Verify(); | 878 #define DECLARE_VERIFIER(Name) void Name##Verify(); |
| 893 #else | 879 #else |
| 894 #define DECLARE_VERIFIER(Name) | 880 #define DECLARE_VERIFIER(Name) |
| 895 #endif | 881 #endif |
| 896 | 882 |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1502 uint32_t index); | 1488 uint32_t index); |
| 1503 // For use when we know that no exception can be thrown. | 1489 // For use when we know that no exception can be thrown. |
| 1504 inline Object* GetElementNoExceptionThrown(Isolate* isolate, uint32_t index); | 1490 inline Object* GetElementNoExceptionThrown(Isolate* isolate, uint32_t index); |
| 1505 MUST_USE_RESULT MaybeObject* GetElementWithReceiver(Isolate* isolate, | 1491 MUST_USE_RESULT MaybeObject* GetElementWithReceiver(Isolate* isolate, |
| 1506 Object* receiver, | 1492 Object* receiver, |
| 1507 uint32_t index); | 1493 uint32_t index); |
| 1508 | 1494 |
| 1509 // Return the object's prototype (might be Heap::null_value()). | 1495 // Return the object's prototype (might be Heap::null_value()). |
| 1510 Object* GetPrototype(Isolate* isolate); | 1496 Object* GetPrototype(Isolate* isolate); |
| 1511 | 1497 |
| 1498 // Returns the permanent hash code associated with this object. May return |
| 1499 // undefined if not yet created. |
| 1500 Object* GetHash(); |
| 1501 |
| 1512 // Returns the permanent hash code associated with this object depending on | 1502 // Returns the permanent hash code associated with this object depending on |
| 1513 // the actual object type. Might return a failure in case no hash was | 1503 // the actual object type. May create and store a hash code if needed and none |
| 1514 // created yet or GC was caused by creation. | 1504 // exists. |
| 1515 MUST_USE_RESULT MaybeObject* GetHash(CreationFlag flag); | 1505 // TODO(rafaelw): Remove isolate parameter when objects.cc is fully |
| 1506 // handlified. |
| 1507 static Handle<Object> GetOrCreateHash(Handle<Object> object, |
| 1508 Isolate* isolate); |
| 1516 | 1509 |
| 1517 // Checks whether this object has the same value as the given one. This | 1510 // Checks whether this object has the same value as the given one. This |
| 1518 // function is implemented according to ES5, section 9.12 and can be used | 1511 // function is implemented according to ES5, section 9.12 and can be used |
| 1519 // to implement the Harmony "egal" function. | 1512 // to implement the Harmony "egal" function. |
| 1520 bool SameValue(Object* other); | 1513 bool SameValue(Object* other); |
| 1521 | 1514 |
| 1522 // Tries to convert an object to an array index. Returns true and sets | 1515 // Tries to convert an object to an array index. Returns true and sets |
| 1523 // the output parameter if it succeeds. | 1516 // the output parameter if it succeeds. |
| 1524 inline bool ToArrayIndex(uint32_t* index); | 1517 inline bool ToArrayIndex(uint32_t* index); |
| 1525 | 1518 |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1996 inline PropertyAttributes GetElementAttribute(uint32_t index); | 1989 inline PropertyAttributes GetElementAttribute(uint32_t index); |
| 1997 inline PropertyAttributes GetLocalElementAttribute(uint32_t index); | 1990 inline PropertyAttributes GetLocalElementAttribute(uint32_t index); |
| 1998 | 1991 |
| 1999 // Return the object's prototype (might be Heap::null_value()). | 1992 // Return the object's prototype (might be Heap::null_value()). |
| 2000 inline Object* GetPrototype(); | 1993 inline Object* GetPrototype(); |
| 2001 | 1994 |
| 2002 // Return the constructor function (may be Heap::null_value()). | 1995 // Return the constructor function (may be Heap::null_value()). |
| 2003 inline Object* GetConstructor(); | 1996 inline Object* GetConstructor(); |
| 2004 | 1997 |
| 2005 // Retrieves a permanent object identity hash code. The undefined value might | 1998 // Retrieves a permanent object identity hash code. The undefined value might |
| 2006 // be returned in case no hash was created yet and OMIT_CREATION was used. | 1999 // be returned in case no hash was created yet. |
| 2007 inline MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); | 2000 inline Object* GetIdentityHash(); |
| 2001 |
| 2002 // Retrieves a permanent object identity hash code. May create and store a |
| 2003 // hash code if needed and none exists. |
| 2004 inline static Handle<Object> GetOrCreateIdentityHash( |
| 2005 Handle<JSReceiver> object); |
| 2008 | 2006 |
| 2009 // Lookup a property. If found, the result is valid and has | 2007 // Lookup a property. If found, the result is valid and has |
| 2010 // detailed information. | 2008 // detailed information. |
| 2011 void LocalLookup(Name* name, LookupResult* result, | 2009 void LocalLookup(Name* name, LookupResult* result, |
| 2012 bool search_hidden_prototypes = false); | 2010 bool search_hidden_prototypes = false); |
| 2013 void Lookup(Name* name, LookupResult* result); | 2011 void Lookup(Name* name, LookupResult* result); |
| 2014 | 2012 |
| 2015 protected: | 2013 protected: |
| 2016 Smi* GenerateIdentityHash(); | 2014 Smi* GenerateIdentityHash(); |
| 2017 | 2015 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2029 LookupResult* result, | 2027 LookupResult* result, |
| 2030 Handle<Name> key, | 2028 Handle<Name> key, |
| 2031 Handle<Object> value, | 2029 Handle<Object> value, |
| 2032 PropertyAttributes attributes, | 2030 PropertyAttributes attributes, |
| 2033 StrictModeFlag strict_mode, | 2031 StrictModeFlag strict_mode, |
| 2034 StoreFromKeyed store_from_keyed); | 2032 StoreFromKeyed store_from_keyed); |
| 2035 | 2033 |
| 2036 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); | 2034 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); |
| 2037 }; | 2035 }; |
| 2038 | 2036 |
| 2037 // Forward declaration for JSObject::GetOrCreateHiddenPropertiesHashTable. |
| 2038 class ObjectHashTable; |
| 2039 |
| 2039 // The JSObject describes real heap allocated JavaScript objects with | 2040 // The JSObject describes real heap allocated JavaScript objects with |
| 2040 // properties. | 2041 // properties. |
| 2041 // Note that the map of JSObject changes during execution to enable inline | 2042 // Note that the map of JSObject changes during execution to enable inline |
| 2042 // caching. | 2043 // caching. |
| 2043 class JSObject: public JSReceiver { | 2044 class JSObject: public JSReceiver { |
| 2044 public: | 2045 public: |
| 2045 // [properties]: Backing storage for properties. | 2046 // [properties]: Backing storage for properties. |
| 2046 // properties is a FixedArray in the fast case and a Dictionary in the | 2047 // properties is a FixedArray in the fast case and a Dictionary in the |
| 2047 // slow case. | 2048 // slow case. |
| 2048 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties. | 2049 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2105 inline SeededNumberDictionary* element_dictionary(); // Gets slow elements. | 2106 inline SeededNumberDictionary* element_dictionary(); // Gets slow elements. |
| 2106 | 2107 |
| 2107 inline bool ShouldTrackAllocationInfo(); | 2108 inline bool ShouldTrackAllocationInfo(); |
| 2108 | 2109 |
| 2109 inline void set_map_and_elements( | 2110 inline void set_map_and_elements( |
| 2110 Map* map, | 2111 Map* map, |
| 2111 FixedArrayBase* value, | 2112 FixedArrayBase* value, |
| 2112 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); | 2113 WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
| 2113 | 2114 |
| 2114 // Requires: HasFastElements(). | 2115 // Requires: HasFastElements(). |
| 2116 static Handle<FixedArray> EnsureWritableFastElements( |
| 2117 Handle<JSObject> object); |
| 2115 MUST_USE_RESULT inline MaybeObject* EnsureWritableFastElements(); | 2118 MUST_USE_RESULT inline MaybeObject* EnsureWritableFastElements(); |
| 2116 | 2119 |
| 2117 // Collects elements starting at index 0. | 2120 // Collects elements starting at index 0. |
| 2118 // Undefined values are placed after non-undefined values. | 2121 // Undefined values are placed after non-undefined values. |
| 2119 // Returns the number of non-undefined values. | 2122 // Returns the number of non-undefined values. |
| 2120 MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit); | 2123 static Handle<Object> PrepareElementsForSort(Handle<JSObject> object, |
| 2124 uint32_t limit); |
| 2121 // As PrepareElementsForSort, but only on objects where elements is | 2125 // As PrepareElementsForSort, but only on objects where elements is |
| 2122 // a dictionary, and it will stay a dictionary. | 2126 // a dictionary, and it will stay a dictionary. |
| 2127 static Handle<Object> PrepareSlowElementsForSort(Handle<JSObject> object, |
| 2128 uint32_t limit); |
| 2123 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); | 2129 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); |
| 2124 | 2130 |
| 2125 static Handle<Object> GetPropertyWithCallback(Handle<JSObject> object, | 2131 static Handle<Object> GetPropertyWithCallback(Handle<JSObject> object, |
| 2126 Handle<Object> receiver, | 2132 Handle<Object> receiver, |
| 2127 Handle<Object> structure, | 2133 Handle<Object> structure, |
| 2128 Handle<Name> name); | 2134 Handle<Name> name); |
| 2129 | 2135 |
| 2130 static Handle<Object> SetPropertyWithCallback( | 2136 static Handle<Object> SetPropertyWithCallback( |
| 2131 Handle<JSObject> object, | 2137 Handle<JSObject> object, |
| 2132 Handle<Object> structure, | 2138 Handle<Object> structure, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2173 static void AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map); | 2179 static void AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map); |
| 2174 | 2180 |
| 2175 // Migrates the given object to a map whose field representations are the | 2181 // Migrates the given object to a map whose field representations are the |
| 2176 // lowest upper bound of all known representations for that field. | 2182 // lowest upper bound of all known representations for that field. |
| 2177 static void MigrateInstance(Handle<JSObject> instance); | 2183 static void MigrateInstance(Handle<JSObject> instance); |
| 2178 | 2184 |
| 2179 // Migrates the given object only if the target map is already available, | 2185 // Migrates the given object only if the target map is already available, |
| 2180 // or returns an empty handle if such a map is not yet available. | 2186 // or returns an empty handle if such a map is not yet available. |
| 2181 static Handle<Object> TryMigrateInstance(Handle<JSObject> instance); | 2187 static Handle<Object> TryMigrateInstance(Handle<JSObject> instance); |
| 2182 | 2188 |
| 2183 // Can cause GC. | |
| 2184 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributesTrampoline( | |
| 2185 Name* key, | |
| 2186 Object* value, | |
| 2187 PropertyAttributes attributes, | |
| 2188 ValueType value_type = OPTIMAL_REPRESENTATION, | |
| 2189 StoreMode mode = ALLOW_AS_CONSTANT, | |
| 2190 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK); | |
| 2191 | |
| 2192 // Retrieve a value in a normalized object given a lookup result. | 2189 // Retrieve a value in a normalized object given a lookup result. |
| 2193 // Handles the special representation of JS global objects. | 2190 // Handles the special representation of JS global objects. |
| 2194 Object* GetNormalizedProperty(LookupResult* result); | 2191 Object* GetNormalizedProperty(LookupResult* result); |
| 2195 | 2192 |
| 2196 // Sets the property value in a normalized object given a lookup result. | 2193 // Sets the property value in a normalized object given a lookup result. |
| 2197 // Handles the special representation of JS global objects. | 2194 // Handles the special representation of JS global objects. |
| 2198 static void SetNormalizedProperty(Handle<JSObject> object, | 2195 static void SetNormalizedProperty(Handle<JSObject> object, |
| 2199 LookupResult* result, | 2196 LookupResult* result, |
| 2200 Handle<Object> value); | 2197 Handle<Object> value); |
| 2201 | 2198 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2275 // | 2272 // |
| 2276 // Hidden properties are not local properties of the object itself. | 2273 // Hidden properties are not local properties of the object itself. |
| 2277 // Instead they are stored in an auxiliary structure kept as a local | 2274 // Instead they are stored in an auxiliary structure kept as a local |
| 2278 // property with a special name Heap::hidden_string(). But if the | 2275 // property with a special name Heap::hidden_string(). But if the |
| 2279 // receiver is a JSGlobalProxy then the auxiliary object is a property | 2276 // receiver is a JSGlobalProxy then the auxiliary object is a property |
| 2280 // of its prototype, and if it's a detached proxy, then you can't have | 2277 // of its prototype, and if it's a detached proxy, then you can't have |
| 2281 // hidden properties. | 2278 // hidden properties. |
| 2282 | 2279 |
| 2283 // Sets a hidden property on this object. Returns this object if successful, | 2280 // Sets a hidden property on this object. Returns this object if successful, |
| 2284 // undefined if called on a detached proxy. | 2281 // undefined if called on a detached proxy. |
| 2285 static Handle<Object> SetHiddenProperty(Handle<JSObject> obj, | 2282 static Handle<Object> SetHiddenProperty(Handle<JSObject> object, |
| 2286 Handle<Name> key, | 2283 Handle<Name> key, |
| 2287 Handle<Object> value); | 2284 Handle<Object> value); |
| 2288 // Returns a failure if a GC is required. | |
| 2289 MUST_USE_RESULT MaybeObject* SetHiddenProperty(Name* key, Object* value); | |
| 2290 // Gets the value of a hidden property with the given key. Returns the hole | 2285 // Gets the value of a hidden property with the given key. Returns the hole |
| 2291 // if the property doesn't exist (or if called on a detached proxy), | 2286 // if the property doesn't exist (or if called on a detached proxy), |
| 2292 // otherwise returns the value set for the key. | 2287 // otherwise returns the value set for the key. |
| 2293 Object* GetHiddenProperty(Name* key); | 2288 Object* GetHiddenProperty(Name* key); |
| 2294 // Deletes a hidden property. Deleting a non-existing property is | 2289 // Deletes a hidden property. Deleting a non-existing property is |
| 2295 // considered successful. | 2290 // considered successful. |
| 2296 static void DeleteHiddenProperty(Handle<JSObject> object, | 2291 static void DeleteHiddenProperty(Handle<JSObject> object, |
| 2297 Handle<Name> key); | 2292 Handle<Name> key); |
| 2298 // Returns true if the object has a property with the hidden string as name. | 2293 // Returns true if the object has a property with the hidden string as name. |
| 2299 bool HasHiddenProperties(); | 2294 bool HasHiddenProperties(); |
| 2300 | 2295 |
| 2301 static int GetIdentityHash(Handle<JSObject> object); | 2296 static void SetIdentityHash(Handle<JSObject> object, Handle<Smi> hash); |
| 2302 static void SetIdentityHash(Handle<JSObject> object, Smi* hash); | |
| 2303 | 2297 |
| 2304 inline void ValidateElements(); | 2298 inline void ValidateElements(); |
| 2305 | 2299 |
| 2306 // Makes sure that this object can contain HeapObject as elements. | 2300 // Makes sure that this object can contain HeapObject as elements. |
| 2307 static inline void EnsureCanContainHeapObjectElements(Handle<JSObject> obj); | 2301 static inline void EnsureCanContainHeapObjectElements(Handle<JSObject> obj); |
| 2308 | 2302 |
| 2309 // Makes sure that this object can contain the specified elements. | 2303 // Makes sure that this object can contain the specified elements. |
| 2310 MUST_USE_RESULT inline MaybeObject* EnsureCanContainElements( | 2304 MUST_USE_RESULT inline MaybeObject* EnsureCanContainElements( |
| 2311 Object** elements, | 2305 Object** elements, |
| 2312 uint32_t count, | 2306 uint32_t count, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2368 Handle<Object> value, | 2362 Handle<Object> value, |
| 2369 StrictModeFlag strict_mode); | 2363 StrictModeFlag strict_mode); |
| 2370 | 2364 |
| 2371 // Empty handle is returned if the element cannot be set to the given value. | 2365 // Empty handle is returned if the element cannot be set to the given value. |
| 2372 static Handle<Object> SetElement( | 2366 static Handle<Object> SetElement( |
| 2373 Handle<JSObject> object, | 2367 Handle<JSObject> object, |
| 2374 uint32_t index, | 2368 uint32_t index, |
| 2375 Handle<Object> value, | 2369 Handle<Object> value, |
| 2376 PropertyAttributes attr, | 2370 PropertyAttributes attr, |
| 2377 StrictModeFlag strict_mode, | 2371 StrictModeFlag strict_mode, |
| 2372 bool check_prototype = true, |
| 2378 SetPropertyMode set_mode = SET_PROPERTY); | 2373 SetPropertyMode set_mode = SET_PROPERTY); |
| 2379 | 2374 |
| 2380 // A Failure object is returned if GC is needed. | 2375 // A Failure object is returned if GC is needed. |
| 2381 MUST_USE_RESULT MaybeObject* SetElement( | 2376 MUST_USE_RESULT MaybeObject* SetElement( |
| 2382 uint32_t index, | 2377 uint32_t index, |
| 2383 Object* value, | 2378 Object* value, |
| 2384 PropertyAttributes attributes, | 2379 PropertyAttributes attributes, |
| 2385 StrictModeFlag strict_mode, | 2380 StrictModeFlag strict_mode, |
| 2386 bool check_prototype = true, | 2381 bool check_prototype = true, |
| 2387 SetPropertyMode set_mode = SET_PROPERTY); | 2382 SetPropertyMode set_mode = SET_PROPERTY); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2584 int number_of_slow_used_properties_; | 2579 int number_of_slow_used_properties_; |
| 2585 int number_of_slow_unused_properties_; | 2580 int number_of_slow_unused_properties_; |
| 2586 int number_of_fast_used_elements_; | 2581 int number_of_fast_used_elements_; |
| 2587 int number_of_fast_unused_elements_; | 2582 int number_of_fast_unused_elements_; |
| 2588 int number_of_slow_used_elements_; | 2583 int number_of_slow_used_elements_; |
| 2589 int number_of_slow_unused_elements_; | 2584 int number_of_slow_unused_elements_; |
| 2590 }; | 2585 }; |
| 2591 | 2586 |
| 2592 void IncrementSpillStatistics(SpillInformation* info); | 2587 void IncrementSpillStatistics(SpillInformation* info); |
| 2593 #endif | 2588 #endif |
| 2589 |
| 2590 #ifdef VERIFY_HEAP |
| 2591 // If a GC was caused while constructing this object, the elements pointer |
| 2592 // may point to a one pointer filler map. The object won't be rooted, but |
| 2593 // our heap verification code could stumble across it. |
| 2594 bool ElementsAreSafeToExamine(); |
| 2595 #endif |
| 2596 |
| 2594 Object* SlowReverseLookup(Object* value); | 2597 Object* SlowReverseLookup(Object* value); |
| 2595 | 2598 |
| 2596 // Maximal number of fast properties for the JSObject. Used to | 2599 // Maximal number of fast properties for the JSObject. Used to |
| 2597 // restrict the number of map transitions to avoid an explosion in | 2600 // restrict the number of map transitions to avoid an explosion in |
| 2598 // the number of maps for objects used as dictionaries. | 2601 // the number of maps for objects used as dictionaries. |
| 2599 inline bool TooManyFastProperties( | 2602 inline bool TooManyFastProperties( |
| 2600 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); | 2603 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); |
| 2601 | 2604 |
| 2602 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1). | 2605 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1). |
| 2603 // Also maximal value of JSArray's length property. | 2606 // Also maximal value of JSArray's length property. |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2838 v8::AccessControl access_control); | 2841 v8::AccessControl access_control); |
| 2839 | 2842 |
| 2840 // Try to define a single accessor paying attention to map transitions. | 2843 // Try to define a single accessor paying attention to map transitions. |
| 2841 // Returns false if this was not possible and we have to use the slow case. | 2844 // Returns false if this was not possible and we have to use the slow case. |
| 2842 static bool DefineFastAccessor(Handle<JSObject> object, | 2845 static bool DefineFastAccessor(Handle<JSObject> object, |
| 2843 Handle<Name> name, | 2846 Handle<Name> name, |
| 2844 AccessorComponent component, | 2847 AccessorComponent component, |
| 2845 Handle<Object> accessor, | 2848 Handle<Object> accessor, |
| 2846 PropertyAttributes attributes); | 2849 PropertyAttributes attributes); |
| 2847 | 2850 |
| 2848 enum InitializeHiddenProperties { | |
| 2849 CREATE_NEW_IF_ABSENT, | |
| 2850 ONLY_RETURN_INLINE_VALUE | |
| 2851 }; | |
| 2852 | 2851 |
| 2853 // If create_if_absent is true, return the hash table backing store | 2852 // Return the hash table backing store or the inline stored identity hash, |
| 2854 // for hidden properties. If there is no backing store, allocate one. | 2853 // whatever is found. |
| 2855 // If create_if_absent is false, return the hash table backing store | 2854 MUST_USE_RESULT Object* GetHiddenPropertiesHashTable(); |
| 2856 // or the inline stored identity hash, whatever is found. | 2855 |
| 2857 MUST_USE_RESULT MaybeObject* GetHiddenPropertiesHashTable( | 2856 // Return the hash table backing store for hidden properties. If there is no |
| 2858 InitializeHiddenProperties init_option); | 2857 // backing store, allocate one. |
| 2858 static Handle<ObjectHashTable> GetOrCreateHiddenPropertiesHashtable( |
| 2859 Handle<JSObject> object); |
| 2860 |
| 2859 // Set the hidden property backing store to either a hash table or | 2861 // Set the hidden property backing store to either a hash table or |
| 2860 // the inline-stored identity hash. | 2862 // the inline-stored identity hash. |
| 2861 MUST_USE_RESULT MaybeObject* SetHiddenPropertiesHashTable( | 2863 static Handle<Object> SetHiddenPropertiesHashTable( |
| 2862 Object* value); | 2864 Handle<JSObject> object, |
| 2865 Handle<Object> value); |
| 2863 | 2866 |
| 2864 MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); | 2867 MUST_USE_RESULT Object* GetIdentityHash(); |
| 2868 |
| 2869 static Handle<Object> GetOrCreateIdentityHash(Handle<JSObject> object); |
| 2865 | 2870 |
| 2866 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); | 2871 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); |
| 2867 }; | 2872 }; |
| 2868 | 2873 |
| 2869 | 2874 |
| 2870 // Common superclass for FixedArrays that allow implementations to share | 2875 // Common superclass for FixedArrays that allow implementations to share |
| 2871 // common accessors and some code paths. | 2876 // common accessors and some code paths. |
| 2872 class FixedArrayBase: public HeapObject { | 2877 class FixedArrayBase: public HeapObject { |
| 2873 public: | 2878 public: |
| 2874 // [length]: length of the array. | 2879 // [length]: length of the array. |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3464 static uint32_t HashForObject(Key key, Object* object) { return 0; } | 3469 static uint32_t HashForObject(Key key, Object* object) { return 0; } |
| 3465 static uint32_t SeededHashForObject(Key key, uint32_t seed, Object* object) { | 3470 static uint32_t SeededHashForObject(Key key, uint32_t seed, Object* object) { |
| 3466 ASSERT(UsesSeed); | 3471 ASSERT(UsesSeed); |
| 3467 return HashForObject(key, object); | 3472 return HashForObject(key, object); |
| 3468 } | 3473 } |
| 3469 }; | 3474 }; |
| 3470 | 3475 |
| 3471 template<typename Shape, typename Key> | 3476 template<typename Shape, typename Key> |
| 3472 class HashTable: public FixedArray { | 3477 class HashTable: public FixedArray { |
| 3473 public: | 3478 public: |
| 3474 enum MinimumCapacity { | |
| 3475 USE_DEFAULT_MINIMUM_CAPACITY, | |
| 3476 USE_CUSTOM_MINIMUM_CAPACITY | |
| 3477 }; | |
| 3478 | |
| 3479 // Wrapper methods | 3479 // Wrapper methods |
| 3480 inline uint32_t Hash(Key key) { | 3480 inline uint32_t Hash(Key key) { |
| 3481 if (Shape::UsesSeed) { | 3481 if (Shape::UsesSeed) { |
| 3482 return Shape::SeededHash(key, | 3482 return Shape::SeededHash(key, |
| 3483 GetHeap()->HashSeed()); | 3483 GetHeap()->HashSeed()); |
| 3484 } else { | 3484 } else { |
| 3485 return Shape::Hash(key); | 3485 return Shape::Hash(key); |
| 3486 } | 3486 } |
| 3487 } | 3487 } |
| 3488 | 3488 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3579 (FixedArray::kMaxLength - kElementsStartOffset) / kEntrySize; | 3579 (FixedArray::kMaxLength - kElementsStartOffset) / kEntrySize; |
| 3580 | 3580 |
| 3581 // Find entry for key otherwise return kNotFound. | 3581 // Find entry for key otherwise return kNotFound. |
| 3582 inline int FindEntry(Key key); | 3582 inline int FindEntry(Key key); |
| 3583 int FindEntry(Isolate* isolate, Key key); | 3583 int FindEntry(Isolate* isolate, Key key); |
| 3584 | 3584 |
| 3585 // Rehashes the table in-place. | 3585 // Rehashes the table in-place. |
| 3586 void Rehash(Key key); | 3586 void Rehash(Key key); |
| 3587 | 3587 |
| 3588 protected: | 3588 protected: |
| 3589 friend class ObjectHashSet; |
| 3590 friend class ObjectHashTable; |
| 3591 |
| 3589 // Find the entry at which to insert element with the given key that | 3592 // Find the entry at which to insert element with the given key that |
| 3590 // has the given hash value. | 3593 // has the given hash value. |
| 3591 uint32_t FindInsertionEntry(uint32_t hash); | 3594 uint32_t FindInsertionEntry(uint32_t hash); |
| 3592 | 3595 |
| 3593 // Returns the index for an entry (of the key) | 3596 // Returns the index for an entry (of the key) |
| 3594 static inline int EntryToIndex(int entry) { | 3597 static inline int EntryToIndex(int entry) { |
| 3595 return (entry * kEntrySize) + kElementsStartIndex; | 3598 return (entry * kEntrySize) + kElementsStartIndex; |
| 3596 } | 3599 } |
| 3597 | 3600 |
| 3598 // Update the number of elements in the hash table. | 3601 // Update the number of elements in the hash table. |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4042 class ObjectHashSet: public HashTable<ObjectHashTableShape<1>, Object*> { | 4045 class ObjectHashSet: public HashTable<ObjectHashTableShape<1>, Object*> { |
| 4043 public: | 4046 public: |
| 4044 static inline ObjectHashSet* cast(Object* obj) { | 4047 static inline ObjectHashSet* cast(Object* obj) { |
| 4045 ASSERT(obj->IsHashTable()); | 4048 ASSERT(obj->IsHashTable()); |
| 4046 return reinterpret_cast<ObjectHashSet*>(obj); | 4049 return reinterpret_cast<ObjectHashSet*>(obj); |
| 4047 } | 4050 } |
| 4048 | 4051 |
| 4049 // Looks up whether the given key is part of this hash set. | 4052 // Looks up whether the given key is part of this hash set. |
| 4050 bool Contains(Object* key); | 4053 bool Contains(Object* key); |
| 4051 | 4054 |
| 4055 static Handle<ObjectHashSet> EnsureCapacity( |
| 4056 Handle<ObjectHashSet> table, |
| 4057 int n, |
| 4058 Handle<Object> key, |
| 4059 PretenureFlag pretenure = NOT_TENURED); |
| 4060 |
| 4061 // Attempt to shrink hash table after removal of key. |
| 4062 static Handle<ObjectHashSet> Shrink(Handle<ObjectHashSet> table, |
| 4063 Handle<Object> key); |
| 4064 |
| 4052 // Adds the given key to this hash set. | 4065 // Adds the given key to this hash set. |
| 4053 MUST_USE_RESULT MaybeObject* Add(Object* key); | 4066 static Handle<ObjectHashSet> Add(Handle<ObjectHashSet> table, |
| 4067 Handle<Object> key); |
| 4054 | 4068 |
| 4055 // Removes the given key from this hash set. | 4069 // Removes the given key from this hash set. |
| 4056 MUST_USE_RESULT MaybeObject* Remove(Object* key); | 4070 static Handle<ObjectHashSet> Remove(Handle<ObjectHashSet> table, |
| 4071 Handle<Object> key); |
| 4057 }; | 4072 }; |
| 4058 | 4073 |
| 4059 | 4074 |
| 4060 // ObjectHashTable maps keys that are arbitrary objects to object values by | 4075 // ObjectHashTable maps keys that are arbitrary objects to object values by |
| 4061 // using the identity hash of the key for hashing purposes. | 4076 // using the identity hash of the key for hashing purposes. |
| 4062 class ObjectHashTable: public HashTable<ObjectHashTableShape<2>, Object*> { | 4077 class ObjectHashTable: public HashTable<ObjectHashTableShape<2>, Object*> { |
| 4063 public: | 4078 public: |
| 4064 static inline ObjectHashTable* cast(Object* obj) { | 4079 static inline ObjectHashTable* cast(Object* obj) { |
| 4065 ASSERT(obj->IsHashTable()); | 4080 ASSERT(obj->IsHashTable()); |
| 4066 return reinterpret_cast<ObjectHashTable*>(obj); | 4081 return reinterpret_cast<ObjectHashTable*>(obj); |
| 4067 } | 4082 } |
| 4068 | 4083 |
| 4084 static Handle<ObjectHashTable> EnsureCapacity( |
| 4085 Handle<ObjectHashTable> table, |
| 4086 int n, |
| 4087 Handle<Object> key, |
| 4088 PretenureFlag pretenure = NOT_TENURED); |
| 4089 |
| 4090 // Attempt to shrink hash table after removal of key. |
| 4091 static Handle<ObjectHashTable> Shrink(Handle<ObjectHashTable> table, |
| 4092 Handle<Object> key); |
| 4093 |
| 4069 // Looks up the value associated with the given key. The hole value is | 4094 // Looks up the value associated with the given key. The hole value is |
| 4070 // returned in case the key is not present. | 4095 // returned in case the key is not present. |
| 4071 Object* Lookup(Object* key); | 4096 Object* Lookup(Object* key); |
| 4072 | 4097 |
| 4073 // Adds (or overwrites) the value associated with the given key. Mapping a | 4098 // Adds (or overwrites) the value associated with the given key. Mapping a |
| 4074 // key to the hole value causes removal of the whole entry. | 4099 // key to the hole value causes removal of the whole entry. |
| 4075 MUST_USE_RESULT MaybeObject* Put(Object* key, Object* value); | 4100 static Handle<ObjectHashTable> Put(Handle<ObjectHashTable> table, |
| 4101 Handle<Object> key, |
| 4102 Handle<Object> value); |
| 4076 | 4103 |
| 4077 private: | 4104 private: |
| 4078 friend class MarkCompactCollector; | 4105 friend class MarkCompactCollector; |
| 4079 | 4106 |
| 4080 void AddEntry(int entry, Object* key, Object* value); | 4107 void AddEntry(int entry, Object* key, Object* value); |
| 4081 void RemoveEntry(int entry); | 4108 void RemoveEntry(int entry); |
| 4082 | 4109 |
| 4083 // Returns the index to the value of an entry. | 4110 // Returns the index to the value of an entry. |
| 4084 static inline int EntryToValueIndex(int entry) { | 4111 static inline int EntryToValueIndex(int entry) { |
| 4085 return EntryToIndex(entry) + 1; | 4112 return EntryToIndex(entry) + 1; |
| (...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4995 // [relocation_info]: Code relocation information | 5022 // [relocation_info]: Code relocation information |
| 4996 DECL_ACCESSORS(relocation_info, ByteArray) | 5023 DECL_ACCESSORS(relocation_info, ByteArray) |
| 4997 void InvalidateRelocation(); | 5024 void InvalidateRelocation(); |
| 4998 | 5025 |
| 4999 // [handler_table]: Fixed array containing offsets of exception handlers. | 5026 // [handler_table]: Fixed array containing offsets of exception handlers. |
| 5000 DECL_ACCESSORS(handler_table, FixedArray) | 5027 DECL_ACCESSORS(handler_table, FixedArray) |
| 5001 | 5028 |
| 5002 // [deoptimization_data]: Array containing data for deopt. | 5029 // [deoptimization_data]: Array containing data for deopt. |
| 5003 DECL_ACCESSORS(deoptimization_data, FixedArray) | 5030 DECL_ACCESSORS(deoptimization_data, FixedArray) |
| 5004 | 5031 |
| 5005 // [type_feedback_info]: This field stores various things, depending on the | 5032 // [raw_type_feedback_info]: This field stores various things, depending on |
| 5006 // kind of the code object. | 5033 // the kind of the code object. |
| 5007 // FUNCTION => type feedback information. | 5034 // FUNCTION => type feedback information. |
| 5008 // STUB => various things, e.g. a SMI | 5035 // STUB => various things, e.g. a SMI |
| 5009 // OPTIMIZED_FUNCTION => the next_code_link for optimized code list. | 5036 // OPTIMIZED_FUNCTION => the next_code_link for optimized code list. |
| 5010 DECL_ACCESSORS(type_feedback_info, Object) | 5037 DECL_ACCESSORS(raw_type_feedback_info, Object) |
| 5011 inline void InitializeTypeFeedbackInfoNoWriteBarrier(Object* value); | 5038 inline Object* type_feedback_info(); |
| 5039 inline void set_type_feedback_info( |
| 5040 Object* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); |
| 5012 inline int stub_info(); | 5041 inline int stub_info(); |
| 5013 inline void set_stub_info(int info); | 5042 inline void set_stub_info(int info); |
| 5014 | 5043 |
| 5015 // [next_code_link]: Link for lists of optimized or deoptimized code. | 5044 // [next_code_link]: Link for lists of optimized or deoptimized code. |
| 5016 // Note that storage for this field is overlapped with typefeedback_info. | 5045 // Note that storage for this field is overlapped with typefeedback_info. |
| 5017 DECL_ACCESSORS(next_code_link, Object) | 5046 DECL_ACCESSORS(next_code_link, Object) |
| 5018 | 5047 |
| 5019 // [gc_metadata]: Field used to hold GC related metadata. The contents of this | 5048 // [gc_metadata]: Field used to hold GC related metadata. The contents of this |
| 5020 // field does not have to be traced during garbage collection since | 5049 // field does not have to be traced during garbage collection since |
| 5021 // it is only used by the garbage collector itself. | 5050 // it is only used by the garbage collector itself. |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5176 | 5205 |
| 5177 // Find |length| handlers and put them into |code_list|. Returns false if not | 5206 // Find |length| handlers and put them into |code_list|. Returns false if not |
| 5178 // enough handlers can be found. | 5207 // enough handlers can be found. |
| 5179 bool FindHandlers(CodeHandleList* code_list, int length = -1); | 5208 bool FindHandlers(CodeHandleList* code_list, int length = -1); |
| 5180 | 5209 |
| 5181 // Find the first name in an IC stub. | 5210 // Find the first name in an IC stub. |
| 5182 Name* FindFirstName(); | 5211 Name* FindFirstName(); |
| 5183 | 5212 |
| 5184 void ReplaceNthCell(int n, Cell* replace_with); | 5213 void ReplaceNthCell(int n, Cell* replace_with); |
| 5185 | 5214 |
| 5215 // The entire code object including its header is copied verbatim to the |
| 5216 // snapshot so that it can be written in one, fast, memcpy during |
| 5217 // deserialization. The deserializer will overwrite some pointers, rather |
| 5218 // like a runtime linker, but the random allocation addresses used in the |
| 5219 // mksnapshot process would still be present in the unlinked snapshot data, |
| 5220 // which would make snapshot production non-reproducible. This method wipes |
| 5221 // out the to-be-overwritten header data for reproducible snapshots. |
| 5222 inline void WipeOutHeader(); |
| 5223 |
| 5186 class ExtraICStateStrictMode: public BitField<StrictModeFlag, 0, 1> {}; | 5224 class ExtraICStateStrictMode: public BitField<StrictModeFlag, 0, 1> {}; |
| 5187 class ExtraICStateKeyedAccessStoreMode: | 5225 class ExtraICStateKeyedAccessStoreMode: |
| 5188 public BitField<KeyedAccessStoreMode, 1, 4> {}; // NOLINT | 5226 public BitField<KeyedAccessStoreMode, 1, 4> {}; // NOLINT |
| 5189 | 5227 |
| 5190 static inline StrictModeFlag GetStrictMode(ExtraICState extra_ic_state) { | 5228 static inline StrictModeFlag GetStrictMode(ExtraICState extra_ic_state) { |
| 5191 return ExtraICStateStrictMode::decode(extra_ic_state); | 5229 return ExtraICStateStrictMode::decode(extra_ic_state); |
| 5192 } | 5230 } |
| 5193 | 5231 |
| 5194 static inline KeyedAccessStoreMode GetKeyedAccessStoreMode( | 5232 static inline KeyedAccessStoreMode GetKeyedAccessStoreMode( |
| 5195 ExtraICState extra_ic_state) { | 5233 ExtraICState extra_ic_state) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5286 int CodeSize() { return SizeFor(body_size()); } | 5324 int CodeSize() { return SizeFor(body_size()); } |
| 5287 inline void CodeIterateBody(ObjectVisitor* v); | 5325 inline void CodeIterateBody(ObjectVisitor* v); |
| 5288 | 5326 |
| 5289 template<typename StaticVisitor> | 5327 template<typename StaticVisitor> |
| 5290 inline void CodeIterateBody(Heap* heap); | 5328 inline void CodeIterateBody(Heap* heap); |
| 5291 | 5329 |
| 5292 DECLARE_PRINTER(Code) | 5330 DECLARE_PRINTER(Code) |
| 5293 DECLARE_VERIFIER(Code) | 5331 DECLARE_VERIFIER(Code) |
| 5294 | 5332 |
| 5295 void ClearInlineCaches(); | 5333 void ClearInlineCaches(); |
| 5334 void ClearInlineCaches(Kind kind); |
| 5335 |
| 5296 void ClearTypeFeedbackCells(Heap* heap); | 5336 void ClearTypeFeedbackCells(Heap* heap); |
| 5297 | 5337 |
| 5298 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); | 5338 BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); |
| 5299 | 5339 |
| 5300 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, | 5340 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, |
| 5301 enum Age { | 5341 enum Age { |
| 5302 kNotExecutedCodeAge = -2, | 5342 kNotExecutedCodeAge = -2, |
| 5303 kExecutedOnceCodeAge = -1, | 5343 kExecutedOnceCodeAge = -1, |
| 5304 kNoAgeCodeAge = 0, | 5344 kNoAgeCodeAge = 0, |
| 5305 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) | 5345 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) |
| 5306 kAfterLastCodeAge, | 5346 kAfterLastCodeAge, |
| 5347 kFirstCodeAge = kNotExecutedCodeAge, |
| 5307 kLastCodeAge = kAfterLastCodeAge - 1, | 5348 kLastCodeAge = kAfterLastCodeAge - 1, |
| 5308 kCodeAgeCount = kAfterLastCodeAge - 1, | 5349 kCodeAgeCount = kAfterLastCodeAge - kNotExecutedCodeAge - 1, |
| 5309 kIsOldCodeAge = kSexagenarianCodeAge, | 5350 kIsOldCodeAge = kSexagenarianCodeAge, |
| 5310 kPreAgedCodeAge = kIsOldCodeAge - 1 | 5351 kPreAgedCodeAge = kIsOldCodeAge - 1 |
| 5311 }; | 5352 }; |
| 5312 #undef DECLARE_CODE_AGE_ENUM | 5353 #undef DECLARE_CODE_AGE_ENUM |
| 5313 | 5354 |
| 5314 // Code aging. Indicates how many full GCs this code has survived without | 5355 // Code aging. Indicates how many full GCs this code has survived without |
| 5315 // being entered through the prologue. Used to determine when it is | 5356 // being entered through the prologue. Used to determine when it is |
| 5316 // relatively safe to flush this code object and replace it with the lazy | 5357 // relatively safe to flush this code object and replace it with the lazy |
| 5317 // compilation stub. | 5358 // compilation stub. |
| 5318 static void MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate); | 5359 static void MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate); |
| 5319 static void MarkCodeAsExecuted(byte* sequence, Isolate* isolate); | 5360 static void MarkCodeAsExecuted(byte* sequence, Isolate* isolate); |
| 5320 void MakeOlder(MarkingParity); | 5361 void MakeOlder(MarkingParity); |
| 5321 static bool IsYoungSequence(byte* sequence); | 5362 static bool IsYoungSequence(byte* sequence); |
| 5322 bool IsOld(); | 5363 bool IsOld(); |
| 5323 Age GetAge(); | 5364 Age GetAge(); |
| 5365 // Gets the raw code age, including psuedo code-age values such as |
| 5366 // kNotExecutedCodeAge and kExecutedOnceCodeAge. |
| 5367 Age GetRawAge(); |
| 5324 static inline Code* GetPreAgedCodeAgeStub(Isolate* isolate) { | 5368 static inline Code* GetPreAgedCodeAgeStub(Isolate* isolate) { |
| 5325 return GetCodeAgeStub(isolate, kNotExecutedCodeAge, NO_MARKING_PARITY); | 5369 return GetCodeAgeStub(isolate, kNotExecutedCodeAge, NO_MARKING_PARITY); |
| 5326 } | 5370 } |
| 5327 | 5371 |
| 5328 void PrintDeoptLocation(int bailout_id); | 5372 void PrintDeoptLocation(FILE* out, int bailout_id); |
| 5329 bool CanDeoptAt(Address pc); | 5373 bool CanDeoptAt(Address pc); |
| 5330 | 5374 |
| 5331 #ifdef VERIFY_HEAP | 5375 #ifdef VERIFY_HEAP |
| 5332 void VerifyEmbeddedObjectsDependency(); | 5376 void VerifyEmbeddedObjectsDependency(); |
| 5333 #endif | 5377 #endif |
| 5334 | 5378 |
| 5335 static bool IsWeakEmbeddedObject(Kind kind, Object* object); | 5379 static bool IsWeakEmbeddedObject(Kind kind, Object* object); |
| 5336 | 5380 |
| 5337 // Max loop nesting marker used to postpose OSR. We don't take loop | 5381 // Max loop nesting marker used to postpose OSR. We don't take loop |
| 5338 // nesting that is deeper than 5 levels into account. | 5382 // nesting that is deeper than 5 levels into account. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5454 ExtendedExtraICStateField::kShift + | 5498 ExtendedExtraICStateField::kShift + |
| 5455 ExtendedExtraICStateField::kSize); | 5499 ExtendedExtraICStateField::kSize); |
| 5456 | 5500 |
| 5457 // This constant should be encodable in an ARM instruction. | 5501 // This constant should be encodable in an ARM instruction. |
| 5458 static const int kFlagsNotUsedInLookup = | 5502 static const int kFlagsNotUsedInLookup = |
| 5459 TypeField::kMask | CacheHolderField::kMask; | 5503 TypeField::kMask | CacheHolderField::kMask; |
| 5460 | 5504 |
| 5461 private: | 5505 private: |
| 5462 friend class RelocIterator; | 5506 friend class RelocIterator; |
| 5463 | 5507 |
| 5508 void ClearInlineCaches(Kind* kind); |
| 5509 |
| 5464 // Code aging | 5510 // Code aging |
| 5465 byte* FindCodeAgeSequence(); | 5511 byte* FindCodeAgeSequence(); |
| 5466 static void GetCodeAgeAndParity(Code* code, Age* age, | 5512 static void GetCodeAgeAndParity(Code* code, Age* age, |
| 5467 MarkingParity* parity); | 5513 MarkingParity* parity); |
| 5468 static void GetCodeAgeAndParity(byte* sequence, Age* age, | 5514 static void GetCodeAgeAndParity(byte* sequence, Age* age, |
| 5469 MarkingParity* parity); | 5515 MarkingParity* parity); |
| 5470 static Code* GetCodeAgeStub(Isolate* isolate, Age age, MarkingParity parity); | 5516 static Code* GetCodeAgeStub(Isolate* isolate, Age age, MarkingParity parity); |
| 5471 | 5517 |
| 5472 // Code aging -- platform-specific | 5518 // Code aging -- platform-specific |
| 5473 static void PatchPlatformCodeAge(Isolate* isolate, | 5519 static void PatchPlatformCodeAge(Isolate* isolate, |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5745 } | 5791 } |
| 5746 | 5792 |
| 5747 inline bool has_slow_elements_kind() { | 5793 inline bool has_slow_elements_kind() { |
| 5748 return elements_kind() == DICTIONARY_ELEMENTS | 5794 return elements_kind() == DICTIONARY_ELEMENTS |
| 5749 || elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS; | 5795 || elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS; |
| 5750 } | 5796 } |
| 5751 | 5797 |
| 5752 static bool IsValidElementsTransition(ElementsKind from_kind, | 5798 static bool IsValidElementsTransition(ElementsKind from_kind, |
| 5753 ElementsKind to_kind); | 5799 ElementsKind to_kind); |
| 5754 | 5800 |
| 5801 // Returns true if the current map doesn't have DICTIONARY_ELEMENTS but if a |
| 5802 // map with DICTIONARY_ELEMENTS was found in the prototype chain. |
| 5803 bool DictionaryElementsInPrototypeChainOnly(); |
| 5804 |
| 5755 inline bool HasTransitionArray(); | 5805 inline bool HasTransitionArray(); |
| 5756 inline bool HasElementsTransition(); | 5806 inline bool HasElementsTransition(); |
| 5757 inline Map* elements_transition_map(); | 5807 inline Map* elements_transition_map(); |
| 5758 MUST_USE_RESULT inline MaybeObject* set_elements_transition_map( | 5808 MUST_USE_RESULT inline MaybeObject* set_elements_transition_map( |
| 5759 Map* transitioned_map); | 5809 Map* transitioned_map); |
| 5760 inline void SetTransition(int transition_index, Map* target); | 5810 inline void SetTransition(int transition_index, Map* target); |
| 5761 inline Map* GetTransition(int transition_index); | 5811 inline Map* GetTransition(int transition_index); |
| 5762 | 5812 |
| 5763 static Handle<TransitionArray> AddTransition(Handle<Map> map, | 5813 static Handle<TransitionArray> AddTransition(Handle<Map> map, |
| 5764 Handle<Name> key, | 5814 Handle<Name> key, |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6725 | 6775 |
| 6726 // True if the function has any duplicated parameter names. | 6776 // True if the function has any duplicated parameter names. |
| 6727 DECL_BOOLEAN_ACCESSORS(has_duplicate_parameters) | 6777 DECL_BOOLEAN_ACCESSORS(has_duplicate_parameters) |
| 6728 | 6778 |
| 6729 // Indicates whether the function is a native function. | 6779 // Indicates whether the function is a native function. |
| 6730 // These needs special treatment in .call and .apply since | 6780 // These needs special treatment in .call and .apply since |
| 6731 // null passed as the receiver should not be translated to the | 6781 // null passed as the receiver should not be translated to the |
| 6732 // global object. | 6782 // global object. |
| 6733 DECL_BOOLEAN_ACCESSORS(native) | 6783 DECL_BOOLEAN_ACCESSORS(native) |
| 6734 | 6784 |
| 6785 // Indicate that this builtin needs to be inlined in crankshaft. |
| 6786 DECL_BOOLEAN_ACCESSORS(inline_builtin) |
| 6787 |
| 6735 // Indicates that the function was created by the Function function. | 6788 // Indicates that the function was created by the Function function. |
| 6736 // Though it's anonymous, toString should treat it as if it had the name | 6789 // Though it's anonymous, toString should treat it as if it had the name |
| 6737 // "anonymous". We don't set the name itself so that the system does not | 6790 // "anonymous". We don't set the name itself so that the system does not |
| 6738 // see a binding for it. | 6791 // see a binding for it. |
| 6739 DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous) | 6792 DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous) |
| 6740 | 6793 |
| 6741 // Indicates whether the function is a bound function created using | 6794 // Indicates whether the function is a bound function created using |
| 6742 // the bind function. | 6795 // the bind function. |
| 6743 DECL_BOOLEAN_ACCESSORS(bound) | 6796 DECL_BOOLEAN_ACCESSORS(bound) |
| 6744 | 6797 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6814 set_opt_count_and_bailout_reason( | 6867 set_opt_count_and_bailout_reason( |
| 6815 DisabledOptimizationReasonBits::update(opt_count_and_bailout_reason(), | 6868 DisabledOptimizationReasonBits::update(opt_count_and_bailout_reason(), |
| 6816 reason)); | 6869 reason)); |
| 6817 } | 6870 } |
| 6818 | 6871 |
| 6819 void set_dont_optimize_reason(BailoutReason reason) { | 6872 void set_dont_optimize_reason(BailoutReason reason) { |
| 6820 set_bailout_reason(reason); | 6873 set_bailout_reason(reason); |
| 6821 set_dont_optimize(reason != kNoReason); | 6874 set_dont_optimize(reason != kNoReason); |
| 6822 } | 6875 } |
| 6823 | 6876 |
| 6877 // Check whether or not this function is inlineable. |
| 6878 bool IsInlineable(); |
| 6879 |
| 6824 // Source size of this function. | 6880 // Source size of this function. |
| 6825 int SourceSize(); | 6881 int SourceSize(); |
| 6826 | 6882 |
| 6827 // Calculate the instance size. | 6883 // Calculate the instance size. |
| 6828 int CalculateInstanceSize(); | 6884 int CalculateInstanceSize(); |
| 6829 | 6885 |
| 6830 // Calculate the number of in-object properties. | 6886 // Calculate the number of in-object properties. |
| 6831 int CalculateInObjectProperties(); | 6887 int CalculateInObjectProperties(); |
| 6832 | 6888 |
| 6833 // Dispatched behavior. | 6889 // Dispatched behavior. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6964 enum CompilerHints { | 7020 enum CompilerHints { |
| 6965 kAllowLazyCompilation, | 7021 kAllowLazyCompilation, |
| 6966 kAllowLazyCompilationWithoutContext, | 7022 kAllowLazyCompilationWithoutContext, |
| 6967 kLiveObjectsMayExist, | 7023 kLiveObjectsMayExist, |
| 6968 kOptimizationDisabled, | 7024 kOptimizationDisabled, |
| 6969 kStrictModeFunction, | 7025 kStrictModeFunction, |
| 6970 kExtendedModeFunction, | 7026 kExtendedModeFunction, |
| 6971 kUsesArguments, | 7027 kUsesArguments, |
| 6972 kHasDuplicateParameters, | 7028 kHasDuplicateParameters, |
| 6973 kNative, | 7029 kNative, |
| 7030 kInlineBuiltin, |
| 6974 kBoundFunction, | 7031 kBoundFunction, |
| 6975 kIsAnonymous, | 7032 kIsAnonymous, |
| 6976 kNameShouldPrintAsAnonymous, | 7033 kNameShouldPrintAsAnonymous, |
| 6977 kIsFunction, | 7034 kIsFunction, |
| 6978 kDontOptimize, | 7035 kDontOptimize, |
| 6979 kDontInline, | 7036 kDontInline, |
| 6980 kDontCache, | 7037 kDontCache, |
| 6981 kDontFlush, | 7038 kDontFlush, |
| 6982 kIsGenerator, | 7039 kIsGenerator, |
| 6983 kCompilerHintsCount // Pseudo entry | 7040 kCompilerHintsCount // Pseudo entry |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7190 ClearExceptionFlag flag); | 7247 ClearExceptionFlag flag); |
| 7191 | 7248 |
| 7192 // Tells whether or not the function is already marked for lazy | 7249 // Tells whether or not the function is already marked for lazy |
| 7193 // recompilation. | 7250 // recompilation. |
| 7194 inline bool IsMarkedForLazyRecompilation(); | 7251 inline bool IsMarkedForLazyRecompilation(); |
| 7195 inline bool IsMarkedForConcurrentRecompilation(); | 7252 inline bool IsMarkedForConcurrentRecompilation(); |
| 7196 | 7253 |
| 7197 // Tells whether or not the function is on the concurrent recompilation queue. | 7254 // Tells whether or not the function is on the concurrent recompilation queue. |
| 7198 inline bool IsInRecompileQueue(); | 7255 inline bool IsInRecompileQueue(); |
| 7199 | 7256 |
| 7200 // Check whether or not this function is inlineable. | |
| 7201 bool IsInlineable(); | |
| 7202 | |
| 7203 // [literals_or_bindings]: Fixed array holding either | 7257 // [literals_or_bindings]: Fixed array holding either |
| 7204 // the materialized literals or the bindings of a bound function. | 7258 // the materialized literals or the bindings of a bound function. |
| 7205 // | 7259 // |
| 7206 // If the function contains object, regexp or array literals, the | 7260 // If the function contains object, regexp or array literals, the |
| 7207 // literals array prefix contains the object, regexp, and array | 7261 // literals array prefix contains the object, regexp, and array |
| 7208 // function to be used when creating these literals. This is | 7262 // function to be used when creating these literals. This is |
| 7209 // necessary so that we do not dynamically lookup the object, regexp | 7263 // necessary so that we do not dynamically lookup the object, regexp |
| 7210 // or array functions. Performing a dynamic lookup, we might end up | 7264 // or array functions. Performing a dynamic lookup, we might end up |
| 7211 // using the functions from a new context that we should not have | 7265 // using the functions from a new context that we should not have |
| 7212 // access to. | 7266 // access to. |
| 7213 // | 7267 // |
| 7214 // On bound functions, the array is a (copy-on-write) fixed-array containing | 7268 // On bound functions, the array is a (copy-on-write) fixed-array containing |
| 7215 // the function that was bound, bound this-value and any bound | 7269 // the function that was bound, bound this-value and any bound |
| 7216 // arguments. Bound functions never contain literals. | 7270 // arguments. Bound functions never contain literals. |
| 7217 DECL_ACCESSORS(literals_or_bindings, FixedArray) | 7271 DECL_ACCESSORS(literals_or_bindings, FixedArray) |
| 7218 | 7272 |
| 7219 inline FixedArray* literals(); | 7273 inline FixedArray* literals(); |
| 7220 inline void set_literals(FixedArray* literals); | 7274 inline void set_literals(FixedArray* literals); |
| 7221 | 7275 |
| 7222 inline FixedArray* function_bindings(); | 7276 inline FixedArray* function_bindings(); |
| 7223 inline void set_function_bindings(FixedArray* bindings); | 7277 inline void set_function_bindings(FixedArray* bindings); |
| 7224 | 7278 |
| 7225 // The initial map for an object created by this constructor. | 7279 // The initial map for an object created by this constructor. |
| 7226 inline Map* initial_map(); | 7280 inline Map* initial_map(); |
| 7227 inline void set_initial_map(Map* value); | 7281 inline void set_initial_map(Map* value); |
| 7228 inline bool has_initial_map(); | 7282 inline bool has_initial_map(); |
| 7283 static void EnsureHasInitialMap(Handle<JSFunction> function); |
| 7229 | 7284 |
| 7230 // Get and set the prototype property on a JSFunction. If the | 7285 // Get and set the prototype property on a JSFunction. If the |
| 7231 // function has an initial map the prototype is set on the initial | 7286 // function has an initial map the prototype is set on the initial |
| 7232 // map. Otherwise, the prototype is put in the initial map field | 7287 // map. Otherwise, the prototype is put in the initial map field |
| 7233 // until an initial map is needed. | 7288 // until an initial map is needed. |
| 7234 inline bool has_prototype(); | 7289 inline bool has_prototype(); |
| 7235 inline bool has_instance_prototype(); | 7290 inline bool has_instance_prototype(); |
| 7236 inline Object* prototype(); | 7291 inline Object* prototype(); |
| 7237 inline Object* instance_prototype(); | 7292 inline Object* instance_prototype(); |
| 7238 static void SetPrototype(Handle<JSFunction> function, | 7293 static void SetPrototype(Handle<JSFunction> function, |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7369 | 7424 |
| 7370 // This is like GetProperty, but is used when you know the lookup won't fail | 7425 // This is like GetProperty, but is used when you know the lookup won't fail |
| 7371 // by throwing an exception. This is for the debug and builtins global | 7426 // by throwing an exception. This is for the debug and builtins global |
| 7372 // objects, where it is known which properties can be expected to be present | 7427 // objects, where it is known which properties can be expected to be present |
| 7373 // on the object. | 7428 // on the object. |
| 7374 Object* GetPropertyNoExceptionThrown(Name* key) { | 7429 Object* GetPropertyNoExceptionThrown(Name* key) { |
| 7375 Object* answer = GetProperty(key)->ToObjectUnchecked(); | 7430 Object* answer = GetProperty(key)->ToObjectUnchecked(); |
| 7376 return answer; | 7431 return answer; |
| 7377 } | 7432 } |
| 7378 | 7433 |
| 7379 // Ensure that the global object has a cell for the given property name. | |
| 7380 static Handle<PropertyCell> EnsurePropertyCell(Handle<GlobalObject> global, | |
| 7381 Handle<Name> name); | |
| 7382 | |
| 7383 // Casting. | 7434 // Casting. |
| 7384 static inline GlobalObject* cast(Object* obj); | 7435 static inline GlobalObject* cast(Object* obj); |
| 7385 | 7436 |
| 7386 // Layout description. | 7437 // Layout description. |
| 7387 static const int kBuiltinsOffset = JSObject::kHeaderSize; | 7438 static const int kBuiltinsOffset = JSObject::kHeaderSize; |
| 7388 static const int kNativeContextOffset = kBuiltinsOffset + kPointerSize; | 7439 static const int kNativeContextOffset = kBuiltinsOffset + kPointerSize; |
| 7389 static const int kGlobalContextOffset = kNativeContextOffset + kPointerSize; | 7440 static const int kGlobalContextOffset = kNativeContextOffset + kPointerSize; |
| 7390 static const int kGlobalReceiverOffset = kGlobalContextOffset + kPointerSize; | 7441 static const int kGlobalReceiverOffset = kGlobalContextOffset + kPointerSize; |
| 7391 static const int kHeaderSize = kGlobalReceiverOffset + kPointerSize; | 7442 static const int kHeaderSize = kGlobalReceiverOffset + kPointerSize; |
| 7392 | 7443 |
| 7393 private: | 7444 private: |
| 7394 DISALLOW_IMPLICIT_CONSTRUCTORS(GlobalObject); | 7445 DISALLOW_IMPLICIT_CONSTRUCTORS(GlobalObject); |
| 7395 }; | 7446 }; |
| 7396 | 7447 |
| 7397 | 7448 |
| 7398 // JavaScript global object. | 7449 // JavaScript global object. |
| 7399 class JSGlobalObject: public GlobalObject { | 7450 class JSGlobalObject: public GlobalObject { |
| 7400 public: | 7451 public: |
| 7401 // Casting. | 7452 // Casting. |
| 7402 static inline JSGlobalObject* cast(Object* obj); | 7453 static inline JSGlobalObject* cast(Object* obj); |
| 7403 | 7454 |
| 7455 // Ensure that the global object has a cell for the given property name. |
| 7456 static Handle<PropertyCell> EnsurePropertyCell(Handle<JSGlobalObject> global, |
| 7457 Handle<Name> name); |
| 7458 |
| 7404 // Dispatched behavior. | 7459 // Dispatched behavior. |
| 7405 DECLARE_PRINTER(JSGlobalObject) | 7460 DECLARE_PRINTER(JSGlobalObject) |
| 7406 DECLARE_VERIFIER(JSGlobalObject) | 7461 DECLARE_VERIFIER(JSGlobalObject) |
| 7407 | 7462 |
| 7408 // Layout description. | 7463 // Layout description. |
| 7409 static const int kSize = GlobalObject::kHeaderSize; | 7464 static const int kSize = GlobalObject::kHeaderSize; |
| 7410 | 7465 |
| 7411 private: | 7466 private: |
| 7412 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalObject); | 7467 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalObject); |
| 7413 }; | 7468 }; |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8319 DISALLOW_IMPLICIT_CONSTRUCTORS(Name); | 8374 DISALLOW_IMPLICIT_CONSTRUCTORS(Name); |
| 8320 }; | 8375 }; |
| 8321 | 8376 |
| 8322 | 8377 |
| 8323 // ES6 symbols. | 8378 // ES6 symbols. |
| 8324 class Symbol: public Name { | 8379 class Symbol: public Name { |
| 8325 public: | 8380 public: |
| 8326 // [name]: the print name of a symbol, or undefined if none. | 8381 // [name]: the print name of a symbol, or undefined if none. |
| 8327 DECL_ACCESSORS(name, Object) | 8382 DECL_ACCESSORS(name, Object) |
| 8328 | 8383 |
| 8384 DECL_ACCESSORS(flags, Smi) |
| 8385 |
| 8386 // [is_private]: whether this is a private symbol. |
| 8387 DECL_BOOLEAN_ACCESSORS(is_private) |
| 8388 |
| 8329 // Casting. | 8389 // Casting. |
| 8330 static inline Symbol* cast(Object* obj); | 8390 static inline Symbol* cast(Object* obj); |
| 8331 | 8391 |
| 8332 // Dispatched behavior. | 8392 // Dispatched behavior. |
| 8333 DECLARE_PRINTER(Symbol) | 8393 DECLARE_PRINTER(Symbol) |
| 8334 DECLARE_VERIFIER(Symbol) | 8394 DECLARE_VERIFIER(Symbol) |
| 8335 | 8395 |
| 8336 // Layout description. | 8396 // Layout description. |
| 8337 static const int kNameOffset = Name::kSize; | 8397 static const int kNameOffset = Name::kSize; |
| 8338 static const int kSize = kNameOffset + kPointerSize; | 8398 static const int kFlagsOffset = kNameOffset + kPointerSize; |
| 8399 static const int kSize = kFlagsOffset + kPointerSize; |
| 8339 | 8400 |
| 8340 typedef FixedBodyDescriptor<kNameOffset, kNameOffset + kPointerSize, kSize> | 8401 typedef FixedBodyDescriptor<kNameOffset, kFlagsOffset, kSize> BodyDescriptor; |
| 8341 BodyDescriptor; | |
| 8342 | 8402 |
| 8343 private: | 8403 private: |
| 8404 static const int kPrivateBit = 0; |
| 8405 |
| 8344 DISALLOW_IMPLICIT_CONSTRUCTORS(Symbol); | 8406 DISALLOW_IMPLICIT_CONSTRUCTORS(Symbol); |
| 8345 }; | 8407 }; |
| 8346 | 8408 |
| 8347 | 8409 |
| 8348 class ConsString; | 8410 class ConsString; |
| 8349 | 8411 |
| 8350 // The String abstract class captures JavaScript string values: | 8412 // The String abstract class captures JavaScript string values: |
| 8351 // | 8413 // |
| 8352 // Ecma-262: | 8414 // Ecma-262: |
| 8353 // 4.3.16 String Value | 8415 // 4.3.16 String Value |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8554 static const int kMaxLength = (1 << (32 - 2)) - 1; | 8616 static const int kMaxLength = (1 << (32 - 2)) - 1; |
| 8555 | 8617 |
| 8556 // Max length for computing hash. For strings longer than this limit the | 8618 // Max length for computing hash. For strings longer than this limit the |
| 8557 // string length is used as the hash value. | 8619 // string length is used as the hash value. |
| 8558 static const int kMaxHashCalcLength = 16383; | 8620 static const int kMaxHashCalcLength = 16383; |
| 8559 | 8621 |
| 8560 // Limit for truncation in short printing. | 8622 // Limit for truncation in short printing. |
| 8561 static const int kMaxShortPrintLength = 1024; | 8623 static const int kMaxShortPrintLength = 1024; |
| 8562 | 8624 |
| 8563 // Support for regular expressions. | 8625 // Support for regular expressions. |
| 8564 const uc16* GetTwoByteData(); | |
| 8565 const uc16* GetTwoByteData(unsigned start); | 8626 const uc16* GetTwoByteData(unsigned start); |
| 8566 | 8627 |
| 8567 // Helper function for flattening strings. | 8628 // Helper function for flattening strings. |
| 8568 template <typename sinkchar> | 8629 template <typename sinkchar> |
| 8569 static void WriteToFlat(String* source, | 8630 static void WriteToFlat(String* source, |
| 8570 sinkchar* sink, | 8631 sinkchar* sink, |
| 8571 int from, | 8632 int from, |
| 8572 int to); | 8633 int to); |
| 8573 | 8634 |
| 8574 // The return value may point to the first aligned word containing the | 8635 // The return value may point to the first aligned word containing the |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9337 static bool HasPropertyWithHandler(Handle<JSProxy> proxy, Handle<Name> name); | 9398 static bool HasPropertyWithHandler(Handle<JSProxy> proxy, Handle<Name> name); |
| 9338 static bool HasElementWithHandler(Handle<JSProxy> proxy, uint32_t index); | 9399 static bool HasElementWithHandler(Handle<JSProxy> proxy, uint32_t index); |
| 9339 | 9400 |
| 9340 static Handle<Object> DeletePropertyWithHandler(Handle<JSProxy> proxy, | 9401 static Handle<Object> DeletePropertyWithHandler(Handle<JSProxy> proxy, |
| 9341 Handle<Name> name, | 9402 Handle<Name> name, |
| 9342 DeleteMode mode); | 9403 DeleteMode mode); |
| 9343 static Handle<Object> DeleteElementWithHandler(Handle<JSProxy> proxy, | 9404 static Handle<Object> DeleteElementWithHandler(Handle<JSProxy> proxy, |
| 9344 uint32_t index, | 9405 uint32_t index, |
| 9345 DeleteMode mode); | 9406 DeleteMode mode); |
| 9346 | 9407 |
| 9347 MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); | 9408 MUST_USE_RESULT Object* GetIdentityHash(); |
| 9348 static Handle<Object> GetIdentityHash(Handle<JSProxy> proxy, | 9409 |
| 9349 CreationFlag flag); | 9410 static Handle<Object> GetOrCreateIdentityHash(Handle<JSProxy> proxy); |
| 9350 | 9411 |
| 9351 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); | 9412 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); |
| 9352 }; | 9413 }; |
| 9353 | 9414 |
| 9354 | 9415 |
| 9355 class JSFunctionProxy: public JSProxy { | 9416 class JSFunctionProxy: public JSProxy { |
| 9356 public: | 9417 public: |
| 9357 // [call_trap]: The call trap. | 9418 // [call_trap]: The call trap. |
| 9358 DECL_ACCESSORS(call_trap, Object) | 9419 DECL_ACCESSORS(call_trap, Object) |
| 9359 | 9420 |
| (...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10427 } else { | 10488 } else { |
| 10428 value &= ~(1 << bit_position); | 10489 value &= ~(1 << bit_position); |
| 10429 } | 10490 } |
| 10430 return value; | 10491 return value; |
| 10431 } | 10492 } |
| 10432 }; | 10493 }; |
| 10433 | 10494 |
| 10434 } } // namespace v8::internal | 10495 } } // namespace v8::internal |
| 10435 | 10496 |
| 10436 #endif // V8_OBJECTS_H_ | 10497 #endif // V8_OBJECTS_H_ |
| OLD | NEW |