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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 : Expression(zone, position), | 63 : Expression(zone, position), |
64 bit_field_(IsThisField::encode(var->is_this()) | | 64 bit_field_(IsThisField::encode(var->is_this()) | |
65 IsAssignedField::encode(false) | | 65 IsAssignedField::encode(false) | |
66 IsResolvedField::encode(false)), | 66 IsResolvedField::encode(false)), |
67 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), | 67 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), |
68 raw_name_(var->raw_name()), | 68 raw_name_(var->raw_name()) { |
69 interface_(var->interface()) { | |
70 BindTo(var); | 69 BindTo(var); |
71 } | 70 } |
72 | 71 |
73 | 72 |
74 VariableProxy::VariableProxy(Zone* zone, const AstRawString* name, bool is_this, | 73 VariableProxy::VariableProxy(Zone* zone, const AstRawString* name, bool is_this, |
75 Interface* interface, int position) | 74 int position) |
76 : Expression(zone, position), | 75 : Expression(zone, position), |
77 bit_field_(IsThisField::encode(is_this) | IsAssignedField::encode(false) | | 76 bit_field_(IsThisField::encode(is_this) | IsAssignedField::encode(false) | |
78 IsResolvedField::encode(false)), | 77 IsResolvedField::encode(false)), |
79 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), | 78 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), |
80 raw_name_(name), | 79 raw_name_(name) {} |
81 interface_(interface) {} | |
82 | 80 |
83 | 81 |
84 void VariableProxy::BindTo(Variable* var) { | 82 void VariableProxy::BindTo(Variable* var) { |
85 DCHECK(!FLAG_harmony_modules || interface_->IsUnified(var->interface())); | |
86 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); | 83 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); |
87 set_var(var); | 84 set_var(var); |
88 set_is_resolved(); | 85 set_is_resolved(); |
89 var->set_is_used(); | 86 var->set_is_used(); |
90 } | 87 } |
91 | 88 |
92 | 89 |
93 Assignment::Assignment(Zone* zone, Token::Value op, Expression* target, | 90 Assignment::Assignment(Zone* zone, Token::Value op, Expression* target, |
94 Expression* value, int pos) | 91 Expression* value, int pos) |
95 : Expression(zone, pos), | 92 : Expression(zone, pos), |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 // static | 1016 // static |
1020 bool Literal::Match(void* literal1, void* literal2) { | 1017 bool Literal::Match(void* literal1, void* literal2) { |
1021 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1018 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
1022 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1019 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
1023 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || | 1020 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || |
1024 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1021 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
1025 } | 1022 } |
1026 | 1023 |
1027 | 1024 |
1028 } } // namespace v8::internal | 1025 } } // namespace v8::internal |
OLD | NEW |