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

Side by Side Diff: src/ast.cc

Issue 22982005: Fix overwriting order of object literal properties for MATERIALIZED_LITERALs (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: add crankshaft testcase Created 7 years, 4 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 | test/mjsunit/object-literal-overwrite.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 266
267 ZoneHashMap table(Literal::Match, ZoneHashMap::kDefaultHashMapCapacity, 267 ZoneHashMap table(Literal::Match, ZoneHashMap::kDefaultHashMapCapacity,
268 allocator); 268 allocator);
269 for (int i = properties()->length() - 1; i >= 0; i--) { 269 for (int i = properties()->length() - 1; i >= 0; i--) {
270 ObjectLiteral::Property* property = properties()->at(i); 270 ObjectLiteral::Property* property = properties()->at(i);
271 Literal* literal = property->key(); 271 Literal* literal = property->key();
272 if (literal->value()->IsNull()) continue; 272 if (literal->value()->IsNull()) continue;
273 uint32_t hash = literal->Hash(); 273 uint32_t hash = literal->Hash();
274 // If the key of a computed property is in the table, do not emit 274 // If the key of a computed property is in the table, do not emit
275 // a store for the property later. 275 // a store for the property later.
276 if (property->kind() == ObjectLiteral::Property::COMPUTED && 276 if ((property->kind() == ObjectLiteral::Property::MATERIALIZED_LITERAL ||
277 property->kind() == ObjectLiteral::Property::COMPUTED) &&
277 table.Lookup(literal, hash, false, allocator) != NULL) { 278 table.Lookup(literal, hash, false, allocator) != NULL) {
278 property->set_emit_store(false); 279 property->set_emit_store(false);
279 } else { 280 } else {
280 // Add key to the table. 281 // Add key to the table.
281 table.Lookup(literal, hash, true, allocator); 282 table.Lookup(literal, hash, true, allocator);
282 } 283 }
283 } 284 }
284 } 285 }
285 286
286 287
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); 1190 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value());
1190 str = arr; 1191 str = arr;
1191 } else { 1192 } else {
1192 str = DoubleToCString(value_->Number(), buffer); 1193 str = DoubleToCString(value_->Number(), buffer);
1193 } 1194 }
1194 return factory->NewStringFromAscii(CStrVector(str)); 1195 return factory->NewStringFromAscii(CStrVector(str));
1195 } 1196 }
1196 1197
1197 1198
1198 } } // namespace v8::internal 1199 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/object-literal-overwrite.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698