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

Unified Diff: src/ast/ast.h

Issue 2481163002: Assign unique IDs to FunctionLiterals (Closed)
Patch Set: updates Created 4 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 | « no previous file | src/compiler.cc » ('j') | src/factory.cc » ('J')
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 47851d7cd9a8dd0bdb3c8a9a8229da268dc5763e..9d89537bb1a1557c1670377f45ce49722897c5d2 100644
--- a/src/ast/ast.h
+++ b/src/ast/ast.h
@@ -2711,6 +2711,8 @@ class FunctionLiteral final : public Expression {
return std::max(start_position(), end_position() - (has_braces_ ? 1 : 0));
}
+ int function_literal_num() const { return function_literal_num_; }
+
private:
friend class AstNodeFactory;
@@ -2721,7 +2723,7 @@ class FunctionLiteral final : public Expression {
int function_length, FunctionType function_type,
ParameterFlag has_duplicate_parameters,
EagerCompileHint eager_compile_hint, int position,
- bool is_function, bool has_braces)
+ bool is_function, bool has_braces, int function_literal_num)
: Expression(position, kFunctionLiteral),
materialized_literal_count_(materialized_literal_count),
expected_property_count_(expected_property_count),
@@ -2734,7 +2736,8 @@ class FunctionLiteral final : public Expression {
scope_(scope),
body_(body),
raw_inferred_name_(ast_value_factory->empty_string()),
- ast_properties_(zone) {
+ ast_properties_(zone),
+ function_literal_num_(function_literal_num) {
bit_field_ |=
FunctionTypeBits::encode(function_type) | Pretenure::encode(false) |
HasDuplicateParameters::encode(has_duplicate_parameters ==
@@ -2775,6 +2778,7 @@ class FunctionLiteral final : public Expression {
const AstString* raw_inferred_name_;
Handle<String> inferred_name_;
AstProperties ast_properties_;
+ int function_literal_num_;
};
// Property is used for passing information
@@ -3464,12 +3468,12 @@ class AstNodeFactory final BASE_EMBEDDED {
FunctionLiteral::ParameterFlag has_duplicate_parameters,
FunctionLiteral::FunctionType function_type,
FunctionLiteral::EagerCompileHint eager_compile_hint, int position,
- bool has_braces) {
+ bool has_braces, int function_literal_num) {
return new (zone_) FunctionLiteral(
zone_, name, ast_value_factory_, scope, body,
materialized_literal_count, expected_property_count, parameter_count,
function_length, function_type, has_duplicate_parameters,
- eager_compile_hint, position, true, has_braces);
+ eager_compile_hint, position, true, has_braces, function_literal_num);
}
// Creates a FunctionLiteral representing a top-level script, the
@@ -3484,7 +3488,7 @@ class AstNodeFactory final BASE_EMBEDDED {
body, materialized_literal_count, expected_property_count,
parameter_count, parameter_count, FunctionLiteral::kAnonymousExpression,
FunctionLiteral::kNoDuplicateParameters,
- FunctionLiteral::kShouldLazyCompile, 0, false, true);
+ FunctionLiteral::kShouldLazyCompile, 0, false, true, 0);
marja 2016/11/18 10:48:04 What does 0 mean here? Invalid? Or just some defau
jochen (gone - plz use gerrit) 2016/11/21 08:03:47 -1 means invalid, zero means top-level function. a
}
ClassLiteral::Property* NewClassLiteralProperty(
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | src/factory.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698