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

Side by Side Diff: src/ast/ast.h

Issue 2533303006: Introduce a separate FunctionLiteral ID for Eval (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_AST_AST_H_ 5 #ifndef V8_AST_AST_H_
6 #define V8_AST_AST_H_ 6 #define V8_AST_AST_H_
7 7
8 #include "src/ast/ast-types.h" 8 #include "src/ast/ast-types.h"
9 #include "src/ast/ast-value-factory.h" 9 #include "src/ast/ast-value-factory.h"
10 #include "src/ast/modules.h" 10 #include "src/ast/modules.h"
(...skipping 2532 matching lines...) Expand 10 before | Expand all | Expand 10 after
2543 2543
2544 class FunctionLiteral final : public Expression { 2544 class FunctionLiteral final : public Expression {
2545 public: 2545 public:
2546 enum FunctionType { 2546 enum FunctionType {
2547 kAnonymousExpression, 2547 kAnonymousExpression,
2548 kNamedExpression, 2548 kNamedExpression,
2549 kDeclaration, 2549 kDeclaration,
2550 kAccessorOrMethod 2550 kAccessorOrMethod
2551 }; 2551 };
2552 2552
2553 enum IdType { kIdTypeInvalid = -1, kIdTypeTopLevel = 0 }; 2553 enum IdType { kIdTypeEval = -2, kIdTypeInvalid = -1, kIdTypeTopLevel = 0 };
2554 2554
2555 enum ParameterFlag { kNoDuplicateParameters, kHasDuplicateParameters }; 2555 enum ParameterFlag { kNoDuplicateParameters, kHasDuplicateParameters };
2556 2556
2557 enum EagerCompileHint { kShouldEagerCompile, kShouldLazyCompile }; 2557 enum EagerCompileHint { kShouldEagerCompile, kShouldLazyCompile };
2558 2558
2559 Handle<String> name() const { return raw_name_->string(); } 2559 Handle<String> name() const { return raw_name_->string(); }
2560 const AstString* raw_name() const { return raw_name_; } 2560 const AstString* raw_name() const { return raw_name_; }
2561 void set_raw_name(const AstString* name) { raw_name_ = name; } 2561 void set_raw_name(const AstString* name) { raw_name_ = name; }
2562 DeclarationScope* scope() const { return scope_; } 2562 DeclarationScope* scope() const { return scope_; }
2563 ZoneList<Statement*>* body() const { return body_; } 2563 ZoneList<Statement*>* body() const { return body_; }
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
3445 function_length, function_type, has_duplicate_parameters, 3445 function_length, function_type, has_duplicate_parameters,
3446 eager_compile_hint, position, true, has_braces, function_literal_id); 3446 eager_compile_hint, position, true, has_braces, function_literal_id);
3447 } 3447 }
3448 3448
3449 // Creates a FunctionLiteral representing a top-level script, the 3449 // Creates a FunctionLiteral representing a top-level script, the
3450 // result of an eval (top-level or otherwise), or the result of calling 3450 // result of an eval (top-level or otherwise), or the result of calling
3451 // the Function constructor. 3451 // the Function constructor.
3452 FunctionLiteral* NewScriptOrEvalFunctionLiteral( 3452 FunctionLiteral* NewScriptOrEvalFunctionLiteral(
3453 DeclarationScope* scope, ZoneList<Statement*>* body, 3453 DeclarationScope* scope, ZoneList<Statement*>* body,
3454 int materialized_literal_count, int expected_property_count, 3454 int materialized_literal_count, int expected_property_count,
3455 int parameter_count) { 3455 int parameter_count, int function_literal_id) {
3456 return new (zone_) FunctionLiteral( 3456 return new (zone_) FunctionLiteral(
3457 zone_, ast_value_factory_->empty_string(), ast_value_factory_, scope, 3457 zone_, ast_value_factory_->empty_string(), ast_value_factory_, scope,
3458 body, materialized_literal_count, expected_property_count, 3458 body, materialized_literal_count, expected_property_count,
3459 parameter_count, parameter_count, FunctionLiteral::kAnonymousExpression, 3459 parameter_count, parameter_count, FunctionLiteral::kAnonymousExpression,
3460 FunctionLiteral::kNoDuplicateParameters, 3460 FunctionLiteral::kNoDuplicateParameters,
3461 FunctionLiteral::kShouldLazyCompile, 0, false, true, 3461 FunctionLiteral::kShouldLazyCompile, 0, false, true,
3462 FunctionLiteral::kIdTypeTopLevel); 3462 function_literal_id);
3463 } 3463 }
3464 3464
3465 ClassLiteral::Property* NewClassLiteralProperty( 3465 ClassLiteral::Property* NewClassLiteralProperty(
3466 Expression* key, Expression* value, ClassLiteralProperty::Kind kind, 3466 Expression* key, Expression* value, ClassLiteralProperty::Kind kind,
3467 bool is_static, bool is_computed_name) { 3467 bool is_static, bool is_computed_name) {
3468 return new (zone_) 3468 return new (zone_)
3469 ClassLiteral::Property(key, value, kind, is_static, is_computed_name); 3469 ClassLiteral::Property(key, value, kind, is_static, is_computed_name);
3470 } 3470 }
3471 3471
3472 ClassLiteral* NewClassLiteral(VariableProxy* proxy, Expression* extends, 3472 ClassLiteral* NewClassLiteral(VariableProxy* proxy, Expression* extends,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
3578 : NULL; \ 3578 : NULL; \
3579 } 3579 }
3580 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) 3580 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS)
3581 #undef DECLARE_NODE_FUNCTIONS 3581 #undef DECLARE_NODE_FUNCTIONS
3582 3582
3583 3583
3584 } // namespace internal 3584 } // namespace internal
3585 } // namespace v8 3585 } // namespace v8
3586 3586
3587 #endif // V8_AST_AST_H_ 3587 #endif // V8_AST_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698