Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 4229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4240 | 4240 |
| 4241 Comment cmnt(masm_, "[ LoadReference"); | 4241 Comment cmnt(masm_, "[ LoadReference"); |
| 4242 Expression* e = ref->expression(); | 4242 Expression* e = ref->expression(); |
| 4243 Property* property = e->AsProperty(); | 4243 Property* property = e->AsProperty(); |
| 4244 Variable* var = e->AsVariableProxy()->AsVariable(); | 4244 Variable* var = e->AsVariableProxy()->AsVariable(); |
| 4245 | 4245 |
| 4246 if (property != NULL) { | 4246 if (property != NULL) { |
| 4247 // The expression is either a property or a variable proxy that rewrites | 4247 // The expression is either a property or a variable proxy that rewrites |
| 4248 // to a property. | 4248 // to a property. |
| 4249 Load(property->obj()); | 4249 Load(property->obj()); |
| 4250 // We use a named reference if the key is a literal symbol, unless it is | 4250 if (property->key()->IsPropertyName()) { |
|
Lasse Reichstein
2010/01/12 08:30:05
This is a really great clean-up! So much easier to
| |
| 4251 // a string that can be legally parsed as an integer. This is because | |
| 4252 // otherwise we will not get into the slow case code that handles [] on | |
| 4253 // String objects. | |
| 4254 Literal* literal = property->key()->AsLiteral(); | |
| 4255 uint32_t dummy; | |
| 4256 if (literal != NULL && | |
| 4257 literal->handle()->IsSymbol() && | |
| 4258 !String::cast(*(literal->handle()))->AsArrayIndex(&dummy)) { | |
| 4259 ref->set_type(Reference::NAMED); | 4251 ref->set_type(Reference::NAMED); |
| 4260 } else { | 4252 } else { |
| 4261 Load(property->key()); | 4253 Load(property->key()); |
| 4262 ref->set_type(Reference::KEYED); | 4254 ref->set_type(Reference::KEYED); |
| 4263 } | 4255 } |
| 4264 } else if (var != NULL) { | 4256 } else if (var != NULL) { |
| 4265 // The expression is a variable proxy that does not rewrite to a | 4257 // The expression is a variable proxy that does not rewrite to a |
| 4266 // property. Global variables are treated as named property references. | 4258 // property. Global variables are treated as named property references. |
| 4267 if (var->is_global()) { | 4259 if (var->is_global()) { |
| 4268 LoadGlobal(); | 4260 LoadGlobal(); |
| (...skipping 3854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8123 masm.GetCode(&desc); | 8115 masm.GetCode(&desc); |
| 8124 // Call the function from C++. | 8116 // Call the function from C++. |
| 8125 return FUNCTION_CAST<ModuloFunction>(buffer); | 8117 return FUNCTION_CAST<ModuloFunction>(buffer); |
| 8126 } | 8118 } |
| 8127 | 8119 |
| 8128 #endif | 8120 #endif |
| 8129 | 8121 |
| 8130 #undef __ | 8122 #undef __ |
| 8131 | 8123 |
| 8132 } } // namespace v8::internal | 8124 } } // namespace v8::internal |
| OLD | NEW |