| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2622 | 2622 |
| 2623 // Materialize the value in the heap. | 2623 // Materialize the value in the heap. |
| 2624 return AllocateHeapNumber(value, pretenure); | 2624 return AllocateHeapNumber(value, pretenure); |
| 2625 } | 2625 } |
| 2626 | 2626 |
| 2627 | 2627 |
| 2628 MaybeObject* Heap::AllocateForeign(Address address, PretenureFlag pretenure) { | 2628 MaybeObject* Heap::AllocateForeign(Address address, PretenureFlag pretenure) { |
| 2629 // Statically ensure that it is safe to allocate foreigns in paged spaces. | 2629 // Statically ensure that it is safe to allocate foreigns in paged spaces. |
| 2630 STATIC_ASSERT(Foreign::kSize <= Page::kMaxHeapObjectSize); | 2630 STATIC_ASSERT(Foreign::kSize <= Page::kMaxHeapObjectSize); |
| 2631 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; | 2631 AllocationSpace space = (pretenure == TENURED) ? OLD_DATA_SPACE : NEW_SPACE; |
| 2632 Object* result; | 2632 Foreign* result; |
| 2633 { MaybeObject* maybe_result = Allocate(foreign_map(), space); | 2633 MaybeObject* maybe_result = Allocate(foreign_map(), space); |
| 2634 if (!maybe_result->ToObject(&result)) return maybe_result; | 2634 if (!maybe_result->To(&result)) return maybe_result; |
| 2635 } | 2635 result->set_foreign_address(address); |
| 2636 | |
| 2637 Foreign::cast(result)->set_address(address); | |
| 2638 return result; | 2636 return result; |
| 2639 } | 2637 } |
| 2640 | 2638 |
| 2641 | 2639 |
| 2642 MaybeObject* Heap::AllocateSharedFunctionInfo(Object* name) { | 2640 MaybeObject* Heap::AllocateSharedFunctionInfo(Object* name) { |
| 2643 SharedFunctionInfo* share; | 2641 SharedFunctionInfo* share; |
| 2644 MaybeObject* maybe = Allocate(shared_function_info_map(), OLD_POINTER_SPACE); | 2642 MaybeObject* maybe = Allocate(shared_function_info_map(), OLD_POINTER_SPACE); |
| 2645 if (!maybe->To<SharedFunctionInfo>(&share)) return maybe; | 2643 if (!maybe->To<SharedFunctionInfo>(&share)) return maybe; |
| 2646 | 2644 |
| 2647 // Set pointer fields. | 2645 // Set pointer fields. |
| (...skipping 3763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6411 isolate_->heap()->store_buffer()->Compact(); | 6409 isolate_->heap()->store_buffer()->Compact(); |
| 6412 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6410 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
| 6413 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6411 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
| 6414 next = chunk->next_chunk(); | 6412 next = chunk->next_chunk(); |
| 6415 isolate_->memory_allocator()->Free(chunk); | 6413 isolate_->memory_allocator()->Free(chunk); |
| 6416 } | 6414 } |
| 6417 chunks_queued_for_free_ = NULL; | 6415 chunks_queued_for_free_ = NULL; |
| 6418 } | 6416 } |
| 6419 | 6417 |
| 6420 } } // namespace v8::internal | 6418 } } // namespace v8::internal |
| OLD | NEW |