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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) { | 628 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) { |
629 HandleScope scope(isolate); | 629 HandleScope scope(isolate); |
630 ASSERT(args.length() == 3); | 630 ASSERT(args.length() == 3); |
631 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); | 631 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); |
632 CONVERT_SMI_ARG_CHECKED(literals_index, 1); | 632 CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
633 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); | 633 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); |
634 | 634 |
635 // Check if boilerplate exists. If not, create it first. | 635 // Check if boilerplate exists. If not, create it first. |
636 Handle<Object> boilerplate(literals->get(literals_index), isolate); | 636 Handle<Object> boilerplate(literals->get(literals_index), isolate); |
637 if (*boilerplate == isolate->heap()->undefined_value()) { | 637 if (*boilerplate == isolate->heap()->undefined_value()) { |
| 638 ASSERT(*elements != isolate->heap()->empty_fixed_array()); |
638 boilerplate = | 639 boilerplate = |
639 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements); | 640 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements); |
640 if (boilerplate.is_null()) return Failure::Exception(); | 641 if (boilerplate.is_null()) return Failure::Exception(); |
641 // Update the functions literal and return the boilerplate. | 642 // Update the functions literal and return the boilerplate. |
642 literals->set(literals_index, *boilerplate); | 643 literals->set(literals_index, *boilerplate); |
643 } | 644 } |
644 return DeepCopyBoilerplate(isolate, JSObject::cast(*boilerplate)); | 645 return DeepCopyBoilerplate(isolate, JSObject::cast(*boilerplate)); |
645 } | 646 } |
646 | 647 |
647 | 648 |
(...skipping 13002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13650 // Handle last resort GC and make sure to allow future allocations | 13651 // Handle last resort GC and make sure to allow future allocations |
13651 // to grow the heap without causing GCs (if possible). | 13652 // to grow the heap without causing GCs (if possible). |
13652 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13653 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13653 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13654 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13654 "Runtime::PerformGC"); | 13655 "Runtime::PerformGC"); |
13655 } | 13656 } |
13656 } | 13657 } |
13657 | 13658 |
13658 | 13659 |
13659 } } // namespace v8::internal | 13660 } } // namespace v8::internal |
OLD | NEW |