| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
| 9 #include "src/api.h" | 9 #include "src/api.h" |
| 10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
| (...skipping 12627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12638 } | 12638 } |
| 12639 | 12639 |
| 12640 // Attempt to put this object back in fast case. | 12640 // Attempt to put this object back in fast case. |
| 12641 if (object->ShouldConvertToFastElements()) { | 12641 if (object->ShouldConvertToFastElements()) { |
| 12642 uint32_t new_length = 0; | 12642 uint32_t new_length = 0; |
| 12643 if (object->IsJSArray()) { | 12643 if (object->IsJSArray()) { |
| 12644 CHECK(Handle<JSArray>::cast(object)->length()->ToArrayIndex(&new_length)); | 12644 CHECK(Handle<JSArray>::cast(object)->length()->ToArrayIndex(&new_length)); |
| 12645 } else { | 12645 } else { |
| 12646 new_length = dictionary->max_number_key() + 1; | 12646 new_length = dictionary->max_number_key() + 1; |
| 12647 } | 12647 } |
| 12648 SetFastElementsCapacitySmiMode smi_mode = FLAG_smi_only_arrays | |
| 12649 ? kAllowSmiElements | |
| 12650 : kDontAllowSmiElements; | |
| 12651 bool has_smi_only_elements = false; | 12648 bool has_smi_only_elements = false; |
| 12652 bool should_convert_to_fast_double_elements = | 12649 bool should_convert_to_fast_double_elements = |
| 12653 object->ShouldConvertToFastDoubleElements(&has_smi_only_elements); | 12650 object->ShouldConvertToFastDoubleElements(&has_smi_only_elements); |
| 12654 if (has_smi_only_elements) { | 12651 SetFastElementsCapacitySmiMode smi_mode = |
| 12655 smi_mode = kForceSmiElements; | 12652 has_smi_only_elements ? kForceSmiElements : kAllowSmiElements; |
| 12656 } | |
| 12657 | 12653 |
| 12658 if (should_convert_to_fast_double_elements) { | 12654 if (should_convert_to_fast_double_elements) { |
| 12659 SetFastDoubleElementsCapacityAndLength(object, new_length, new_length); | 12655 SetFastDoubleElementsCapacityAndLength(object, new_length, new_length); |
| 12660 } else { | 12656 } else { |
| 12661 SetFastElementsCapacityAndLength(object, new_length, new_length, | 12657 SetFastElementsCapacityAndLength(object, new_length, new_length, |
| 12662 smi_mode); | 12658 smi_mode); |
| 12663 } | 12659 } |
| 12664 JSObject::ValidateElements(object); | 12660 JSObject::ValidateElements(object); |
| 12665 #ifdef DEBUG | 12661 #ifdef DEBUG |
| 12666 if (FLAG_trace_normalization) { | 12662 if (FLAG_trace_normalization) { |
| (...skipping 4248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16915 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16911 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16916 static const char* error_messages_[] = { | 16912 static const char* error_messages_[] = { |
| 16917 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16913 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16918 }; | 16914 }; |
| 16919 #undef ERROR_MESSAGES_TEXTS | 16915 #undef ERROR_MESSAGES_TEXTS |
| 16920 return error_messages_[reason]; | 16916 return error_messages_[reason]; |
| 16921 } | 16917 } |
| 16922 | 16918 |
| 16923 | 16919 |
| 16924 } } // namespace v8::internal | 16920 } } // namespace v8::internal |
| OLD | NEW |