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

Unified Diff: src/type-feedback-vector.h

Issue 2614373002: [FeedbackVector] Infrastructure for literal arrays in the vector. (Closed)
Patch Set: Release compile fix. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/s390/interface-descriptors-s390.cc ('k') | src/type-feedback-vector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/type-feedback-vector.h
diff --git a/src/type-feedback-vector.h b/src/type-feedback-vector.h
index ed74904fcd9b298b92f51c8fdc87b1bae54280bd..c9eae023a867951103cf4dc76e4a4d8decdb0260 100644
--- a/src/type-feedback-vector.h
+++ b/src/type-feedback-vector.h
@@ -32,6 +32,8 @@ enum class FeedbackVectorSlotKind {
INTERPRETER_COMPARE_IC,
STORE_DATA_PROPERTY_IN_LITERAL_IC,
+ // This kind of slot has an integer parameter associated with it.
+ CREATE_CLOSURE,
// This is a general purpose slot that occupies one feedback vector element.
GENERAL,
@@ -58,6 +60,11 @@ class FeedbackVectorSpecBase {
return AddSlot(FeedbackVectorSlotKind::LOAD_GLOBAL_IC);
}
+ FeedbackVectorSlot AddCreateClosureSlot(int size) {
+ This()->append_parameter(size);
+ return AddSlot(FeedbackVectorSlotKind::CREATE_CLOSURE);
+ }
+
FeedbackVectorSlot AddKeyedLoadICSlot() {
return AddSlot(FeedbackVectorSlotKind::KEYED_LOAD_IC);
}
@@ -101,7 +108,7 @@ class FeedbackVectorSpecBase {
class StaticFeedbackVectorSpec
: public FeedbackVectorSpecBase<StaticFeedbackVectorSpec> {
public:
- StaticFeedbackVectorSpec() : slot_count_(0) {}
+ StaticFeedbackVectorSpec() : slot_count_(0), parameters_count_(0) {}
int slots() const { return slot_count_; }
@@ -110,6 +117,13 @@ class StaticFeedbackVectorSpec
return kinds_[slot];
}
+ int parameters_count() const { return parameters_count_; }
+
+ int GetParameter(int index) const {
+ DCHECK(index >= 0 && index < parameters_count_);
+ return parameters_[index];
+ }
+
private:
friend class FeedbackVectorSpecBase<StaticFeedbackVectorSpec>;
@@ -118,17 +132,26 @@ class StaticFeedbackVectorSpec
kinds_[slot_count_++] = kind;
}
+ void append_parameter(int parameter) {
+ DCHECK(parameters_count_ < kMaxLength);
+ parameters_[parameters_count_++] = parameter;
+ }
+
static const int kMaxLength = 12;
int slot_count_;
FeedbackVectorSlotKind kinds_[kMaxLength];
+ int parameters_count_;
+ int parameters_[kMaxLength];
};
class FeedbackVectorSpec : public FeedbackVectorSpecBase<FeedbackVectorSpec> {
public:
- explicit FeedbackVectorSpec(Zone* zone) : slot_kinds_(zone) {
+ explicit FeedbackVectorSpec(Zone* zone)
+ : slot_kinds_(zone), parameters_(zone) {
slot_kinds_.reserve(16);
+ parameters_.reserve(8);
}
int slots() const { return static_cast<int>(slot_kinds_.size()); }
@@ -137,6 +160,10 @@ class FeedbackVectorSpec : public FeedbackVectorSpecBase<FeedbackVectorSpec> {
return static_cast<FeedbackVectorSlotKind>(slot_kinds_.at(slot));
}
+ int parameters_count() const { return static_cast<int>(parameters_.size()); }
+
+ int GetParameter(int index) const { return parameters_.at(index); }
+
private:
friend class FeedbackVectorSpecBase<FeedbackVectorSpec>;
@@ -144,14 +171,18 @@ class FeedbackVectorSpec : public FeedbackVectorSpecBase<FeedbackVectorSpec> {
slot_kinds_.push_back(static_cast<unsigned char>(kind));
}
+ void append_parameter(int parameter) { parameters_.push_back(parameter); }
+
ZoneVector<unsigned char> slot_kinds_;
+ ZoneVector<int> parameters_;
};
// The shape of the TypeFeedbackMetadata is an array with:
// 0: slot_count
// 1: names table
-// 2..N: slot kinds packed into a bit vector
+// 2: parameters table
+// 3..N: slot kinds packed into a bit vector
//
class TypeFeedbackMetadata : public FixedArray {
public:
@@ -159,11 +190,15 @@ class TypeFeedbackMetadata : public FixedArray {
static inline TypeFeedbackMetadata* cast(Object* obj);
static const int kSlotsCountIndex = 0;
- static const int kReservedIndexCount = 1;
+ static const int kParametersTableIndex = 1;
+ static const int kReservedIndexCount = 2;
// Returns number of feedback vector elements used by given slot kind.
static inline int GetSlotSize(FeedbackVectorSlotKind kind);
+ // Defines if slots of given kind require "parameter".
+ static inline bool SlotRequiresParameter(FeedbackVectorSlotKind kind);
+
bool SpecDiffersFrom(const FeedbackVectorSpec* other_spec) const;
bool DiffersFrom(const TypeFeedbackMetadata* other_metadata) const;
@@ -176,6 +211,9 @@ class TypeFeedbackMetadata : public FixedArray {
// Returns slot kind for given slot.
FeedbackVectorSlotKind GetKind(FeedbackVectorSlot slot) const;
+ // Returns parameter for given index (note: this is not the slot)
+ int GetParameter(int parameter_index) const;
+
template <typename Spec>
static Handle<TypeFeedbackMetadata> New(Isolate* isolate, const Spec* spec);
@@ -244,6 +282,8 @@ class TypeFeedbackVector : public FixedArray {
// Returns slot kind for given slot.
FeedbackVectorSlotKind GetKind(FeedbackVectorSlot slot) const;
+ // Returns parameter corresponding to given slot or -1.
+ int GetParameter(FeedbackVectorSlot slot) const;
static Handle<TypeFeedbackVector> New(Isolate* isolate,
Handle<TypeFeedbackMetadata> metadata);
« no previous file with comments | « src/s390/interface-descriptors-s390.cc ('k') | src/type-feedback-vector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698