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 2011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2022 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( | 2022 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( |
2023 Isolate* isolate, | 2023 Isolate* isolate, |
2024 ElementsKind elements_kind); | 2024 ElementsKind elements_kind); |
2025 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( | 2025 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( |
2026 ElementsKind elements_kind); | 2026 ElementsKind elements_kind); |
2027 | 2027 |
2028 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, | 2028 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, |
2029 ElementsKind to_kind); | 2029 ElementsKind to_kind); |
2030 | 2030 |
2031 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); | 2031 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); |
2032 MUST_USE_RESULT MaybeObject* PossiblyTransitionArrayBoilerplate( | 2032 MUST_USE_RESULT MaybeObject* UpdateAllocationSiteInfo( |
2033 ElementsKind to_kind); | 2033 ElementsKind to_kind); |
2034 | 2034 |
2035 // Replaces an existing transition with a transition to a map with a FIELD. | 2035 // Replaces an existing transition with a transition to a map with a FIELD. |
2036 MUST_USE_RESULT MaybeObject* ConvertTransitionToMapTransition( | 2036 MUST_USE_RESULT MaybeObject* ConvertTransitionToMapTransition( |
2037 int transition_index, | 2037 int transition_index, |
2038 String* name, | 2038 String* name, |
2039 Object* new_value, | 2039 Object* new_value, |
2040 PropertyAttributes attributes); | 2040 PropertyAttributes attributes); |
2041 | 2041 |
2042 // Converts a descriptor of any other type to a real field, backed by the | 2042 // Converts a descriptor of any other type to a real field, backed by the |
(...skipping 2130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4173 inline void SetCell(int index, JSGlobalPropertyCell* cell); | 4173 inline void SetCell(int index, JSGlobalPropertyCell* cell); |
4174 | 4174 |
4175 // The object that indicates an uninitialized cache. | 4175 // The object that indicates an uninitialized cache. |
4176 static inline Handle<Object> UninitializedSentinel(Isolate* isolate); | 4176 static inline Handle<Object> UninitializedSentinel(Isolate* isolate); |
4177 | 4177 |
4178 // The object that indicates a megamorphic state. | 4178 // The object that indicates a megamorphic state. |
4179 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate); | 4179 static inline Handle<Object> MegamorphicSentinel(Isolate* isolate); |
4180 | 4180 |
4181 // The object that indicates a monomorphic state of Array with | 4181 // The object that indicates a monomorphic state of Array with |
4182 // ElementsKind | 4182 // ElementsKind |
4183 static inline Handle<Object> MonomorphicArraySentinel( | 4183 static inline Handle<Object> MonomorphicArraySentinel(Isolate* isolate, |
4184 ElementsKind elements_kind); | 4184 ElementsKind elements_kind); |
4185 | 4185 |
4186 // A raw version of the uninitialized sentinel that's safe to read during | 4186 // A raw version of the uninitialized sentinel that's safe to read during |
4187 // garbage collection (e.g., for patching the cache). | 4187 // garbage collection (e.g., for patching the cache). |
4188 static inline Object* RawUninitializedSentinel(Heap* heap); | 4188 static inline Object* RawUninitializedSentinel(Heap* heap); |
4189 | 4189 |
4190 // Casting. | 4190 // Casting. |
4191 static inline TypeFeedbackCells* cast(Object* obj); | 4191 static inline TypeFeedbackCells* cast(Object* obj); |
4192 | 4192 |
4193 static const int kForInFastCaseMarker = 0; | 4193 static const int kForInFastCaseMarker = 0; |
(...skipping 2845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7039 }; | 7039 }; |
7040 | 7040 |
7041 | 7041 |
7042 enum AllocationSiteMode { | 7042 enum AllocationSiteMode { |
7043 DONT_TRACK_ALLOCATION_SITE, | 7043 DONT_TRACK_ALLOCATION_SITE, |
7044 TRACK_ALLOCATION_SITE, | 7044 TRACK_ALLOCATION_SITE, |
7045 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE | 7045 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE |
7046 }; | 7046 }; |
7047 | 7047 |
7048 | 7048 |
7049 | |
7050 | |
7051 class AllocationSiteInfo: public Struct { | 7049 class AllocationSiteInfo: public Struct { |
7052 public: | 7050 public: |
7053 DECL_ACCESSORS(payload, Object) | 7051 DECL_ACCESSORS(payload, Object) |
7054 | 7052 |
7055 static inline AllocationSiteInfo* cast(Object* obj); | 7053 static inline AllocationSiteInfo* cast(Object* obj); |
7056 | 7054 |
7057 DECLARE_PRINTER(AllocationSiteInfo) | 7055 DECLARE_PRINTER(AllocationSiteInfo) |
7058 DECLARE_VERIFIER(AllocationSiteInfo) | 7056 DECLARE_VERIFIER(AllocationSiteInfo) |
7059 | 7057 |
7060 // Returns NULL if no AllocationSiteInfo is available for object. | 7058 // Returns NULL if no AllocationSiteInfo is available for object. |
7061 static AllocationSiteInfo* FindForJSObject(JSObject* object); | 7059 static AllocationSiteInfo* FindForJSObject(JSObject* object); |
7062 | 7060 |
7063 static AllocationSiteMode GetMode(ElementsKind boilerplate_elements_kind); | 7061 static AllocationSiteMode GetMode(ElementsKind boilerplate_elements_kind); |
7064 static AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | 7062 static AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); |
7065 | 7063 |
7066 static const int kPayloadOffset = HeapObject::kHeaderSize; | 7064 static const int kPayloadOffset = HeapObject::kHeaderSize; |
7067 static const int kSize = kPayloadOffset + kPointerSize; | 7065 static const int kSize = kPayloadOffset + kPointerSize; |
| 7066 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; |
7068 | 7067 |
7069 bool GetElementsKindPayload(ElementsKind* kind); | 7068 bool GetElementsKindPayload(ElementsKind* kind); |
7070 private: | 7069 private: |
7071 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSiteInfo); | 7070 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSiteInfo); |
7072 }; | 7071 }; |
7073 | 7072 |
7074 | 7073 |
7075 // Representation of a slow alias as part of a non-strict arguments objects. | 7074 // Representation of a slow alias as part of a non-strict arguments objects. |
7076 // For fast aliases (if HasNonStrictArgumentsElements()): | 7075 // For fast aliases (if HasNonStrictArgumentsElements()): |
7077 // - the parameter map contains an index into the context | 7076 // - the parameter map contains an index into the context |
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8346 // Overload the length setter to skip write barrier when the length | 8345 // Overload the length setter to skip write barrier when the length |
8347 // is set to a smi. This matches the set function on FixedArray. | 8346 // is set to a smi. This matches the set function on FixedArray. |
8348 inline void set_length(Smi* length); | 8347 inline void set_length(Smi* length); |
8349 | 8348 |
8350 MUST_USE_RESULT MaybeObject* JSArrayUpdateLengthFromIndex(uint32_t index, | 8349 MUST_USE_RESULT MaybeObject* JSArrayUpdateLengthFromIndex(uint32_t index, |
8351 Object* value); | 8350 Object* value); |
8352 | 8351 |
8353 // Initialize the array with the given capacity. The function may | 8352 // Initialize the array with the given capacity. The function may |
8354 // fail due to out-of-memory situations, but only if the requested | 8353 // fail due to out-of-memory situations, but only if the requested |
8355 // capacity is non-zero. | 8354 // capacity is non-zero. |
8356 MUST_USE_RESULT MaybeObject* Initialize(int capacity); | 8355 MUST_USE_RESULT MaybeObject* Initialize(int capacity, int length = 0); |
8357 | 8356 |
8358 // Initializes the array to a certain length. | 8357 // Initializes the array to a certain length. |
8359 inline bool AllowsSetElementsLength(); | 8358 inline bool AllowsSetElementsLength(); |
8360 // Can cause GC. | 8359 // Can cause GC. |
8361 MUST_USE_RESULT MaybeObject* SetElementsLength(Object* length); | 8360 MUST_USE_RESULT MaybeObject* SetElementsLength(Object* length); |
8362 | 8361 |
8363 // Set the content of the array to the content of storage. | 8362 // Set the content of the array to the content of storage. |
8364 MUST_USE_RESULT inline MaybeObject* SetContent(FixedArrayBase* storage); | 8363 MUST_USE_RESULT inline MaybeObject* SetContent(FixedArrayBase* storage); |
8365 | 8364 |
8366 // Casting. | 8365 // Casting. |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9024 } else { | 9023 } else { |
9025 value &= ~(1 << bit_position); | 9024 value &= ~(1 << bit_position); |
9026 } | 9025 } |
9027 return value; | 9026 return value; |
9028 } | 9027 } |
9029 }; | 9028 }; |
9030 | 9029 |
9031 } } // namespace v8::internal | 9030 } } // namespace v8::internal |
9032 | 9031 |
9033 #endif // V8_OBJECTS_H_ | 9032 #endif // V8_OBJECTS_H_ |
OLD | NEW |