| 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 2666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2677 static const uint32_t kMaxGap = 1024; | 2677 static const uint32_t kMaxGap = 1024; |
| 2678 | 2678 |
| 2679 // Maximal length of fast elements array that won't be checked for | 2679 // Maximal length of fast elements array that won't be checked for |
| 2680 // being dense enough on expansion. | 2680 // being dense enough on expansion. |
| 2681 static const int kMaxUncheckedFastElementsLength = 5000; | 2681 static const int kMaxUncheckedFastElementsLength = 5000; |
| 2682 | 2682 |
| 2683 // Same as above but for old arrays. This limit is more strict. We | 2683 // Same as above but for old arrays. This limit is more strict. We |
| 2684 // don't want to be wasteful with long lived objects. | 2684 // don't want to be wasteful with long lived objects. |
| 2685 static const int kMaxUncheckedOldFastElementsLength = 500; | 2685 static const int kMaxUncheckedOldFastElementsLength = 500; |
| 2686 | 2686 |
| 2687 // TODO(2790): HAllocate currently always allocates fast backing stores | 2687 static const int kInitialMaxFastElementArray = 100000; |
| 2688 // in new space, where on x64 we can only fit ~98K elements. Keep this | |
| 2689 // limit lower than that until HAllocate is made smarter. | |
| 2690 static const int kInitialMaxFastElementArray = 95000; | |
| 2691 | 2688 |
| 2692 static const int kFastPropertiesSoftLimit = 12; | 2689 static const int kFastPropertiesSoftLimit = 12; |
| 2693 static const int kMaxFastProperties = 64; | 2690 static const int kMaxFastProperties = 64; |
| 2694 static const int kMaxInstanceSize = 255 * kPointerSize; | 2691 static const int kMaxInstanceSize = 255 * kPointerSize; |
| 2695 // When extending the backing storage for property values, we increase | 2692 // When extending the backing storage for property values, we increase |
| 2696 // its size by more than the 1 entry necessary, so sequentially adding fields | 2693 // its size by more than the 1 entry necessary, so sequentially adding fields |
| 2697 // to the same object requires fewer allocations and copies. | 2694 // to the same object requires fewer allocations and copies. |
| 2698 static const int kFieldsAdded = 3; | 2695 static const int kFieldsAdded = 3; |
| 2699 | 2696 |
| 2700 // Layout description. | 2697 // Layout description. |
| 2701 static const int kPropertiesOffset = HeapObject::kHeaderSize; | 2698 static const int kPropertiesOffset = HeapObject::kHeaderSize; |
| 2702 static const int kElementsOffset = kPropertiesOffset + kPointerSize; | 2699 static const int kElementsOffset = kPropertiesOffset + kPointerSize; |
| 2703 static const int kHeaderSize = kElementsOffset + kPointerSize; | 2700 static const int kHeaderSize = kElementsOffset + kPointerSize; |
| 2704 | 2701 |
| 2705 STATIC_CHECK(kHeaderSize == Internals::kJSObjectHeaderSize); | 2702 STATIC_CHECK(kHeaderSize == Internals::kJSObjectHeaderSize); |
| 2706 | 2703 |
| 2707 class BodyDescriptor : public FlexibleBodyDescriptor<kPropertiesOffset> { | 2704 class BodyDescriptor : public FlexibleBodyDescriptor<kPropertiesOffset> { |
| 2708 public: | 2705 public: |
| 2709 static inline int SizeOf(Map* map, HeapObject* object); | 2706 static inline int SizeOf(Map* map, HeapObject* object); |
| 2710 }; | 2707 }; |
| 2711 | 2708 |
| 2712 // Enqueue change record for Object.observe. May cause GC. | 2709 // Enqueue change record for Object.observe. May cause GC. |
| 2713 static void EnqueueChangeRecord(Handle<JSObject> object, | 2710 static void EnqueueChangeRecord(Handle<JSObject> object, |
| 2714 const char* type, | 2711 const char* type, |
| 2715 Handle<Name> name, | 2712 Handle<Name> name, |
| 2716 Handle<Object> old_value); | 2713 Handle<Object> old_value); |
| 2717 | 2714 |
| 2718 // Deliver change records to observers. May cause GC. | 2715 // Deliver change records to observers. May cause GC. |
| 2719 static void DeliverChangeRecords(Isolate* isolate); | 2716 static void DeliverChangeRecords(Isolate* isolate); |
| 2717 static int InitialMaxFastElementArray(Heap* heap); |
| 2720 | 2718 |
| 2721 private: | 2719 private: |
| 2722 friend class DictionaryElementsAccessor; | 2720 friend class DictionaryElementsAccessor; |
| 2723 friend class JSReceiver; | 2721 friend class JSReceiver; |
| 2724 | 2722 |
| 2725 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, | 2723 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, |
| 2726 Object* structure, | 2724 Object* structure, |
| 2727 uint32_t index, | 2725 uint32_t index, |
| 2728 Object* holder); | 2726 Object* holder); |
| 2729 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor( | 2727 MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor( |
| (...skipping 7503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10233 } else { | 10231 } else { |
| 10234 value &= ~(1 << bit_position); | 10232 value &= ~(1 << bit_position); |
| 10235 } | 10233 } |
| 10236 return value; | 10234 return value; |
| 10237 } | 10235 } |
| 10238 }; | 10236 }; |
| 10239 | 10237 |
| 10240 } } // namespace v8::internal | 10238 } } // namespace v8::internal |
| 10241 | 10239 |
| 10242 #endif // V8_OBJECTS_H_ | 10240 #endif // V8_OBJECTS_H_ |
| OLD | NEW |