OLD | NEW |
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 are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 static const int kMaxCallSize = 6; | 357 static const int kMaxCallSize = 6; |
358 | 358 |
359 // The maximum pc delta that will use the short encoding. | 359 // The maximum pc delta that will use the short encoding. |
360 static const int kMaxSmallPCDelta; | 360 static const int kMaxSmallPCDelta; |
361 | 361 |
362 enum Mode { | 362 enum Mode { |
363 // Please note the order is important (see IsCodeTarget, IsGCRelocMode). | 363 // Please note the order is important (see IsCodeTarget, IsGCRelocMode). |
364 CODE_TARGET, // Code target which is not any of the above. | 364 CODE_TARGET, // Code target which is not any of the above. |
365 CODE_TARGET_WITH_ID, | 365 CODE_TARGET_WITH_ID, |
366 CONSTRUCT_CALL, // code target that is a call to a JavaScript constructor. | 366 CONSTRUCT_CALL, // code target that is a call to a JavaScript constructor. |
367 DEBUG_BREAK, // Code target for the debugger statement. | 367 DEBUGGER_STATEMENT, // Code target for the debugger statement. |
368 EMBEDDED_OBJECT, | 368 EMBEDDED_OBJECT, |
369 CELL, | 369 CELL, |
370 | 370 |
371 // Everything after runtime_entry (inclusive) is not GC'ed. | 371 // Everything after runtime_entry (inclusive) is not GC'ed. |
372 RUNTIME_ENTRY, | 372 RUNTIME_ENTRY, |
373 JS_RETURN, // Marks start of the ExitJSFrame code. | 373 JS_RETURN, // Marks start of the ExitJSFrame code. |
374 COMMENT, | 374 COMMENT, |
375 POSITION, // See comment for kNoPosition above. | 375 POSITION, // See comment for kNoPosition above. |
376 STATEMENT_POSITION, // See comment for kNoPosition above. | 376 STATEMENT_POSITION, // See comment for kNoPosition above. |
377 DEBUG_BREAK_SLOT, // Additional code inserted for debug break slot. | 377 |
| 378 // Additional code inserted for debug break slot. |
| 379 DEBUG_BREAK_SLOT_AT_POSITION, |
| 380 DEBUG_BREAK_SLOT_AT_CALL, |
| 381 DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL, |
| 382 |
378 EXTERNAL_REFERENCE, // The address of an external C++ function. | 383 EXTERNAL_REFERENCE, // The address of an external C++ function. |
379 INTERNAL_REFERENCE, // An address inside the same function. | 384 INTERNAL_REFERENCE, // An address inside the same function. |
380 | 385 |
381 // Encoded internal reference, used only on MIPS, MIPS64 and PPC. | 386 // Encoded internal reference, used only on MIPS, MIPS64 and PPC. |
382 INTERNAL_REFERENCE_ENCODED, | 387 INTERNAL_REFERENCE_ENCODED, |
383 | 388 |
384 // Marks constant and veneer pools. Only used on ARM and ARM64. | 389 // Marks constant and veneer pools. Only used on ARM and ARM64. |
385 // They use a custom noncompact encoding. | 390 // They use a custom noncompact encoding. |
386 CONST_POOL, | 391 CONST_POOL, |
387 VENEER_POOL, | 392 VENEER_POOL, |
388 | 393 |
389 DEOPT_REASON, // Deoptimization reason index. | 394 DEOPT_REASON, // Deoptimization reason index. |
390 | 395 |
391 // This is not an actual reloc mode, but used to encode a long pc jump that | 396 // This is not an actual reloc mode, but used to encode a long pc jump that |
392 // cannot be encoded as part of another record. | 397 // cannot be encoded as part of another record. |
393 PC_JUMP, | 398 PC_JUMP, |
394 | 399 |
395 // Pseudo-types | 400 // Pseudo-types |
396 NUMBER_OF_MODES, | 401 NUMBER_OF_MODES, |
397 NONE32, // never recorded 32-bit value | 402 NONE32, // never recorded 32-bit value |
398 NONE64, // never recorded 64-bit value | 403 NONE64, // never recorded 64-bit value |
399 CODE_AGE_SEQUENCE, // Not stored in RelocInfo array, used explictly by | 404 CODE_AGE_SEQUENCE, // Not stored in RelocInfo array, used explictly by |
400 // code aging. | 405 // code aging. |
401 | 406 |
402 FIRST_REAL_RELOC_MODE = CODE_TARGET, | 407 FIRST_REAL_RELOC_MODE = CODE_TARGET, |
403 LAST_REAL_RELOC_MODE = VENEER_POOL, | 408 LAST_REAL_RELOC_MODE = VENEER_POOL, |
404 LAST_CODE_ENUM = DEBUG_BREAK, | 409 LAST_CODE_ENUM = DEBUGGER_STATEMENT, |
405 LAST_GCED_ENUM = CELL, | 410 LAST_GCED_ENUM = CELL, |
406 }; | 411 }; |
407 | 412 |
| 413 STATIC_ASSERT(NUMBER_OF_MODES <= kBitsPerInt); |
| 414 |
408 RelocInfo() {} | 415 RelocInfo() {} |
409 | 416 |
410 RelocInfo(byte* pc, Mode rmode, intptr_t data, Code* host) | 417 RelocInfo(byte* pc, Mode rmode, intptr_t data, Code* host) |
411 : pc_(pc), rmode_(rmode), data_(data), host_(host) { | 418 : pc_(pc), rmode_(rmode), data_(data), host_(host) { |
412 } | 419 } |
413 | 420 |
414 static inline bool IsRealRelocMode(Mode mode) { | 421 static inline bool IsRealRelocMode(Mode mode) { |
415 return mode >= FIRST_REAL_RELOC_MODE && | 422 return mode >= FIRST_REAL_RELOC_MODE && |
416 mode <= LAST_REAL_RELOC_MODE; | 423 mode <= LAST_REAL_RELOC_MODE; |
417 } | 424 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 static inline bool IsExternalReference(Mode mode) { | 463 static inline bool IsExternalReference(Mode mode) { |
457 return mode == EXTERNAL_REFERENCE; | 464 return mode == EXTERNAL_REFERENCE; |
458 } | 465 } |
459 static inline bool IsInternalReference(Mode mode) { | 466 static inline bool IsInternalReference(Mode mode) { |
460 return mode == INTERNAL_REFERENCE; | 467 return mode == INTERNAL_REFERENCE; |
461 } | 468 } |
462 static inline bool IsInternalReferenceEncoded(Mode mode) { | 469 static inline bool IsInternalReferenceEncoded(Mode mode) { |
463 return mode == INTERNAL_REFERENCE_ENCODED; | 470 return mode == INTERNAL_REFERENCE_ENCODED; |
464 } | 471 } |
465 static inline bool IsDebugBreakSlot(Mode mode) { | 472 static inline bool IsDebugBreakSlot(Mode mode) { |
466 return mode == DEBUG_BREAK_SLOT; | 473 return IsDebugBreakSlotAtPosition(mode) || IsDebugBreakSlotAtCall(mode) || |
| 474 IsDebugBreakSlotAtConstructCall(mode); |
| 475 } |
| 476 static inline bool IsDebugBreakSlotAtPosition(Mode mode) { |
| 477 return mode == DEBUG_BREAK_SLOT_AT_POSITION; |
| 478 } |
| 479 static inline bool IsDebugBreakSlotAtCall(Mode mode) { |
| 480 return mode == DEBUG_BREAK_SLOT_AT_CALL; |
| 481 } |
| 482 static inline bool IsDebugBreakSlotAtConstructCall(Mode mode) { |
| 483 return mode == DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL; |
467 } | 484 } |
468 static inline bool IsDebuggerStatement(Mode mode) { | 485 static inline bool IsDebuggerStatement(Mode mode) { |
469 return mode == DEBUG_BREAK; | 486 return mode == DEBUGGER_STATEMENT; |
470 } | 487 } |
471 static inline bool IsNone(Mode mode) { | 488 static inline bool IsNone(Mode mode) { |
472 return mode == NONE32 || mode == NONE64; | 489 return mode == NONE32 || mode == NONE64; |
473 } | 490 } |
474 static inline bool IsCodeAgeSequence(Mode mode) { | 491 static inline bool IsCodeAgeSequence(Mode mode) { |
475 return mode == CODE_AGE_SEQUENCE; | 492 return mode == CODE_AGE_SEQUENCE; |
476 } | 493 } |
477 static inline int ModeMask(Mode mode) { return 1 << mode; } | 494 static inline int ModeMask(Mode mode) { return 1 << mode; } |
478 | 495 |
479 // Accessors | 496 // Accessors |
(...skipping 11 matching lines...) Expand all Loading... |
491 | 508 |
492 // Is the pointer this relocation info refers to coded like a plain pointer | 509 // Is the pointer this relocation info refers to coded like a plain pointer |
493 // or is it strange in some way (e.g. relative or patched into a series of | 510 // or is it strange in some way (e.g. relative or patched into a series of |
494 // instructions). | 511 // instructions). |
495 bool IsCodedSpecially(); | 512 bool IsCodedSpecially(); |
496 | 513 |
497 // If true, the pointer this relocation info refers to is an entry in the | 514 // If true, the pointer this relocation info refers to is an entry in the |
498 // constant pool, otherwise the pointer is embedded in the instruction stream. | 515 // constant pool, otherwise the pointer is embedded in the instruction stream. |
499 bool IsInConstantPool(); | 516 bool IsInConstantPool(); |
500 | 517 |
501 static bool DebugBreakIsConstructCall(intptr_t data); | |
502 static bool DebugBreakIsCall(intptr_t data); | |
503 static int DebugBreakCallArgumentsCount(intptr_t data); | 518 static int DebugBreakCallArgumentsCount(intptr_t data); |
504 | 519 |
505 // Read/modify the code target in the branch/call instruction | 520 // Read/modify the code target in the branch/call instruction |
506 // this relocation applies to; | 521 // this relocation applies to; |
507 // can only be called if IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) | 522 // can only be called if IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) |
508 INLINE(Address target_address()); | 523 INLINE(Address target_address()); |
509 INLINE(void set_target_address(Address target, | 524 INLINE(void set_target_address(Address target, |
510 WriteBarrierMode write_barrier_mode = | 525 WriteBarrierMode write_barrier_mode = |
511 UPDATE_WRITE_BARRIER, | 526 UPDATE_WRITE_BARRIER, |
512 ICacheFlushMode icache_flush_mode = | 527 ICacheFlushMode icache_flush_mode = |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 void Print(Isolate* isolate, std::ostream& os); // NOLINT | 626 void Print(Isolate* isolate, std::ostream& os); // NOLINT |
612 #endif // ENABLE_DISASSEMBLER | 627 #endif // ENABLE_DISASSEMBLER |
613 #ifdef VERIFY_HEAP | 628 #ifdef VERIFY_HEAP |
614 void Verify(Isolate* isolate); | 629 void Verify(Isolate* isolate); |
615 #endif | 630 #endif |
616 | 631 |
617 static const int kCodeTargetMask = (1 << (LAST_CODE_ENUM + 1)) - 1; | 632 static const int kCodeTargetMask = (1 << (LAST_CODE_ENUM + 1)) - 1; |
618 static const int kPositionMask = 1 << POSITION | 1 << STATEMENT_POSITION; | 633 static const int kPositionMask = 1 << POSITION | 1 << STATEMENT_POSITION; |
619 static const int kDataMask = | 634 static const int kDataMask = |
620 (1 << CODE_TARGET_WITH_ID) | kPositionMask | (1 << COMMENT); | 635 (1 << CODE_TARGET_WITH_ID) | kPositionMask | (1 << COMMENT); |
| 636 static const int kDebugBreakSlotMask = |
| 637 1 << DEBUG_BREAK_SLOT_AT_POSITION | 1 << DEBUG_BREAK_SLOT_AT_CALL | |
| 638 1 << DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL; |
621 static const int kApplyMask; // Modes affected by apply. Depends on arch. | 639 static const int kApplyMask; // Modes affected by apply. Depends on arch. |
622 static const int kDebugBreakNonCallSentinel = -2; | |
623 static const int kDebugBreakConstructCallSentinel = -1; | |
624 | 640 |
625 private: | 641 private: |
626 // On ARM, note that pc_ is the address of the constant pool entry | 642 // On ARM, note that pc_ is the address of the constant pool entry |
627 // to be relocated and not the address of the instruction | 643 // to be relocated and not the address of the instruction |
628 // referencing the constant pool entry (except when rmode_ == | 644 // referencing the constant pool entry (except when rmode_ == |
629 // comment). | 645 // comment). |
630 byte* pc_; | 646 byte* pc_; |
631 Mode rmode_; | 647 Mode rmode_; |
632 intptr_t data_; | 648 intptr_t data_; |
633 Code* host_; | 649 Code* host_; |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 }; | 1264 }; |
1249 | 1265 |
1250 Label emitted_label_; // Records pc_offset of emitted pool | 1266 Label emitted_label_; // Records pc_offset of emitted pool |
1251 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; | 1267 PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES]; |
1252 }; | 1268 }; |
1253 | 1269 |
1254 | 1270 |
1255 } } // namespace v8::internal | 1271 } } // namespace v8::internal |
1256 | 1272 |
1257 #endif // V8_ASSEMBLER_H_ | 1273 #endif // V8_ASSEMBLER_H_ |
OLD | NEW |