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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 bit_field_(IsThisField::encode(var->is_this()) | | 65 bit_field_(IsThisField::encode(var->is_this()) | |
66 IsAssignedField::encode(false) | | 66 IsAssignedField::encode(false) | |
67 IsResolvedField::encode(false)), | 67 IsResolvedField::encode(false)), |
68 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), | 68 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), |
69 raw_name_(var->raw_name()), | 69 raw_name_(var->raw_name()), |
70 end_position_(end_position) { | 70 end_position_(end_position) { |
71 BindTo(var); | 71 BindTo(var); |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 VariableProxy::VariableProxy(Zone* zone, const AstRawString* name, bool is_this, | 75 VariableProxy::VariableProxy(Zone* zone, const AstRawString* name, |
76 int start_position, int end_position) | 76 Variable::Kind variable_kind, int start_position, |
| 77 int end_position) |
77 : Expression(zone, start_position), | 78 : Expression(zone, start_position), |
78 bit_field_(IsThisField::encode(is_this) | IsAssignedField::encode(false) | | 79 bit_field_(IsThisField::encode(variable_kind == Variable::THIS) | |
| 80 IsAssignedField::encode(false) | |
79 IsResolvedField::encode(false)), | 81 IsResolvedField::encode(false)), |
80 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), | 82 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), |
81 raw_name_(name), | 83 raw_name_(name), |
82 end_position_(end_position) {} | 84 end_position_(end_position) {} |
83 | 85 |
84 | 86 |
85 void VariableProxy::BindTo(Variable* var) { | 87 void VariableProxy::BindTo(Variable* var) { |
86 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); | 88 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); |
87 set_var(var); | 89 set_var(var); |
88 set_is_resolved(); | 90 set_is_resolved(); |
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 // static | 1020 // static |
1019 bool Literal::Match(void* literal1, void* literal2) { | 1021 bool Literal::Match(void* literal1, void* literal2) { |
1020 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1022 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
1021 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1023 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
1022 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || | 1024 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || |
1023 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1025 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
1024 } | 1026 } |
1025 | 1027 |
1026 | 1028 |
1027 } } // namespace v8::internal | 1029 } } // namespace v8::internal |
OLD | NEW |