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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 | 140 |
141 static Failure* ThrowArrayLengthRangeError(Heap* heap) { | 141 static Failure* ThrowArrayLengthRangeError(Heap* heap) { |
142 HandleScope scope(heap->isolate()); | 142 HandleScope scope(heap->isolate()); |
143 return heap->isolate()->Throw( | 143 return heap->isolate()->Throw( |
144 *heap->isolate()->factory()->NewRangeError("invalid_array_length", | 144 *heap->isolate()->factory()->NewRangeError("invalid_array_length", |
145 HandleVector<Object>(NULL, 0))); | 145 HandleVector<Object>(NULL, 0))); |
146 } | 146 } |
147 | 147 |
148 | 148 |
149 void CopyObjectToObjectElements(FixedArray* from, | 149 static void CopyObjectToObjectElements(FixedArray* from, |
150 ElementsKind from_kind, | 150 ElementsKind from_kind, |
151 uint32_t from_start, | 151 uint32_t from_start, |
152 FixedArray* to, | 152 FixedArray* to, |
153 ElementsKind to_kind, | 153 ElementsKind to_kind, |
154 uint32_t to_start, | 154 uint32_t to_start, |
155 int raw_copy_size) { | 155 int raw_copy_size) { |
156 ASSERT(to->map() != HEAP->fixed_cow_array_map()); | 156 ASSERT(to->map() != HEAP->fixed_cow_array_map()); |
157 int copy_size = raw_copy_size; | 157 int copy_size = raw_copy_size; |
158 if (raw_copy_size < 0) { | 158 if (raw_copy_size < 0) { |
159 ASSERT(raw_copy_size == ElementsAccessor::kCopyToEnd || | 159 ASSERT(raw_copy_size == ElementsAccessor::kCopyToEnd || |
160 raw_copy_size == ElementsAccessor::kCopyToEndAndInitializeToHole); | 160 raw_copy_size == ElementsAccessor::kCopyToEndAndInitializeToHole); |
161 copy_size = Min(from->length() - from_start, | 161 copy_size = Min(from->length() - from_start, |
162 to->length() - to_start); | 162 to->length() - to_start); |
163 #ifdef DEBUG | 163 #ifdef DEBUG |
164 // FAST_*_ELEMENTS arrays cannot be uninitialized. Ensure they are already | 164 // FAST_*_ELEMENTS arrays cannot be uninitialized. Ensure they are already |
165 // marked with the hole. | 165 // marked with the hole. |
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1747 if (!maybe_obj->To(&new_backing_store)) return maybe_obj; | 1747 if (!maybe_obj->To(&new_backing_store)) return maybe_obj; |
1748 new_backing_store->set(0, length); | 1748 new_backing_store->set(0, length); |
1749 { MaybeObject* result = array->SetContent(new_backing_store); | 1749 { MaybeObject* result = array->SetContent(new_backing_store); |
1750 if (result->IsFailure()) return result; | 1750 if (result->IsFailure()) return result; |
1751 } | 1751 } |
1752 return array; | 1752 return array; |
1753 } | 1753 } |
1754 | 1754 |
1755 | 1755 |
1756 } } // namespace v8::internal | 1756 } } // namespace v8::internal |
OLD | NEW |