OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 7235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7246 Handle<Smi> e(Smi::FromInt(static_cast<int>(array->get(j)))); | 7246 Handle<Smi> e(Smi::FromInt(static_cast<int>(array->get(j)))); |
7247 visitor->visit(j, e); | 7247 visitor->visit(j, e); |
7248 } | 7248 } |
7249 } else { | 7249 } else { |
7250 for (uint32_t j = 0; j < len; j++) { | 7250 for (uint32_t j = 0; j < len; j++) { |
7251 int64_t val = static_cast<int64_t>(array->get(j)); | 7251 int64_t val = static_cast<int64_t>(array->get(j)); |
7252 if (Smi::IsValid(static_cast<intptr_t>(val))) { | 7252 if (Smi::IsValid(static_cast<intptr_t>(val))) { |
7253 Handle<Smi> e(Smi::FromInt(static_cast<int>(val))); | 7253 Handle<Smi> e(Smi::FromInt(static_cast<int>(val))); |
7254 visitor->visit(j, e); | 7254 visitor->visit(j, e); |
7255 } else { | 7255 } else { |
7256 Handle<Object> e( | 7256 Handle<Object> e = |
7257 Heap::AllocateHeapNumber(static_cast<ElementType>(val))); | 7257 Factory::NewNumber(static_cast<ElementType>(val)); |
7258 visitor->visit(j, e); | 7258 visitor->visit(j, e); |
7259 } | 7259 } |
7260 } | 7260 } |
7261 } | 7261 } |
7262 } else { | 7262 } else { |
7263 for (uint32_t j = 0; j < len; j++) { | 7263 for (uint32_t j = 0; j < len; j++) { |
7264 Handle<Object> e(Heap::AllocateHeapNumber(array->get(j))); | 7264 Handle<Object> e = Factory::NewNumber(array->get(j)); |
7265 visitor->visit(j, e); | 7265 visitor->visit(j, e); |
7266 } | 7266 } |
7267 } | 7267 } |
7268 } | 7268 } |
7269 | 7269 |
7270 return len; | 7270 return len; |
7271 } | 7271 } |
7272 | 7272 |
7273 /** | 7273 /** |
7274 * A helper function that visits elements of a JSObject. Only elements | 7274 * A helper function that visits elements of a JSObject. Only elements |
(...skipping 2938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10213 } else { | 10213 } else { |
10214 // Handle last resort GC and make sure to allow future allocations | 10214 // Handle last resort GC and make sure to allow future allocations |
10215 // to grow the heap without causing GCs (if possible). | 10215 // to grow the heap without causing GCs (if possible). |
10216 Counters::gc_last_resort_from_js.Increment(); | 10216 Counters::gc_last_resort_from_js.Increment(); |
10217 Heap::CollectAllGarbage(false); | 10217 Heap::CollectAllGarbage(false); |
10218 } | 10218 } |
10219 } | 10219 } |
10220 | 10220 |
10221 | 10221 |
10222 } } // namespace v8::internal | 10222 } } // namespace v8::internal |
OLD | NEW |