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

Side by Side Diff: src/heap.h

Issue 253293003: Replace heap object access macros with functions and move them to the heap class (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 months 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 | src/heap-inl.h » ('j') | src/objects-inl.h » ('J')
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 // 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
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 static inline Object* read_field(HeapObject* p, int offset);
Hannes Payer (out of office) 2014/04/30 07:47:25 Our INLINE macro may force inlining of these funct
687 static inline intptr_t read_intptr_field(HeapObject* p, int offset);
688 static inline int read_int_field(HeapObject* p, int offset);
689 static inline int32_t read_int32_field(HeapObject* p, int offset);
690 static inline uint32_t read_uint32_field(HeapObject* p, int offset);
691 static inline int64_t read_int64_field(HeapObject* p, int offset);
692 static inline int16_t read_short_field(HeapObject* p, int offset);
693 static inline byte read_byte_field(HeapObject* p, int offset);
694 static inline double read_double_field(HeapObject* p, int offset);
695
696
697 static inline void write_intptr_field(HeapObject* p,
698 int offset,
699 intptr_t value);
700 static inline void write_int_field(HeapObject* p,
701 int offset,
702 int value);
703 static inline void write_int32_field(HeapObject* p,
704 int offset,
705 int32_t value);
706 static inline void write_uint32_field(HeapObject* p,
707 int offset,
708 uint32_t value);
709 static inline void write_int64_field(HeapObject* p,
710 int offset,
711 int64_t value);
712 static inline void write_short_field(HeapObject* p,
713 int offset,
714 int16_t value);
715 static inline void write_byte_field(HeapObject* p,
716 int offset,
717 byte value);
718 static inline void write_double_field(HeapObject* p,
719 int offset,
720 double value);
721
722 // TODO(jarin) expose the barrier reason here
723 static inline 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 static inline 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 static inline Object* acquire_read_field(HeapObject* p, int offset);
735 static inline Object* nobarrier_read_field(HeapObject* p, int offset);
736 static inline void release_write_field(HeapObject* p,
737 int offset,
738 Object* value);
739 static inline void nobarrier_write_field(HeapObject* p,
740 int offset,
741 Object* value);
742 static inline byte nobarrier_read_byte_field(HeapObject* p, int offset);
743 static inline 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
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
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_
OLDNEW
« no previous file with comments | « no previous file | src/heap-inl.h » ('j') | src/objects-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698