| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 } | 71 } |
| 72 | 72 |
| 73 | 73 |
| 74 bool Expression::IsUndefinedLiteral(Isolate* isolate) const { | 74 bool Expression::IsUndefinedLiteral(Isolate* isolate) const { |
| 75 const VariableProxy* var_proxy = AsVariableProxy(); | 75 const VariableProxy* var_proxy = AsVariableProxy(); |
| 76 if (var_proxy == NULL) return false; | 76 if (var_proxy == NULL) return false; |
| 77 Variable* var = var_proxy->var(); | 77 Variable* var = var_proxy->var(); |
| 78 // The global identifier "undefined" is immutable. Everything | 78 // The global identifier "undefined" is immutable. Everything |
| 79 // else could be reassigned. | 79 // else could be reassigned. |
| 80 return var != NULL && var->location() == Variable::UNALLOCATED && | 80 return var != NULL && var->location() == Variable::UNALLOCATED && |
| 81 var_proxy->name()->Equals(isolate->heap()->undefined_string()); | 81 String::Equals(var_proxy->name(), |
| 82 isolate->factory()->undefined_string()); |
| 82 } | 83 } |
| 83 | 84 |
| 84 | 85 |
| 85 VariableProxy::VariableProxy(Zone* zone, Variable* var, int position) | 86 VariableProxy::VariableProxy(Zone* zone, Variable* var, int position) |
| 86 : Expression(zone, position), | 87 : Expression(zone, position), |
| 87 name_(var->name()), | 88 name_(var->name()), |
| 88 var_(NULL), // Will be set by the call to BindTo. | 89 var_(NULL), // Will be set by the call to BindTo. |
| 89 is_this_(var->is_this()), | 90 is_this_(var->is_this()), |
| 90 is_trivial_(false), | 91 is_trivial_(false), |
| 91 is_lvalue_(false), | 92 is_lvalue_(false), |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 } | 201 } |
| 201 } | 202 } |
| 202 } | 203 } |
| 203 | 204 |
| 204 | 205 |
| 205 ObjectLiteralProperty::ObjectLiteralProperty( | 206 ObjectLiteralProperty::ObjectLiteralProperty( |
| 206 Zone* zone, Literal* key, Expression* value) { | 207 Zone* zone, Literal* key, Expression* value) { |
| 207 emit_store_ = true; | 208 emit_store_ = true; |
| 208 key_ = key; | 209 key_ = key; |
| 209 value_ = value; | 210 value_ = value; |
| 210 Object* k = *key->value(); | 211 Handle<Object> k = key->value(); |
| 211 if (k->IsInternalizedString() && | 212 if (k->IsInternalizedString() && |
| 212 zone->isolate()->heap()->proto_string()->Equals(String::cast(k))) { | 213 String::Equals(Handle<String>::cast(k), |
| 214 zone->isolate()->factory()->proto_string())) { |
| 213 kind_ = PROTOTYPE; | 215 kind_ = PROTOTYPE; |
| 214 } else if (value_->AsMaterializedLiteral() != NULL) { | 216 } else if (value_->AsMaterializedLiteral() != NULL) { |
| 215 kind_ = MATERIALIZED_LITERAL; | 217 kind_ = MATERIALIZED_LITERAL; |
| 216 } else if (value_->AsLiteral() != NULL) { | 218 } else if (value_->AsLiteral() != NULL) { |
| 217 kind_ = CONSTANT; | 219 kind_ = CONSTANT; |
| 218 } else { | 220 } else { |
| 219 kind_ = COMPUTED; | 221 kind_ = COMPUTED; |
| 220 } | 222 } |
| 221 } | 223 } |
| 222 | 224 |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); | 1177 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); |
| 1176 str = arr; | 1178 str = arr; |
| 1177 } else { | 1179 } else { |
| 1178 str = DoubleToCString(value_->Number(), buffer); | 1180 str = DoubleToCString(value_->Number(), buffer); |
| 1179 } | 1181 } |
| 1180 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); | 1182 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); |
| 1181 } | 1183 } |
| 1182 | 1184 |
| 1183 | 1185 |
| 1184 } } // namespace v8::internal | 1186 } } // namespace v8::internal |
| OLD | NEW |