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

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

Issue 1005183006: Serializer: serialize internal references via object visitor. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix compilation Created 5 years, 9 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
« no previous file with comments | « src/arm/assembler-arm.h ('k') | src/arm64/assembler-arm64.h » ('j') | no next file with comments »
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
115 115
116 116
117 Address RelocInfo::target_address_address() { 117 Address RelocInfo::target_address_address() {
118 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) 118 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)
119 || rmode_ == EMBEDDED_OBJECT 119 || rmode_ == EMBEDDED_OBJECT
120 || rmode_ == EXTERNAL_REFERENCE); 120 || rmode_ == EXTERNAL_REFERENCE);
121 if (FLAG_enable_ool_constant_pool || 121 if (FLAG_enable_ool_constant_pool ||
122 Assembler::IsMovW(Memory::int32_at(pc_))) { 122 Assembler::IsMovW(Memory::int32_at(pc_))) {
123 // We return the PC for ool constant pool since this function is used by the 123 // We return the PC for ool constant pool since this function is used by the
124 // serializerer and expects the address to reside within the code object. 124 // serializer and expects the address to reside within the code object.
125 return reinterpret_cast<Address>(pc_); 125 return reinterpret_cast<Address>(pc_);
126 } else { 126 } else {
127 DCHECK(Assembler::IsLdrPcImmediateOffset(Memory::int32_at(pc_))); 127 DCHECK(Assembler::IsLdrPcImmediateOffset(Memory::int32_at(pc_)));
128 return constant_pool_entry_address(); 128 return constant_pool_entry_address();
129 } 129 }
130 } 130 }
131 131
132 132
133 Address RelocInfo::constant_pool_entry_address() { 133 Address RelocInfo::constant_pool_entry_address() {
134 DCHECK(IsInConstantPool()); 134 DCHECK(IsInConstantPool());
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 return Assembler::target_address_at(pc_, host_); 189 return Assembler::target_address_at(pc_, host_);
190 } 190 }
191 191
192 192
193 Address RelocInfo::target_internal_reference() { 193 Address RelocInfo::target_internal_reference() {
194 DCHECK(rmode_ == INTERNAL_REFERENCE); 194 DCHECK(rmode_ == INTERNAL_REFERENCE);
195 return Memory::Address_at(pc_); 195 return Memory::Address_at(pc_);
196 } 196 }
197 197
198 198
199 void RelocInfo::set_target_internal_reference(Address target) { 199 Address RelocInfo::target_internal_reference_address() {
200 DCHECK(rmode_ == INTERNAL_REFERENCE); 200 DCHECK(rmode_ == INTERNAL_REFERENCE);
201 Memory::Address_at(pc_) = target; 201 return reinterpret_cast<Address>(pc_);
202 } 202 }
203 203
204 204
205 Address RelocInfo::target_runtime_entry(Assembler* origin) { 205 Address RelocInfo::target_runtime_entry(Assembler* origin) {
206 DCHECK(IsRuntimeEntry(rmode_)); 206 DCHECK(IsRuntimeEntry(rmode_));
207 return target_address(); 207 return target_address();
208 } 208 }
209 209
210 210
211 void RelocInfo::set_target_runtime_entry(Address target, 211 void RelocInfo::set_target_runtime_entry(Address target,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 303
304 304
305 Object** RelocInfo::call_object_address() { 305 Object** RelocInfo::call_object_address() {
306 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 306 DCHECK((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
307 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 307 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
308 return reinterpret_cast<Object**>(pc_ + 2 * Assembler::kInstrSize); 308 return reinterpret_cast<Object**>(pc_ + 2 * Assembler::kInstrSize);
309 } 309 }
310 310
311 311
312 void RelocInfo::WipeOut() { 312 void RelocInfo::WipeOut() {
313 DCHECK(IsEmbeddedObject(rmode_) || 313 DCHECK(IsEmbeddedObject(rmode_) || IsCodeTarget(rmode_) ||
314 IsCodeTarget(rmode_) || 314 IsRuntimeEntry(rmode_) || IsExternalReference(rmode_) ||
315 IsRuntimeEntry(rmode_) || 315 IsInternalReference(rmode_));
316 IsExternalReference(rmode_)); 316 if (IsInternalReference(rmode_)) {
317 Assembler::set_target_address_at(pc_, host_, NULL); 317 Memory::Address_at(pc_) = NULL;
318 } else {
319 Assembler::set_target_address_at(pc_, host_, NULL);
320 }
318 } 321 }
319 322
320 323
321 bool RelocInfo::IsPatchedReturnSequence() { 324 bool RelocInfo::IsPatchedReturnSequence() {
322 Instr current_instr = Assembler::instr_at(pc_); 325 Instr current_instr = Assembler::instr_at(pc_);
323 Instr next_instr = Assembler::instr_at(pc_ + Assembler::kInstrSize); 326 Instr next_instr = Assembler::instr_at(pc_ + Assembler::kInstrSize);
324 // A patched return sequence is: 327 // A patched return sequence is:
325 // ldr ip, [pc, #0] 328 // ldr ip, [pc, #0]
326 // blx ip 329 // blx ip
327 return Assembler::IsLdrPcImmediateOffset(current_instr) && 330 return Assembler::IsLdrPcImmediateOffset(current_instr) &&
(...skipping 10 matching lines...) Expand all
338 void RelocInfo::Visit(Isolate* isolate, ObjectVisitor* visitor) { 341 void RelocInfo::Visit(Isolate* isolate, ObjectVisitor* visitor) {
339 RelocInfo::Mode mode = rmode(); 342 RelocInfo::Mode mode = rmode();
340 if (mode == RelocInfo::EMBEDDED_OBJECT) { 343 if (mode == RelocInfo::EMBEDDED_OBJECT) {
341 visitor->VisitEmbeddedPointer(this); 344 visitor->VisitEmbeddedPointer(this);
342 } else if (RelocInfo::IsCodeTarget(mode)) { 345 } else if (RelocInfo::IsCodeTarget(mode)) {
343 visitor->VisitCodeTarget(this); 346 visitor->VisitCodeTarget(this);
344 } else if (mode == RelocInfo::CELL) { 347 } else if (mode == RelocInfo::CELL) {
345 visitor->VisitCell(this); 348 visitor->VisitCell(this);
346 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 349 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
347 visitor->VisitExternalReference(this); 350 visitor->VisitExternalReference(this);
351 } else if (mode == RelocInfo::INTERNAL_REFERENCE) {
352 visitor->VisitInternalReference(this);
348 } else if (RelocInfo::IsCodeAgeSequence(mode)) { 353 } else if (RelocInfo::IsCodeAgeSequence(mode)) {
349 visitor->VisitCodeAgeSequence(this); 354 visitor->VisitCodeAgeSequence(this);
350 } else if (((RelocInfo::IsJSReturn(mode) && 355 } else if (((RelocInfo::IsJSReturn(mode) &&
351 IsPatchedReturnSequence()) || 356 IsPatchedReturnSequence()) ||
352 (RelocInfo::IsDebugBreakSlot(mode) && 357 (RelocInfo::IsDebugBreakSlot(mode) &&
353 IsPatchedDebugBreakSlotSequence())) && 358 IsPatchedDebugBreakSlotSequence())) &&
354 isolate->debug()->has_break_points()) { 359 isolate->debug()->has_break_points()) {
355 visitor->VisitDebugTarget(this); 360 visitor->VisitDebugTarget(this);
356 } else if (RelocInfo::IsRuntimeEntry(mode)) { 361 } else if (RelocInfo::IsRuntimeEntry(mode)) {
357 visitor->VisitRuntimeEntry(this); 362 visitor->VisitRuntimeEntry(this);
358 } 363 }
359 } 364 }
360 365
361 366
362 template<typename StaticVisitor> 367 template<typename StaticVisitor>
363 void RelocInfo::Visit(Heap* heap) { 368 void RelocInfo::Visit(Heap* heap) {
364 RelocInfo::Mode mode = rmode(); 369 RelocInfo::Mode mode = rmode();
365 if (mode == RelocInfo::EMBEDDED_OBJECT) { 370 if (mode == RelocInfo::EMBEDDED_OBJECT) {
366 StaticVisitor::VisitEmbeddedPointer(heap, this); 371 StaticVisitor::VisitEmbeddedPointer(heap, this);
367 } else if (RelocInfo::IsCodeTarget(mode)) { 372 } else if (RelocInfo::IsCodeTarget(mode)) {
368 StaticVisitor::VisitCodeTarget(heap, this); 373 StaticVisitor::VisitCodeTarget(heap, this);
369 } else if (mode == RelocInfo::CELL) { 374 } else if (mode == RelocInfo::CELL) {
370 StaticVisitor::VisitCell(heap, this); 375 StaticVisitor::VisitCell(heap, this);
371 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 376 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
372 StaticVisitor::VisitExternalReference(this); 377 StaticVisitor::VisitExternalReference(this);
378 } else if (mode == RelocInfo::INTERNAL_REFERENCE) {
379 StaticVisitor::VisitInternalReference(this);
373 } else if (RelocInfo::IsCodeAgeSequence(mode)) { 380 } else if (RelocInfo::IsCodeAgeSequence(mode)) {
374 StaticVisitor::VisitCodeAgeSequence(heap, this); 381 StaticVisitor::VisitCodeAgeSequence(heap, this);
375 } else if (heap->isolate()->debug()->has_break_points() && 382 } else if (heap->isolate()->debug()->has_break_points() &&
376 ((RelocInfo::IsJSReturn(mode) && 383 ((RelocInfo::IsJSReturn(mode) &&
377 IsPatchedReturnSequence()) || 384 IsPatchedReturnSequence()) ||
378 (RelocInfo::IsDebugBreakSlot(mode) && 385 (RelocInfo::IsDebugBreakSlot(mode) &&
379 IsPatchedDebugBreakSlotSequence()))) { 386 IsPatchedDebugBreakSlotSequence()))) {
380 StaticVisitor::VisitDebugTarget(heap, this); 387 StaticVisitor::VisitDebugTarget(heap, this);
381 } else if (RelocInfo::IsRuntimeEntry(mode)) { 388 } else if (RelocInfo::IsRuntimeEntry(mode)) {
382 StaticVisitor::VisitRuntimeEntry(this); 389 StaticVisitor::VisitRuntimeEntry(this);
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 void Assembler::deserialization_set_special_target_at( 546 void Assembler::deserialization_set_special_target_at(
540 Address constant_pool_entry, Code* code, Address target) { 547 Address constant_pool_entry, Code* code, Address target) {
541 if (FLAG_enable_ool_constant_pool) { 548 if (FLAG_enable_ool_constant_pool) {
542 set_target_address_at(constant_pool_entry, code, target); 549 set_target_address_at(constant_pool_entry, code, target);
543 } else { 550 } else {
544 Memory::Address_at(constant_pool_entry) = target; 551 Memory::Address_at(constant_pool_entry) = target;
545 } 552 }
546 } 553 }
547 554
548 555
556 void Assembler::deserialization_set_target_internal_reference_at(
557 Address pc, Address target) {
558 Memory::Address_at(pc) = target;
559 }
560
561
549 bool Assembler::is_constant_pool_load(Address pc) { 562 bool Assembler::is_constant_pool_load(Address pc) {
550 if (CpuFeatures::IsSupported(ARMv7)) { 563 if (CpuFeatures::IsSupported(ARMv7)) {
551 return !Assembler::IsMovW(Memory::int32_at(pc)) || 564 return !Assembler::IsMovW(Memory::int32_at(pc)) ||
552 (FLAG_enable_ool_constant_pool && 565 (FLAG_enable_ool_constant_pool &&
553 Assembler::IsLdrPpRegOffset( 566 Assembler::IsLdrPpRegOffset(
554 Memory::int32_at(pc + 2 * Assembler::kInstrSize))); 567 Memory::int32_at(pc + 2 * Assembler::kInstrSize)));
555 } else { 568 } else {
556 return !Assembler::IsMovImmed(Memory::int32_at(pc)) || 569 return !Assembler::IsMovImmed(Memory::int32_at(pc)) ||
557 (FLAG_enable_ool_constant_pool && 570 (FLAG_enable_ool_constant_pool &&
558 Assembler::IsLdrPpRegOffset( 571 Assembler::IsLdrPpRegOffset(
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { 694 if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
682 CpuFeatures::FlushICache(pc, 4 * kInstrSize); 695 CpuFeatures::FlushICache(pc, 4 * kInstrSize);
683 } 696 }
684 } 697 }
685 } 698 }
686 699
687 700
688 } } // namespace v8::internal 701 } } // namespace v8::internal
689 702
690 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_ 703 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.h ('k') | src/arm64/assembler-arm64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698