OLD | NEW |
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 bit_field_(IsThisField::encode(is_this) | IsAssignedField::encode(false) | | 77 bit_field_(IsThisField::encode(is_this) | IsAssignedField::encode(false) | |
78 IsResolvedField::encode(false)), | 78 IsResolvedField::encode(false)), |
79 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), | 79 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), |
80 raw_name_(name), | 80 raw_name_(name), |
81 interface_(interface) {} | 81 interface_(interface) {} |
82 | 82 |
83 | 83 |
84 void VariableProxy::BindTo(Variable* var) { | 84 void VariableProxy::BindTo(Variable* var) { |
85 DCHECK(!FLAG_harmony_modules || interface_->IsUnified(var->interface())); | 85 DCHECK(!FLAG_harmony_modules || interface_->IsUnified(var->interface())); |
86 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); | 86 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); |
87 // Ideally CONST-ness should match. However, this is very hard to achieve | |
88 // because we don't know the exact semantics of conflicting (const and | |
89 // non-const) multiple variable declarations, const vars introduced via | |
90 // eval() etc. Const-ness and variable declarations are a complete mess | |
91 // in JS. Sigh... | |
92 set_var(var); | 87 set_var(var); |
93 set_is_resolved(); | 88 set_is_resolved(); |
94 var->set_is_used(); | 89 var->set_is_used(); |
95 } | 90 } |
96 | 91 |
97 | 92 |
98 Assignment::Assignment(Zone* zone, Token::Value op, Expression* target, | 93 Assignment::Assignment(Zone* zone, Token::Value op, Expression* target, |
99 Expression* value, int pos) | 94 Expression* value, int pos) |
100 : Expression(zone, pos), | 95 : Expression(zone, pos), |
101 bit_field_(IsUninitializedField::encode(false) | | 96 bit_field_(IsUninitializedField::encode(false) | |
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 // static | 1019 // static |
1025 bool Literal::Match(void* literal1, void* literal2) { | 1020 bool Literal::Match(void* literal1, void* literal2) { |
1026 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1021 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
1027 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1022 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
1028 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || | 1023 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || |
1029 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1024 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
1030 } | 1025 } |
1031 | 1026 |
1032 | 1027 |
1033 } } // namespace v8::internal | 1028 } } // namespace v8::internal |
OLD | NEW |