OLD | NEW |
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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 #include "ast.h" | 30 #include "ast.h" |
31 #include "parser.h" | 31 #include "parser.h" |
32 #include "scopes.h" | 32 #include "scopes.h" |
33 #include "string-stream.h" | 33 #include "string-stream.h" |
34 #include "type-info.h" | 34 #include "type-info.h" |
35 | 35 |
36 namespace v8 { | 36 namespace v8 { |
37 namespace internal { | 37 namespace internal { |
38 | 38 |
| 39 AstSentinels::AstSentinels() |
| 40 : this_proxy_(Isolate::Current(), true), |
| 41 identifier_proxy_(Isolate::Current(), false), |
| 42 valid_left_hand_side_sentinel_(Isolate::Current()), |
| 43 this_property_(Isolate::Current(), &this_proxy_, NULL, 0), |
| 44 call_sentinel_(Isolate::Current(), NULL, NULL, 0) { |
| 45 } |
| 46 |
| 47 |
39 // ---------------------------------------------------------------------------- | 48 // ---------------------------------------------------------------------------- |
40 // All the Accept member functions for each syntax tree node type. | 49 // All the Accept member functions for each syntax tree node type. |
41 | 50 |
42 void Slot::Accept(AstVisitor* v) { v->VisitSlot(this); } | 51 void Slot::Accept(AstVisitor* v) { v->VisitSlot(this); } |
43 | 52 |
44 #define DECL_ACCEPT(type) \ | 53 #define DECL_ACCEPT(type) \ |
45 void type::Accept(AstVisitor* v) { v->Visit##type(this); } | 54 void type::Accept(AstVisitor* v) { v->Visit##type(this); } |
46 AST_NODE_LIST(DECL_ACCEPT) | 55 AST_NODE_LIST(DECL_ACCEPT) |
47 #undef DECL_ACCEPT | 56 #undef DECL_ACCEPT |
48 | 57 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 var_(NULL), | 94 var_(NULL), |
86 is_this_(is_this), | 95 is_this_(is_this), |
87 inside_with_(inside_with), | 96 inside_with_(inside_with), |
88 is_trivial_(false), | 97 is_trivial_(false), |
89 position_(position) { | 98 position_(position) { |
90 // Names must be canonicalized for fast equality checks. | 99 // Names must be canonicalized for fast equality checks. |
91 ASSERT(name->IsSymbol()); | 100 ASSERT(name->IsSymbol()); |
92 } | 101 } |
93 | 102 |
94 | 103 |
| 104 VariableProxy::VariableProxy(Isolate* isolate, bool is_this) |
| 105 : Expression(isolate), |
| 106 var_(NULL), |
| 107 is_this_(is_this), |
| 108 inside_with_(false), |
| 109 is_trivial_(false) { |
| 110 } |
| 111 |
| 112 |
95 void VariableProxy::BindTo(Variable* var) { | 113 void VariableProxy::BindTo(Variable* var) { |
96 ASSERT(var_ == NULL); // must be bound only once | 114 ASSERT(var_ == NULL); // must be bound only once |
97 ASSERT(var != NULL); // must bind | 115 ASSERT(var != NULL); // must bind |
98 ASSERT((is_this() && var->is_this()) || name_.is_identical_to(var->name())); | 116 ASSERT((is_this() && var->is_this()) || name_.is_identical_to(var->name())); |
99 // Ideally CONST-ness should match. However, this is very hard to achieve | 117 // Ideally CONST-ness should match. However, this is very hard to achieve |
100 // because we don't know the exact semantics of conflicting (const and | 118 // because we don't know the exact semantics of conflicting (const and |
101 // non-const) multiple variable declarations, const vars introduced via | 119 // non-const) multiple variable declarations, const vars introduced via |
102 // eval() etc. Const-ness and variable declarations are a complete mess | 120 // eval() etc. Const-ness and variable declarations are a complete mess |
103 // in JS. Sigh... | 121 // in JS. Sigh... |
104 var_ = var; | 122 var_ = var; |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 bool ThisFunction::IsInlineable() const { | 480 bool ThisFunction::IsInlineable() const { |
463 return false; | 481 return false; |
464 } | 482 } |
465 | 483 |
466 | 484 |
467 bool SharedFunctionInfoLiteral::IsInlineable() const { | 485 bool SharedFunctionInfoLiteral::IsInlineable() const { |
468 return false; | 486 return false; |
469 } | 487 } |
470 | 488 |
471 | 489 |
| 490 bool ValidLeftHandSideSentinel::IsInlineable() const { |
| 491 UNREACHABLE(); |
| 492 return false; |
| 493 } |
| 494 |
| 495 |
472 bool ForStatement::IsInlineable() const { | 496 bool ForStatement::IsInlineable() const { |
473 return (init() == NULL || init()->IsInlineable()) | 497 return (init() == NULL || init()->IsInlineable()) |
474 && (cond() == NULL || cond()->IsInlineable()) | 498 && (cond() == NULL || cond()->IsInlineable()) |
475 && (next() == NULL || next()->IsInlineable()) | 499 && (next() == NULL || next()->IsInlineable()) |
476 && body()->IsInlineable(); | 500 && body()->IsInlineable(); |
477 } | 501 } |
478 | 502 |
479 | 503 |
480 bool WhileStatement::IsInlineable() const { | 504 bool WhileStatement::IsInlineable() const { |
481 return cond()->IsInlineable() | 505 return cond()->IsInlineable() |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1182 int pos) | 1206 int pos) |
1183 : label_(label), | 1207 : label_(label), |
1184 statements_(statements), | 1208 statements_(statements), |
1185 position_(pos), | 1209 position_(pos), |
1186 compare_type_(NONE), | 1210 compare_type_(NONE), |
1187 compare_id_(AstNode::GetNextId(isolate)), | 1211 compare_id_(AstNode::GetNextId(isolate)), |
1188 entry_id_(AstNode::GetNextId(isolate)) { | 1212 entry_id_(AstNode::GetNextId(isolate)) { |
1189 } | 1213 } |
1190 | 1214 |
1191 } } // namespace v8::internal | 1215 } } // namespace v8::internal |
OLD | NEW |