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

Side by Side Diff: src/objects.h

Issue 702243003: Basic array capacity feedback via allocation sites. Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update. Created 6 years, 1 month 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
« no previous file with comments | « src/hydrogen.cc ('k') | src/objects-inl.h » ('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 <iosfwd> 8 #include <iosfwd>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 8134 matching lines...) Expand 10 before | Expand all | Expand 10 after
8145 DECL_ACCESSORS(dependent_code, DependentCode) 8145 DECL_ACCESSORS(dependent_code, DependentCode)
8146 DECL_ACCESSORS(weak_next, Object) 8146 DECL_ACCESSORS(weak_next, Object)
8147 8147
8148 inline void Initialize(); 8148 inline void Initialize();
8149 8149
8150 // This method is expensive, it should only be called for reporting. 8150 // This method is expensive, it should only be called for reporting.
8151 bool IsNestedSite(); 8151 bool IsNestedSite();
8152 8152
8153 // transition_info bitfields, for constructed array transition info. 8153 // transition_info bitfields, for constructed array transition info.
8154 class ElementsKindBits: public BitField<ElementsKind, 0, 15> {}; 8154 class ElementsKindBits: public BitField<ElementsKind, 0, 15> {};
8155 class UnusedBits: public BitField<int, 15, 14> {}; 8155 class InitialElementsCapacity : public BitField<int, 15, 10> {};
8156 class UnusedBits : public BitField<int, 25, 4> {};
8156 class DoNotInlineBit: public BitField<bool, 29, 1> {}; 8157 class DoNotInlineBit: public BitField<bool, 29, 1> {};
8157 8158
8158 // Bitfields for pretenure_data 8159 // Bitfields for pretenure_data
8159 class MementoFoundCountBits: public BitField<int, 0, 26> {}; 8160 class MementoFoundCountBits: public BitField<int, 0, 26> {};
8160 class PretenureDecisionBits: public BitField<PretenureDecision, 26, 3> {}; 8161 class PretenureDecisionBits: public BitField<PretenureDecision, 26, 3> {};
8161 class DeoptDependentCodeBit: public BitField<bool, 29, 1> {}; 8162 class DeoptDependentCodeBit: public BitField<bool, 29, 1> {};
8162 STATIC_ASSERT(PretenureDecisionBits::kMax >= kLastPretenureDecisionValue); 8163 STATIC_ASSERT(PretenureDecisionBits::kMax >= kLastPretenureDecisionValue);
8163 8164
8164 // Increments the mementos found counter and returns true when the first 8165 // Increments the mementos found counter and returns true when the first
8165 // memento was found for a given allocation site. 8166 // memento was found for a given allocation site.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
8235 int value = Smi::cast(transition_info())->value(); 8236 int value = Smi::cast(transition_info())->value();
8236 return ElementsKindBits::decode(value); 8237 return ElementsKindBits::decode(value);
8237 } 8238 }
8238 8239
8239 void SetElementsKind(ElementsKind kind) { 8240 void SetElementsKind(ElementsKind kind) {
8240 int value = Smi::cast(transition_info())->value(); 8241 int value = Smi::cast(transition_info())->value();
8241 set_transition_info(Smi::FromInt(ElementsKindBits::update(value, kind)), 8242 set_transition_info(Smi::FromInt(ElementsKindBits::update(value, kind)),
8242 SKIP_WRITE_BARRIER); 8243 SKIP_WRITE_BARRIER);
8243 } 8244 }
8244 8245
8246 inline int GetInitialElementsCapacity();
8247
8248 // Note that the function accepts the new length, not capacity.
8249 inline void DigestInitialElementsCapacityFeedback(int new_length);
8250
8245 bool CanInlineCall() { 8251 bool CanInlineCall() {
8246 int value = Smi::cast(transition_info())->value(); 8252 int value = Smi::cast(transition_info())->value();
8247 return DoNotInlineBit::decode(value) == 0; 8253 return DoNotInlineBit::decode(value) == 0;
8248 } 8254 }
8249 8255
8250 void SetDoNotInlineCall() { 8256 void SetDoNotInlineCall() {
8251 int value = Smi::cast(transition_info())->value(); 8257 int value = Smi::cast(transition_info())->value();
8252 set_transition_info(Smi::FromInt(DoNotInlineBit::update(value, true)), 8258 set_transition_info(Smi::FromInt(DoNotInlineBit::update(value, true)),
8253 SKIP_WRITE_BARRIER); 8259 SKIP_WRITE_BARRIER);
8254 } 8260 }
(...skipping 1839 matching lines...) Expand 10 before | Expand all | Expand 10 after
10094 // Expand the fixed array backing of a fast-case JSArray to at least 10100 // Expand the fixed array backing of a fast-case JSArray to at least
10095 // the requested size. 10101 // the requested size.
10096 static void Expand(Handle<JSArray> array, 10102 static void Expand(Handle<JSArray> array,
10097 int minimum_size_of_backing_fixed_array); 10103 int minimum_size_of_backing_fixed_array);
10098 10104
10099 // Dispatched behavior. 10105 // Dispatched behavior.
10100 DECLARE_PRINTER(JSArray) 10106 DECLARE_PRINTER(JSArray)
10101 DECLARE_VERIFIER(JSArray) 10107 DECLARE_VERIFIER(JSArray)
10102 10108
10103 // Number of element slots to pre-allocate for an empty array. 10109 // Number of element slots to pre-allocate for an empty array.
10104 static const int kPreallocatedArrayElements = 4; 10110 static int PreallocatedArrayElements() {
10111 if (FLAG_initial_capacity_mode == 1) return 4;
10112 DCHECK(FLAG_initial_capacity_mode == 0 ||
10113 FLAG_initial_capacity_mode == 2);
10114 return 0;
10115 }
10105 10116
10106 // Layout description. 10117 // Layout description.
10107 static const int kLengthOffset = JSObject::kHeaderSize; 10118 static const int kLengthOffset = JSObject::kHeaderSize;
10108 static const int kSize = kLengthOffset + kPointerSize; 10119 static const int kSize = kLengthOffset + kPointerSize;
10109 10120
10110 private: 10121 private:
10111 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArray); 10122 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArray);
10112 }; 10123 };
10113 10124
10114 10125
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
10841 } else { 10852 } else {
10842 value &= ~(1 << bit_position); 10853 value &= ~(1 << bit_position);
10843 } 10854 }
10844 return value; 10855 return value;
10845 } 10856 }
10846 }; 10857 };
10847 10858
10848 } } // namespace v8::internal 10859 } } // namespace v8::internal
10849 10860
10850 #endif // V8_OBJECTS_H_ 10861 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698