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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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()) { | 69 interface_(var->interface()) { |
70 BindTo(var); | 70 BindTo(var); |
71 } | 71 } |
72 | 72 |
73 | 73 |
74 VariableProxy::VariableProxy(Zone* zone, const AstRawString* name, bool is_this, | 74 VariableProxy::VariableProxy(Zone* zone, |
75 Interface* interface, int position) | 75 const AstRawString* name, |
| 76 Variable::Kind variable_kind, |
| 77 Interface* interface, |
| 78 int position) |
76 : Expression(zone, position), | 79 : Expression(zone, position), |
77 bit_field_(IsThisField::encode(is_this) | IsAssignedField::encode(false) | | 80 bit_field_(IsThisField::encode(variable_kind == Variable::THIS) | |
| 81 IsAssignedField::encode(false) | |
78 IsResolvedField::encode(false)), | 82 IsResolvedField::encode(false)), |
79 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), | 83 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), |
80 raw_name_(name), | 84 raw_name_(name), |
81 interface_(interface) {} | 85 interface_(interface) {} |
82 | 86 |
83 | 87 |
84 void VariableProxy::BindTo(Variable* var) { | 88 void VariableProxy::BindTo(Variable* var) { |
85 DCHECK(!FLAG_harmony_modules || interface_->IsUnified(var->interface())); | 89 DCHECK(!FLAG_harmony_modules || interface_->IsUnified(var->interface())); |
86 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); | 90 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); |
87 // Ideally CONST-ness should match. However, this is very hard to achieve | 91 // Ideally CONST-ness should match. However, this is very hard to achieve |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 // static | 1033 // static |
1030 bool Literal::Match(void* literal1, void* literal2) { | 1034 bool Literal::Match(void* literal1, void* literal2) { |
1031 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1035 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
1032 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1036 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
1033 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || | 1037 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || |
1034 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1038 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
1035 } | 1039 } |
1036 | 1040 |
1037 | 1041 |
1038 } } // namespace v8::internal | 1042 } } // namespace v8::internal |
OLD | NEW |