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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 103e93e8c4ac2547bea8167c190803000071ea6a..9e1003b713bda0d14457536bf004b0dc0f153f5a 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -8152,7 +8152,8 @@ class AllocationSite: public Struct {
// transition_info bitfields, for constructed array transition info.
class ElementsKindBits: public BitField<ElementsKind, 0, 15> {};
- class UnusedBits: public BitField<int, 15, 14> {};
+ class InitialElementsCapacity : public BitField<int, 15, 10> {};
+ class UnusedBits : public BitField<int, 25, 4> {};
class DoNotInlineBit: public BitField<bool, 29, 1> {};
// Bitfields for pretenure_data
@@ -8242,6 +8243,11 @@ class AllocationSite: public Struct {
SKIP_WRITE_BARRIER);
}
+ inline int GetInitialElementsCapacity();
+
+ // Note that the function accepts the new length, not capacity.
+ inline void DigestInitialElementsCapacityFeedback(int new_length);
+
bool CanInlineCall() {
int value = Smi::cast(transition_info())->value();
return DoNotInlineBit::decode(value) == 0;
@@ -10101,7 +10107,12 @@ class JSArray: public JSObject {
DECLARE_VERIFIER(JSArray)
// Number of element slots to pre-allocate for an empty array.
- static const int kPreallocatedArrayElements = 4;
+ static int PreallocatedArrayElements() {
+ if (FLAG_initial_capacity_mode == 1) return 4;
+ DCHECK(FLAG_initial_capacity_mode == 0 ||
+ FLAG_initial_capacity_mode == 2);
+ return 0;
+ }
// Layout description.
static const int kLengthOffset = JSObject::kHeaderSize;
« 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