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 3648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3659 // different context. | 3659 // different context. |
3660 JSFunction* object_function = | 3660 JSFunction* object_function = |
3661 function->context()->global_context()->object_function(); | 3661 function->context()->global_context()->object_function(); |
3662 | 3662 |
3663 // Each function prototype gets a copy of the object function map. | 3663 // Each function prototype gets a copy of the object function map. |
3664 // This avoid unwanted sharing of maps between prototypes of different | 3664 // This avoid unwanted sharing of maps between prototypes of different |
3665 // constructors. | 3665 // constructors. |
3666 Map* new_map; | 3666 Map* new_map; |
3667 ASSERT(object_function->has_initial_map()); | 3667 ASSERT(object_function->has_initial_map()); |
3668 { MaybeObject* maybe_map = | 3668 { MaybeObject* maybe_map = |
3669 object_function->initial_map()->CopyDropTransitions(); | 3669 object_function->initial_map()->CopyDropTransitions( |
| 3670 DescriptorArray::MAY_BE_SHARED); |
3670 if (!maybe_map->To<Map>(&new_map)) return maybe_map; | 3671 if (!maybe_map->To<Map>(&new_map)) return maybe_map; |
3671 } | 3672 } |
3672 Object* prototype; | 3673 Object* prototype; |
3673 { MaybeObject* maybe_prototype = AllocateJSObjectFromMap(new_map); | 3674 { MaybeObject* maybe_prototype = AllocateJSObjectFromMap(new_map); |
3674 if (!maybe_prototype->ToObject(&prototype)) return maybe_prototype; | 3675 if (!maybe_prototype->ToObject(&prototype)) return maybe_prototype; |
3675 } | 3676 } |
3676 // When creating the prototype for the function we must set its | 3677 // When creating the prototype for the function we must set its |
3677 // constructor to the function. | 3678 // constructor to the function. |
3678 Object* result; | 3679 Object* result; |
3679 { MaybeObject* maybe_result = | 3680 { MaybeObject* maybe_result = |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3807 // the inline_new flag so we only change the map if we generate a | 3808 // the inline_new flag so we only change the map if we generate a |
3808 // specialized construct stub. | 3809 // specialized construct stub. |
3809 ASSERT(in_object_properties <= Map::kMaxPreAllocatedPropertyFields); | 3810 ASSERT(in_object_properties <= Map::kMaxPreAllocatedPropertyFields); |
3810 if (fun->shared()->CanGenerateInlineConstructor(prototype)) { | 3811 if (fun->shared()->CanGenerateInlineConstructor(prototype)) { |
3811 int count = fun->shared()->this_property_assignments_count(); | 3812 int count = fun->shared()->this_property_assignments_count(); |
3812 if (count > in_object_properties) { | 3813 if (count > in_object_properties) { |
3813 // Inline constructor can only handle inobject properties. | 3814 // Inline constructor can only handle inobject properties. |
3814 fun->shared()->ForbidInlineConstructor(); | 3815 fun->shared()->ForbidInlineConstructor(); |
3815 } else { | 3816 } else { |
3816 DescriptorArray* descriptors; | 3817 DescriptorArray* descriptors; |
3817 { MaybeObject* maybe_descriptors_obj = DescriptorArray::Allocate(count); | 3818 { MaybeObject* maybe_descriptors_obj = |
| 3819 DescriptorArray::Allocate(count, DescriptorArray::MAY_BE_SHARED); |
3818 if (!maybe_descriptors_obj->To<DescriptorArray>(&descriptors)) { | 3820 if (!maybe_descriptors_obj->To<DescriptorArray>(&descriptors)) { |
3819 return maybe_descriptors_obj; | 3821 return maybe_descriptors_obj; |
3820 } | 3822 } |
3821 } | 3823 } |
3822 DescriptorArray::WhitenessWitness witness(descriptors); | 3824 DescriptorArray::WhitenessWitness witness(descriptors); |
3823 for (int i = 0; i < count; i++) { | 3825 for (int i = 0; i < count; i++) { |
3824 String* name = fun->shared()->GetThisPropertyAssignmentName(i); | 3826 String* name = fun->shared()->GetThisPropertyAssignmentName(i); |
3825 ASSERT(name->IsSymbol()); | 3827 ASSERT(name->IsSymbol()); |
3826 FieldDescriptor field(name, i, NONE); | 3828 FieldDescriptor field(name, i, NONE); |
3827 field.SetEnumerationIndex(i); | 3829 field.SetEnumerationIndex(i); |
(...skipping 3317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7145 } else { | 7147 } else { |
7146 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. | 7148 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. |
7147 } | 7149 } |
7148 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = | 7150 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = |
7149 reinterpret_cast<Address>(p); | 7151 reinterpret_cast<Address>(p); |
7150 remembered_unmapped_pages_index_++; | 7152 remembered_unmapped_pages_index_++; |
7151 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; | 7153 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; |
7152 } | 7154 } |
7153 | 7155 |
7154 } } // namespace v8::internal | 7156 } } // namespace v8::internal |
OLD | NEW |