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 "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
10 #include "src/builtins.h" | 10 #include "src/builtins.h" |
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 class Object { | 1368 class Object { |
1369 public: | 1369 public: |
1370 // Type testing. | 1370 // Type testing. |
1371 bool IsObject() const { return true; } | 1371 bool IsObject() const { return true; } |
1372 | 1372 |
1373 #define IS_TYPE_FUNCTION_DECL(type_) INLINE(bool Is##type_() const); | 1373 #define IS_TYPE_FUNCTION_DECL(type_) INLINE(bool Is##type_() const); |
1374 OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL) | 1374 OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL) |
1375 HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL) | 1375 HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL) |
1376 #undef IS_TYPE_FUNCTION_DECL | 1376 #undef IS_TYPE_FUNCTION_DECL |
1377 | 1377 |
| 1378 // A non-keyed store is of the form a.x = foo or a["x"] = foo whereas |
| 1379 // a keyed store is of the form a[expression] = foo. |
| 1380 enum StoreFromKeyed { |
| 1381 MAY_BE_STORE_FROM_KEYED, |
| 1382 CERTAINLY_NOT_STORE_FROM_KEYED |
| 1383 }; |
| 1384 |
1378 INLINE(bool IsFixedArrayBase() const); | 1385 INLINE(bool IsFixedArrayBase() const); |
1379 INLINE(bool IsExternal() const); | 1386 INLINE(bool IsExternal() const); |
1380 INLINE(bool IsAccessorInfo() const); | 1387 INLINE(bool IsAccessorInfo() const); |
1381 | 1388 |
1382 INLINE(bool IsStruct() const); | 1389 INLINE(bool IsStruct() const); |
1383 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) \ | 1390 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) \ |
1384 INLINE(bool Is##Name() const); | 1391 INLINE(bool Is##Name() const); |
1385 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) | 1392 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) |
1386 #undef DECLARE_STRUCT_PREDICATE | 1393 #undef DECLARE_STRUCT_PREDICATE |
1387 | 1394 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 Handle<Object> object, | 1476 Handle<Object> object, |
1470 Handle<Context> context); | 1477 Handle<Context> context); |
1471 | 1478 |
1472 // Converts this to a Smi if possible. | 1479 // Converts this to a Smi if possible. |
1473 static MUST_USE_RESULT inline MaybeHandle<Smi> ToSmi(Isolate* isolate, | 1480 static MUST_USE_RESULT inline MaybeHandle<Smi> ToSmi(Isolate* isolate, |
1474 Handle<Object> object); | 1481 Handle<Object> object); |
1475 | 1482 |
1476 void Lookup(Handle<Name> name, LookupResult* result); | 1483 void Lookup(Handle<Name> name, LookupResult* result); |
1477 | 1484 |
1478 MUST_USE_RESULT static MaybeHandle<Object> GetProperty(LookupIterator* it); | 1485 MUST_USE_RESULT static MaybeHandle<Object> GetProperty(LookupIterator* it); |
| 1486 MUST_USE_RESULT static MaybeHandle<Object> SetProperty( |
| 1487 LookupIterator* it, Handle<Object> value, StrictMode strict_mode, |
| 1488 StoreFromKeyed store_mode); |
| 1489 MUST_USE_RESULT static MaybeHandle<Object> WriteToReadOnlyProperty( |
| 1490 LookupIterator* it, Handle<Object> value, StrictMode strict_mode); |
| 1491 MUST_USE_RESULT static MaybeHandle<Object> SetDataProperty( |
| 1492 LookupIterator* it, Handle<Object> value); |
| 1493 MUST_USE_RESULT static MaybeHandle<Object> AddDataProperty( |
| 1494 LookupIterator* it, Handle<Object> value, PropertyAttributes attributes, |
| 1495 StrictMode strict_mode, StoreFromKeyed store_mode); |
1479 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( | 1496 MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement( |
1480 Handle<Object> object, | 1497 Handle<Object> object, |
1481 Handle<Name> key); | 1498 Handle<Name> key); |
1482 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( | 1499 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( |
1483 Isolate* isolate, | 1500 Isolate* isolate, |
1484 Handle<Object> object, | 1501 Handle<Object> object, |
1485 const char* key); | 1502 const char* key); |
1486 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( | 1503 MUST_USE_RESULT static inline MaybeHandle<Object> GetProperty( |
1487 Handle<Object> object, | 1504 Handle<Object> object, |
1488 Handle<Name> key); | 1505 Handle<Name> key); |
1489 | 1506 |
1490 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithAccessor( | 1507 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithAccessor( |
1491 Handle<Object> receiver, | 1508 Handle<Object> receiver, |
1492 Handle<Name> name, | 1509 Handle<Name> name, |
1493 Handle<JSObject> holder, | 1510 Handle<JSObject> holder, |
1494 Handle<Object> structure); | 1511 Handle<Object> structure); |
1495 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithCallback( | 1512 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithAccessor( |
1496 Handle<Object> receiver, | 1513 Handle<Object> receiver, Handle<Name> name, Handle<Object> value, |
1497 Handle<Name> name, | 1514 Handle<JSObject> holder, Handle<Object> structure, |
1498 Handle<Object> value, | |
1499 Handle<JSObject> holder, | |
1500 Handle<Object> structure, | |
1501 StrictMode strict_mode); | 1515 StrictMode strict_mode); |
1502 | 1516 |
1503 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithDefinedGetter( | 1517 MUST_USE_RESULT static MaybeHandle<Object> GetPropertyWithDefinedGetter( |
1504 Handle<Object> receiver, | 1518 Handle<Object> receiver, |
1505 Handle<JSReceiver> getter); | 1519 Handle<JSReceiver> getter); |
1506 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithDefinedSetter( | 1520 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithDefinedSetter( |
1507 Handle<Object> receiver, | 1521 Handle<Object> receiver, |
1508 Handle<JSReceiver> setter, | 1522 Handle<JSReceiver> setter, |
1509 Handle<Object> value); | 1523 Handle<Object> value); |
1510 | 1524 |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1911 // JSReceiver includes types on which properties can be defined, i.e., | 1925 // JSReceiver includes types on which properties can be defined, i.e., |
1912 // JSObject and JSProxy. | 1926 // JSObject and JSProxy. |
1913 class JSReceiver: public HeapObject { | 1927 class JSReceiver: public HeapObject { |
1914 public: | 1928 public: |
1915 enum DeleteMode { | 1929 enum DeleteMode { |
1916 NORMAL_DELETION, | 1930 NORMAL_DELETION, |
1917 STRICT_DELETION, | 1931 STRICT_DELETION, |
1918 FORCE_DELETION | 1932 FORCE_DELETION |
1919 }; | 1933 }; |
1920 | 1934 |
1921 // A non-keyed store is of the form a.x = foo or a["x"] = foo whereas | |
1922 // a keyed store is of the form a[expression] = foo. | |
1923 enum StoreFromKeyed { | |
1924 MAY_BE_STORE_FROM_KEYED, | |
1925 CERTAINLY_NOT_STORE_FROM_KEYED | |
1926 }; | |
1927 | |
1928 // Internal properties (e.g. the hidden properties dictionary) might | 1935 // Internal properties (e.g. the hidden properties dictionary) might |
1929 // be added even though the receiver is non-extensible. | 1936 // be added even though the receiver is non-extensible. |
1930 enum ExtensibilityCheck { | 1937 enum ExtensibilityCheck { |
1931 PERFORM_EXTENSIBILITY_CHECK, | 1938 PERFORM_EXTENSIBILITY_CHECK, |
1932 OMIT_EXTENSIBILITY_CHECK | 1939 OMIT_EXTENSIBILITY_CHECK |
1933 }; | 1940 }; |
1934 | 1941 |
1935 DECLARE_CAST(JSReceiver) | 1942 DECLARE_CAST(JSReceiver) |
1936 | 1943 |
1937 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5. | 1944 // Implementation of [[Put]], ECMA-262 5th edition, section 8.12.5. |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2132 // Returns the number of non-undefined values. | 2139 // Returns the number of non-undefined values. |
2133 static Handle<Object> PrepareElementsForSort(Handle<JSObject> object, | 2140 static Handle<Object> PrepareElementsForSort(Handle<JSObject> object, |
2134 uint32_t limit); | 2141 uint32_t limit); |
2135 // As PrepareElementsForSort, but only on objects where elements is | 2142 // As PrepareElementsForSort, but only on objects where elements is |
2136 // a dictionary, and it will stay a dictionary. Collates undefined and | 2143 // a dictionary, and it will stay a dictionary. Collates undefined and |
2137 // unexisting elements below limit from position zero of the elements. | 2144 // unexisting elements below limit from position zero of the elements. |
2138 static Handle<Object> PrepareSlowElementsForSort(Handle<JSObject> object, | 2145 static Handle<Object> PrepareSlowElementsForSort(Handle<JSObject> object, |
2139 uint32_t limit); | 2146 uint32_t limit); |
2140 | 2147 |
2141 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithInterceptor( | 2148 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithInterceptor( |
2142 Handle<JSObject> object, | 2149 LookupIterator* it, Handle<Object> value); |
2143 Handle<Name> name, | |
2144 Handle<Object> value, | |
2145 StrictMode strict_mode); | |
2146 | |
2147 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyForResult( | |
2148 Handle<JSObject> object, | |
2149 LookupResult* result, | |
2150 Handle<Name> name, | |
2151 Handle<Object> value, | |
2152 StrictMode strict_mode, | |
2153 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); | |
2154 | 2150 |
2155 // SetLocalPropertyIgnoreAttributes converts callbacks to fields. We need to | 2151 // SetLocalPropertyIgnoreAttributes converts callbacks to fields. We need to |
2156 // grant an exemption to ExecutableAccessor callbacks in some cases. | 2152 // grant an exemption to ExecutableAccessor callbacks in some cases. |
2157 enum ExecutableAccessorInfoHandling { | 2153 enum ExecutableAccessorInfoHandling { |
2158 DEFAULT_HANDLING, | 2154 DEFAULT_HANDLING, |
2159 DONT_FORCE_FIELD | 2155 DONT_FORCE_FIELD |
2160 }; | 2156 }; |
2161 | 2157 |
2162 MUST_USE_RESULT static MaybeHandle<Object> SetOwnPropertyIgnoreAttributes( | 2158 MUST_USE_RESULT static MaybeHandle<Object> SetOwnPropertyIgnoreAttributes( |
2163 Handle<JSObject> object, | 2159 Handle<JSObject> object, |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2569 | 2565 |
2570 #ifdef VERIFY_HEAP | 2566 #ifdef VERIFY_HEAP |
2571 // If a GC was caused while constructing this object, the elements pointer | 2567 // If a GC was caused while constructing this object, the elements pointer |
2572 // may point to a one pointer filler map. The object won't be rooted, but | 2568 // may point to a one pointer filler map. The object won't be rooted, but |
2573 // our heap verification code could stumble across it. | 2569 // our heap verification code could stumble across it. |
2574 bool ElementsAreSafeToExamine(); | 2570 bool ElementsAreSafeToExamine(); |
2575 #endif | 2571 #endif |
2576 | 2572 |
2577 Object* SlowReverseLookup(Object* value); | 2573 Object* SlowReverseLookup(Object* value); |
2578 | 2574 |
2579 // Maximal number of fast properties for the JSObject. Used to | |
2580 // restrict the number of map transitions to avoid an explosion in | |
2581 // the number of maps for objects used as dictionaries. | |
2582 inline bool TooManyFastProperties( | |
2583 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED); | |
2584 | |
2585 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1). | 2575 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1). |
2586 // Also maximal value of JSArray's length property. | 2576 // Also maximal value of JSArray's length property. |
2587 static const uint32_t kMaxElementCount = 0xffffffffu; | 2577 static const uint32_t kMaxElementCount = 0xffffffffu; |
2588 | 2578 |
2589 // Constants for heuristics controlling conversion of fast elements | 2579 // Constants for heuristics controlling conversion of fast elements |
2590 // to slow elements. | 2580 // to slow elements. |
2591 | 2581 |
2592 // Maximal gap that can be introduced by adding an element beyond | 2582 // Maximal gap that can be introduced by adding an element beyond |
2593 // the current elements length. | 2583 // the current elements length. |
2594 static const uint32_t kMaxGap = 1024; | 2584 static const uint32_t kMaxGap = 1024; |
2595 | 2585 |
2596 // Maximal length of fast elements array that won't be checked for | 2586 // Maximal length of fast elements array that won't be checked for |
2597 // being dense enough on expansion. | 2587 // being dense enough on expansion. |
2598 static const int kMaxUncheckedFastElementsLength = 5000; | 2588 static const int kMaxUncheckedFastElementsLength = 5000; |
2599 | 2589 |
2600 // Same as above but for old arrays. This limit is more strict. We | 2590 // Same as above but for old arrays. This limit is more strict. We |
2601 // don't want to be wasteful with long lived objects. | 2591 // don't want to be wasteful with long lived objects. |
2602 static const int kMaxUncheckedOldFastElementsLength = 500; | 2592 static const int kMaxUncheckedOldFastElementsLength = 500; |
2603 | 2593 |
2604 // Note that Page::kMaxRegularHeapObjectSize puts a limit on | 2594 // Note that Page::kMaxRegularHeapObjectSize puts a limit on |
2605 // permissible values (see the ASSERT in heap.cc). | 2595 // permissible values (see the ASSERT in heap.cc). |
2606 static const int kInitialMaxFastElementArray = 100000; | 2596 static const int kInitialMaxFastElementArray = 100000; |
2607 | 2597 |
2608 // This constant applies only to the initial map of "$Object" aka | 2598 // This constant applies only to the initial map of "$Object" aka |
2609 // "global.Object" and not to arbitrary other JSObject maps. | 2599 // "global.Object" and not to arbitrary other JSObject maps. |
2610 static const int kInitialGlobalObjectUnusedPropertiesCount = 4; | 2600 static const int kInitialGlobalObjectUnusedPropertiesCount = 4; |
2611 | 2601 |
2612 static const int kFastPropertiesSoftLimit = 12; | |
2613 static const int kMaxFastProperties = 128; | |
2614 static const int kMaxInstanceSize = 255 * kPointerSize; | 2602 static const int kMaxInstanceSize = 255 * kPointerSize; |
2615 // When extending the backing storage for property values, we increase | 2603 // When extending the backing storage for property values, we increase |
2616 // its size by more than the 1 entry necessary, so sequentially adding fields | 2604 // its size by more than the 1 entry necessary, so sequentially adding fields |
2617 // to the same object requires fewer allocations and copies. | 2605 // to the same object requires fewer allocations and copies. |
2618 static const int kFieldsAdded = 3; | 2606 static const int kFieldsAdded = 3; |
2619 | 2607 |
2620 // Layout description. | 2608 // Layout description. |
2621 static const int kPropertiesOffset = HeapObject::kHeaderSize; | 2609 static const int kPropertiesOffset = HeapObject::kHeaderSize; |
2622 static const int kElementsOffset = kPropertiesOffset + kPointerSize; | 2610 static const int kElementsOffset = kPropertiesOffset + kPointerSize; |
2623 static const int kHeaderSize = kElementsOffset + kPointerSize; | 2611 static const int kHeaderSize = kElementsOffset + kPointerSize; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2730 StrictMode strict_mode, | 2718 StrictMode strict_mode, |
2731 bool check_prototype, | 2719 bool check_prototype, |
2732 SetPropertyMode set_mode = SET_PROPERTY); | 2720 SetPropertyMode set_mode = SET_PROPERTY); |
2733 MUST_USE_RESULT static MaybeHandle<Object> SetFastDoubleElement( | 2721 MUST_USE_RESULT static MaybeHandle<Object> SetFastDoubleElement( |
2734 Handle<JSObject> object, | 2722 Handle<JSObject> object, |
2735 uint32_t index, | 2723 uint32_t index, |
2736 Handle<Object> value, | 2724 Handle<Object> value, |
2737 StrictMode strict_mode, | 2725 StrictMode strict_mode, |
2738 bool check_prototype = true); | 2726 bool check_prototype = true); |
2739 | 2727 |
2740 // Searches the prototype chain for property 'name'. If it is found and | |
2741 // has a setter, invoke it and set '*done' to true. If it is found and is | |
2742 // read-only, reject and set '*done' to true. Otherwise, set '*done' to | |
2743 // false. Can throw and return an empty handle with '*done==true'. | |
2744 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyViaPrototypes( | |
2745 Handle<JSObject> object, | |
2746 Handle<Name> name, | |
2747 Handle<Object> value, | |
2748 StrictMode strict_mode, | |
2749 bool* done); | |
2750 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyPostInterceptor( | |
2751 Handle<JSObject> object, | |
2752 Handle<Name> name, | |
2753 Handle<Object> value, | |
2754 StrictMode strict_mode); | |
2755 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyUsingTransition( | 2728 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyUsingTransition( |
2756 Handle<JSObject> object, | 2729 Handle<JSObject> object, |
2757 LookupResult* lookup, | 2730 LookupResult* lookup, |
2758 Handle<Name> name, | 2731 Handle<Name> name, |
2759 Handle<Object> value, | 2732 Handle<Object> value, |
2760 PropertyAttributes attributes); | 2733 PropertyAttributes attributes); |
2761 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithFailedAccessCheck( | 2734 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithFailedAccessCheck( |
2762 Handle<JSObject> object, | 2735 LookupIterator* it, Handle<Object> value, StrictMode strict_mode); |
2763 LookupResult* result, | |
2764 Handle<Name> name, | |
2765 Handle<Object> value, | |
2766 bool check_prototype, | |
2767 StrictMode strict_mode); | |
2768 | 2736 |
2769 // Add a property to an object. | 2737 // Add a property to an object. |
2770 MUST_USE_RESULT static MaybeHandle<Object> AddPropertyInternal( | 2738 MUST_USE_RESULT static MaybeHandle<Object> AddPropertyInternal( |
2771 Handle<JSObject> object, | 2739 Handle<JSObject> object, |
2772 Handle<Name> name, | 2740 Handle<Name> name, |
2773 Handle<Object> value, | 2741 Handle<Object> value, |
2774 PropertyAttributes attributes, | 2742 PropertyAttributes attributes, |
2775 StrictMode strict_mode, | 2743 StrictMode strict_mode, |
2776 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, | 2744 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, |
2777 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, | 2745 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3448 } | 3416 } |
3449 | 3417 |
3450 void ClearEnumCache(); | 3418 void ClearEnumCache(); |
3451 | 3419 |
3452 // Initialize or change the enum cache, | 3420 // Initialize or change the enum cache, |
3453 // using the supplied storage for the small "bridge". | 3421 // using the supplied storage for the small "bridge". |
3454 void SetEnumCache(FixedArray* bridge_storage, | 3422 void SetEnumCache(FixedArray* bridge_storage, |
3455 FixedArray* new_cache, | 3423 FixedArray* new_cache, |
3456 Object* new_index_cache); | 3424 Object* new_index_cache); |
3457 | 3425 |
| 3426 bool CanHoldValue(int descriptor, Object* value); |
| 3427 |
3458 // Accessors for fetching instance descriptor at descriptor number. | 3428 // Accessors for fetching instance descriptor at descriptor number. |
3459 inline Name* GetKey(int descriptor_number); | 3429 inline Name* GetKey(int descriptor_number); |
3460 inline Object** GetKeySlot(int descriptor_number); | 3430 inline Object** GetKeySlot(int descriptor_number); |
3461 inline Object* GetValue(int descriptor_number); | 3431 inline Object* GetValue(int descriptor_number); |
3462 inline void SetValue(int descriptor_number, Object* value); | 3432 inline void SetValue(int descriptor_number, Object* value); |
3463 inline Object** GetValueSlot(int descriptor_number); | 3433 inline Object** GetValueSlot(int descriptor_number); |
3464 inline Object** GetDescriptorStartSlot(int descriptor_number); | 3434 inline Object** GetDescriptorStartSlot(int descriptor_number); |
3465 inline Object** GetDescriptorEndSlot(int descriptor_number); | 3435 inline Object** GetDescriptorEndSlot(int descriptor_number); |
3466 inline PropertyDetails GetDetails(int descriptor_number); | 3436 inline PropertyDetails GetDetails(int descriptor_number); |
3467 inline PropertyType GetType(int descriptor_number); | 3437 inline PropertyType GetType(int descriptor_number); |
(...skipping 2862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6330 int modify_index, | 6300 int modify_index, |
6331 StoreMode store_mode, | 6301 StoreMode store_mode, |
6332 PropertyAttributes attributes, | 6302 PropertyAttributes attributes, |
6333 const char* reason); | 6303 const char* reason); |
6334 static Handle<Map> CopyGeneralizeAllRepresentations( | 6304 static Handle<Map> CopyGeneralizeAllRepresentations( |
6335 Handle<Map> map, | 6305 Handle<Map> map, |
6336 int modify_index, | 6306 int modify_index, |
6337 StoreMode store_mode, | 6307 StoreMode store_mode, |
6338 const char* reason); | 6308 const char* reason); |
6339 | 6309 |
| 6310 static Handle<Map> PrepareForDataProperty(Handle<Map> old_map, |
| 6311 int descriptor_number, |
| 6312 Handle<Object> value); |
| 6313 |
6340 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode); | 6314 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode); |
6341 | 6315 |
6342 // Returns the constructor name (the name (possibly, inferred name) of the | 6316 // Returns the constructor name (the name (possibly, inferred name) of the |
6343 // function that was used to instantiate the object). | 6317 // function that was used to instantiate the object). |
6344 String* constructor_name(); | 6318 String* constructor_name(); |
6345 | 6319 |
6346 // Tells whether the map is shared between objects that may have different | 6320 // Tells whether the map is shared between objects that may have different |
6347 // behavior. If true, the map should never be modified, instead a clone | 6321 // behavior. If true, the map should never be modified, instead a clone |
6348 // should be created and modified. | 6322 // should be created and modified. |
6349 inline void set_is_shared(bool value); | 6323 inline void set_is_shared(bool value); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6522 | 6496 |
6523 static Handle<Map> AsElementsKind(Handle<Map> map, ElementsKind kind); | 6497 static Handle<Map> AsElementsKind(Handle<Map> map, ElementsKind kind); |
6524 | 6498 |
6525 static Handle<Map> CopyAsElementsKind(Handle<Map> map, | 6499 static Handle<Map> CopyAsElementsKind(Handle<Map> map, |
6526 ElementsKind kind, | 6500 ElementsKind kind, |
6527 TransitionFlag flag); | 6501 TransitionFlag flag); |
6528 | 6502 |
6529 static Handle<Map> CopyForObserved(Handle<Map> map); | 6503 static Handle<Map> CopyForObserved(Handle<Map> map); |
6530 | 6504 |
6531 static Handle<Map> CopyForFreeze(Handle<Map> map); | 6505 static Handle<Map> CopyForFreeze(Handle<Map> map); |
| 6506 // Maximal number of fast properties. Used to restrict the number of map |
| 6507 // transitions to avoid an explosion in the number of maps for objects used as |
| 6508 // dictionaries. |
| 6509 inline bool TooManyFastProperties(StoreFromKeyed store_mode); |
| 6510 static Handle<Map> TransitionToDataProperty(Handle<Map> map, |
| 6511 Handle<Name> name, |
| 6512 Handle<Object> value, |
| 6513 PropertyAttributes attributes, |
| 6514 StoreFromKeyed store_mode); |
6532 | 6515 |
6533 inline void AppendDescriptor(Descriptor* desc); | 6516 inline void AppendDescriptor(Descriptor* desc); |
6534 | 6517 |
6535 // Returns a copy of the map, with all transitions dropped from the | 6518 // Returns a copy of the map, with all transitions dropped from the |
6536 // instance descriptors. | 6519 // instance descriptors. |
6537 static Handle<Map> Copy(Handle<Map> map); | 6520 static Handle<Map> Copy(Handle<Map> map); |
6538 static Handle<Map> Create(Handle<JSFunction> constructor, | 6521 static Handle<Map> Create(Handle<JSFunction> constructor, |
6539 int extra_inobject_properties); | 6522 int extra_inobject_properties); |
6540 | 6523 |
6541 // Returns the next free property index (only valid for FAST MODE). | 6524 // Returns the next free property index (only valid for FAST MODE). |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6830 static inline void SetPrototypeTransitions( | 6813 static inline void SetPrototypeTransitions( |
6831 Handle<Map> map, | 6814 Handle<Map> map, |
6832 Handle<FixedArray> prototype_transitions); | 6815 Handle<FixedArray> prototype_transitions); |
6833 | 6816 |
6834 static Handle<Map> GetPrototypeTransition(Handle<Map> map, | 6817 static Handle<Map> GetPrototypeTransition(Handle<Map> map, |
6835 Handle<Object> prototype); | 6818 Handle<Object> prototype); |
6836 static Handle<Map> PutPrototypeTransition(Handle<Map> map, | 6819 static Handle<Map> PutPrototypeTransition(Handle<Map> map, |
6837 Handle<Object> prototype, | 6820 Handle<Object> prototype, |
6838 Handle<Map> target_map); | 6821 Handle<Map> target_map); |
6839 | 6822 |
| 6823 static const int kFastPropertiesSoftLimit = 12; |
| 6824 static const int kMaxFastProperties = 128; |
| 6825 |
6840 DISALLOW_IMPLICIT_CONSTRUCTORS(Map); | 6826 DISALLOW_IMPLICIT_CONSTRUCTORS(Map); |
6841 }; | 6827 }; |
6842 | 6828 |
6843 | 6829 |
6844 // An abstract superclass, a marker class really, for simple structure classes. | 6830 // An abstract superclass, a marker class really, for simple structure classes. |
6845 // It doesn't carry much functionality but allows struct classes to be | 6831 // It doesn't carry much functionality but allows struct classes to be |
6846 // identified in the type system. | 6832 // identified in the type system. |
6847 class Struct: public HeapObject { | 6833 class Struct: public HeapObject { |
6848 public: | 6834 public: |
6849 inline void InitializeBody(int object_size); | 6835 inline void InitializeBody(int object_size); |
(...skipping 3115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9965 Handle<JSProxy> proxy, | 9951 Handle<JSProxy> proxy, |
9966 Handle<Object> receiver, | 9952 Handle<Object> receiver, |
9967 uint32_t index); | 9953 uint32_t index); |
9968 | 9954 |
9969 // If the handler defines an accessor property with a setter, invoke it. | 9955 // If the handler defines an accessor property with a setter, invoke it. |
9970 // If it defines an accessor property without a setter, or a data property | 9956 // If it defines an accessor property without a setter, or a data property |
9971 // that is read-only, throw. In all these cases set '*done' to true, | 9957 // that is read-only, throw. In all these cases set '*done' to true, |
9972 // otherwise set it to false. | 9958 // otherwise set it to false. |
9973 MUST_USE_RESULT | 9959 MUST_USE_RESULT |
9974 static MaybeHandle<Object> SetPropertyViaPrototypesWithHandler( | 9960 static MaybeHandle<Object> SetPropertyViaPrototypesWithHandler( |
9975 Handle<JSProxy> proxy, | 9961 Handle<JSProxy> proxy, Handle<Object> receiver, Handle<Name> name, |
9976 Handle<JSReceiver> receiver, | 9962 Handle<Object> value, StrictMode strict_mode, bool* done); |
9977 Handle<Name> name, | |
9978 Handle<Object> value, | |
9979 StrictMode strict_mode, | |
9980 bool* done); | |
9981 | 9963 |
9982 static PropertyAttributes GetPropertyAttributesWithHandler( | 9964 static PropertyAttributes GetPropertyAttributesWithHandler( |
9983 Handle<JSProxy> proxy, | 9965 Handle<JSProxy> proxy, |
9984 Handle<Object> receiver, | 9966 Handle<Object> receiver, |
9985 Handle<Name> name); | 9967 Handle<Name> name); |
9986 static PropertyAttributes GetElementAttributeWithHandler( | 9968 static PropertyAttributes GetElementAttributeWithHandler( |
9987 Handle<JSProxy> proxy, | 9969 Handle<JSProxy> proxy, |
9988 Handle<JSReceiver> receiver, | 9970 Handle<JSReceiver> receiver, |
9989 uint32_t index); | 9971 uint32_t index); |
| 9972 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithHandler( |
| 9973 Handle<JSProxy> proxy, Handle<Object> receiver, Handle<Name> name, |
| 9974 Handle<Object> value, StrictMode strict_mode); |
9990 | 9975 |
9991 // Turn the proxy into an (empty) JSObject. | 9976 // Turn the proxy into an (empty) JSObject. |
9992 static void Fix(Handle<JSProxy> proxy); | 9977 static void Fix(Handle<JSProxy> proxy); |
9993 | 9978 |
9994 // Initializes the body after the handler slot. | 9979 // Initializes the body after the handler slot. |
9995 inline void InitializeBody(int object_size, Object* value); | 9980 inline void InitializeBody(int object_size, Object* value); |
9996 | 9981 |
9997 // Invoke a trap by name. If the trap does not exist on this's handler, | 9982 // Invoke a trap by name. If the trap does not exist on this's handler, |
9998 // but derived_trap is non-NULL, invoke that instead. May cause GC. | 9983 // but derived_trap is non-NULL, invoke that instead. May cause GC. |
9999 MUST_USE_RESULT static MaybeHandle<Object> CallTrap( | 9984 MUST_USE_RESULT static MaybeHandle<Object> CallTrap( |
(...skipping 19 matching lines...) Expand all Loading... |
10019 | 10004 |
10020 STATIC_ASSERT(kPaddingSize >= 0); | 10005 STATIC_ASSERT(kPaddingSize >= 0); |
10021 | 10006 |
10022 typedef FixedBodyDescriptor<kHandlerOffset, | 10007 typedef FixedBodyDescriptor<kHandlerOffset, |
10023 kPaddingOffset, | 10008 kPaddingOffset, |
10024 kSize> BodyDescriptor; | 10009 kSize> BodyDescriptor; |
10025 | 10010 |
10026 private: | 10011 private: |
10027 friend class JSReceiver; | 10012 friend class JSReceiver; |
10028 | 10013 |
10029 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithHandler( | |
10030 Handle<JSProxy> proxy, | |
10031 Handle<JSReceiver> receiver, | |
10032 Handle<Name> name, | |
10033 Handle<Object> value, | |
10034 StrictMode strict_mode); | |
10035 MUST_USE_RESULT static inline MaybeHandle<Object> SetElementWithHandler( | 10014 MUST_USE_RESULT static inline MaybeHandle<Object> SetElementWithHandler( |
10036 Handle<JSProxy> proxy, | 10015 Handle<JSProxy> proxy, |
10037 Handle<JSReceiver> receiver, | 10016 Handle<JSReceiver> receiver, |
10038 uint32_t index, | 10017 uint32_t index, |
10039 Handle<Object> value, | 10018 Handle<Object> value, |
10040 StrictMode strict_mode); | 10019 StrictMode strict_mode); |
10041 | 10020 |
10042 static bool HasPropertyWithHandler(Handle<JSProxy> proxy, Handle<Name> name); | 10021 static bool HasPropertyWithHandler(Handle<JSProxy> proxy, Handle<Name> name); |
10043 static inline bool HasElementWithHandler(Handle<JSProxy> proxy, | 10022 static inline bool HasElementWithHandler(Handle<JSProxy> proxy, |
10044 uint32_t index); | 10023 uint32_t index); |
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11244 } else { | 11223 } else { |
11245 value &= ~(1 << bit_position); | 11224 value &= ~(1 << bit_position); |
11246 } | 11225 } |
11247 return value; | 11226 return value; |
11248 } | 11227 } |
11249 }; | 11228 }; |
11250 | 11229 |
11251 } } // namespace v8::internal | 11230 } } // namespace v8::internal |
11252 | 11231 |
11253 #endif // V8_OBJECTS_H_ | 11232 #endif // V8_OBJECTS_H_ |
OLD | NEW |