OLD | NEW |
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 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 Code); | 887 Code); |
888 } | 888 } |
889 | 889 |
890 | 890 |
891 MUST_USE_RESULT static inline MaybeObject* DoCopyInsert( | 891 MUST_USE_RESULT static inline MaybeObject* DoCopyInsert( |
892 DescriptorArray* array, | 892 DescriptorArray* array, |
893 String* key, | 893 String* key, |
894 Object* value, | 894 Object* value, |
895 PropertyAttributes attributes) { | 895 PropertyAttributes attributes) { |
896 CallbacksDescriptor desc(key, value, attributes); | 896 CallbacksDescriptor desc(key, value, attributes); |
897 MaybeObject* obj = array->CopyInsert(&desc, REMOVE_TRANSITIONS); | 897 MaybeObject* obj = array->CopyInsert(&desc); |
898 return obj; | 898 return obj; |
899 } | 899 } |
900 | 900 |
901 | 901 |
902 // Allocate the new array. | 902 // Allocate the new array. |
903 Handle<DescriptorArray> Factory::CopyAppendForeignDescriptor( | 903 Handle<DescriptorArray> Factory::CopyAppendForeignDescriptor( |
904 Handle<DescriptorArray> array, | 904 Handle<DescriptorArray> array, |
905 Handle<String> key, | 905 Handle<String> key, |
906 Handle<Object> value, | 906 Handle<Object> value, |
907 PropertyAttributes attributes) { | 907 PropertyAttributes attributes) { |
(...skipping 29 matching lines...) Expand all Loading... |
937 // Fill in new callback descriptors. Process the callbacks from | 937 // Fill in new callback descriptors. Process the callbacks from |
938 // back to front so that the last callback with a given name takes | 938 // back to front so that the last callback with a given name takes |
939 // precedence over previously added callbacks with that name. | 939 // precedence over previously added callbacks with that name. |
940 for (int i = nof_callbacks - 1; i >= 0; i--) { | 940 for (int i = nof_callbacks - 1; i >= 0; i--) { |
941 Handle<AccessorInfo> entry = | 941 Handle<AccessorInfo> entry = |
942 Handle<AccessorInfo>(AccessorInfo::cast(callbacks.get(i))); | 942 Handle<AccessorInfo>(AccessorInfo::cast(callbacks.get(i))); |
943 // Ensure the key is a symbol before writing into the instance descriptor. | 943 // Ensure the key is a symbol before writing into the instance descriptor. |
944 Handle<String> key = | 944 Handle<String> key = |
945 SymbolFromString(Handle<String>(String::cast(entry->name()))); | 945 SymbolFromString(Handle<String>(String::cast(entry->name()))); |
946 // Check if a descriptor with this name already exists before writing. | 946 // Check if a descriptor with this name already exists before writing. |
947 if (result->LinearSearch(EXPECT_UNSORTED, *key, descriptor_count) == | 947 if (LinearSearch(*result, EXPECT_UNSORTED, *key, descriptor_count) == |
948 DescriptorArray::kNotFound) { | 948 DescriptorArray::kNotFound) { |
949 CallbacksDescriptor desc(*key, *entry, entry->property_attributes()); | 949 CallbacksDescriptor desc(*key, *entry, entry->property_attributes()); |
950 result->Set(descriptor_count, &desc, witness); | 950 result->Set(descriptor_count, &desc, witness); |
951 descriptor_count++; | 951 descriptor_count++; |
952 } | 952 } |
953 } | 953 } |
954 | 954 |
955 // If duplicates were detected, allocate a result of the right size | 955 // If duplicates were detected, allocate a result of the right size |
956 // and transfer the elements. | 956 // and transfer the elements. |
957 if (descriptor_count < result->length()) { | 957 if (descriptor_count < result->length()) { |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1481 | 1481 |
1482 | 1482 |
1483 Handle<Object> Factory::ToBoolean(bool value) { | 1483 Handle<Object> Factory::ToBoolean(bool value) { |
1484 return Handle<Object>(value | 1484 return Handle<Object>(value |
1485 ? isolate()->heap()->true_value() | 1485 ? isolate()->heap()->true_value() |
1486 : isolate()->heap()->false_value()); | 1486 : isolate()->heap()->false_value()); |
1487 } | 1487 } |
1488 | 1488 |
1489 | 1489 |
1490 } } // namespace v8::internal | 1490 } } // namespace v8::internal |
OLD | NEW |