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

Side by Side Diff: src/objects.h

Issue 392243002: Reimplement SetProperty using the LookupIterator (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/lookup.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // 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
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
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
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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
2129 // Returns the number of non-undefined values. 2136 // Returns the number of non-undefined values.
2130 static Handle<Object> PrepareElementsForSort(Handle<JSObject> object, 2137 static Handle<Object> PrepareElementsForSort(Handle<JSObject> object,
2131 uint32_t limit); 2138 uint32_t limit);
2132 // As PrepareElementsForSort, but only on objects where elements is 2139 // As PrepareElementsForSort, but only on objects where elements is
2133 // a dictionary, and it will stay a dictionary. Collates undefined and 2140 // a dictionary, and it will stay a dictionary. Collates undefined and
2134 // unexisting elements below limit from position zero of the elements. 2141 // unexisting elements below limit from position zero of the elements.
2135 static Handle<Object> PrepareSlowElementsForSort(Handle<JSObject> object, 2142 static Handle<Object> PrepareSlowElementsForSort(Handle<JSObject> object,
2136 uint32_t limit); 2143 uint32_t limit);
2137 2144
2138 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithInterceptor( 2145 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithInterceptor(
2139 Handle<JSObject> object, 2146 LookupIterator* it, Handle<Object> value);
2140 Handle<Name> name,
2141 Handle<Object> value,
2142 StrictMode strict_mode);
2143
2144 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyForResult(
2145 Handle<JSObject> object,
2146 LookupResult* result,
2147 Handle<Name> name,
2148 Handle<Object> value,
2149 StrictMode strict_mode,
2150 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED);
2151 2147
2152 // SetLocalPropertyIgnoreAttributes converts callbacks to fields. We need to 2148 // SetLocalPropertyIgnoreAttributes converts callbacks to fields. We need to
2153 // grant an exemption to ExecutableAccessor callbacks in some cases. 2149 // grant an exemption to ExecutableAccessor callbacks in some cases.
2154 enum ExecutableAccessorInfoHandling { 2150 enum ExecutableAccessorInfoHandling {
2155 DEFAULT_HANDLING, 2151 DEFAULT_HANDLING,
2156 DONT_FORCE_FIELD 2152 DONT_FORCE_FIELD
2157 }; 2153 };
2158 2154
2159 MUST_USE_RESULT static MaybeHandle<Object> SetOwnPropertyIgnoreAttributes( 2155 MUST_USE_RESULT static MaybeHandle<Object> SetOwnPropertyIgnoreAttributes(
2160 Handle<JSObject> object, 2156 Handle<JSObject> object,
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
2566 2562
2567 #ifdef VERIFY_HEAP 2563 #ifdef VERIFY_HEAP
2568 // If a GC was caused while constructing this object, the elements pointer 2564 // If a GC was caused while constructing this object, the elements pointer
2569 // may point to a one pointer filler map. The object won't be rooted, but 2565 // may point to a one pointer filler map. The object won't be rooted, but
2570 // our heap verification code could stumble across it. 2566 // our heap verification code could stumble across it.
2571 bool ElementsAreSafeToExamine(); 2567 bool ElementsAreSafeToExamine();
2572 #endif 2568 #endif
2573 2569
2574 Object* SlowReverseLookup(Object* value); 2570 Object* SlowReverseLookup(Object* value);
2575 2571
2576 // Maximal number of fast properties for the JSObject. Used to
2577 // restrict the number of map transitions to avoid an explosion in
2578 // the number of maps for objects used as dictionaries.
2579 inline bool TooManyFastProperties(
2580 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED);
2581
2582 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1). 2572 // Maximal number of elements (numbered 0 .. kMaxElementCount - 1).
2583 // Also maximal value of JSArray's length property. 2573 // Also maximal value of JSArray's length property.
2584 static const uint32_t kMaxElementCount = 0xffffffffu; 2574 static const uint32_t kMaxElementCount = 0xffffffffu;
2585 2575
2586 // Constants for heuristics controlling conversion of fast elements 2576 // Constants for heuristics controlling conversion of fast elements
2587 // to slow elements. 2577 // to slow elements.
2588 2578
2589 // Maximal gap that can be introduced by adding an element beyond 2579 // Maximal gap that can be introduced by adding an element beyond
2590 // the current elements length. 2580 // the current elements length.
2591 static const uint32_t kMaxGap = 1024; 2581 static const uint32_t kMaxGap = 1024;
2592 2582
2593 // Maximal length of fast elements array that won't be checked for 2583 // Maximal length of fast elements array that won't be checked for
2594 // being dense enough on expansion. 2584 // being dense enough on expansion.
2595 static const int kMaxUncheckedFastElementsLength = 5000; 2585 static const int kMaxUncheckedFastElementsLength = 5000;
2596 2586
2597 // Same as above but for old arrays. This limit is more strict. We 2587 // Same as above but for old arrays. This limit is more strict. We
2598 // don't want to be wasteful with long lived objects. 2588 // don't want to be wasteful with long lived objects.
2599 static const int kMaxUncheckedOldFastElementsLength = 500; 2589 static const int kMaxUncheckedOldFastElementsLength = 500;
2600 2590
2601 // Note that Page::kMaxRegularHeapObjectSize puts a limit on 2591 // Note that Page::kMaxRegularHeapObjectSize puts a limit on
2602 // permissible values (see the ASSERT in heap.cc). 2592 // permissible values (see the ASSERT in heap.cc).
2603 static const int kInitialMaxFastElementArray = 100000; 2593 static const int kInitialMaxFastElementArray = 100000;
2604 2594
2605 // This constant applies only to the initial map of "$Object" aka 2595 // This constant applies only to the initial map of "$Object" aka
2606 // "global.Object" and not to arbitrary other JSObject maps. 2596 // "global.Object" and not to arbitrary other JSObject maps.
2607 static const int kInitialGlobalObjectUnusedPropertiesCount = 4; 2597 static const int kInitialGlobalObjectUnusedPropertiesCount = 4;
2608 2598
2609 static const int kFastPropertiesSoftLimit = 12;
2610 static const int kMaxFastProperties = 128;
2611 static const int kMaxInstanceSize = 255 * kPointerSize; 2599 static const int kMaxInstanceSize = 255 * kPointerSize;
2612 // When extending the backing storage for property values, we increase 2600 // When extending the backing storage for property values, we increase
2613 // its size by more than the 1 entry necessary, so sequentially adding fields 2601 // its size by more than the 1 entry necessary, so sequentially adding fields
2614 // to the same object requires fewer allocations and copies. 2602 // to the same object requires fewer allocations and copies.
2615 static const int kFieldsAdded = 3; 2603 static const int kFieldsAdded = 3;
2616 2604
2617 // Layout description. 2605 // Layout description.
2618 static const int kPropertiesOffset = HeapObject::kHeaderSize; 2606 static const int kPropertiesOffset = HeapObject::kHeaderSize;
2619 static const int kElementsOffset = kPropertiesOffset + kPointerSize; 2607 static const int kElementsOffset = kPropertiesOffset + kPointerSize;
2620 static const int kHeaderSize = kElementsOffset + kPointerSize; 2608 static const int kHeaderSize = kElementsOffset + kPointerSize;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2727 StrictMode strict_mode, 2715 StrictMode strict_mode,
2728 bool check_prototype, 2716 bool check_prototype,
2729 SetPropertyMode set_mode = SET_PROPERTY); 2717 SetPropertyMode set_mode = SET_PROPERTY);
2730 MUST_USE_RESULT static MaybeHandle<Object> SetFastDoubleElement( 2718 MUST_USE_RESULT static MaybeHandle<Object> SetFastDoubleElement(
2731 Handle<JSObject> object, 2719 Handle<JSObject> object,
2732 uint32_t index, 2720 uint32_t index,
2733 Handle<Object> value, 2721 Handle<Object> value,
2734 StrictMode strict_mode, 2722 StrictMode strict_mode,
2735 bool check_prototype = true); 2723 bool check_prototype = true);
2736 2724
2737 // Searches the prototype chain for property 'name'. If it is found and
2738 // has a setter, invoke it and set '*done' to true. If it is found and is
2739 // read-only, reject and set '*done' to true. Otherwise, set '*done' to
2740 // false. Can throw and return an empty handle with '*done==true'.
2741 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyViaPrototypes(
2742 Handle<JSObject> object,
2743 Handle<Name> name,
2744 Handle<Object> value,
2745 StrictMode strict_mode,
2746 bool* done);
2747 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyPostInterceptor(
2748 Handle<JSObject> object,
2749 Handle<Name> name,
2750 Handle<Object> value,
2751 StrictMode strict_mode);
2752 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyUsingTransition( 2725 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyUsingTransition(
2753 Handle<JSObject> object, 2726 Handle<JSObject> object,
2754 LookupResult* lookup, 2727 LookupResult* lookup,
2755 Handle<Name> name, 2728 Handle<Name> name,
2756 Handle<Object> value, 2729 Handle<Object> value,
2757 PropertyAttributes attributes); 2730 PropertyAttributes attributes);
2758 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithFailedAccessCheck( 2731 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithFailedAccessCheck(
2759 Handle<JSObject> object, 2732 LookupIterator* it, Handle<Object> value, StrictMode strict_mode);
2760 LookupResult* result,
2761 Handle<Name> name,
2762 Handle<Object> value,
2763 bool check_prototype,
2764 StrictMode strict_mode);
2765 2733
2766 // Add a property to an object. 2734 // Add a property to an object.
2767 MUST_USE_RESULT static MaybeHandle<Object> AddPropertyInternal( 2735 MUST_USE_RESULT static MaybeHandle<Object> AddPropertyInternal(
2768 Handle<JSObject> object, 2736 Handle<JSObject> object,
2769 Handle<Name> name, 2737 Handle<Name> name,
2770 Handle<Object> value, 2738 Handle<Object> value,
2771 PropertyAttributes attributes, 2739 PropertyAttributes attributes,
2772 StrictMode strict_mode, 2740 StrictMode strict_mode,
2773 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED, 2741 StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED,
2774 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK, 2742 ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK,
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
3445 } 3413 }
3446 3414
3447 void ClearEnumCache(); 3415 void ClearEnumCache();
3448 3416
3449 // Initialize or change the enum cache, 3417 // Initialize or change the enum cache,
3450 // using the supplied storage for the small "bridge". 3418 // using the supplied storage for the small "bridge".
3451 void SetEnumCache(FixedArray* bridge_storage, 3419 void SetEnumCache(FixedArray* bridge_storage,
3452 FixedArray* new_cache, 3420 FixedArray* new_cache,
3453 Object* new_index_cache); 3421 Object* new_index_cache);
3454 3422
3423 bool CanHoldValue(int descriptor, Object* value);
3424
3455 // Accessors for fetching instance descriptor at descriptor number. 3425 // Accessors for fetching instance descriptor at descriptor number.
3456 inline Name* GetKey(int descriptor_number); 3426 inline Name* GetKey(int descriptor_number);
3457 inline Object** GetKeySlot(int descriptor_number); 3427 inline Object** GetKeySlot(int descriptor_number);
3458 inline Object* GetValue(int descriptor_number); 3428 inline Object* GetValue(int descriptor_number);
3459 inline void SetValue(int descriptor_number, Object* value); 3429 inline void SetValue(int descriptor_number, Object* value);
3460 inline Object** GetValueSlot(int descriptor_number); 3430 inline Object** GetValueSlot(int descriptor_number);
3461 inline Object** GetDescriptorStartSlot(int descriptor_number); 3431 inline Object** GetDescriptorStartSlot(int descriptor_number);
3462 inline Object** GetDescriptorEndSlot(int descriptor_number); 3432 inline Object** GetDescriptorEndSlot(int descriptor_number);
3463 inline PropertyDetails GetDetails(int descriptor_number); 3433 inline PropertyDetails GetDetails(int descriptor_number);
3464 inline PropertyType GetType(int descriptor_number); 3434 inline PropertyType GetType(int descriptor_number);
(...skipping 2862 matching lines...) Expand 10 before | Expand all | Expand 10 after
6327 int modify_index, 6297 int modify_index,
6328 StoreMode store_mode, 6298 StoreMode store_mode,
6329 PropertyAttributes attributes, 6299 PropertyAttributes attributes,
6330 const char* reason); 6300 const char* reason);
6331 static Handle<Map> CopyGeneralizeAllRepresentations( 6301 static Handle<Map> CopyGeneralizeAllRepresentations(
6332 Handle<Map> map, 6302 Handle<Map> map,
6333 int modify_index, 6303 int modify_index,
6334 StoreMode store_mode, 6304 StoreMode store_mode,
6335 const char* reason); 6305 const char* reason);
6336 6306
6307 static Handle<Map> PrepareForDataProperty(Handle<Map> old_map,
6308 int descriptor_number,
6309 Handle<Object> value);
6310
6337 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode); 6311 static Handle<Map> Normalize(Handle<Map> map, PropertyNormalizationMode mode);
6338 6312
6339 // Returns the constructor name (the name (possibly, inferred name) of the 6313 // Returns the constructor name (the name (possibly, inferred name) of the
6340 // function that was used to instantiate the object). 6314 // function that was used to instantiate the object).
6341 String* constructor_name(); 6315 String* constructor_name();
6342 6316
6343 // Tells whether the map is shared between objects that may have different 6317 // Tells whether the map is shared between objects that may have different
6344 // behavior. If true, the map should never be modified, instead a clone 6318 // behavior. If true, the map should never be modified, instead a clone
6345 // should be created and modified. 6319 // should be created and modified.
6346 inline void set_is_shared(bool value); 6320 inline void set_is_shared(bool value);
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
6519 6493
6520 static Handle<Map> AsElementsKind(Handle<Map> map, ElementsKind kind); 6494 static Handle<Map> AsElementsKind(Handle<Map> map, ElementsKind kind);
6521 6495
6522 static Handle<Map> CopyAsElementsKind(Handle<Map> map, 6496 static Handle<Map> CopyAsElementsKind(Handle<Map> map,
6523 ElementsKind kind, 6497 ElementsKind kind,
6524 TransitionFlag flag); 6498 TransitionFlag flag);
6525 6499
6526 static Handle<Map> CopyForObserved(Handle<Map> map); 6500 static Handle<Map> CopyForObserved(Handle<Map> map);
6527 6501
6528 static Handle<Map> CopyForFreeze(Handle<Map> map); 6502 static Handle<Map> CopyForFreeze(Handle<Map> map);
6503 // Maximal number of fast properties. Used to restrict the number of map
6504 // transitions to avoid an explosion in the number of maps for objects used as
6505 // dictionaries.
6506 inline bool TooManyFastProperties(StoreFromKeyed store_mode);
6507 static Handle<Map> TransitionToDataProperty(Handle<Map> map,
6508 Handle<Name> name,
6509 Handle<Object> value,
6510 PropertyAttributes attributes,
6511 StoreFromKeyed store_mode);
6529 6512
6530 inline void AppendDescriptor(Descriptor* desc); 6513 inline void AppendDescriptor(Descriptor* desc);
6531 6514
6532 // Returns a copy of the map, with all transitions dropped from the 6515 // Returns a copy of the map, with all transitions dropped from the
6533 // instance descriptors. 6516 // instance descriptors.
6534 static Handle<Map> Copy(Handle<Map> map); 6517 static Handle<Map> Copy(Handle<Map> map);
6535 static Handle<Map> Create(Handle<JSFunction> constructor, 6518 static Handle<Map> Create(Handle<JSFunction> constructor,
6536 int extra_inobject_properties); 6519 int extra_inobject_properties);
6537 6520
6538 // Returns the next free property index (only valid for FAST MODE). 6521 // Returns the next free property index (only valid for FAST MODE).
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
6827 static inline void SetPrototypeTransitions( 6810 static inline void SetPrototypeTransitions(
6828 Handle<Map> map, 6811 Handle<Map> map,
6829 Handle<FixedArray> prototype_transitions); 6812 Handle<FixedArray> prototype_transitions);
6830 6813
6831 static Handle<Map> GetPrototypeTransition(Handle<Map> map, 6814 static Handle<Map> GetPrototypeTransition(Handle<Map> map,
6832 Handle<Object> prototype); 6815 Handle<Object> prototype);
6833 static Handle<Map> PutPrototypeTransition(Handle<Map> map, 6816 static Handle<Map> PutPrototypeTransition(Handle<Map> map,
6834 Handle<Object> prototype, 6817 Handle<Object> prototype,
6835 Handle<Map> target_map); 6818 Handle<Map> target_map);
6836 6819
6820 static const int kFastPropertiesSoftLimit = 12;
6821 static const int kMaxFastProperties = 128;
6822
6837 DISALLOW_IMPLICIT_CONSTRUCTORS(Map); 6823 DISALLOW_IMPLICIT_CONSTRUCTORS(Map);
6838 }; 6824 };
6839 6825
6840 6826
6841 // An abstract superclass, a marker class really, for simple structure classes. 6827 // An abstract superclass, a marker class really, for simple structure classes.
6842 // It doesn't carry much functionality but allows struct classes to be 6828 // It doesn't carry much functionality but allows struct classes to be
6843 // identified in the type system. 6829 // identified in the type system.
6844 class Struct: public HeapObject { 6830 class Struct: public HeapObject {
6845 public: 6831 public:
6846 inline void InitializeBody(int object_size); 6832 inline void InitializeBody(int object_size);
(...skipping 3114 matching lines...) Expand 10 before | Expand all | Expand 10 after
9961 Handle<JSProxy> proxy, 9947 Handle<JSProxy> proxy,
9962 Handle<Object> receiver, 9948 Handle<Object> receiver,
9963 uint32_t index); 9949 uint32_t index);
9964 9950
9965 // If the handler defines an accessor property with a setter, invoke it. 9951 // If the handler defines an accessor property with a setter, invoke it.
9966 // If it defines an accessor property without a setter, or a data property 9952 // If it defines an accessor property without a setter, or a data property
9967 // that is read-only, throw. In all these cases set '*done' to true, 9953 // that is read-only, throw. In all these cases set '*done' to true,
9968 // otherwise set it to false. 9954 // otherwise set it to false.
9969 MUST_USE_RESULT 9955 MUST_USE_RESULT
9970 static MaybeHandle<Object> SetPropertyViaPrototypesWithHandler( 9956 static MaybeHandle<Object> SetPropertyViaPrototypesWithHandler(
9971 Handle<JSProxy> proxy, 9957 Handle<JSProxy> proxy, Handle<Object> receiver, Handle<Name> name,
9972 Handle<JSReceiver> receiver, 9958 Handle<Object> value, StrictMode strict_mode, bool* done);
9973 Handle<Name> name,
9974 Handle<Object> value,
9975 StrictMode strict_mode,
9976 bool* done);
9977 9959
9978 static PropertyAttributes GetPropertyAttributesWithHandler( 9960 static PropertyAttributes GetPropertyAttributesWithHandler(
9979 Handle<JSProxy> proxy, 9961 Handle<JSProxy> proxy,
9980 Handle<Object> receiver, 9962 Handle<Object> receiver,
9981 Handle<Name> name); 9963 Handle<Name> name);
9982 static PropertyAttributes GetElementAttributeWithHandler( 9964 static PropertyAttributes GetElementAttributeWithHandler(
9983 Handle<JSProxy> proxy, 9965 Handle<JSProxy> proxy,
9984 Handle<JSReceiver> receiver, 9966 Handle<JSReceiver> receiver,
9985 uint32_t index); 9967 uint32_t index);
9968 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithHandler(
9969 Handle<JSProxy> proxy, Handle<Object> receiver, Handle<Name> name,
9970 Handle<Object> value, StrictMode strict_mode);
9986 9971
9987 // Turn the proxy into an (empty) JSObject. 9972 // Turn the proxy into an (empty) JSObject.
9988 static void Fix(Handle<JSProxy> proxy); 9973 static void Fix(Handle<JSProxy> proxy);
9989 9974
9990 // Initializes the body after the handler slot. 9975 // Initializes the body after the handler slot.
9991 inline void InitializeBody(int object_size, Object* value); 9976 inline void InitializeBody(int object_size, Object* value);
9992 9977
9993 // Invoke a trap by name. If the trap does not exist on this's handler, 9978 // Invoke a trap by name. If the trap does not exist on this's handler,
9994 // but derived_trap is non-NULL, invoke that instead. May cause GC. 9979 // but derived_trap is non-NULL, invoke that instead. May cause GC.
9995 MUST_USE_RESULT static MaybeHandle<Object> CallTrap( 9980 MUST_USE_RESULT static MaybeHandle<Object> CallTrap(
(...skipping 19 matching lines...) Expand all
10015 10000
10016 STATIC_ASSERT(kPaddingSize >= 0); 10001 STATIC_ASSERT(kPaddingSize >= 0);
10017 10002
10018 typedef FixedBodyDescriptor<kHandlerOffset, 10003 typedef FixedBodyDescriptor<kHandlerOffset,
10019 kPaddingOffset, 10004 kPaddingOffset,
10020 kSize> BodyDescriptor; 10005 kSize> BodyDescriptor;
10021 10006
10022 private: 10007 private:
10023 friend class JSReceiver; 10008 friend class JSReceiver;
10024 10009
10025 MUST_USE_RESULT static MaybeHandle<Object> SetPropertyWithHandler(
10026 Handle<JSProxy> proxy,
10027 Handle<JSReceiver> receiver,
10028 Handle<Name> name,
10029 Handle<Object> value,
10030 StrictMode strict_mode);
10031 MUST_USE_RESULT static inline MaybeHandle<Object> SetElementWithHandler( 10010 MUST_USE_RESULT static inline MaybeHandle<Object> SetElementWithHandler(
10032 Handle<JSProxy> proxy, 10011 Handle<JSProxy> proxy,
10033 Handle<JSReceiver> receiver, 10012 Handle<JSReceiver> receiver,
10034 uint32_t index, 10013 uint32_t index,
10035 Handle<Object> value, 10014 Handle<Object> value,
10036 StrictMode strict_mode); 10015 StrictMode strict_mode);
10037 10016
10038 static bool HasPropertyWithHandler(Handle<JSProxy> proxy, Handle<Name> name); 10017 static bool HasPropertyWithHandler(Handle<JSProxy> proxy, Handle<Name> name);
10039 static inline bool HasElementWithHandler(Handle<JSProxy> proxy, 10018 static inline bool HasElementWithHandler(Handle<JSProxy> proxy,
10040 uint32_t index); 10019 uint32_t index);
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
11240 } else { 11219 } else {
11241 value &= ~(1 << bit_position); 11220 value &= ~(1 << bit_position);
11242 } 11221 }
11243 return value; 11222 return value;
11244 } 11223 }
11245 }; 11224 };
11246 11225
11247 } } // namespace v8::internal 11226 } } // namespace v8::internal
11248 11227
11249 #endif // V8_OBJECTS_H_ 11228 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/lookup.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698