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

Side by Side Diff: src/ast.h

Issue 8404030: Version 3.7.1 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/assembler.cc ('k') | src/ast.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 class Declaration: public AstNode { 398 class Declaration: public AstNode {
399 public: 399 public:
400 Declaration(VariableProxy* proxy, 400 Declaration(VariableProxy* proxy,
401 VariableMode mode, 401 VariableMode mode,
402 FunctionLiteral* fun, 402 FunctionLiteral* fun,
403 Scope* scope) 403 Scope* scope)
404 : proxy_(proxy), 404 : proxy_(proxy),
405 mode_(mode), 405 mode_(mode),
406 fun_(fun), 406 fun_(fun),
407 scope_(scope) { 407 scope_(scope) {
408 ASSERT(mode == VAR || mode == CONST || mode == LET); 408 ASSERT(mode == VAR ||
409 mode == CONST ||
410 mode == CONST_HARMONY ||
411 mode == LET);
409 // At the moment there are no "const functions"'s in JavaScript... 412 // At the moment there are no "const functions"'s in JavaScript...
410 ASSERT(fun == NULL || mode == VAR || mode == LET); 413 ASSERT(fun == NULL || mode == VAR || mode == LET);
411 } 414 }
412 415
413 DECLARE_NODE_TYPE(Declaration) 416 DECLARE_NODE_TYPE(Declaration)
414 417
415 VariableProxy* proxy() const { return proxy_; } 418 VariableProxy* proxy() const { return proxy_; }
416 VariableMode mode() const { return mode_; } 419 VariableMode mode() const { return mode_; }
417 FunctionLiteral* fun() const { return fun_; } // may be NULL 420 FunctionLiteral* fun() const { return fun_; } // may be NULL
418 virtual bool IsInlineable() const; 421 virtual bool IsInlineable() const;
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 1124
1122 bool IsVariable(Handle<String> n) { 1125 bool IsVariable(Handle<String> n) {
1123 return !is_this() && name().is_identical_to(n); 1126 return !is_this() && name().is_identical_to(n);
1124 } 1127 }
1125 1128
1126 bool IsArguments() { return var_ != NULL && var_->is_arguments(); } 1129 bool IsArguments() { return var_ != NULL && var_->is_arguments(); }
1127 1130
1128 Handle<String> name() const { return name_; } 1131 Handle<String> name() const { return name_; }
1129 Variable* var() const { return var_; } 1132 Variable* var() const { return var_; }
1130 bool is_this() const { return is_this_; } 1133 bool is_this() const { return is_this_; }
1131 bool inside_with() const { return inside_with_; }
1132 int position() const { return position_; } 1134 int position() const { return position_; }
1133 1135
1134 void MarkAsTrivial() { is_trivial_ = true; } 1136 void MarkAsTrivial() { is_trivial_ = true; }
1135 1137
1136 // Bind this proxy to the variable var. 1138 // Bind this proxy to the variable var.
1137 void BindTo(Variable* var); 1139 void BindTo(Variable* var);
1138 1140
1139 protected: 1141 protected:
1140 Handle<String> name_; 1142 Handle<String> name_;
1141 Variable* var_; // resolved variable, or NULL 1143 Variable* var_; // resolved variable, or NULL
1142 bool is_this_; 1144 bool is_this_;
1143 bool inside_with_;
1144 bool is_trivial_; 1145 bool is_trivial_;
1145 int position_; 1146 int position_;
1146 1147
1147 VariableProxy(Isolate* isolate, 1148 VariableProxy(Isolate* isolate,
1148 Handle<String> name, 1149 Handle<String> name,
1149 bool is_this, 1150 bool is_this,
1150 bool inside_with,
1151 int position = RelocInfo::kNoPosition); 1151 int position = RelocInfo::kNoPosition);
1152 1152
1153 friend class Scope; 1153 friend class Scope;
1154 }; 1154 };
1155 1155
1156 1156
1157 class Property: public Expression { 1157 class Property: public Expression {
1158 public: 1158 public:
1159 Property(Isolate* isolate, 1159 Property(Isolate* isolate,
1160 Expression* obj, 1160 Expression* obj,
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 1613
1614 FunctionLiteral(Isolate* isolate, 1614 FunctionLiteral(Isolate* isolate,
1615 Handle<String> name, 1615 Handle<String> name,
1616 Scope* scope, 1616 Scope* scope,
1617 ZoneList<Statement*>* body, 1617 ZoneList<Statement*>* body,
1618 int materialized_literal_count, 1618 int materialized_literal_count,
1619 int expected_property_count, 1619 int expected_property_count,
1620 bool has_only_simple_this_property_assignments, 1620 bool has_only_simple_this_property_assignments,
1621 Handle<FixedArray> this_property_assignments, 1621 Handle<FixedArray> this_property_assignments,
1622 int num_parameters, 1622 int num_parameters,
1623 int start_position,
1624 int end_position,
1625 Type type, 1623 Type type,
1626 bool has_duplicate_parameters) 1624 bool has_duplicate_parameters)
1627 : Expression(isolate), 1625 : Expression(isolate),
1628 name_(name), 1626 name_(name),
1629 scope_(scope), 1627 scope_(scope),
1630 body_(body), 1628 body_(body),
1631 materialized_literal_count_(materialized_literal_count), 1629 materialized_literal_count_(materialized_literal_count),
1632 expected_property_count_(expected_property_count), 1630 expected_property_count_(expected_property_count),
1633 has_only_simple_this_property_assignments_( 1631 has_only_simple_this_property_assignments_(
1634 has_only_simple_this_property_assignments), 1632 has_only_simple_this_property_assignments),
1635 this_property_assignments_(this_property_assignments), 1633 this_property_assignments_(this_property_assignments),
1636 num_parameters_(num_parameters), 1634 num_parameters_(num_parameters),
1637 start_position_(start_position),
1638 end_position_(end_position),
1639 function_token_position_(RelocInfo::kNoPosition), 1635 function_token_position_(RelocInfo::kNoPosition),
1640 inferred_name_(HEAP->empty_string()), 1636 inferred_name_(HEAP->empty_string()),
1641 is_expression_(type != DECLARATION), 1637 is_expression_(type != DECLARATION),
1642 is_anonymous_(type == ANONYMOUS_EXPRESSION), 1638 is_anonymous_(type == ANONYMOUS_EXPRESSION),
1643 pretenure_(false), 1639 pretenure_(false),
1644 has_duplicate_parameters_(has_duplicate_parameters) { 1640 has_duplicate_parameters_(has_duplicate_parameters) {
1645 } 1641 }
1646 1642
1647 DECLARE_NODE_TYPE(FunctionLiteral) 1643 DECLARE_NODE_TYPE(FunctionLiteral)
1648 1644
1649 Handle<String> name() const { return name_; } 1645 Handle<String> name() const { return name_; }
1650 Scope* scope() const { return scope_; } 1646 Scope* scope() const { return scope_; }
1651 ZoneList<Statement*>* body() const { return body_; } 1647 ZoneList<Statement*>* body() const { return body_; }
1652 void set_function_token_position(int pos) { function_token_position_ = pos; } 1648 void set_function_token_position(int pos) { function_token_position_ = pos; }
1653 int function_token_position() const { return function_token_position_; } 1649 int function_token_position() const { return function_token_position_; }
1654 int start_position() const { return start_position_; } 1650 int start_position() const;
1655 int end_position() const { return end_position_; } 1651 int end_position() const;
1656 bool is_expression() const { return is_expression_; } 1652 bool is_expression() const { return is_expression_; }
1657 bool is_anonymous() const { return is_anonymous_; } 1653 bool is_anonymous() const { return is_anonymous_; }
1658 bool strict_mode() const; 1654 bool strict_mode() const { return strict_mode_flag() == kStrictMode; }
1655 StrictModeFlag strict_mode_flag() const;
1659 1656
1660 int materialized_literal_count() { return materialized_literal_count_; } 1657 int materialized_literal_count() { return materialized_literal_count_; }
1661 int expected_property_count() { return expected_property_count_; } 1658 int expected_property_count() { return expected_property_count_; }
1662 bool has_only_simple_this_property_assignments() { 1659 bool has_only_simple_this_property_assignments() {
1663 return has_only_simple_this_property_assignments_; 1660 return has_only_simple_this_property_assignments_;
1664 } 1661 }
1665 Handle<FixedArray> this_property_assignments() { 1662 Handle<FixedArray> this_property_assignments() {
1666 return this_property_assignments_; 1663 return this_property_assignments_;
1667 } 1664 }
1668 int num_parameters() { return num_parameters_; } 1665 int num_parameters() { return num_parameters_; }
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
2127 2124
2128 private: 2125 private:
2129 Isolate* isolate_; 2126 Isolate* isolate_;
2130 bool stack_overflow_; 2127 bool stack_overflow_;
2131 }; 2128 };
2132 2129
2133 2130
2134 } } // namespace v8::internal 2131 } } // namespace v8::internal
2135 2132
2136 #endif // V8_AST_H_ 2133 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/assembler.cc ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698