Chromium Code Reviews| 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 9256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 9267 { MaybeObject* maybe_allocation = | 9267 { MaybeObject* maybe_allocation = |
| 9268 heap->old_pointer_space()->AllocateRaw(size); | 9268 heap->old_pointer_space()->AllocateRaw(size); |
| 9269 if (maybe_allocation->ToObject(&allocation)) { | 9269 if (maybe_allocation->ToObject(&allocation)) { |
| 9270 heap->CreateFillerObjectAt(HeapObject::cast(allocation)->address(), size); | 9270 heap->CreateFillerObjectAt(HeapObject::cast(allocation)->address(), size); |
| 9271 } | 9271 } |
| 9272 return maybe_allocation; | 9272 return maybe_allocation; |
| 9273 } | 9273 } |
| 9274 } | 9274 } |
| 9275 | 9275 |
| 9276 | 9276 |
| 9277 RUNTIME_FUNCTION(MaybeObject*, Runtime_AllocateInOldDataSpace) { | |
| 9278 // Allocate a block of memory in old data space (filled with a filler). | |
| 9279 // Use as fallback for allocation in generated code when old pointer space | |
| 9280 // is full. | |
| 9281 ASSERT(args.length() == 1); | |
| 9282 CONVERT_ARG_HANDLE_CHECKED(Smi, size_smi, 0); | |
| 9283 int size = size_smi->value(); | |
| 9284 RUNTIME_ASSERT(IsAligned(size, kPointerSize)); | |
| 9285 RUNTIME_ASSERT(size > 0); | |
| 9286 Heap* heap = isolate->heap(); | |
| 9287 Object* allocation; | |
| 9288 { MaybeObject* maybe_allocation = | |
| 9289 heap->old_data_space()->AllocateRaw(size); | |
| 9290 if (maybe_allocation->ToObject(&allocation)) { | |
| 9291 heap->CreateFillerObjectAt(HeapObject::cast(allocation)->address(), size); | |
| 9292 } | |
| 9293 return maybe_allocation; | |
|
mvstanton
2013/05/28 07:11:11
Aside from the assert involving MaxNewSpaceAllocat
Hannes Payer (out of office)
2013/05/28 09:06:07
Thanks for the suggestion. I refactored the code.
| |
| 9294 } | |
| 9295 } | |
| 9296 | |
| 9297 | |
| 9277 // Push an object unto an array of objects if it is not already in the | 9298 // Push an object unto an array of objects if it is not already in the |
| 9278 // array. Returns true if the element was pushed on the stack and | 9299 // array. Returns true if the element was pushed on the stack and |
| 9279 // false otherwise. | 9300 // false otherwise. |
| 9280 RUNTIME_FUNCTION(MaybeObject*, Runtime_PushIfAbsent) { | 9301 RUNTIME_FUNCTION(MaybeObject*, Runtime_PushIfAbsent) { |
| 9281 NoHandleAllocation ha(isolate); | 9302 NoHandleAllocation ha(isolate); |
| 9282 ASSERT(args.length() == 2); | 9303 ASSERT(args.length() == 2); |
| 9283 CONVERT_ARG_CHECKED(JSArray, array, 0); | 9304 CONVERT_ARG_CHECKED(JSArray, array, 0); |
| 9284 CONVERT_ARG_CHECKED(JSReceiver, element, 1); | 9305 CONVERT_ARG_CHECKED(JSReceiver, element, 1); |
| 9285 RUNTIME_ASSERT(array->HasFastSmiOrObjectElements()); | 9306 RUNTIME_ASSERT(array->HasFastSmiOrObjectElements()); |
| 9286 int length = Smi::cast(array->length())->value(); | 9307 int length = Smi::cast(array->length())->value(); |
| (...skipping 4227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13514 // Handle last resort GC and make sure to allow future allocations | 13535 // Handle last resort GC and make sure to allow future allocations |
| 13515 // to grow the heap without causing GCs (if possible). | 13536 // to grow the heap without causing GCs (if possible). |
| 13516 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13537 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13517 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13538 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13518 "Runtime::PerformGC"); | 13539 "Runtime::PerformGC"); |
| 13519 } | 13540 } |
| 13520 } | 13541 } |
| 13521 | 13542 |
| 13522 | 13543 |
| 13523 } } // namespace v8::internal | 13544 } } // namespace v8::internal |
| OLD | NEW |