Chromium Code Reviews| Index: src/ast/ast.h |
| diff --git a/src/ast/ast.h b/src/ast/ast.h |
| index 768527f5ad42ae0a37d3a3f08f572c42795dd839..b3abe5240190bc6a10058901de0d5d63b3d84bd9 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. |
|
Michael Starzinger
2017/01/30 11:16:44
nit: s/in the corresponding JSFunction/in the type
mvstanton
2017/01/30 11:57:04
Done.
|
| 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); |
| } |
| @@ -1471,10 +1471,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) | |
| @@ -1530,12 +1530,16 @@ class RegExpLiteral final : public MaterializedLiteral { |
| Handle<String> pattern() const { return pattern_->string(); } |
| int flags() const { return flags_; } |
| + void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec, |
|
Michael Starzinger
2017/01/30 11:16:44
nit: Shouldn't this be the same as just using the
mvstanton
2017/01/30 11:57:04
Yep, thanks!
|
| + FeedbackVectorSlotCache* cache) { |
| + MaterializedLiteral::AssignFeedbackVectorSlots(spec, cache); |
| + } |
| + |
| 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); |
| @@ -1620,9 +1624,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) {} |
| @@ -3334,11 +3337,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( |
| @@ -3356,21 +3358,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, |