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

Side by Side Diff: src/objects.cc

Issue 40291: Fixed a bug exposed by the Mozilla test suite where the result of ... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/global/
Patch Set: Created 11 years, 9 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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 } 428 }
429 return value; 429 return value;
430 } 430 }
431 431
432 432
433 Object* JSObject::SetNormalizedProperty(String* name, 433 Object* JSObject::SetNormalizedProperty(String* name,
434 Object* value, 434 Object* value,
435 PropertyDetails details) { 435 PropertyDetails details) {
436 ASSERT(!HasFastProperties()); 436 ASSERT(!HasFastProperties());
437 int entry = property_dictionary()->FindStringEntry(name); 437 int entry = property_dictionary()->FindStringEntry(name);
438 Object* store_value = value; 438 Object* store_value = value;
Kasper Lund 2009/03/09 09:27:33 Maybe move the declaration of store_value to the (
439 if (entry == -1) { 439 if (entry == -1) {
440 if (IsJSGlobalObject()) { 440 if (IsJSGlobalObject()) {
441 store_value = Heap::AllocateJSGlobalPropertyCell(value); 441 store_value = Heap::AllocateJSGlobalPropertyCell(value);
442 } 442 }
443 if (store_value->IsFailure()) return store_value; 443 if (store_value->IsFailure()) return store_value;
Kasper Lund 2009/03/09 09:27:33 Move inside the IsJSGlobalObject() case?
444 Object* dict = 444 Object* dict =
445 property_dictionary()->AddStringEntry(name, store_value, details); 445 property_dictionary()->AddStringEntry(name, store_value, details);
446 if (dict->IsFailure()) return dict; 446 if (dict->IsFailure()) return dict;
447 set_properties(Dictionary::cast(dict)); 447 set_properties(Dictionary::cast(dict));
448 return value; 448 return value;
449 } 449 }
450 // Preserve enumeration index. 450 // Preserve enumeration index.
451 details = PropertyDetails(details.attributes(), 451 details = PropertyDetails(details.attributes(),
452 details.type(), 452 details.type(),
453 property_dictionary()->DetailsAt(entry).index()); 453 property_dictionary()->DetailsAt(entry).index());
454 if (IsJSGlobalObject()) { 454 if (IsJSGlobalObject()) {
455 JSGlobalPropertyCell* cell = 455 JSGlobalPropertyCell* cell =
456 JSGlobalPropertyCell::cast(property_dictionary()->ValueAt(entry)); 456 JSGlobalPropertyCell::cast(property_dictionary()->ValueAt(entry));
457 cell->set_value(value); 457 cell->set_value(value);
458 store_value = cell; 458 store_value = cell;
Kasper Lund 2009/03/09 09:27:33 Remove. You're not going to use store_value from h
459 // No need to update the property dictionary.
460 } else {
461 property_dictionary()->SetStringEntry(entry, name, store_value, details);
Kasper Lund 2009/03/09 09:27:33 store_value -> value?
459 } 462 }
460 property_dictionary()->SetStringEntry(entry, name, store_value, details);
461 return value; 463 return value;
462 } 464 }
463 465
464 466
465 Object* Object::GetProperty(Object* receiver, 467 Object* Object::GetProperty(Object* receiver,
466 LookupResult* result, 468 LookupResult* result,
467 String* name, 469 String* name,
468 PropertyAttributes* attributes) { 470 PropertyAttributes* attributes) {
469 // Make sure that the top context does not change when doing 471 // Make sure that the top context does not change when doing
470 // callbacks or interceptor calls. 472 // callbacks or interceptor calls.
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 1317
1316 return function; 1318 return function;
1317 } 1319 }
1318 1320
1319 1321
1320 // Add property in slow mode 1322 // Add property in slow mode
1321 Object* JSObject::AddSlowProperty(String* name, 1323 Object* JSObject::AddSlowProperty(String* name,
1322 Object* value, 1324 Object* value,
1323 PropertyAttributes attributes) { 1325 PropertyAttributes attributes) {
1324 PropertyDetails details = PropertyDetails(attributes, NORMAL); 1326 PropertyDetails details = PropertyDetails(attributes, NORMAL);
1327 Object* store_value = value;
1325 if (IsJSGlobalObject()) { 1328 if (IsJSGlobalObject()) {
1326 value = Heap::AllocateJSGlobalPropertyCell(value); 1329 store_value = Heap::AllocateJSGlobalPropertyCell(value);
1327 if (value->IsFailure()) return value; 1330 if (store_value->IsFailure()) return store_value;
1328 } 1331 }
1329 Object* result = property_dictionary()->AddStringEntry(name, value, details); 1332 Object* result = property_dictionary()->AddStringEntry(name,
1333 store_value,
1334 details);
1330 if (result->IsFailure()) return result; 1335 if (result->IsFailure()) return result;
1331 if (property_dictionary() != result) { 1336 if (property_dictionary() != result) {
1332 set_properties(Dictionary::cast(result)); 1337 set_properties(Dictionary::cast(result));
Kasper Lund 2009/03/09 09:27:33 Weird indentation.
1333 } 1338 }
1334 return value; 1339 return value;
1335 } 1340 }
1336 1341
1337 1342
1338 Object* JSObject::AddProperty(String* name, 1343 Object* JSObject::AddProperty(String* name,
1339 Object* value, 1344 Object* value,
1340 PropertyAttributes attributes) { 1345 PropertyAttributes attributes) {
1341 ASSERT(!IsJSGlobalProxy()); 1346 ASSERT(!IsJSGlobalProxy());
1342 if (HasFastProperties()) { 1347 if (HasFastProperties()) {
(...skipping 5991 matching lines...) Expand 10 before | Expand all | Expand 10 after
7334 // No break point. 7339 // No break point.
7335 if (break_point_objects()->IsUndefined()) return 0; 7340 if (break_point_objects()->IsUndefined()) return 0;
7336 // Single beak point. 7341 // Single beak point.
7337 if (!break_point_objects()->IsFixedArray()) return 1; 7342 if (!break_point_objects()->IsFixedArray()) return 1;
7338 // Multiple break points. 7343 // Multiple break points.
7339 return FixedArray::cast(break_point_objects())->length(); 7344 return FixedArray::cast(break_point_objects())->length();
7340 } 7345 }
7341 7346
7342 7347
7343 } } // namespace v8::internal 7348 } } // 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