OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/elements.h" | 5 #include "src/elements.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
9 #include "src/factory.h" | 9 #include "src/factory.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 for (uint32_t i = 0; i < nof_indices; i++) { | 1004 for (uint32_t i = 0; i < nof_indices; i++) { |
1005 Handle<Object> index_string = isolate->factory()->Uint32ToString( | 1005 Handle<Object> index_string = isolate->factory()->Uint32ToString( |
1006 combined_keys->get(i)->Number()); | 1006 combined_keys->get(i)->Number()); |
1007 combined_keys->set(i, *index_string); | 1007 combined_keys->set(i, *index_string); |
1008 } | 1008 } |
1009 } else if (!(object->IsJSArray() && | 1009 } else if (!(object->IsJSArray() && |
1010 JSArray::cast(*object)->length()->ToArrayLength( | 1010 JSArray::cast(*object)->length()->ToArrayLength( |
1011 &array_length) && | 1011 &array_length) && |
1012 array_length <= Smi::kMaxValue)) { | 1012 array_length <= Smi::kMaxValue)) { |
1013 // Since we use std::sort above, the GC will no longer know where the | 1013 // Since we use std::sort above, the GC will no longer know where the |
1014 // HeapNumbers are. For Arrays with valid Smi length, we are sure to | 1014 // HeapNumbers are, hence we have to write them again. |
1015 // have no HeapNumber indices and thus we can skip this step. | 1015 // For Arrays with valid Smi length, we are sure to have no HeapNumber |
1016 FIXED_ARRAY_ELEMENTS_WRITE_BARRIER(isolate->heap(), *combined_keys, 0, | 1016 // indices and thus we can skip this step. |
1017 nof_indices); | 1017 for (uint32_t i = 0; i < nof_indices; i++) { |
| 1018 Object* index = combined_keys->get(i); |
| 1019 combined_keys->set(i, index); |
| 1020 } |
1018 } | 1021 } |
1019 } | 1022 } |
1020 | 1023 |
1021 // Copy over the passed-in property keys. | 1024 // Copy over the passed-in property keys. |
1022 CopyObjectToObjectElements(*keys, FAST_ELEMENTS, 0, *combined_keys, | 1025 CopyObjectToObjectElements(*keys, FAST_ELEMENTS, 0, *combined_keys, |
1023 FAST_ELEMENTS, nof_indices, nof_property_keys); | 1026 FAST_ELEMENTS, nof_indices, nof_property_keys); |
1024 | 1027 |
1025 if (IsHoleyElementsKind(kind())) { | 1028 if (IsHoleyElementsKind(kind())) { |
1026 // Shrink combined_keys to the final size. | 1029 // Shrink combined_keys to the final size. |
1027 int final_size = nof_indices + nof_property_keys; | 1030 int final_size = nof_indices + nof_property_keys; |
(...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3026 insertion_index += len; | 3029 insertion_index += len; |
3027 } | 3030 } |
3028 | 3031 |
3029 DCHECK_EQ(insertion_index, result_len); | 3032 DCHECK_EQ(insertion_index, result_len); |
3030 return result_array; | 3033 return result_array; |
3031 } | 3034 } |
3032 | 3035 |
3033 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; | 3036 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; |
3034 } // namespace internal | 3037 } // namespace internal |
3035 } // namespace v8 | 3038 } // namespace v8 |
OLD | NEW |