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

Side by Side Diff: src/x64/assembler-x64-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
OLDNEW
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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 int RelocInfo::target_address_size() { 232 int RelocInfo::target_address_size() {
233 if (IsCodedSpecially()) { 233 if (IsCodedSpecially()) {
234 return Assembler::kCallTargetSize; 234 return Assembler::kCallTargetSize;
235 } else { 235 } else {
236 return Assembler::kExternalTargetSize; 236 return Assembler::kExternalTargetSize;
237 } 237 }
238 } 238 }
239 239
240 240
241 void RelocInfo::set_target_address(Address target, Code* code) { 241 void RelocInfo::set_target_address(Address target) {
242 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); 242 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY);
243 if (IsCodeTarget(rmode_)) { 243 if (IsCodeTarget(rmode_)) {
244 Assembler::set_target_address_at(pc_, target); 244 Assembler::set_target_address_at(pc_, target);
245 Object* target_code = Code::GetCodeFromTargetAddress(target); 245 Object* target_code = Code::GetCodeFromTargetAddress(target);
246 if (code != NULL) { 246 if (host() != NULL) {
247 // TODO(1550) We are passing NULL as a slot because code can never be on 247 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
248 // evacuation candidate. 248 host(), this, HeapObject::cast(target_code));
249 code->GetHeap()->incremental_marking()->RecordWrite(
250 code, NULL, HeapObject::cast(target_code));
251 } 249 }
252 } else { 250 } else {
253 Memory::Address_at(pc_) = target; 251 Memory::Address_at(pc_) = target;
254 CPU::FlushICache(pc_, sizeof(Address)); 252 CPU::FlushICache(pc_, sizeof(Address));
255 } 253 }
256 } 254 }
257 255
258 256
259 Object* RelocInfo::target_object() { 257 Object* RelocInfo::target_object() {
260 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 258 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
(...skipping 16 matching lines...) Expand all
277 return reinterpret_cast<Object**>(pc_); 275 return reinterpret_cast<Object**>(pc_);
278 } 276 }
279 277
280 278
281 Address* RelocInfo::target_reference_address() { 279 Address* RelocInfo::target_reference_address() {
282 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE); 280 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE);
283 return reinterpret_cast<Address*>(pc_); 281 return reinterpret_cast<Address*>(pc_);
284 } 282 }
285 283
286 284
287 void RelocInfo::set_target_object(Object* target, Code* code) { 285 void RelocInfo::set_target_object(Object* target) {
288 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 286 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
289 Memory::Object_at(pc_) = target; 287 Memory::Object_at(pc_) = target;
290 CPU::FlushICache(pc_, sizeof(Address)); 288 CPU::FlushICache(pc_, sizeof(Address));
291 if (code != NULL && target->IsHeapObject()) { 289 if (host() != NULL && target->IsHeapObject()) {
292 code->GetHeap()->incremental_marking()->RecordWrite( 290 host()->GetHeap()->incremental_marking()->RecordWrite(
293 code, &Memory::Object_at(pc_), HeapObject::cast(target)); 291 host(), &Memory::Object_at(pc_), HeapObject::cast(target));
294 } 292 }
295 } 293 }
296 294
297 295
298 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() { 296 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() {
299 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); 297 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL);
300 Address address = Memory::Address_at(pc_); 298 Address address = Memory::Address_at(pc_);
301 return Handle<JSGlobalPropertyCell>( 299 return Handle<JSGlobalPropertyCell>(
302 reinterpret_cast<JSGlobalPropertyCell**>(address)); 300 reinterpret_cast<JSGlobalPropertyCell**>(address));
303 } 301 }
304 302
305 303
306 JSGlobalPropertyCell* RelocInfo::target_cell() { 304 JSGlobalPropertyCell* RelocInfo::target_cell() {
307 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); 305 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL);
308 Address address = Memory::Address_at(pc_); 306 Address address = Memory::Address_at(pc_);
309 Object* object = HeapObject::FromAddress( 307 Object* object = HeapObject::FromAddress(
310 address - JSGlobalPropertyCell::kValueOffset); 308 address - JSGlobalPropertyCell::kValueOffset);
311 return reinterpret_cast<JSGlobalPropertyCell*>(object); 309 return reinterpret_cast<JSGlobalPropertyCell*>(object);
312 } 310 }
313 311
314 312
315 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell, Code* code) { 313 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell) {
316 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); 314 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL);
317 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; 315 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset;
318 Memory::Address_at(pc_) = address; 316 Memory::Address_at(pc_) = address;
319 CPU::FlushICache(pc_, sizeof(Address)); 317 CPU::FlushICache(pc_, sizeof(Address));
320 if (code != NULL) { 318 if (host() != NULL) {
321 code->GetHeap()->incremental_marking()->RecordWrite( 319 // TODO(1550) We are passing NULL as a slot because cell can never be on
322 code, &Memory::Object_at(pc_), cell); 320 // evacuation candidate.
321 host()->GetHeap()->incremental_marking()->RecordWrite(
322 host(), NULL, cell);
323 } 323 }
324 } 324 }
325 325
326 326
327 bool RelocInfo::IsPatchedReturnSequence() { 327 bool RelocInfo::IsPatchedReturnSequence() {
328 // The recognized call sequence is: 328 // The recognized call sequence is:
329 // movq(kScratchRegister, immediate64); call(kScratchRegister); 329 // movq(kScratchRegister, immediate64); call(kScratchRegister);
330 // It only needs to be distinguished from a return sequence 330 // It only needs to be distinguished from a return sequence
331 // movq(rsp, rbp); pop(rbp); ret(n); int3 *6 331 // movq(rsp, rbp); pop(rbp); ret(n); int3 *6
332 // The 11th byte is int3 (0xCC) in the return sequence and 332 // The 11th byte is int3 (0xCC) in the return sequence and
(...skipping 19 matching lines...) Expand all
352 } 352 }
353 353
354 354
355 void RelocInfo::set_call_address(Address target) { 355 void RelocInfo::set_call_address(Address target) {
356 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 356 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
357 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 357 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
358 Memory::Address_at(pc_ + Assembler::kRealPatchReturnSequenceAddressOffset) = 358 Memory::Address_at(pc_ + Assembler::kRealPatchReturnSequenceAddressOffset) =
359 target; 359 target;
360 CPU::FlushICache(pc_ + Assembler::kRealPatchReturnSequenceAddressOffset, 360 CPU::FlushICache(pc_ + Assembler::kRealPatchReturnSequenceAddressOffset,
361 sizeof(Address)); 361 sizeof(Address));
362 if (host() != NULL) {
363 Object* target_code = Code::GetCodeFromTargetAddress(target);
364 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
365 host(), this, HeapObject::cast(target_code));
366 }
362 } 367 }
363 368
364 369
365 Object* RelocInfo::call_object() { 370 Object* RelocInfo::call_object() {
366 return *call_object_address(); 371 return *call_object_address();
367 } 372 }
368 373
369 374
370 void RelocInfo::set_call_object(Object* target) { 375 void RelocInfo::set_call_object(Object* target) {
371 *call_object_address() = target; 376 *call_object_address() = target;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 ASSERT(len_ == 1 || len_ == 2); 473 ASSERT(len_ == 1 || len_ == 2);
469 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); 474 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]);
470 *p = disp; 475 *p = disp;
471 len_ += sizeof(int32_t); 476 len_ += sizeof(int32_t);
472 } 477 }
473 478
474 479
475 } } // namespace v8::internal 480 } } // namespace v8::internal
476 481
477 #endif // V8_X64_ASSEMBLER_X64_INL_H_ 482 #endif // V8_X64_ASSEMBLER_X64_INL_H_
OLDNEW
« src/spaces.h ('K') | « src/spaces.h ('k') | src/x64/deoptimizer-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698