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

Unified Diff: src/ast/ast.h

Issue 2655853010: [TypeFeedbackVector] Combine the literals array and the feedback vector. (Closed)
Patch Set: more comments. 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/arm64/macro-assembler-arm64.cc ('k') | src/ast/ast.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/ast.h
diff --git a/src/ast/ast.h b/src/ast/ast.h
index 796037d7da451decdfe29efea954c3eb1ef85d69..e5c7646ef3a342794ad5db1ded50b13ecd425e73 100644
--- a/src/ast/ast.h
+++ b/src/ast/ast.h
@@ -1240,32 +1240,32 @@ class Literal final : public Expression {
const AstValue* value_;
};
-
-class AstLiteralReindexer;
-
-// Base class for literals that needs space in the corresponding JSFunction.
+// Base class for literals that need space in the type feedback vector.
class MaterializedLiteral : public Expression {
public:
- int literal_index() { return literal_index_; }
-
int depth() const {
// only callable after initialization.
DCHECK(depth_ >= 1);
return depth_;
}
+ void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec,
+ FeedbackVectorSlotCache* cache) {
+ literal_slot_ = spec->AddLiteralSlot();
+ }
+
+ FeedbackVectorSlot literal_slot() const { return literal_slot_; }
+
private:
int depth_ : 31;
- int literal_index_;
-
- friend class AstLiteralReindexer;
+ FeedbackVectorSlot literal_slot_;
class IsSimpleField
: public BitField<bool, Expression::kNextBitFieldIndex, 1> {};
protected:
- MaterializedLiteral(int literal_index, int pos, NodeType type)
- : Expression(pos, type), depth_(0), literal_index_(literal_index) {
+ MaterializedLiteral(int pos, NodeType type)
+ : Expression(pos, type), depth_(0) {
bit_field_ |= IsSimpleField::encode(false);
}
@@ -1472,10 +1472,10 @@ class ObjectLiteral final : public MaterializedLiteral {
private:
friend class AstNodeFactory;
- ObjectLiteral(ZoneList<Property*>* properties, int literal_index,
+ ObjectLiteral(ZoneList<Property*>* properties,
uint32_t boilerplate_properties, int pos,
bool has_rest_property)
- : MaterializedLiteral(literal_index, pos, kObjectLiteral),
+ : MaterializedLiteral(pos, kObjectLiteral),
boilerplate_properties_(boilerplate_properties),
properties_(properties) {
bit_field_ |= FastElementsField::encode(false) |
@@ -1534,9 +1534,8 @@ class RegExpLiteral final : public MaterializedLiteral {
private:
friend class AstNodeFactory;
- RegExpLiteral(const AstRawString* pattern, int flags, int literal_index,
- int pos)
- : MaterializedLiteral(literal_index, pos, kRegExpLiteral),
+ RegExpLiteral(const AstRawString* pattern, int flags, int pos)
+ : MaterializedLiteral(pos, kRegExpLiteral),
flags_(flags),
pattern_(pattern) {
set_depth(1);
@@ -1619,9 +1618,8 @@ class ArrayLiteral final : public MaterializedLiteral {
private:
friend class AstNodeFactory;
- ArrayLiteral(ZoneList<Expression*>* values, int first_spread_index,
- int literal_index, int pos)
- : MaterializedLiteral(literal_index, pos, kArrayLiteral),
+ ArrayLiteral(ZoneList<Expression*>* values, int first_spread_index, int pos)
+ : MaterializedLiteral(pos, kArrayLiteral),
first_spread_index_(first_spread_index),
values_(values) {}
@@ -3333,11 +3331,10 @@ class AstNodeFactory final BASE_EMBEDDED {
}
ObjectLiteral* NewObjectLiteral(
- ZoneList<ObjectLiteral::Property*>* properties, int literal_index,
+ ZoneList<ObjectLiteral::Property*>* properties,
uint32_t boilerplate_properties, int pos, bool has_rest_property) {
- return new (zone_)
- ObjectLiteral(properties, literal_index, boilerplate_properties, pos,
- has_rest_property);
+ return new (zone_) ObjectLiteral(properties, boilerplate_properties, pos,
+ has_rest_property);
}
ObjectLiteral::Property* NewObjectLiteralProperty(
@@ -3355,21 +3352,18 @@ class AstNodeFactory final BASE_EMBEDDED {
}
RegExpLiteral* NewRegExpLiteral(const AstRawString* pattern, int flags,
- int literal_index, int pos) {
- return new (zone_) RegExpLiteral(pattern, flags, literal_index, pos);
+ int pos) {
+ return new (zone_) RegExpLiteral(pattern, flags, pos);
}
ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values,
- int literal_index,
int pos) {
- return new (zone_) ArrayLiteral(values, -1, literal_index, pos);
+ return new (zone_) ArrayLiteral(values, -1, pos);
}
ArrayLiteral* NewArrayLiteral(ZoneList<Expression*>* values,
- int first_spread_index, int literal_index,
- int pos) {
- return new (zone_)
- ArrayLiteral(values, first_spread_index, literal_index, pos);
+ int first_spread_index, int pos) {
+ return new (zone_) ArrayLiteral(values, first_spread_index, pos);
}
VariableProxy* NewVariableProxy(Variable* var,
« no previous file with comments | « src/arm64/macro-assembler-arm64.cc ('k') | src/ast/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698