| Index: src/ast.h
|
| diff --git a/src/ast.h b/src/ast.h
|
| index c2d9412a90b227e59885504ed79effd08ad8dcdc..f59689ebdda36fa8d6e5418fec01c69fe93ca9e8 100644
|
| --- a/src/ast.h
|
| +++ b/src/ast.h
|
| @@ -168,6 +168,7 @@ class AstNode: public ZoneObject {
|
| virtual bool IsInlineable() const = 0;
|
|
|
| static int Count() { return Isolate::Current()->ast_node_count(); }
|
| + static int HeavyCount() { return Isolate::Current()->heavy_ast_node_count(); }
|
| static void ResetIds() { Isolate::Current()->set_ast_node_id(0); }
|
|
|
| protected:
|
| @@ -181,6 +182,11 @@ class AstNode: public ZoneObject {
|
| return tmp;
|
| }
|
|
|
| + void IncrementHeavyAstNodeCounter(Isolate* isolate) {
|
| + unsigned tmp = isolate->heavy_ast_node_count();
|
| + isolate->set_heavy_ast_node_count(tmp + 1);
|
| + }
|
| +
|
| private:
|
| // Hidden to prevent accidental usage. It would have to load the
|
| // current zone from the TLS.
|
| @@ -441,6 +447,7 @@ class IterationStatement: public BreakableStatement {
|
| : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS),
|
| body_(NULL),
|
| osr_entry_id_(GetNextId(isolate)) {
|
| + IncrementHeavyAstNodeCounter(isolate);
|
| }
|
|
|
| void Initialize(Statement* body) {
|
| @@ -686,8 +693,10 @@ class ReturnStatement: public Statement {
|
|
|
| class WithStatement: public Statement {
|
| public:
|
| - WithStatement(Expression* expression, Statement* statement)
|
| - : expression_(expression), statement_(statement) { }
|
| + WithStatement(Isolate* isolate, Expression* expression, Statement* statement)
|
| + : expression_(expression), statement_(statement) {
|
| + IncrementHeavyAstNodeCounter(isolate);
|
| + }
|
|
|
| DECLARE_NODE_TYPE(WithStatement)
|
|
|
| @@ -754,6 +763,7 @@ class SwitchStatement: public BreakableStatement {
|
| : BreakableStatement(isolate, labels, TARGET_FOR_ANONYMOUS),
|
| tag_(NULL),
|
| cases_(NULL) {
|
| + IncrementHeavyAstNodeCounter(isolate);
|
| }
|
|
|
|
|
| @@ -790,8 +800,7 @@ class IfStatement: public Statement {
|
| else_statement_(else_statement),
|
| if_id_(GetNextId(isolate)),
|
| then_id_(GetNextId(isolate)),
|
| - else_id_(GetNextId(isolate)) {
|
| - }
|
| + else_id_(GetNextId(isolate)) { }
|
|
|
| DECLARE_NODE_TYPE(IfStatement)
|
|
|
| @@ -846,8 +855,7 @@ class TryStatement: public Statement {
|
| explicit TryStatement(int index, Block* try_block)
|
| : index_(index),
|
| try_block_(try_block),
|
| - escaping_targets_(NULL) {
|
| - }
|
| + escaping_targets_(NULL) { }
|
|
|
| void set_escaping_targets(ZoneList<Label*>* targets) {
|
| escaping_targets_ = targets;
|
| @@ -869,7 +877,8 @@ class TryStatement: public Statement {
|
|
|
| class TryCatchStatement: public TryStatement {
|
| public:
|
| - TryCatchStatement(int index,
|
| + TryCatchStatement(Isolate* isolate,
|
| + int index,
|
| Block* try_block,
|
| Scope* scope,
|
| Variable* variable,
|
| @@ -878,6 +887,7 @@ class TryCatchStatement: public TryStatement {
|
| scope_(scope),
|
| variable_(variable),
|
| catch_block_(catch_block) {
|
| + IncrementHeavyAstNodeCounter(isolate);
|
| }
|
|
|
| DECLARE_NODE_TYPE(TryCatchStatement)
|
| @@ -896,9 +906,14 @@ class TryCatchStatement: public TryStatement {
|
|
|
| class TryFinallyStatement: public TryStatement {
|
| public:
|
| - TryFinallyStatement(int index, Block* try_block, Block* finally_block)
|
| + TryFinallyStatement(Isolate* isolate,
|
| + int index,
|
| + Block* try_block,
|
| + Block* finally_block)
|
| : TryStatement(index, try_block),
|
| - finally_block_(finally_block) { }
|
| + finally_block_(finally_block) {
|
| + IncrementHeavyAstNodeCounter(isolate);
|
| + }
|
|
|
| DECLARE_NODE_TYPE(TryFinallyStatement)
|
|
|
| @@ -1242,6 +1257,7 @@ class Call: public Expression {
|
| is_monomorphic_(false),
|
| check_type_(RECEIVER_MAP_CHECK),
|
| return_id_(GetNextId(isolate)) {
|
| + IncrementHeavyAstNodeCounter(isolate);
|
| }
|
|
|
| DECLARE_NODE_TYPE(Call)
|
| @@ -1297,7 +1313,9 @@ class CallNew: public Expression {
|
| : Expression(isolate),
|
| expression_(expression),
|
| arguments_(arguments),
|
| - pos_(pos) { }
|
| + pos_(pos) {
|
| + IncrementHeavyAstNodeCounter(isolate);
|
| + }
|
|
|
| DECLARE_NODE_TYPE(CallNew)
|
|
|
| @@ -1327,7 +1345,9 @@ class CallRuntime: public Expression {
|
| : Expression(isolate),
|
| name_(name),
|
| function_(function),
|
| - arguments_(arguments) { }
|
| + arguments_(arguments) {
|
| + IncrementHeavyAstNodeCounter(isolate);
|
| + }
|
|
|
| DECLARE_NODE_TYPE(CallRuntime)
|
|
|
| @@ -1665,7 +1685,9 @@ class FunctionLiteral: public Expression {
|
| Handle<FixedArray> this_property_assignments,
|
| int parameter_count,
|
| Type type,
|
| - bool has_duplicate_parameters)
|
| + bool has_duplicate_parameters,
|
| + int ast_node_count,
|
| + bool is_primitive)
|
| : Expression(isolate),
|
| name_(name),
|
| scope_(scope),
|
| @@ -1676,7 +1698,9 @@ class FunctionLiteral: public Expression {
|
| expected_property_count_(expected_property_count),
|
| handler_count_(handler_count),
|
| parameter_count_(parameter_count),
|
| - function_token_position_(RelocInfo::kNoPosition) {
|
| + function_token_position_(RelocInfo::kNoPosition),
|
| + ast_node_count_(ast_node_count),
|
| + is_primitive_(is_primitive) {
|
| bitfield_ =
|
| HasOnlySimpleThisPropertyAssignments::encode(
|
| has_only_simple_this_property_assignments) |
|
| @@ -1684,6 +1708,7 @@ class FunctionLiteral: public Expression {
|
| IsAnonymous::encode(type == ANONYMOUS_EXPRESSION) |
|
| Pretenure::encode(false) |
|
| HasDuplicateParameters::encode(has_duplicate_parameters);
|
| + IncrementHeavyAstNodeCounter(isolate);
|
| }
|
|
|
| DECLARE_NODE_TYPE(FunctionLiteral)
|
| @@ -1731,6 +1756,14 @@ class FunctionLiteral: public Expression {
|
| return HasDuplicateParameters::decode(bitfield_);
|
| }
|
|
|
| + int ast_node_count() {
|
| + return ast_node_count_;
|
| + }
|
| +
|
| + bool is_primitive() {
|
| + return is_primitive_;
|
| + }
|
| +
|
| private:
|
| Handle<String> name_;
|
| Scope* scope_;
|
| @@ -1744,6 +1777,9 @@ class FunctionLiteral: public Expression {
|
| int parameter_count_;
|
| int function_token_position_;
|
|
|
| + int ast_node_count_;
|
| + bool is_primitive_;
|
| +
|
| unsigned bitfield_;
|
| class HasOnlySimpleThisPropertyAssignments: public BitField<bool, 0, 1> {};
|
| class IsExpression: public BitField<bool, 1, 1> {};
|
| @@ -1758,7 +1794,9 @@ class SharedFunctionInfoLiteral: public Expression {
|
| SharedFunctionInfoLiteral(
|
| Isolate* isolate,
|
| Handle<SharedFunctionInfo> shared_function_info)
|
| - : Expression(isolate), shared_function_info_(shared_function_info) { }
|
| + : Expression(isolate), shared_function_info_(shared_function_info) {
|
| + IncrementHeavyAstNodeCounter(isolate);
|
| + }
|
|
|
| DECLARE_NODE_TYPE(SharedFunctionInfoLiteral)
|
|
|
| @@ -1774,7 +1812,9 @@ class SharedFunctionInfoLiteral: public Expression {
|
|
|
| class ThisFunction: public Expression {
|
| public:
|
| - explicit ThisFunction(Isolate* isolate) : Expression(isolate) {}
|
| + explicit ThisFunction(Isolate* isolate) : Expression(isolate) {
|
| + IncrementHeavyAstNodeCounter(isolate);
|
| + }
|
| DECLARE_NODE_TYPE(ThisFunction)
|
| virtual bool IsInlineable() const;
|
| };
|
|
|