Chromium Code Reviews| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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->IsUnallocatedOrGlobalSlot() && | 57 return var != NULL && var->IsUnallocatedOrGlobalSlot() && |
| 58 var_proxy->raw_name()->IsOneByteEqualTo("undefined"); | 58 var_proxy->raw_name()->IsOneByteEqualTo("undefined"); |
| 59 } | 59 } |
| 60 | 60 |
| 61 | 61 |
| 62 bool Expression::IsVariableProxyOrProperty() const { | |
|
rossberg
2015/07/16 11:50:48
I have a slight preference for
IsValidReferenceEx
Michael Starzinger
2015/07/16 12:46:19
Done. Your slight preference is my command.
| |
| 63 return IsVariableProxy() || IsProperty(); | |
| 64 } | |
| 65 | |
| 66 | |
| 62 VariableProxy::VariableProxy(Zone* zone, Variable* var, int start_position, | 67 VariableProxy::VariableProxy(Zone* zone, Variable* var, int start_position, |
| 63 int end_position) | 68 int end_position) |
| 64 : Expression(zone, start_position), | 69 : Expression(zone, start_position), |
| 65 bit_field_(IsThisField::encode(var->is_this()) | | 70 bit_field_(IsThisField::encode(var->is_this()) | |
| 66 IsAssignedField::encode(false) | | 71 IsAssignedField::encode(false) | |
| 67 IsResolvedField::encode(false)), | 72 IsResolvedField::encode(false)), |
| 68 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), | 73 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), |
| 69 raw_name_(var->raw_name()), | 74 raw_name_(var->raw_name()), |
| 70 end_position_(end_position) { | 75 end_position_(end_position) { |
| 71 BindTo(var); | 76 BindTo(var); |
| (...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1145 bool Literal::Match(void* literal1, void* literal2) { | 1150 bool Literal::Match(void* literal1, void* literal2) { |
| 1146 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1151 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
| 1147 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1152 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
| 1148 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 1153 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
| 1149 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1154 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
| 1150 } | 1155 } |
| 1151 | 1156 |
| 1152 | 1157 |
| 1153 } // namespace internal | 1158 } // namespace internal |
| 1154 } // namespace v8 | 1159 } // namespace v8 |
| OLD | NEW |