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

Side by Side Diff: src/factory.cc

Issue 10784014: Removed transitions from the accessor pair descriptors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 8 years, 5 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/heap.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 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 Handle<DescriptorArray> result = 926 Handle<DescriptorArray> result =
927 NewDescriptorArray(descriptor_count + nof_callbacks); 927 NewDescriptorArray(descriptor_count + nof_callbacks);
928 928
929 // Ensure that marking will not progress and change color of objects. 929 // Ensure that marking will not progress and change color of objects.
930 DescriptorArray::WhitenessWitness witness(*result); 930 DescriptorArray::WhitenessWitness witness(*result);
931 931
932 // Copy the descriptors from the array. 932 // Copy the descriptors from the array.
933 if (0 < descriptor_count) { 933 if (0 < descriptor_count) {
934 result->SetLastAdded(array->LastAdded()); 934 result->SetLastAdded(array->LastAdded());
935 for (int i = 0; i < descriptor_count; i++) { 935 for (int i = 0; i < descriptor_count; i++) {
936 DescriptorArray::CopyFrom(result, i, array, i, witness); 936 result->CopyFrom(i, *array, i, witness);
937 } 937 }
938 } 938 }
939 939
940 // Fill in new callback descriptors. Process the callbacks from 940 // Fill in new callback descriptors. Process the callbacks from
941 // back to front so that the last callback with a given name takes 941 // back to front so that the last callback with a given name takes
942 // precedence over previously added callbacks with that name. 942 // precedence over previously added callbacks with that name.
943 for (int i = nof_callbacks - 1; i >= 0; i--) { 943 for (int i = nof_callbacks - 1; i >= 0; i--) {
944 Handle<AccessorInfo> entry = 944 Handle<AccessorInfo> entry =
945 Handle<AccessorInfo>(AccessorInfo::cast(callbacks.get(i))); 945 Handle<AccessorInfo>(AccessorInfo::cast(callbacks.get(i)));
946 // Ensure the key is a symbol before writing into the instance descriptor. 946 // Ensure the key is a symbol before writing into the instance descriptor.
(...skipping 13 matching lines...) Expand all
960 int new_number_of_descriptors = result->NumberOfSetDescriptors(); 960 int new_number_of_descriptors = result->NumberOfSetDescriptors();
961 // Return the old descriptor array if there were no new elements. 961 // Return the old descriptor array if there were no new elements.
962 if (new_number_of_descriptors == descriptor_count) return array; 962 if (new_number_of_descriptors == descriptor_count) return array;
963 963
964 // If duplicates were detected, allocate a result of the right size 964 // If duplicates were detected, allocate a result of the right size
965 // and transfer the elements. 965 // and transfer the elements.
966 if (new_number_of_descriptors < result->length()) { 966 if (new_number_of_descriptors < result->length()) {
967 Handle<DescriptorArray> new_result = 967 Handle<DescriptorArray> new_result =
968 NewDescriptorArray(new_number_of_descriptors); 968 NewDescriptorArray(new_number_of_descriptors);
969 for (int i = 0; i < new_number_of_descriptors; i++) { 969 for (int i = 0; i < new_number_of_descriptors; i++) {
970 DescriptorArray::CopyFrom(new_result, i, result, i, witness); 970 new_result->CopyFrom(i, *result, i, witness);
971 } 971 }
972 result = new_result; 972 result = new_result;
973 } 973 }
974 974
975 // Sort the result before returning. 975 // Sort the result before returning.
976 result->Sort(witness); 976 result->Sort(witness);
977 return result; 977 return result;
978 } 978 }
979 979
980 980
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 1492
1493 1493
1494 Handle<Object> Factory::ToBoolean(bool value) { 1494 Handle<Object> Factory::ToBoolean(bool value) {
1495 return Handle<Object>(value 1495 return Handle<Object>(value
1496 ? isolate()->heap()->true_value() 1496 ? isolate()->heap()->true_value()
1497 : isolate()->heap()->false_value()); 1497 : isolate()->heap()->false_value());
1498 } 1498 }
1499 1499
1500 1500
1501 } } // namespace v8::internal 1501 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698