| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_HEAP_H_ | 5 #ifndef V8_HEAP_H_ |
| 6 #define V8_HEAP_H_ | 6 #define V8_HEAP_H_ |
| 7 | 7 |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "allocation.h" | 10 #include "allocation.h" |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 return old_pointer_space_->allocation_limit_address(); | 675 return old_pointer_space_->allocation_limit_address(); |
| 676 } | 676 } |
| 677 | 677 |
| 678 Address* OldDataSpaceAllocationTopAddress() { | 678 Address* OldDataSpaceAllocationTopAddress() { |
| 679 return old_data_space_->allocation_top_address(); | 679 return old_data_space_->allocation_top_address(); |
| 680 } | 680 } |
| 681 Address* OldDataSpaceAllocationLimitAddress() { | 681 Address* OldDataSpaceAllocationLimitAddress() { |
| 682 return old_data_space_->allocation_limit_address(); | 682 return old_data_space_->allocation_limit_address(); |
| 683 } | 683 } |
| 684 | 684 |
| 685 // Heap access methods. |
| 686 INLINE(static Object* read_field(HeapObject* p, int offset)); |
| 687 INLINE(static intptr_t read_intptr_field(HeapObject* p, int offset)); |
| 688 INLINE(static int read_int_field(HeapObject* p, int offset)); |
| 689 INLINE(static int32_t read_int32_field(HeapObject* p, int offset)); |
| 690 INLINE(static uint32_t read_uint32_field(HeapObject* p, int offset)); |
| 691 INLINE(static int64_t read_int64_field(HeapObject* p, int offset)); |
| 692 INLINE(static int16_t read_short_field(HeapObject* p, int offset)); |
| 693 INLINE(static byte read_byte_field(HeapObject* p, int offset)); |
| 694 INLINE(static double read_double_field(HeapObject* p, int offset)); |
| 695 |
| 696 |
| 697 INLINE(static void write_intptr_field(HeapObject* p, |
| 698 int offset, |
| 699 intptr_t value)); |
| 700 INLINE(static void write_int_field(HeapObject* p, |
| 701 int offset, |
| 702 int value)); |
| 703 INLINE(static void write_int32_field(HeapObject* p, |
| 704 int offset, |
| 705 int32_t value)); |
| 706 INLINE(static void write_uint32_field(HeapObject* p, |
| 707 int offset, |
| 708 uint32_t value)); |
| 709 INLINE(static void write_int64_field(HeapObject* p, |
| 710 int offset, |
| 711 int64_t value)); |
| 712 INLINE(static void write_short_field(HeapObject* p, |
| 713 int offset, |
| 714 int16_t value)); |
| 715 INLINE(static void write_byte_field(HeapObject* p, |
| 716 int offset, |
| 717 byte value)); |
| 718 INLINE(static void write_double_field(HeapObject* p, |
| 719 int offset, |
| 720 double value)); |
| 721 |
| 722 // TODO(jarin) expose the barrier reason here |
| 723 INLINE(static void write_field(HeapObject* p, |
| 724 int offset, |
| 725 Object* value, |
| 726 WriteBarrierMode mode)); |
| 727 |
| 728 // TODO(jarin) replace this with variants that do not expose |
| 729 // internal pointers. |
| 730 INLINE(static Address get_field_address(HeapObject* p, int offset)); |
| 731 |
| 732 // TODO(jarin) synchronized flavors of the field accesses should be |
| 733 // wrapped so that we do not expose the sync. |
| 734 INLINE(static Object* acquire_read_field(HeapObject* p, int offset)); |
| 735 INLINE(static Object* nobarrier_read_field(HeapObject* p, int offset)); |
| 736 INLINE(static void release_write_field(HeapObject* p, |
| 737 int offset, |
| 738 Object* value)); |
| 739 INLINE(static void nobarrier_write_field(HeapObject* p, |
| 740 int offset, |
| 741 Object* value)); |
| 742 INLINE(static byte nobarrier_read_byte_field(HeapObject* p, int offset)); |
| 743 INLINE(static void nobarrier_write_byte_field(HeapObject* p, |
| 744 int offset, |
| 745 byte value)); |
| 746 |
| 685 // Returns a deep copy of the JavaScript object. | 747 // Returns a deep copy of the JavaScript object. |
| 686 // Properties and elements are copied too. | 748 // Properties and elements are copied too. |
| 687 // Returns failure if allocation failed. | 749 // Returns failure if allocation failed. |
| 688 // Optionally takes an AllocationSite to be appended in an AllocationMemento. | 750 // Optionally takes an AllocationSite to be appended in an AllocationMemento. |
| 689 MUST_USE_RESULT MaybeObject* CopyJSObject(JSObject* source, | 751 MUST_USE_RESULT MaybeObject* CopyJSObject(JSObject* source, |
| 690 AllocationSite* site = NULL); | 752 AllocationSite* site = NULL); |
| 691 | 753 |
| 692 // Clear the Instanceof cache (used when a prototype changes). | 754 // Clear the Instanceof cache (used when a prototype changes). |
| 693 inline void ClearInstanceofCache(); | 755 inline void ClearInstanceofCache(); |
| 694 | 756 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 | 1070 |
| 1009 void TracePathToObjectFrom(Object* target, Object* root); | 1071 void TracePathToObjectFrom(Object* target, Object* root); |
| 1010 void TracePathToObject(Object* target); | 1072 void TracePathToObject(Object* target); |
| 1011 void TracePathToGlobal(); | 1073 void TracePathToGlobal(); |
| 1012 #endif | 1074 #endif |
| 1013 | 1075 |
| 1014 // Callback function passed to Heap::Iterate etc. Copies an object if | 1076 // Callback function passed to Heap::Iterate etc. Copies an object if |
| 1015 // necessary, the object might be promoted to an old space. The caller must | 1077 // necessary, the object might be promoted to an old space. The caller must |
| 1016 // ensure the precondition that the object is (a) a heap object and (b) in | 1078 // ensure the precondition that the object is (a) a heap object and (b) in |
| 1017 // the heap's from space. | 1079 // the heap's from space. |
| 1018 static inline void ScavengePointer(HeapObject** p); | |
| 1019 static inline void ScavengeObject(HeapObject** p, HeapObject* object); | 1080 static inline void ScavengeObject(HeapObject** p, HeapObject* object); |
| 1020 | 1081 |
| 1021 enum ScratchpadSlotMode { | 1082 enum ScratchpadSlotMode { |
| 1022 IGNORE_SCRATCHPAD_SLOT, | 1083 IGNORE_SCRATCHPAD_SLOT, |
| 1023 RECORD_SCRATCHPAD_SLOT | 1084 RECORD_SCRATCHPAD_SLOT |
| 1024 }; | 1085 }; |
| 1025 | 1086 |
| 1026 // If an object has an AllocationMemento trailing it, return it, otherwise | 1087 // If an object has an AllocationMemento trailing it, return it, otherwise |
| 1027 // return NULL; | 1088 // return NULL; |
| 1028 inline AllocationMemento* FindAllocationMemento(HeapObject* object); | 1089 inline AllocationMemento* FindAllocationMemento(HeapObject* object); |
| (...skipping 1781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2810 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2871 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2811 | 2872 |
| 2812 private: | 2873 private: |
| 2813 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2874 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2814 }; | 2875 }; |
| 2815 #endif // DEBUG | 2876 #endif // DEBUG |
| 2816 | 2877 |
| 2817 } } // namespace v8::internal | 2878 } } // namespace v8::internal |
| 2818 | 2879 |
| 2819 #endif // V8_HEAP_H_ | 2880 #endif // V8_HEAP_H_ |
| OLD | NEW |