Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: src/ast.cc

Issue 6304016: Fix bad assumption in object literal interpretation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/build-x64
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 ObjectLiteral::Property* property = this->properties()->at(i); 230 ObjectLiteral::Property* property = this->properties()->at(i);
231 Literal* literal = property->key(); 231 Literal* literal = property->key();
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;
fschneider 2011/01/24 14:47:52 Could this be made an Object** since that's what .
Lasse Reichstein 2011/01/25 07:48:13 Not without some reinterpret-casts. There isn't a
241 uint32_t index; 241 uint32_t index;
242 Smi* smi_key_location;
242 if (handle->IsSymbol()) { 243 if (handle->IsSymbol()) {
243 Handle<String> name(String::cast(*handle)); 244 Handle<String> name(String::cast(*handle));
244 ASSERT(!name->AsArrayIndex(&index)); 245 if (name->AsArrayIndex(&index)) {
245 key = name.location(); 246 smi_key_location = Smi::FromInt(index);
246 hash = name->Hash(); 247 key = &smi_key_location;
247 table = &properties; 248 hash = index;
249 table = &elements;
250 } else {
251 key = name.location();
252 hash = name->Hash();
253 table = &properties;
254 }
248 } else if (handle->ToArrayIndex(&index)) { 255 } else if (handle->ToArrayIndex(&index)) {
249 key = handle.location(); 256 key = handle.location();
250 hash = index; 257 hash = index;
251 table = &elements; 258 table = &elements;
252 } else { 259 } else {
253 ASSERT(handle->IsNumber()); 260 ASSERT(handle->IsNumber());
254 double num = handle->Number(); 261 double num = handle->Number();
255 char arr[100]; 262 char arr[100];
256 Vector<char> buffer(arr, ARRAY_SIZE(arr)); 263 Vector<char> buffer(arr, ARRAY_SIZE(arr));
257 const char* str = DoubleToCString(num, buffer); 264 const char* str = DoubleToCString(num, buffer);
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 1047
1041 CaseClause::CaseClause(Expression* label, 1048 CaseClause::CaseClause(Expression* label,
1042 ZoneList<Statement*>* statements, 1049 ZoneList<Statement*>* statements,
1043 int pos) 1050 int pos)
1044 : label_(label), 1051 : label_(label),
1045 statements_(statements), 1052 statements_(statements),
1046 position_(pos), 1053 position_(pos),
1047 compare_type_(NONE) {} 1054 compare_type_(NONE) {}
1048 1055
1049 } } // namespace v8::internal 1056 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698