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