Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: src/runtime.cc

Issue 35313002: MIPS: Ensure double aligned allocations through runtime routines. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 9760 matching lines...) Expand 10 before | Expand all | Expand 10 after
9771 } 9771 }
9772 9772
9773 9773
9774 // Allocate a block of memory in the given space (filled with a filler). 9774 // Allocate a block of memory in the given space (filled with a filler).
9775 // Used as a fall-back for generated code when the space is full. 9775 // Used as a fall-back for generated code when the space is full.
9776 static MaybeObject* Allocate(Isolate* isolate, 9776 static MaybeObject* Allocate(Isolate* isolate,
9777 int size, 9777 int size,
9778 bool double_align, 9778 bool double_align,
9779 AllocationSpace space) { 9779 AllocationSpace space) {
9780 Heap* heap = isolate->heap(); 9780 Heap* heap = isolate->heap();
9781 if (double_align) size += kPointerSize;
9781 RUNTIME_ASSERT(IsAligned(size, kPointerSize)); 9782 RUNTIME_ASSERT(IsAligned(size, kPointerSize));
9782 RUNTIME_ASSERT(size > 0); 9783 RUNTIME_ASSERT(size > 0);
9783 RUNTIME_ASSERT(size <= heap->MaxRegularSpaceAllocationSize()); 9784 RUNTIME_ASSERT(size <= heap->MaxRegularSpaceAllocationSize());
9784 HeapObject* allocation; 9785 HeapObject* allocation;
9785 { MaybeObject* maybe_allocation = heap->AllocateRaw(size, space, space); 9786 { MaybeObject* maybe_allocation = heap->AllocateRaw(size, space, space);
9786 if (!maybe_allocation->To(&allocation)) return maybe_allocation; 9787 if (!maybe_allocation->To(&allocation)) return maybe_allocation;
9787 } 9788 }
9788 #ifdef DEBUG 9789 #ifdef DEBUG
9789 MemoryChunk* chunk = MemoryChunk::FromAddress(allocation->address()); 9790 MemoryChunk* chunk = MemoryChunk::FromAddress(allocation->address());
9790 ASSERT(chunk->owner()->identity() == space); 9791 ASSERT(chunk->owner()->identity() == space);
9791 #endif 9792 #endif
9793 if (double_align) {
9794 allocation = heap->EnsureDoubleAligned(allocation, size);
9795 }
9792 heap->CreateFillerObjectAt(allocation->address(), size); 9796 heap->CreateFillerObjectAt(allocation->address(), size);
9793 return allocation; 9797 return allocation;
9794 } 9798 }
9795 9799
9796 9800
9797 RUNTIME_FUNCTION(MaybeObject*, Runtime_AllocateInNewSpace) { 9801 RUNTIME_FUNCTION(MaybeObject*, Runtime_AllocateInNewSpace) {
9798 SealHandleScope shs(isolate); 9802 SealHandleScope shs(isolate);
9799 ASSERT(args.length() == 1); 9803 ASSERT(args.length() == 1);
9800 CONVERT_SMI_ARG_CHECKED(size, 0); 9804 CONVERT_SMI_ARG_CHECKED(size, 0);
9801 return Allocate(isolate, size, false, NEW_SPACE); 9805 return Allocate(isolate, size, false, NEW_SPACE);
(...skipping 5084 matching lines...) Expand 10 before | Expand all | Expand 10 after
14886 // Handle last resort GC and make sure to allow future allocations 14890 // Handle last resort GC and make sure to allow future allocations
14887 // to grow the heap without causing GCs (if possible). 14891 // to grow the heap without causing GCs (if possible).
14888 isolate->counters()->gc_last_resort_from_js()->Increment(); 14892 isolate->counters()->gc_last_resort_from_js()->Increment();
14889 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14893 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14890 "Runtime::PerformGC"); 14894 "Runtime::PerformGC");
14891 } 14895 }
14892 } 14896 }
14893 14897
14894 14898
14895 } } // namespace v8::internal 14899 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698