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 9763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9774 StrictMode strict_mode = static_cast<StrictMode>(args.smi_at(3)); | 9774 StrictMode strict_mode = static_cast<StrictMode>(args.smi_at(3)); |
9775 ASSERT(args[4]->IsSmi()); | 9775 ASSERT(args[4]->IsSmi()); |
9776 return CompileGlobalEval(isolate, | 9776 return CompileGlobalEval(isolate, |
9777 args.at<String>(1), | 9777 args.at<String>(1), |
9778 args.at<Object>(2), | 9778 args.at<Object>(2), |
9779 strict_mode, | 9779 strict_mode, |
9780 args.smi_at(4)); | 9780 args.smi_at(4)); |
9781 } | 9781 } |
9782 | 9782 |
9783 | 9783 |
9784 // Allocate a block of memory in the given space (filled with a filler). | |
9785 // Used as a fall-back for generated code when the space is full. | |
9786 static MaybeObject* Allocate(Isolate* isolate, | |
9787 int size, | |
9788 bool double_align, | |
9789 AllocationSpace space) { | |
9790 Heap* heap = isolate->heap(); | |
9791 RUNTIME_ASSERT(IsAligned(size, kPointerSize)); | |
9792 RUNTIME_ASSERT(size > 0); | |
9793 RUNTIME_ASSERT(size <= Page::kMaxRegularHeapObjectSize); | |
9794 HeapObject* allocation; | |
9795 { MaybeObject* maybe_allocation = heap->AllocateRaw(size, space, space); | |
9796 if (!maybe_allocation->To(&allocation)) return maybe_allocation; | |
9797 } | |
9798 #ifdef DEBUG | |
9799 MemoryChunk* chunk = MemoryChunk::FromAddress(allocation->address()); | |
9800 ASSERT(chunk->owner()->identity() == space); | |
9801 #endif | |
9802 heap->CreateFillerObjectAt(allocation->address(), size); | |
9803 return allocation; | |
9804 } | |
9805 | |
9806 | |
9807 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_AllocateInNewSpace) { | 9784 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_AllocateInNewSpace) { |
9808 SealHandleScope shs(isolate); | 9785 HandleScope scope(isolate); |
9809 ASSERT(args.length() == 1); | 9786 ASSERT(args.length() == 1); |
9810 CONVERT_SMI_ARG_CHECKED(size, 0); | 9787 CONVERT_SMI_ARG_CHECKED(size, 0); |
9811 return Allocate(isolate, size, false, NEW_SPACE); | 9788 RUNTIME_ASSERT(IsAligned(size, kPointerSize)); |
| 9789 RUNTIME_ASSERT(size > 0); |
| 9790 RUNTIME_ASSERT(size <= Page::kMaxRegularHeapObjectSize); |
| 9791 return *isolate->factory()->NewFillerObject(size, false, NEW_SPACE); |
9812 } | 9792 } |
9813 | 9793 |
9814 | 9794 |
9815 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_AllocateInTargetSpace) { | 9795 RUNTIME_FUNCTION(MaybeObject*, RuntimeHidden_AllocateInTargetSpace) { |
9816 SealHandleScope shs(isolate); | 9796 HandleScope scope(isolate); |
9817 ASSERT(args.length() == 2); | 9797 ASSERT(args.length() == 2); |
9818 CONVERT_SMI_ARG_CHECKED(size, 0); | 9798 CONVERT_SMI_ARG_CHECKED(size, 0); |
9819 CONVERT_SMI_ARG_CHECKED(flags, 1); | 9799 CONVERT_SMI_ARG_CHECKED(flags, 1); |
| 9800 RUNTIME_ASSERT(IsAligned(size, kPointerSize)); |
| 9801 RUNTIME_ASSERT(size > 0); |
| 9802 RUNTIME_ASSERT(size <= Page::kMaxRegularHeapObjectSize); |
9820 bool double_align = AllocateDoubleAlignFlag::decode(flags); | 9803 bool double_align = AllocateDoubleAlignFlag::decode(flags); |
9821 AllocationSpace space = AllocateTargetSpace::decode(flags); | 9804 AllocationSpace space = AllocateTargetSpace::decode(flags); |
9822 return Allocate(isolate, size, double_align, space); | 9805 return *isolate->factory()->NewFillerObject(size, double_align, space); |
9823 } | 9806 } |
9824 | 9807 |
9825 | 9808 |
9826 // Push an object unto an array of objects if it is not already in the | 9809 // Push an object unto an array of objects if it is not already in the |
9827 // array. Returns true if the element was pushed on the stack and | 9810 // array. Returns true if the element was pushed on the stack and |
9828 // false otherwise. | 9811 // false otherwise. |
9829 RUNTIME_FUNCTION(MaybeObject*, Runtime_PushIfAbsent) { | 9812 RUNTIME_FUNCTION(MaybeObject*, Runtime_PushIfAbsent) { |
9830 HandleScope scope(isolate); | 9813 HandleScope scope(isolate); |
9831 ASSERT(args.length() == 2); | 9814 ASSERT(args.length() == 2); |
9832 CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0); | 9815 CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0); |
(...skipping 5248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15081 } | 15064 } |
15082 } | 15065 } |
15083 | 15066 |
15084 | 15067 |
15085 void Runtime::OutOfMemory() { | 15068 void Runtime::OutOfMemory() { |
15086 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); | 15069 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); |
15087 UNREACHABLE(); | 15070 UNREACHABLE(); |
15088 } | 15071 } |
15089 | 15072 |
15090 } } // namespace v8::internal | 15073 } } // namespace v8::internal |
OLD | NEW |