Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 Handle<Object> handle = literal->handle(); | 232 Handle<Object> handle = literal->handle(); |
| 233 | 233 |
| 234 if (handle->IsNull()) { | 234 if (handle->IsNull()) { |
| 235 continue; | 235 continue; |
| 236 } | 236 } |
| 237 | 237 |
| 238 uint32_t hash; | 238 uint32_t hash; |
| 239 HashMap* table; | 239 HashMap* table; |
| 240 void* key; | 240 void* key; |
| 241 uint32_t index; | 241 uint32_t index; |
| 242 if (handle->IsSymbol()) { | 242 |
| 243 // Check for array index first because symbol may still be an array index: | |
| 244 // var y = {get "1234"() {return 42; }}; | |
| 245 if (handle->ToArrayIndex(&index)) { | |
|
Lasse Reichstein
2011/01/25 11:19:03
I already committed a patch for this case.
During
Martin Maly
2011/01/25 18:29:23
Thanks, I reverted this part of my change.
| |
| 246 key = handle.location(); | |
| 247 hash = index; | |
| 248 table = &elements; | |
| 249 } else if (handle->IsSymbol()) { | |
| 243 Handle<String> name(String::cast(*handle)); | 250 Handle<String> name(String::cast(*handle)); |
| 244 ASSERT(!name->AsArrayIndex(&index)); | |
| 245 key = name.location(); | 251 key = name.location(); |
| 246 hash = name->Hash(); | 252 hash = name->Hash(); |
| 247 table = &properties; | 253 table = &properties; |
| 248 } else if (handle->ToArrayIndex(&index)) { | |
| 249 key = handle.location(); | |
| 250 hash = index; | |
| 251 table = &elements; | |
| 252 } else { | 254 } else { |
| 253 ASSERT(handle->IsNumber()); | 255 ASSERT(handle->IsNumber()); |
| 254 double num = handle->Number(); | 256 double num = handle->Number(); |
| 255 char arr[100]; | 257 char arr[100]; |
| 256 Vector<char> buffer(arr, ARRAY_SIZE(arr)); | 258 Vector<char> buffer(arr, ARRAY_SIZE(arr)); |
| 257 const char* str = DoubleToCString(num, buffer); | 259 const char* str = DoubleToCString(num, buffer); |
| 258 Handle<String> name = Factory::NewStringFromAscii(CStrVector(str)); | 260 Handle<String> name = Factory::NewStringFromAscii(CStrVector(str)); |
| 259 key = name.location(); | 261 key = name.location(); |
| 260 hash = name->Hash(); | 262 hash = name->Hash(); |
| 261 table = &properties; | 263 table = &properties; |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1040 | 1042 |
| 1041 CaseClause::CaseClause(Expression* label, | 1043 CaseClause::CaseClause(Expression* label, |
| 1042 ZoneList<Statement*>* statements, | 1044 ZoneList<Statement*>* statements, |
| 1043 int pos) | 1045 int pos) |
| 1044 : label_(label), | 1046 : label_(label), |
| 1045 statements_(statements), | 1047 statements_(statements), |
| 1046 position_(pos), | 1048 position_(pos), |
| 1047 compare_type_(NONE) {} | 1049 compare_type_(NONE) {} |
| 1048 | 1050 |
| 1049 } } // namespace v8::internal | 1051 } } // namespace v8::internal |
| OLD | NEW |