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

Side by Side Diff: src/objects.cc

Issue 10417030: Decoupling MarkDescriptorArray as much as possible from the ContentArray. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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
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 5820 matching lines...) Expand 10 before | Expand all | Expand 10 after
5831 MaybeObject* copy_result = 5831 MaybeObject* copy_result =
5832 new_descriptors->CopyFrom(next_descriptor++, this, i, witness); 5832 new_descriptors->CopyFrom(next_descriptor++, this, i, witness);
5833 if (copy_result->IsFailure()) return copy_result; 5833 if (copy_result->IsFailure()) return copy_result;
5834 } 5834 }
5835 } 5835 }
5836 ASSERT(next_descriptor == new_descriptors->number_of_descriptors()); 5836 ASSERT(next_descriptor == new_descriptors->number_of_descriptors());
5837 5837
5838 return new_descriptors; 5838 return new_descriptors;
5839 } 5839 }
5840 5840
5841 5841 // We need the whiteness witness since sort will reshuffle the entries in the
5842 // descriptor array. If the descriptor array were to be gray, the sort would
5843 // potentially swap a black and a white member. This would resulting in
Michael Starzinger 2012/05/24 14:28:54 Reasoning is off. [...] were to be black, the shu
Toon Verwaest 2012/05/25 12:27:26 Done.
5844 // accidentally reclaiming the white member if the descriptor array owned the
5845 // unique pointer.
5842 void DescriptorArray::SortUnchecked(const WhitenessWitness& witness) { 5846 void DescriptorArray::SortUnchecked(const WhitenessWitness& witness) {
5843 // In-place heap sort. 5847 // In-place heap sort.
5844 int len = number_of_descriptors(); 5848 int len = number_of_descriptors();
5845 5849
5846 // Bottom-up max-heap construction. 5850 // Bottom-up max-heap construction.
5847 // Index of the last node with children 5851 // Index of the last node with children
5848 const int max_parent_index = (len / 2) - 1; 5852 const int max_parent_index = (len / 2) - 1;
5849 for (int i = max_parent_index; i >= 0; --i) { 5853 for (int i = max_parent_index; i >= 0; --i) {
5850 int parent_index = i; 5854 int parent_index = i;
5851 const uint32_t parent_hash = GetKey(i)->Hash(); 5855 const uint32_t parent_hash = GetKey(i)->Hash();
(...skipping 7088 matching lines...) Expand 10 before | Expand all | Expand 10 after
12940 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 12944 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
12941 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 12945 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
12942 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 12946 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
12943 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 12947 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
12944 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 12948 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
12945 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 12949 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
12946 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 12950 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
12947 } 12951 }
12948 12952
12949 } } // namespace v8::internal 12953 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698