OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 { MaybeObject* maybe_result = | 162 { MaybeObject* maybe_result = |
163 copy->SetProperty(key_string, result, NONE); | 163 copy->SetProperty(key_string, result, NONE); |
164 if (!maybe_result->ToObject(&result)) return maybe_result; | 164 if (!maybe_result->ToObject(&result)) return maybe_result; |
165 } | 165 } |
166 } | 166 } |
167 } | 167 } |
168 } | 168 } |
169 | 169 |
170 // Deep copy local elements. | 170 // Deep copy local elements. |
171 // Pixel elements cannot be created using an object literal. | 171 // Pixel elements cannot be created using an object literal. |
172 ASSERT(!copy->HasPixelElements() && !copy->HasExternalArrayElements()); | 172 ASSERT(!copy->HasExternalArrayElements()); |
173 switch (copy->GetElementsKind()) { | 173 switch (copy->GetElementsKind()) { |
174 case JSObject::FAST_ELEMENTS: { | 174 case JSObject::FAST_ELEMENTS: { |
175 FixedArray* elements = FixedArray::cast(copy->elements()); | 175 FixedArray* elements = FixedArray::cast(copy->elements()); |
176 if (elements->map() == Heap::fixed_cow_array_map()) { | 176 if (elements->map() == Heap::fixed_cow_array_map()) { |
177 Counters::cow_arrays_created_runtime.Increment(); | 177 Counters::cow_arrays_created_runtime.Increment(); |
178 #ifdef DEBUG | 178 #ifdef DEBUG |
179 for (int i = 0; i < elements->length(); i++) { | 179 for (int i = 0; i < elements->length(); i++) { |
180 ASSERT(!elements->get(i)->IsJSObject()); | 180 ASSERT(!elements->get(i)->IsJSObject()); |
181 } | 181 } |
182 #endif | 182 #endif |
(...skipping 7935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8118 Handle<Object> e(elements->get(j)); | 8118 Handle<Object> e(elements->get(j)); |
8119 if (!e->IsTheHole()) { | 8119 if (!e->IsTheHole()) { |
8120 num_of_elements++; | 8120 num_of_elements++; |
8121 if (visitor) { | 8121 if (visitor) { |
8122 visitor->visit(j, e); | 8122 visitor->visit(j, e); |
8123 } | 8123 } |
8124 } | 8124 } |
8125 } | 8125 } |
8126 break; | 8126 break; |
8127 } | 8127 } |
8128 case JSObject::PIXEL_ELEMENTS: { | 8128 case JSObject::EXTERNAL_PIXEL_ELEMENTS: { |
8129 Handle<PixelArray> pixels(PixelArray::cast(receiver->elements())); | 8129 Handle<ExternalPixelArray> pixels( |
| 8130 ExternalPixelArray::cast(receiver->elements())); |
8130 uint32_t len = pixels->length(); | 8131 uint32_t len = pixels->length(); |
8131 if (range < len) { | 8132 if (range < len) { |
8132 len = range; | 8133 len = range; |
8133 } | 8134 } |
8134 | 8135 |
8135 for (uint32_t j = 0; j < len; j++) { | 8136 for (uint32_t j = 0; j < len; j++) { |
8136 num_of_elements++; | 8137 num_of_elements++; |
8137 if (visitor != NULL) { | 8138 if (visitor != NULL) { |
8138 Handle<Smi> e(Smi::FromInt(pixels->get(j))); | 8139 Handle<Smi> e(Smi::FromInt(pixels->get(j))); |
8139 visitor->visit(j, e); | 8140 visitor->visit(j, e); |
(...skipping 3061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11201 } else { | 11202 } else { |
11202 // Handle last resort GC and make sure to allow future allocations | 11203 // Handle last resort GC and make sure to allow future allocations |
11203 // to grow the heap without causing GCs (if possible). | 11204 // to grow the heap without causing GCs (if possible). |
11204 Counters::gc_last_resort_from_js.Increment(); | 11205 Counters::gc_last_resort_from_js.Increment(); |
11205 Heap::CollectAllGarbage(false); | 11206 Heap::CollectAllGarbage(false); |
11206 } | 11207 } |
11207 } | 11208 } |
11208 | 11209 |
11209 | 11210 |
11210 } } // namespace v8::internal | 11211 } } // namespace v8::internal |
OLD | NEW |