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

Side by Side Diff: src/elements.cc

Issue 250913003: Dictionary::SetEntry() and Dictionary::AddEntry() handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 | src/objects.h » ('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 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 1460
1461 if (new_length == 0) { 1461 if (new_length == 0) {
1462 // If the length of a slow array is reset to zero, we clear 1462 // If the length of a slow array is reset to zero, we clear
1463 // the array and flush backing storage. This has the added 1463 // the array and flush backing storage. This has the added
1464 // benefit that the array returns to fast mode. 1464 // benefit that the array returns to fast mode.
1465 JSObject::ResetElements(array); 1465 JSObject::ResetElements(array);
1466 } else { 1466 } else {
1467 DisallowHeapAllocation no_gc; 1467 DisallowHeapAllocation no_gc;
1468 // Remove elements that should be deleted. 1468 // Remove elements that should be deleted.
1469 int removed_entries = 0; 1469 int removed_entries = 0;
1470 Object* the_hole_value = isolate->heap()->the_hole_value(); 1470 Handle<Object> the_hole_value = isolate->factory()->the_hole_value();
1471 for (int i = 0; i < capacity; i++) { 1471 for (int i = 0; i < capacity; i++) {
1472 Object* key = dict->KeyAt(i); 1472 Object* key = dict->KeyAt(i);
1473 if (key->IsNumber()) { 1473 if (key->IsNumber()) {
1474 uint32_t number = static_cast<uint32_t>(key->Number()); 1474 uint32_t number = static_cast<uint32_t>(key->Number());
1475 if (new_length <= number && number < old_length) { 1475 if (new_length <= number && number < old_length) {
1476 dict->SetEntry(i, the_hole_value, the_hole_value); 1476 dict->SetEntry(i, the_hole_value, the_hole_value);
1477 removed_entries++; 1477 removed_entries++;
1478 } 1478 }
1479 } 1479 }
1480 } 1480 }
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
2014 UNREACHABLE(); 2014 UNREACHABLE();
2015 break; 2015 break;
2016 } 2016 }
2017 2017
2018 array->set_elements(*elms); 2018 array->set_elements(*elms);
2019 array->set_length(Smi::FromInt(number_of_elements)); 2019 array->set_length(Smi::FromInt(number_of_elements));
2020 return array; 2020 return array;
2021 } 2021 }
2022 2022
2023 } } // namespace v8::internal 2023 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698