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 5373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5384 Factory::DictionaryAtNumberPut(dict, index, elm); | 5384 Factory::DictionaryAtNumberPut(dict, index, elm); |
5385 if (!result.is_identical_to(dict)) | 5385 if (!result.is_identical_to(dict)) |
5386 storage_ = result; | 5386 storage_ = result; |
5387 } | 5387 } |
5388 } | 5388 } |
5389 | 5389 |
5390 void increase_index_offset(uint32_t delta) { | 5390 void increase_index_offset(uint32_t delta) { |
5391 index_offset_ += delta; | 5391 index_offset_ += delta; |
5392 } | 5392 } |
5393 | 5393 |
| 5394 Handle<FixedArray> storage() { return storage_; } |
| 5395 |
5394 private: | 5396 private: |
5395 Handle<FixedArray> storage_; | 5397 Handle<FixedArray> storage_; |
5396 uint32_t index_limit_; | 5398 uint32_t index_limit_; |
5397 bool fast_elements_; | 5399 bool fast_elements_; |
5398 uint32_t index_offset_; | 5400 uint32_t index_offset_; |
5399 }; | 5401 }; |
5400 | 5402 |
5401 | 5403 |
5402 template<class ExternalArrayClass, class ElementType> | 5404 template<class ExternalArrayClass, class ElementType> |
5403 static uint32_t IterateExternalArrayElements(Handle<JSObject> receiver, | 5405 static uint32_t IterateExternalArrayElements(Handle<JSObject> receiver, |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5693 Factory::NewNumberDictionary(at_least_space_for)); | 5695 Factory::NewNumberDictionary(at_least_space_for)); |
5694 } | 5696 } |
5695 | 5697 |
5696 Handle<Object> len = Factory::NewNumber(static_cast<double>(result_length)); | 5698 Handle<Object> len = Factory::NewNumber(static_cast<double>(result_length)); |
5697 | 5699 |
5698 ArrayConcatVisitor visitor(storage, result_length, fast_case); | 5700 ArrayConcatVisitor visitor(storage, result_length, fast_case); |
5699 | 5701 |
5700 IterateArguments(arguments, &visitor); | 5702 IterateArguments(arguments, &visitor); |
5701 | 5703 |
5702 result->set_length(*len); | 5704 result->set_length(*len); |
5703 result->set_elements(*storage); | 5705 // Please note the storage might have changed in the visitor. |
| 5706 result->set_elements(*visitor.storage()); |
5704 | 5707 |
5705 return *result; | 5708 return *result; |
5706 } | 5709 } |
5707 | 5710 |
5708 | 5711 |
5709 // This will not allocate (flatten the string), but it may run | 5712 // This will not allocate (flatten the string), but it may run |
5710 // very slowly for very deeply nested ConsStrings. For debugging use only. | 5713 // very slowly for very deeply nested ConsStrings. For debugging use only. |
5711 static Object* Runtime_GlobalPrint(Arguments args) { | 5714 static Object* Runtime_GlobalPrint(Arguments args) { |
5712 NoHandleAllocation ha; | 5715 NoHandleAllocation ha; |
5713 ASSERT(args.length() == 1); | 5716 ASSERT(args.length() == 1); |
(...skipping 2310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8024 } else { | 8027 } else { |
8025 // Handle last resort GC and make sure to allow future allocations | 8028 // Handle last resort GC and make sure to allow future allocations |
8026 // to grow the heap without causing GCs (if possible). | 8029 // to grow the heap without causing GCs (if possible). |
8027 Counters::gc_last_resort_from_js.Increment(); | 8030 Counters::gc_last_resort_from_js.Increment(); |
8028 Heap::CollectAllGarbage(false); | 8031 Heap::CollectAllGarbage(false); |
8029 } | 8032 } |
8030 } | 8033 } |
8031 | 8034 |
8032 | 8035 |
8033 } } // namespace v8::internal | 8036 } } // namespace v8::internal |
OLD | NEW |