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

Side by Side Diff: src/factory.cc

Issue 9389005: DescriptorArray::CopyFrom should always drop transitions for CALLBACKS. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Improved comments. Created 8 years, 10 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 | « src/bootstrapper.cc ('k') | 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 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 858
859 // Number of descriptors added to the result so far. 859 // Number of descriptors added to the result so far.
860 int descriptor_count = 0; 860 int descriptor_count = 0;
861 861
862 // Ensure that marking will not progress and change color of objects. 862 // Ensure that marking will not progress and change color of objects.
863 DescriptorArray::WhitenessWitness witness(*result); 863 DescriptorArray::WhitenessWitness witness(*result);
864 864
865 // Copy the descriptors from the array. 865 // Copy the descriptors from the array.
866 for (int i = 0; i < array->number_of_descriptors(); i++) { 866 for (int i = 0; i < array->number_of_descriptors(); i++) {
867 if (!array->IsNullDescriptor(i)) { 867 if (!array->IsNullDescriptor(i)) {
868 result->CopyFrom(descriptor_count++, *array, i, witness); 868 DescriptorArray::CopyFrom(result, descriptor_count++, array, i, witness);
869 } 869 }
870 } 870 }
871 871
872 // Number of duplicates detected. 872 // Number of duplicates detected.
873 int duplicates = 0; 873 int duplicates = 0;
874 874
875 // Fill in new callback descriptors. Process the callbacks from 875 // Fill in new callback descriptors. Process the callbacks from
876 // back to front so that the last callback with a given name takes 876 // back to front so that the last callback with a given name takes
877 // precedence over previously added callbacks with that name. 877 // precedence over previously added callbacks with that name.
878 for (int i = nof_callbacks - 1; i >= 0; i--) { 878 for (int i = nof_callbacks - 1; i >= 0; i--) {
(...skipping 13 matching lines...) Expand all
892 } 892 }
893 } 893 }
894 894
895 // If duplicates were detected, allocate a result of the right size 895 // If duplicates were detected, allocate a result of the right size
896 // and transfer the elements. 896 // and transfer the elements.
897 if (duplicates > 0) { 897 if (duplicates > 0) {
898 int number_of_descriptors = result->number_of_descriptors() - duplicates; 898 int number_of_descriptors = result->number_of_descriptors() - duplicates;
899 Handle<DescriptorArray> new_result = 899 Handle<DescriptorArray> new_result =
900 NewDescriptorArray(number_of_descriptors); 900 NewDescriptorArray(number_of_descriptors);
901 for (int i = 0; i < number_of_descriptors; i++) { 901 for (int i = 0; i < number_of_descriptors; i++) {
902 new_result->CopyFrom(i, *result, i, witness); 902 DescriptorArray::CopyFrom(new_result, i, result, i, witness);
903 } 903 }
904 result = new_result; 904 result = new_result;
905 } 905 }
906 906
907 // Sort the result before returning. 907 // Sort the result before returning.
908 result->Sort(witness); 908 result->Sort(witness);
909 return result; 909 return result;
910 } 910 }
911 911
912 912
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 1415
1416 1416
1417 Handle<Object> Factory::ToBoolean(bool value) { 1417 Handle<Object> Factory::ToBoolean(bool value) {
1418 return Handle<Object>(value 1418 return Handle<Object>(value
1419 ? isolate()->heap()->true_value() 1419 ? isolate()->heap()->true_value()
1420 : isolate()->heap()->false_value()); 1420 : isolate()->heap()->false_value());
1421 } 1421 }
1422 1422
1423 1423
1424 } } // namespace v8::internal 1424 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698