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

Side by Side Diff: src/arm/assembler-arm-inl.h

Issue 7834018: Support compaction for code space pages. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: port changes from ia32 to arm & x64 Created 9 years, 3 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/arm/deoptimizer-arm.cc » ('j') | src/assembler.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); 67 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY);
68 return reinterpret_cast<Address>(Assembler::target_address_address_at(pc_)); 68 return reinterpret_cast<Address>(Assembler::target_address_address_at(pc_));
69 } 69 }
70 70
71 71
72 int RelocInfo::target_address_size() { 72 int RelocInfo::target_address_size() {
73 return Assembler::kExternalTargetSize; 73 return Assembler::kExternalTargetSize;
74 } 74 }
75 75
76 76
77 void RelocInfo::set_target_address(Address target, Code* code) { 77 void RelocInfo::set_target_address(Address target) {
78 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); 78 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY);
79 Assembler::set_target_address_at(pc_, target); 79 Assembler::set_target_address_at(pc_, target);
80 if (code != NULL && IsCodeTarget(rmode_)) { 80 if (host() != NULL && IsCodeTarget(rmode_)) {
81 Object* target_code = Code::GetCodeFromTargetAddress(target); 81 Object* target_code = Code::GetCodeFromTargetAddress(target);
82 // TODO(1550) We do not compact code pages. 82 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
83 code->GetHeap()->incremental_marking()->RecordWrite( 83 host(), this, HeapObject::cast(target_code));
84 code, NULL, HeapObject::cast(target_code));
85 } 84 }
86 } 85 }
87 86
88 87
89 Object* RelocInfo::target_object() { 88 Object* RelocInfo::target_object() {
90 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 89 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
91 return Memory::Object_at(Assembler::target_address_address_at(pc_)); 90 return Memory::Object_at(Assembler::target_address_address_at(pc_));
92 } 91 }
93 92
94 93
95 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { 94 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) {
96 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 95 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
97 return Memory::Object_Handle_at(Assembler::target_address_address_at(pc_)); 96 return Memory::Object_Handle_at(Assembler::target_address_address_at(pc_));
98 } 97 }
99 98
100 99
101 Object** RelocInfo::target_object_address() { 100 Object** RelocInfo::target_object_address() {
102 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 101 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
103 return reinterpret_cast<Object**>(Assembler::target_address_address_at(pc_)); 102 return reinterpret_cast<Object**>(Assembler::target_address_address_at(pc_));
104 } 103 }
105 104
106 105
107 void RelocInfo::set_target_object(Object* target, Code* code) { 106 void RelocInfo::set_target_object(Object* target) {
108 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 107 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
109 Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target)); 108 Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target));
110 if (code != NULL && target->IsHeapObject()) { 109 if (host() != NULL && target->IsHeapObject()) {
111 // It is safe to record this slot as a simple in object slot 110 host()->GetHeap()->incremental_marking()->RecordWrite(
112 // because it resides outside of code stream and updating it 111 host(), &Memory::Object_at(pc_), HeapObject::cast(target));
113 // does not require code cache flushing.
114 code->GetHeap()->incremental_marking()->RecordWrite(
115 code, target_object_address(), HeapObject::cast(target));
116 } 112 }
117 } 113 }
118 114
119 115
120 Address* RelocInfo::target_reference_address() { 116 Address* RelocInfo::target_reference_address() {
121 ASSERT(rmode_ == EXTERNAL_REFERENCE); 117 ASSERT(rmode_ == EXTERNAL_REFERENCE);
122 return reinterpret_cast<Address*>(Assembler::target_address_address_at(pc_)); 118 return reinterpret_cast<Address*>(Assembler::target_address_address_at(pc_));
123 } 119 }
124 120
125 121
126 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() { 122 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() {
127 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); 123 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL);
128 Address address = Memory::Address_at(pc_); 124 Address address = Memory::Address_at(pc_);
129 return Handle<JSGlobalPropertyCell>( 125 return Handle<JSGlobalPropertyCell>(
130 reinterpret_cast<JSGlobalPropertyCell**>(address)); 126 reinterpret_cast<JSGlobalPropertyCell**>(address));
131 } 127 }
132 128
133 129
134 JSGlobalPropertyCell* RelocInfo::target_cell() { 130 JSGlobalPropertyCell* RelocInfo::target_cell() {
135 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); 131 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL);
136 Address address = Memory::Address_at(pc_); 132 Address address = Memory::Address_at(pc_);
137 Object* object = HeapObject::FromAddress( 133 Object* object = HeapObject::FromAddress(
138 address - JSGlobalPropertyCell::kValueOffset); 134 address - JSGlobalPropertyCell::kValueOffset);
139 return reinterpret_cast<JSGlobalPropertyCell*>(object); 135 return reinterpret_cast<JSGlobalPropertyCell*>(object);
140 } 136 }
141 137
142 138
143 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell, Code* code) { 139 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell) {
144 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); 140 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL);
145 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; 141 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset;
146 Memory::Address_at(pc_) = address; 142 Memory::Address_at(pc_) = address;
147 if (code != NULL) { 143 if (host() != NULL) {
148 code->GetHeap()->incremental_marking()->RecordWrite( 144 // TODO(1550) We are passing NULL as a slot because cell can never be on
149 code, &Memory::Object_at(pc_), cell); 145 // evacuation candidate.
146 host()->GetHeap()->incremental_marking()->RecordWrite(
147 host(), NULL, cell);
150 } 148 }
151 } 149 }
152 150
153 151
154 Address RelocInfo::call_address() { 152 Address RelocInfo::call_address() {
155 // The 2 instructions offset assumes patched debug break slot or return 153 // The 2 instructions offset assumes patched debug break slot or return
156 // sequence. 154 // sequence.
157 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 155 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
158 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 156 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
159 return Memory::Address_at(pc_ + 2 * Assembler::kInstrSize); 157 return Memory::Address_at(pc_ + 2 * Assembler::kInstrSize);
160 } 158 }
161 159
162 160
163 void RelocInfo::set_call_address(Address target) { 161 void RelocInfo::set_call_address(Address target) {
164 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 162 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
165 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 163 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
166 Memory::Address_at(pc_ + 2 * Assembler::kInstrSize) = target; 164 Memory::Address_at(pc_ + 2 * Assembler::kInstrSize) = target;
165 if (host() != NULL) {
166 Object* target_code = Code::GetCodeFromTargetAddress(target);
167 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
168 host(), this, HeapObject::cast(target_code));
169 }
167 } 170 }
168 171
169 172
170 Object* RelocInfo::call_object() { 173 Object* RelocInfo::call_object() {
171 return *call_object_address(); 174 return *call_object_address();
172 } 175 }
173 176
174 177
175 void RelocInfo::set_call_object(Object* target) { 178 void RelocInfo::set_call_object(Object* target) {
176 *call_object_address() = target; 179 *call_object_address() = target;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // CPU::FlushICache(pc, sizeof(target)); 364 // CPU::FlushICache(pc, sizeof(target));
362 // However, on ARM, no instruction was actually patched by the assignment 365 // However, on ARM, no instruction was actually patched by the assignment
363 // above; the target address is not part of an instruction, it is patched in 366 // above; the target address is not part of an instruction, it is patched in
364 // the constant pool and is read via a data access; the instruction accessing 367 // the constant pool and is read via a data access; the instruction accessing
365 // this address in the constant pool remains unchanged. 368 // this address in the constant pool remains unchanged.
366 } 369 }
367 370
368 } } // namespace v8::internal 371 } } // namespace v8::internal
369 372
370 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_ 373 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_
OLDNEW
« no previous file with comments | « no previous file | src/arm/deoptimizer-arm.cc » ('j') | src/assembler.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698