OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 8701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8712 | 8712 |
8713 // Allocate the instance descriptor. | 8713 // Allocate the instance descriptor. |
8714 Object* descriptors_unchecked = | 8714 Object* descriptors_unchecked = |
8715 DescriptorArray::Allocate(instance_descriptor_length); | 8715 DescriptorArray::Allocate(instance_descriptor_length); |
8716 if (descriptors_unchecked->IsFailure()) return descriptors_unchecked; | 8716 if (descriptors_unchecked->IsFailure()) return descriptors_unchecked; |
8717 DescriptorArray* descriptors = DescriptorArray::cast(descriptors_unchecked); | 8717 DescriptorArray* descriptors = DescriptorArray::cast(descriptors_unchecked); |
8718 | 8718 |
8719 int inobject_props = obj->map()->inobject_properties(); | 8719 int inobject_props = obj->map()->inobject_properties(); |
8720 int number_of_allocated_fields = | 8720 int number_of_allocated_fields = |
8721 number_of_fields + unused_property_fields - inobject_props; | 8721 number_of_fields + unused_property_fields - inobject_props; |
| 8722 if (number_of_allocated_fields < 0) { |
| 8723 // There is enough inobject space for all fields (including unused). |
| 8724 number_of_allocated_fields = 0; |
| 8725 unused_property_fields = inobject_props - number_of_fields; |
| 8726 } |
8722 | 8727 |
8723 // Allocate the fixed array for the fields. | 8728 // Allocate the fixed array for the fields. |
8724 Object* fields = Heap::AllocateFixedArray(number_of_allocated_fields); | 8729 Object* fields = Heap::AllocateFixedArray(number_of_allocated_fields); |
8725 if (fields->IsFailure()) return fields; | 8730 if (fields->IsFailure()) return fields; |
8726 | 8731 |
8727 // Fill in the instance descriptor and the fields. | 8732 // Fill in the instance descriptor and the fields. |
8728 int next_descriptor = 0; | 8733 int next_descriptor = 0; |
8729 int current_offset = 0; | 8734 int current_offset = 0; |
8730 for (int i = 0; i < capacity; i++) { | 8735 for (int i = 0; i < capacity; i++) { |
8731 Object* k = KeyAt(i); | 8736 Object* k = KeyAt(i); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9032 if (break_point_objects()->IsUndefined()) return 0; | 9037 if (break_point_objects()->IsUndefined()) return 0; |
9033 // Single beak point. | 9038 // Single beak point. |
9034 if (!break_point_objects()->IsFixedArray()) return 1; | 9039 if (!break_point_objects()->IsFixedArray()) return 1; |
9035 // Multiple break points. | 9040 // Multiple break points. |
9036 return FixedArray::cast(break_point_objects())->length(); | 9041 return FixedArray::cast(break_point_objects())->length(); |
9037 } | 9042 } |
9038 #endif | 9043 #endif |
9039 | 9044 |
9040 | 9045 |
9041 } } // namespace v8::internal | 9046 } } // namespace v8::internal |
OLD | NEW |