| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 | 158 |
| 159 void SetExpectedNofPropertiesFromEstimate(Handle<JSFunction> func, | 159 void SetExpectedNofPropertiesFromEstimate(Handle<JSFunction> func, |
| 160 int estimate) { | 160 int estimate) { |
| 161 SetExpectedNofProperties( | 161 SetExpectedNofProperties( |
| 162 func, ExpectedNofPropertiesFromEstimate(estimate)); | 162 func, ExpectedNofPropertiesFromEstimate(estimate)); |
| 163 } | 163 } |
| 164 | 164 |
| 165 | 165 |
| 166 void NormalizeProperties(Handle<JSObject> object, | 166 void NormalizeProperties(Handle<JSObject> object, |
| 167 PropertyNormalizationMode mode) { | 167 PropertyNormalizationMode mode, |
| 168 CALL_HEAP_FUNCTION_VOID(object->NormalizeProperties(mode)); | 168 int expected_additional_properties) { |
| 169 CALL_HEAP_FUNCTION_VOID(object->NormalizeProperties( |
| 170 mode, |
| 171 expected_additional_properties)); |
| 169 } | 172 } |
| 170 | 173 |
| 171 | 174 |
| 172 void NormalizeElements(Handle<JSObject> object) { | 175 void NormalizeElements(Handle<JSObject> object) { |
| 173 CALL_HEAP_FUNCTION_VOID(object->NormalizeElements()); | 176 CALL_HEAP_FUNCTION_VOID(object->NormalizeElements()); |
| 174 } | 177 } |
| 175 | 178 |
| 176 | 179 |
| 177 void TransformToFastProperties(Handle<JSObject> object, | 180 void TransformToFastProperties(Handle<JSObject> object, |
| 178 int unused_property_fields) { | 181 int unused_property_fields) { |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 | 647 |
| 645 | 648 |
| 646 bool CompileLazyInLoop(Handle<JSFunction> function, ClearExceptionFlag flag) { | 649 bool CompileLazyInLoop(Handle<JSFunction> function, ClearExceptionFlag flag) { |
| 647 // Compile the source information to a code object. | 650 // Compile the source information to a code object. |
| 648 Handle<SharedFunctionInfo> shared(function->shared()); | 651 Handle<SharedFunctionInfo> shared(function->shared()); |
| 649 return CompileLazyShared(shared, flag, 1); | 652 return CompileLazyShared(shared, flag, 1); |
| 650 } | 653 } |
| 651 | 654 |
| 652 OptimizedObjectForAddingMultipleProperties:: | 655 OptimizedObjectForAddingMultipleProperties:: |
| 653 OptimizedObjectForAddingMultipleProperties(Handle<JSObject> object, | 656 OptimizedObjectForAddingMultipleProperties(Handle<JSObject> object, |
| 657 int expected_additional_properties, |
| 654 bool condition) { | 658 bool condition) { |
| 655 object_ = object; | 659 object_ = object; |
| 656 if (condition && object_->HasFastProperties()) { | 660 if (condition && object_->HasFastProperties()) { |
| 657 // Normalize the properties of object to avoid n^2 behavior | 661 // Normalize the properties of object to avoid n^2 behavior |
| 658 // when extending the object multiple properties. | 662 // when extending the object multiple properties. Indicate the number of |
| 663 // properties to be added. |
| 659 unused_property_fields_ = object->map()->unused_property_fields(); | 664 unused_property_fields_ = object->map()->unused_property_fields(); |
| 660 NormalizeProperties(object_, KEEP_INOBJECT_PROPERTIES); | 665 NormalizeProperties(object_, |
| 666 KEEP_INOBJECT_PROPERTIES, |
| 667 expected_additional_properties); |
| 661 has_been_transformed_ = true; | 668 has_been_transformed_ = true; |
| 662 | 669 |
| 663 } else { | 670 } else { |
| 664 has_been_transformed_ = false; | 671 has_been_transformed_ = false; |
| 665 } | 672 } |
| 666 } | 673 } |
| 667 | 674 |
| 668 | 675 |
| 669 OptimizedObjectForAddingMultipleProperties:: | 676 OptimizedObjectForAddingMultipleProperties:: |
| 670 ~OptimizedObjectForAddingMultipleProperties() { | 677 ~OptimizedObjectForAddingMultipleProperties() { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 Handle<Map> new_map = Factory::CopyMapDropTransitions(old_map); | 758 Handle<Map> new_map = Factory::CopyMapDropTransitions(old_map); |
| 752 obj->set_map(*new_map); | 759 obj->set_map(*new_map); |
| 753 new_map->set_needs_loading(true); | 760 new_map->set_needs_loading(true); |
| 754 // Store the lazy loading info in the constructor field. We'll | 761 // Store the lazy loading info in the constructor field. We'll |
| 755 // reestablish the constructor from the fixed array after loading. | 762 // reestablish the constructor from the fixed array after loading. |
| 756 new_map->set_constructor(*arr); | 763 new_map->set_constructor(*arr); |
| 757 ASSERT(!obj->IsLoaded()); | 764 ASSERT(!obj->IsLoaded()); |
| 758 } | 765 } |
| 759 | 766 |
| 760 } } // namespace v8::internal | 767 } } // namespace v8::internal |
| OLD | NEW |