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

Side by Side Diff: src/ast.cc

Issue 636403003: Assign bailout and type feedback IDs in a post-pass (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 months 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
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 #include "src/ast.h" 5 #include "src/ast.h"
6 6
7 #include <cmath> // For isfinite. 7 #include <cmath> // For isfinite.
8 #include "src/builtins.h" 8 #include "src/builtins.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/contexts.h" 10 #include "src/contexts.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 const VariableProxy* var_proxy = AsVariableProxy(); 52 const VariableProxy* var_proxy = AsVariableProxy();
53 if (var_proxy == NULL) return false; 53 if (var_proxy == NULL) return false;
54 Variable* var = var_proxy->var(); 54 Variable* var = var_proxy->var();
55 // The global identifier "undefined" is immutable. Everything 55 // The global identifier "undefined" is immutable. Everything
56 // else could be reassigned. 56 // else could be reassigned.
57 return var != NULL && var->location() == Variable::UNALLOCATED && 57 return var != NULL && var->location() == Variable::UNALLOCATED &&
58 var_proxy->raw_name()->IsOneByteEqualTo("undefined"); 58 var_proxy->raw_name()->IsOneByteEqualTo("undefined");
59 } 59 }
60 60
61 61
62 VariableProxy::VariableProxy(Zone* zone, Variable* var, int position, 62 VariableProxy::VariableProxy(Zone* zone, Variable* var, int position)
63 IdGen* id_gen) 63 : Expression(zone, position),
64 : Expression(zone, position, 0, id_gen),
65 raw_name_(var->raw_name()), 64 raw_name_(var->raw_name()),
66 interface_(var->interface()), 65 interface_(var->interface()),
67 variable_feedback_slot_(kInvalidFeedbackSlot), 66 variable_feedback_slot_(kInvalidFeedbackSlot),
68 is_this_(var->is_this()), 67 is_this_(var->is_this()),
69 is_assigned_(false), 68 is_assigned_(false),
70 is_resolved_(false) { 69 is_resolved_(false) {
71 BindTo(var); 70 BindTo(var);
72 } 71 }
73 72
74 73
75 VariableProxy::VariableProxy(Zone* zone, const AstRawString* name, bool is_this, 74 VariableProxy::VariableProxy(Zone* zone, const AstRawString* name, bool is_this,
76 Interface* interface, int position, IdGen* id_gen) 75 Interface* interface, int position)
77 : Expression(zone, position, 0, id_gen), 76 : Expression(zone, position),
78 raw_name_(name), 77 raw_name_(name),
79 interface_(interface), 78 interface_(interface),
80 variable_feedback_slot_(kInvalidFeedbackSlot), 79 variable_feedback_slot_(kInvalidFeedbackSlot),
81 is_this_(is_this), 80 is_this_(is_this),
82 is_assigned_(false), 81 is_assigned_(false),
83 is_resolved_(false) {} 82 is_resolved_(false) {}
84 83
85 84
86 void VariableProxy::BindTo(Variable* var) { 85 void VariableProxy::BindTo(Variable* var) {
87 DCHECK(!FLAG_harmony_modules || interface_->IsUnified(var->interface())); 86 DCHECK(!FLAG_harmony_modules || interface_->IsUnified(var->interface()));
88 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); 87 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name());
89 // Ideally CONST-ness should match. However, this is very hard to achieve 88 // Ideally CONST-ness should match. However, this is very hard to achieve
90 // because we don't know the exact semantics of conflicting (const and 89 // because we don't know the exact semantics of conflicting (const and
91 // non-const) multiple variable declarations, const vars introduced via 90 // non-const) multiple variable declarations, const vars introduced via
92 // eval() etc. Const-ness and variable declarations are a complete mess 91 // eval() etc. Const-ness and variable declarations are a complete mess
93 // in JS. Sigh... 92 // in JS. Sigh...
94 set_var(var); 93 set_var(var);
95 set_is_resolved(); 94 set_is_resolved();
96 var->set_is_used(); 95 var->set_is_used();
97 } 96 }
98 97
99 98
100 Assignment::Assignment(Zone* zone, Token::Value op, Expression* target, 99 Assignment::Assignment(Zone* zone, Token::Value op, Expression* target,
101 Expression* value, int pos, IdGen* id_gen) 100 Expression* value, int pos)
102 : Expression(zone, pos, num_ids(), id_gen), 101 : Expression(zone, pos),
103 op_(op), 102 op_(op),
104 target_(target), 103 target_(target),
105 value_(value), 104 value_(value),
106 binary_operation_(NULL), 105 binary_operation_(NULL),
107 is_uninitialized_(false), 106 is_uninitialized_(false),
108 store_mode_(STANDARD_STORE) {} 107 store_mode_(STANDARD_STORE) {}
109 108
110 109
111 Token::Value Assignment::binary_op() const { 110 Token::Value Assignment::binary_op() const {
112 switch (op_) { 111 switch (op_) {
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 RegExpTree* node = nodes->at(i); 979 RegExpTree* node = nodes->at(i);
981 int node_min_match = node->min_match(); 980 int node_min_match = node->min_match();
982 min_match_ = IncreaseBy(min_match_, node_min_match); 981 min_match_ = IncreaseBy(min_match_, node_min_match);
983 int node_max_match = node->max_match(); 982 int node_max_match = node->max_match();
984 max_match_ = IncreaseBy(max_match_, node_max_match); 983 max_match_ = IncreaseBy(max_match_, node_max_match);
985 } 984 }
986 } 985 }
987 986
988 987
989 CaseClause::CaseClause(Zone* zone, Expression* label, 988 CaseClause::CaseClause(Zone* zone, Expression* label,
990 ZoneList<Statement*>* statements, int pos, IdGen* id_gen) 989 ZoneList<Statement*>* statements, int pos)
991 : Expression(zone, pos, num_ids(), id_gen), 990 : Expression(zone, pos),
992 label_(label), 991 label_(label),
993 statements_(statements), 992 statements_(statements),
994 compare_type_(Type::None(zone)) {} 993 compare_type_(Type::None(zone)) {}
995 994
996 995
997 #define REGULAR_NODE(NodeType) \ 996 #define REGULAR_NODE(NodeType) \
998 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \ 997 void AstConstructionVisitor::Visit##NodeType(NodeType* node) { \
999 increase_node_count(); \ 998 increase_node_count(); \
1000 } 999 }
1001 #define REGULAR_NODE_WITH_FEEDBACK_SLOTS(NodeType) \ 1000 #define REGULAR_NODE_WITH_FEEDBACK_SLOTS(NodeType) \
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 // static 1141 // static
1143 bool Literal::Match(void* literal1, void* literal2) { 1142 bool Literal::Match(void* literal1, void* literal2) {
1144 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 1143 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
1145 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 1144 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
1146 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || 1145 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) ||
1147 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 1146 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
1148 } 1147 }
1149 1148
1150 1149
1151 } } // namespace v8::internal 1150 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698