| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 buffer_size = kMinimalBufferSize; | 143 buffer_size = kMinimalBufferSize; |
| 144 if (isolate->assembler_spare_buffer() != NULL) { | 144 if (isolate->assembler_spare_buffer() != NULL) { |
| 145 buffer = isolate->assembler_spare_buffer(); | 145 buffer = isolate->assembler_spare_buffer(); |
| 146 isolate->set_assembler_spare_buffer(NULL); | 146 isolate->set_assembler_spare_buffer(NULL); |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 if (buffer == NULL) buffer = NewArray<byte>(buffer_size); | 149 if (buffer == NULL) buffer = NewArray<byte>(buffer_size); |
| 150 own_buffer_ = true; | 150 own_buffer_ = true; |
| 151 } else { | 151 } else { |
| 152 // Use externally provided buffer instead. | 152 // Use externally provided buffer instead. |
| 153 ASSERT(buffer_size > 0); | 153 DCHECK(buffer_size > 0); |
| 154 own_buffer_ = false; | 154 own_buffer_ = false; |
| 155 } | 155 } |
| 156 buffer_ = static_cast<byte*>(buffer); | 156 buffer_ = static_cast<byte*>(buffer); |
| 157 buffer_size_ = buffer_size; | 157 buffer_size_ = buffer_size; |
| 158 | 158 |
| 159 pc_ = buffer_; | 159 pc_ = buffer_; |
| 160 } | 160 } |
| 161 | 161 |
| 162 | 162 |
| 163 AssemblerBase::~AssemblerBase() { | 163 AssemblerBase::~AssemblerBase() { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 194 assembler_->set_predictable_code_size(old_value_); | 194 assembler_->set_predictable_code_size(old_value_); |
| 195 } | 195 } |
| 196 | 196 |
| 197 | 197 |
| 198 // ----------------------------------------------------------------------------- | 198 // ----------------------------------------------------------------------------- |
| 199 // Implementation of CpuFeatureScope | 199 // Implementation of CpuFeatureScope |
| 200 | 200 |
| 201 #ifdef DEBUG | 201 #ifdef DEBUG |
| 202 CpuFeatureScope::CpuFeatureScope(AssemblerBase* assembler, CpuFeature f) | 202 CpuFeatureScope::CpuFeatureScope(AssemblerBase* assembler, CpuFeature f) |
| 203 : assembler_(assembler) { | 203 : assembler_(assembler) { |
| 204 ASSERT(CpuFeatures::IsSupported(f)); | 204 DCHECK(CpuFeatures::IsSupported(f)); |
| 205 old_enabled_ = assembler_->enabled_cpu_features(); | 205 old_enabled_ = assembler_->enabled_cpu_features(); |
| 206 uint64_t mask = static_cast<uint64_t>(1) << f; | 206 uint64_t mask = static_cast<uint64_t>(1) << f; |
| 207 // TODO(svenpanne) This special case below doesn't belong here! | 207 // TODO(svenpanne) This special case below doesn't belong here! |
| 208 #if V8_TARGET_ARCH_ARM | 208 #if V8_TARGET_ARCH_ARM |
| 209 // ARMv7 is implied by VFP3. | 209 // ARMv7 is implied by VFP3. |
| 210 if (f == VFP3) { | 210 if (f == VFP3) { |
| 211 mask |= static_cast<uint64_t>(1) << ARMv7; | 211 mask |= static_cast<uint64_t>(1) << ARMv7; |
| 212 } | 212 } |
| 213 #endif | 213 #endif |
| 214 assembler_->set_enabled_cpu_features(old_enabled_ | mask); | 214 assembler_->set_enabled_cpu_features(old_enabled_ | mask); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 const int kVeneerPoolTag = 1; | 351 const int kVeneerPoolTag = 1; |
| 352 | 352 |
| 353 | 353 |
| 354 uint32_t RelocInfoWriter::WriteVariableLengthPCJump(uint32_t pc_delta) { | 354 uint32_t RelocInfoWriter::WriteVariableLengthPCJump(uint32_t pc_delta) { |
| 355 // Return if the pc_delta can fit in kSmallPCDeltaBits bits. | 355 // Return if the pc_delta can fit in kSmallPCDeltaBits bits. |
| 356 // Otherwise write a variable length PC jump for the bits that do | 356 // Otherwise write a variable length PC jump for the bits that do |
| 357 // not fit in the kSmallPCDeltaBits bits. | 357 // not fit in the kSmallPCDeltaBits bits. |
| 358 if (is_uintn(pc_delta, kSmallPCDeltaBits)) return pc_delta; | 358 if (is_uintn(pc_delta, kSmallPCDeltaBits)) return pc_delta; |
| 359 WriteExtraTag(kPCJumpExtraTag, kVariableLengthPCJumpTopTag); | 359 WriteExtraTag(kPCJumpExtraTag, kVariableLengthPCJumpTopTag); |
| 360 uint32_t pc_jump = pc_delta >> kSmallPCDeltaBits; | 360 uint32_t pc_jump = pc_delta >> kSmallPCDeltaBits; |
| 361 ASSERT(pc_jump > 0); | 361 DCHECK(pc_jump > 0); |
| 362 // Write kChunkBits size chunks of the pc_jump. | 362 // Write kChunkBits size chunks of the pc_jump. |
| 363 for (; pc_jump > 0; pc_jump = pc_jump >> kChunkBits) { | 363 for (; pc_jump > 0; pc_jump = pc_jump >> kChunkBits) { |
| 364 byte b = pc_jump & kChunkMask; | 364 byte b = pc_jump & kChunkMask; |
| 365 *--pos_ = b << kLastChunkTagBits; | 365 *--pos_ = b << kLastChunkTagBits; |
| 366 } | 366 } |
| 367 // Tag the last chunk so it can be identified. | 367 // Tag the last chunk so it can be identified. |
| 368 *pos_ = *pos_ | kLastChunkTag; | 368 *pos_ = *pos_ | kLastChunkTag; |
| 369 // Return the remaining kSmallPCDeltaBits of the pc_delta. | 369 // Return the remaining kSmallPCDeltaBits of the pc_delta. |
| 370 return pc_delta & kSmallPCDeltaMask; | 370 return pc_delta & kSmallPCDeltaMask; |
| 371 } | 371 } |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 // Signed right shift is arithmetic shift. Tested in test-utils.cc. | 425 // Signed right shift is arithmetic shift. Tested in test-utils.cc. |
| 426 data_delta = data_delta >> kBitsPerByte; | 426 data_delta = data_delta >> kBitsPerByte; |
| 427 } | 427 } |
| 428 } | 428 } |
| 429 | 429 |
| 430 | 430 |
| 431 void RelocInfoWriter::Write(const RelocInfo* rinfo) { | 431 void RelocInfoWriter::Write(const RelocInfo* rinfo) { |
| 432 #ifdef DEBUG | 432 #ifdef DEBUG |
| 433 byte* begin_pos = pos_; | 433 byte* begin_pos = pos_; |
| 434 #endif | 434 #endif |
| 435 ASSERT(rinfo->rmode() < RelocInfo::NUMBER_OF_MODES); | 435 DCHECK(rinfo->rmode() < RelocInfo::NUMBER_OF_MODES); |
| 436 ASSERT(rinfo->pc() - last_pc_ >= 0); | 436 DCHECK(rinfo->pc() - last_pc_ >= 0); |
| 437 ASSERT(RelocInfo::LAST_STANDARD_NONCOMPACT_ENUM - RelocInfo::LAST_COMPACT_ENUM | 437 DCHECK(RelocInfo::LAST_STANDARD_NONCOMPACT_ENUM - RelocInfo::LAST_COMPACT_ENUM |
| 438 <= kMaxStandardNonCompactModes); | 438 <= kMaxStandardNonCompactModes); |
| 439 // Use unsigned delta-encoding for pc. | 439 // Use unsigned delta-encoding for pc. |
| 440 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_); | 440 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_); |
| 441 RelocInfo::Mode rmode = rinfo->rmode(); | 441 RelocInfo::Mode rmode = rinfo->rmode(); |
| 442 | 442 |
| 443 // The two most common modes are given small tags, and usually fit in a byte. | 443 // The two most common modes are given small tags, and usually fit in a byte. |
| 444 if (rmode == RelocInfo::EMBEDDED_OBJECT) { | 444 if (rmode == RelocInfo::EMBEDDED_OBJECT) { |
| 445 WriteTaggedPC(pc_delta, kEmbeddedObjectTag); | 445 WriteTaggedPC(pc_delta, kEmbeddedObjectTag); |
| 446 } else if (rmode == RelocInfo::CODE_TARGET) { | 446 } else if (rmode == RelocInfo::CODE_TARGET) { |
| 447 WriteTaggedPC(pc_delta, kCodeTargetTag); | 447 WriteTaggedPC(pc_delta, kCodeTargetTag); |
| 448 ASSERT(begin_pos - pos_ <= RelocInfo::kMaxCallSize); | 448 DCHECK(begin_pos - pos_ <= RelocInfo::kMaxCallSize); |
| 449 } else if (rmode == RelocInfo::CODE_TARGET_WITH_ID) { | 449 } else if (rmode == RelocInfo::CODE_TARGET_WITH_ID) { |
| 450 // Use signed delta-encoding for id. | 450 // Use signed delta-encoding for id. |
| 451 ASSERT(static_cast<int>(rinfo->data()) == rinfo->data()); | 451 DCHECK(static_cast<int>(rinfo->data()) == rinfo->data()); |
| 452 int id_delta = static_cast<int>(rinfo->data()) - last_id_; | 452 int id_delta = static_cast<int>(rinfo->data()) - last_id_; |
| 453 // Check if delta is small enough to fit in a tagged byte. | 453 // Check if delta is small enough to fit in a tagged byte. |
| 454 if (is_intn(id_delta, kSmallDataBits)) { | 454 if (is_intn(id_delta, kSmallDataBits)) { |
| 455 WriteTaggedPC(pc_delta, kLocatableTag); | 455 WriteTaggedPC(pc_delta, kLocatableTag); |
| 456 WriteTaggedData(id_delta, kCodeWithIdTag); | 456 WriteTaggedData(id_delta, kCodeWithIdTag); |
| 457 } else { | 457 } else { |
| 458 // Otherwise, use costly encoding. | 458 // Otherwise, use costly encoding. |
| 459 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); | 459 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); |
| 460 WriteExtraTaggedIntData(id_delta, kCodeWithIdTag); | 460 WriteExtraTaggedIntData(id_delta, kCodeWithIdTag); |
| 461 } | 461 } |
| 462 last_id_ = static_cast<int>(rinfo->data()); | 462 last_id_ = static_cast<int>(rinfo->data()); |
| 463 } else if (RelocInfo::IsPosition(rmode)) { | 463 } else if (RelocInfo::IsPosition(rmode)) { |
| 464 // Use signed delta-encoding for position. | 464 // Use signed delta-encoding for position. |
| 465 ASSERT(static_cast<int>(rinfo->data()) == rinfo->data()); | 465 DCHECK(static_cast<int>(rinfo->data()) == rinfo->data()); |
| 466 int pos_delta = static_cast<int>(rinfo->data()) - last_position_; | 466 int pos_delta = static_cast<int>(rinfo->data()) - last_position_; |
| 467 int pos_type_tag = (rmode == RelocInfo::POSITION) ? kNonstatementPositionTag | 467 int pos_type_tag = (rmode == RelocInfo::POSITION) ? kNonstatementPositionTag |
| 468 : kStatementPositionTag; | 468 : kStatementPositionTag; |
| 469 // Check if delta is small enough to fit in a tagged byte. | 469 // Check if delta is small enough to fit in a tagged byte. |
| 470 if (is_intn(pos_delta, kSmallDataBits)) { | 470 if (is_intn(pos_delta, kSmallDataBits)) { |
| 471 WriteTaggedPC(pc_delta, kLocatableTag); | 471 WriteTaggedPC(pc_delta, kLocatableTag); |
| 472 WriteTaggedData(pos_delta, pos_type_tag); | 472 WriteTaggedData(pos_delta, pos_type_tag); |
| 473 } else { | 473 } else { |
| 474 // Otherwise, use costly encoding. | 474 // Otherwise, use costly encoding. |
| 475 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); | 475 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); |
| 476 WriteExtraTaggedIntData(pos_delta, pos_type_tag); | 476 WriteExtraTaggedIntData(pos_delta, pos_type_tag); |
| 477 } | 477 } |
| 478 last_position_ = static_cast<int>(rinfo->data()); | 478 last_position_ = static_cast<int>(rinfo->data()); |
| 479 } else if (RelocInfo::IsComment(rmode)) { | 479 } else if (RelocInfo::IsComment(rmode)) { |
| 480 // Comments are normally not generated, so we use the costly encoding. | 480 // Comments are normally not generated, so we use the costly encoding. |
| 481 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); | 481 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); |
| 482 WriteExtraTaggedData(rinfo->data(), kCommentTag); | 482 WriteExtraTaggedData(rinfo->data(), kCommentTag); |
| 483 ASSERT(begin_pos - pos_ >= RelocInfo::kMinRelocCommentSize); | 483 DCHECK(begin_pos - pos_ >= RelocInfo::kMinRelocCommentSize); |
| 484 } else if (RelocInfo::IsConstPool(rmode) || RelocInfo::IsVeneerPool(rmode)) { | 484 } else if (RelocInfo::IsConstPool(rmode) || RelocInfo::IsVeneerPool(rmode)) { |
| 485 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); | 485 WriteExtraTaggedPC(pc_delta, kPCJumpExtraTag); |
| 486 WriteExtraTaggedPoolData(static_cast<int>(rinfo->data()), | 486 WriteExtraTaggedPoolData(static_cast<int>(rinfo->data()), |
| 487 RelocInfo::IsConstPool(rmode) ? kConstPoolTag | 487 RelocInfo::IsConstPool(rmode) ? kConstPoolTag |
| 488 : kVeneerPoolTag); | 488 : kVeneerPoolTag); |
| 489 } else { | 489 } else { |
| 490 ASSERT(rmode > RelocInfo::LAST_COMPACT_ENUM); | 490 DCHECK(rmode > RelocInfo::LAST_COMPACT_ENUM); |
| 491 int saved_mode = rmode - RelocInfo::LAST_COMPACT_ENUM; | 491 int saved_mode = rmode - RelocInfo::LAST_COMPACT_ENUM; |
| 492 // For all other modes we simply use the mode as the extra tag. | 492 // For all other modes we simply use the mode as the extra tag. |
| 493 // None of these modes need a data component. | 493 // None of these modes need a data component. |
| 494 ASSERT(saved_mode < kPCJumpExtraTag && saved_mode < kDataJumpExtraTag); | 494 DCHECK(saved_mode < kPCJumpExtraTag && saved_mode < kDataJumpExtraTag); |
| 495 WriteExtraTaggedPC(pc_delta, saved_mode); | 495 WriteExtraTaggedPC(pc_delta, saved_mode); |
| 496 } | 496 } |
| 497 last_pc_ = rinfo->pc(); | 497 last_pc_ = rinfo->pc(); |
| 498 #ifdef DEBUG | 498 #ifdef DEBUG |
| 499 ASSERT(begin_pos - pos_ <= kMaxSize); | 499 DCHECK(begin_pos - pos_ <= kMaxSize); |
| 500 #endif | 500 #endif |
| 501 } | 501 } |
| 502 | 502 |
| 503 | 503 |
| 504 inline int RelocIterator::AdvanceGetTag() { | 504 inline int RelocIterator::AdvanceGetTag() { |
| 505 return *--pos_ & kTagMask; | 505 return *--pos_ & kTagMask; |
| 506 } | 506 } |
| 507 | 507 |
| 508 | 508 |
| 509 inline int RelocIterator::GetExtraTag() { | 509 inline int RelocIterator::GetExtraTag() { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 | 595 |
| 596 inline void RelocIterator::ReadTaggedPosition() { | 596 inline void RelocIterator::ReadTaggedPosition() { |
| 597 int8_t signed_b = *pos_; | 597 int8_t signed_b = *pos_; |
| 598 // Signed right shift is arithmetic shift. Tested in test-utils.cc. | 598 // Signed right shift is arithmetic shift. Tested in test-utils.cc. |
| 599 last_position_ += signed_b >> kLocatableTypeTagBits; | 599 last_position_ += signed_b >> kLocatableTypeTagBits; |
| 600 rinfo_.data_ = last_position_; | 600 rinfo_.data_ = last_position_; |
| 601 } | 601 } |
| 602 | 602 |
| 603 | 603 |
| 604 static inline RelocInfo::Mode GetPositionModeFromTag(int tag) { | 604 static inline RelocInfo::Mode GetPositionModeFromTag(int tag) { |
| 605 ASSERT(tag == kNonstatementPositionTag || | 605 DCHECK(tag == kNonstatementPositionTag || |
| 606 tag == kStatementPositionTag); | 606 tag == kStatementPositionTag); |
| 607 return (tag == kNonstatementPositionTag) ? | 607 return (tag == kNonstatementPositionTag) ? |
| 608 RelocInfo::POSITION : | 608 RelocInfo::POSITION : |
| 609 RelocInfo::STATEMENT_POSITION; | 609 RelocInfo::STATEMENT_POSITION; |
| 610 } | 610 } |
| 611 | 611 |
| 612 | 612 |
| 613 void RelocIterator::next() { | 613 void RelocIterator::next() { |
| 614 ASSERT(!done()); | 614 DCHECK(!done()); |
| 615 // Basically, do the opposite of RelocInfoWriter::Write. | 615 // Basically, do the opposite of RelocInfoWriter::Write. |
| 616 // Reading of data is as far as possible avoided for unwanted modes, | 616 // Reading of data is as far as possible avoided for unwanted modes, |
| 617 // but we must always update the pc. | 617 // but we must always update the pc. |
| 618 // | 618 // |
| 619 // We exit this loop by returning when we find a mode we want. | 619 // We exit this loop by returning when we find a mode we want. |
| 620 while (pos_ > end_) { | 620 while (pos_ > end_) { |
| 621 int tag = AdvanceGetTag(); | 621 int tag = AdvanceGetTag(); |
| 622 if (tag == kEmbeddedObjectTag) { | 622 if (tag == kEmbeddedObjectTag) { |
| 623 ReadTaggedPC(); | 623 ReadTaggedPC(); |
| 624 if (SetMode(RelocInfo::EMBEDDED_OBJECT)) return; | 624 if (SetMode(RelocInfo::EMBEDDED_OBJECT)) return; |
| 625 } else if (tag == kCodeTargetTag) { | 625 } else if (tag == kCodeTargetTag) { |
| 626 ReadTaggedPC(); | 626 ReadTaggedPC(); |
| 627 if (SetMode(RelocInfo::CODE_TARGET)) return; | 627 if (SetMode(RelocInfo::CODE_TARGET)) return; |
| 628 } else if (tag == kLocatableTag) { | 628 } else if (tag == kLocatableTag) { |
| 629 ReadTaggedPC(); | 629 ReadTaggedPC(); |
| 630 Advance(); | 630 Advance(); |
| 631 int locatable_tag = GetLocatableTypeTag(); | 631 int locatable_tag = GetLocatableTypeTag(); |
| 632 if (locatable_tag == kCodeWithIdTag) { | 632 if (locatable_tag == kCodeWithIdTag) { |
| 633 if (SetMode(RelocInfo::CODE_TARGET_WITH_ID)) { | 633 if (SetMode(RelocInfo::CODE_TARGET_WITH_ID)) { |
| 634 ReadTaggedId(); | 634 ReadTaggedId(); |
| 635 return; | 635 return; |
| 636 } | 636 } |
| 637 } else { | 637 } else { |
| 638 // Compact encoding is never used for comments, | 638 // Compact encoding is never used for comments, |
| 639 // so it must be a position. | 639 // so it must be a position. |
| 640 ASSERT(locatable_tag == kNonstatementPositionTag || | 640 DCHECK(locatable_tag == kNonstatementPositionTag || |
| 641 locatable_tag == kStatementPositionTag); | 641 locatable_tag == kStatementPositionTag); |
| 642 if (mode_mask_ & RelocInfo::kPositionMask) { | 642 if (mode_mask_ & RelocInfo::kPositionMask) { |
| 643 ReadTaggedPosition(); | 643 ReadTaggedPosition(); |
| 644 if (SetMode(GetPositionModeFromTag(locatable_tag))) return; | 644 if (SetMode(GetPositionModeFromTag(locatable_tag))) return; |
| 645 } | 645 } |
| 646 } | 646 } |
| 647 } else { | 647 } else { |
| 648 ASSERT(tag == kDefaultTag); | 648 DCHECK(tag == kDefaultTag); |
| 649 int extra_tag = GetExtraTag(); | 649 int extra_tag = GetExtraTag(); |
| 650 if (extra_tag == kPCJumpExtraTag) { | 650 if (extra_tag == kPCJumpExtraTag) { |
| 651 if (GetTopTag() == kVariableLengthPCJumpTopTag) { | 651 if (GetTopTag() == kVariableLengthPCJumpTopTag) { |
| 652 AdvanceReadVariableLengthPCJump(); | 652 AdvanceReadVariableLengthPCJump(); |
| 653 } else { | 653 } else { |
| 654 AdvanceReadPC(); | 654 AdvanceReadPC(); |
| 655 } | 655 } |
| 656 } else if (extra_tag == kDataJumpExtraTag) { | 656 } else if (extra_tag == kDataJumpExtraTag) { |
| 657 int locatable_tag = GetTopTag(); | 657 int locatable_tag = GetTopTag(); |
| 658 if (locatable_tag == kCodeWithIdTag) { | 658 if (locatable_tag == kCodeWithIdTag) { |
| 659 if (SetMode(RelocInfo::CODE_TARGET_WITH_ID)) { | 659 if (SetMode(RelocInfo::CODE_TARGET_WITH_ID)) { |
| 660 AdvanceReadId(); | 660 AdvanceReadId(); |
| 661 return; | 661 return; |
| 662 } | 662 } |
| 663 Advance(kIntSize); | 663 Advance(kIntSize); |
| 664 } else if (locatable_tag != kCommentTag) { | 664 } else if (locatable_tag != kCommentTag) { |
| 665 ASSERT(locatable_tag == kNonstatementPositionTag || | 665 DCHECK(locatable_tag == kNonstatementPositionTag || |
| 666 locatable_tag == kStatementPositionTag); | 666 locatable_tag == kStatementPositionTag); |
| 667 if (mode_mask_ & RelocInfo::kPositionMask) { | 667 if (mode_mask_ & RelocInfo::kPositionMask) { |
| 668 AdvanceReadPosition(); | 668 AdvanceReadPosition(); |
| 669 if (SetMode(GetPositionModeFromTag(locatable_tag))) return; | 669 if (SetMode(GetPositionModeFromTag(locatable_tag))) return; |
| 670 } else { | 670 } else { |
| 671 Advance(kIntSize); | 671 Advance(kIntSize); |
| 672 } | 672 } |
| 673 } else { | 673 } else { |
| 674 ASSERT(locatable_tag == kCommentTag); | 674 DCHECK(locatable_tag == kCommentTag); |
| 675 if (SetMode(RelocInfo::COMMENT)) { | 675 if (SetMode(RelocInfo::COMMENT)) { |
| 676 AdvanceReadData(); | 676 AdvanceReadData(); |
| 677 return; | 677 return; |
| 678 } | 678 } |
| 679 Advance(kIntptrSize); | 679 Advance(kIntptrSize); |
| 680 } | 680 } |
| 681 } else if (extra_tag == kPoolExtraTag) { | 681 } else if (extra_tag == kPoolExtraTag) { |
| 682 int pool_type = GetTopTag(); | 682 int pool_type = GetTopTag(); |
| 683 ASSERT(pool_type == kConstPoolTag || pool_type == kVeneerPoolTag); | 683 DCHECK(pool_type == kConstPoolTag || pool_type == kVeneerPoolTag); |
| 684 RelocInfo::Mode rmode = (pool_type == kConstPoolTag) ? | 684 RelocInfo::Mode rmode = (pool_type == kConstPoolTag) ? |
| 685 RelocInfo::CONST_POOL : RelocInfo::VENEER_POOL; | 685 RelocInfo::CONST_POOL : RelocInfo::VENEER_POOL; |
| 686 if (SetMode(rmode)) { | 686 if (SetMode(rmode)) { |
| 687 AdvanceReadPoolData(); | 687 AdvanceReadPoolData(); |
| 688 return; | 688 return; |
| 689 } | 689 } |
| 690 Advance(kIntSize); | 690 Advance(kIntSize); |
| 691 } else { | 691 } else { |
| 692 AdvanceReadPC(); | 692 AdvanceReadPC(); |
| 693 int rmode = extra_tag + RelocInfo::LAST_COMPACT_ENUM; | 693 int rmode = extra_tag + RelocInfo::LAST_COMPACT_ENUM; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 case CONST_POOL: | 884 case CONST_POOL: |
| 885 case VENEER_POOL: | 885 case VENEER_POOL: |
| 886 case DEBUG_BREAK_SLOT: | 886 case DEBUG_BREAK_SLOT: |
| 887 case NONE32: | 887 case NONE32: |
| 888 case NONE64: | 888 case NONE64: |
| 889 break; | 889 break; |
| 890 case NUMBER_OF_MODES: | 890 case NUMBER_OF_MODES: |
| 891 UNREACHABLE(); | 891 UNREACHABLE(); |
| 892 break; | 892 break; |
| 893 case CODE_AGE_SEQUENCE: | 893 case CODE_AGE_SEQUENCE: |
| 894 ASSERT(Code::IsYoungSequence(isolate, pc_) || code_age_stub()->IsCode()); | 894 DCHECK(Code::IsYoungSequence(isolate, pc_) || code_age_stub()->IsCode()); |
| 895 break; | 895 break; |
| 896 } | 896 } |
| 897 } | 897 } |
| 898 #endif // VERIFY_HEAP | 898 #endif // VERIFY_HEAP |
| 899 | 899 |
| 900 | 900 |
| 901 // ----------------------------------------------------------------------------- | 901 // ----------------------------------------------------------------------------- |
| 902 // Implementation of ExternalReference | 902 // Implementation of ExternalReference |
| 903 | 903 |
| 904 void ExternalReference::SetUp() { | 904 void ExternalReference::SetUp() { |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 ExternalReference ExternalReference::math_log_double_function( | 1396 ExternalReference ExternalReference::math_log_double_function( |
| 1397 Isolate* isolate) { | 1397 Isolate* isolate) { |
| 1398 typedef double (*d2d)(double x); | 1398 typedef double (*d2d)(double x); |
| 1399 return ExternalReference(Redirect(isolate, | 1399 return ExternalReference(Redirect(isolate, |
| 1400 FUNCTION_ADDR(static_cast<d2d>(std::log)), | 1400 FUNCTION_ADDR(static_cast<d2d>(std::log)), |
| 1401 BUILTIN_FP_CALL)); | 1401 BUILTIN_FP_CALL)); |
| 1402 } | 1402 } |
| 1403 | 1403 |
| 1404 | 1404 |
| 1405 ExternalReference ExternalReference::math_exp_constants(int constant_index) { | 1405 ExternalReference ExternalReference::math_exp_constants(int constant_index) { |
| 1406 ASSERT(math_exp_data_initialized); | 1406 DCHECK(math_exp_data_initialized); |
| 1407 return ExternalReference( | 1407 return ExternalReference( |
| 1408 reinterpret_cast<void*>(math_exp_constants_array + constant_index)); | 1408 reinterpret_cast<void*>(math_exp_constants_array + constant_index)); |
| 1409 } | 1409 } |
| 1410 | 1410 |
| 1411 | 1411 |
| 1412 ExternalReference ExternalReference::math_exp_log_table() { | 1412 ExternalReference ExternalReference::math_exp_log_table() { |
| 1413 ASSERT(math_exp_data_initialized); | 1413 DCHECK(math_exp_data_initialized); |
| 1414 return ExternalReference(reinterpret_cast<void*>(math_exp_log_table_array)); | 1414 return ExternalReference(reinterpret_cast<void*>(math_exp_log_table_array)); |
| 1415 } | 1415 } |
| 1416 | 1416 |
| 1417 | 1417 |
| 1418 ExternalReference ExternalReference::page_flags(Page* page) { | 1418 ExternalReference ExternalReference::page_flags(Page* page) { |
| 1419 return ExternalReference(reinterpret_cast<Address>(page) + | 1419 return ExternalReference(reinterpret_cast<Address>(page) + |
| 1420 MemoryChunk::kFlagsOffset); | 1420 MemoryChunk::kFlagsOffset); |
| 1421 } | 1421 } |
| 1422 | 1422 |
| 1423 | 1423 |
| 1424 ExternalReference ExternalReference::ForDeoptEntry(Address entry) { | 1424 ExternalReference ExternalReference::ForDeoptEntry(Address entry) { |
| 1425 return ExternalReference(entry); | 1425 return ExternalReference(entry); |
| 1426 } | 1426 } |
| 1427 | 1427 |
| 1428 | 1428 |
| 1429 ExternalReference ExternalReference::cpu_features() { | 1429 ExternalReference ExternalReference::cpu_features() { |
| 1430 ASSERT(CpuFeatures::initialized_); | 1430 DCHECK(CpuFeatures::initialized_); |
| 1431 return ExternalReference(&CpuFeatures::supported_); | 1431 return ExternalReference(&CpuFeatures::supported_); |
| 1432 } | 1432 } |
| 1433 | 1433 |
| 1434 | 1434 |
| 1435 ExternalReference ExternalReference::debug_is_active_address( | 1435 ExternalReference ExternalReference::debug_is_active_address( |
| 1436 Isolate* isolate) { | 1436 Isolate* isolate) { |
| 1437 return ExternalReference(isolate->debug()->is_active_address()); | 1437 return ExternalReference(isolate->debug()->is_active_address()); |
| 1438 } | 1438 } |
| 1439 | 1439 |
| 1440 | 1440 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1526 | 1526 |
| 1527 ExternalReference ExternalReference::power_double_int_function( | 1527 ExternalReference ExternalReference::power_double_int_function( |
| 1528 Isolate* isolate) { | 1528 Isolate* isolate) { |
| 1529 return ExternalReference(Redirect(isolate, | 1529 return ExternalReference(Redirect(isolate, |
| 1530 FUNCTION_ADDR(power_double_int), | 1530 FUNCTION_ADDR(power_double_int), |
| 1531 BUILTIN_FP_INT_CALL)); | 1531 BUILTIN_FP_INT_CALL)); |
| 1532 } | 1532 } |
| 1533 | 1533 |
| 1534 | 1534 |
| 1535 bool EvalComparison(Token::Value op, double op1, double op2) { | 1535 bool EvalComparison(Token::Value op, double op1, double op2) { |
| 1536 ASSERT(Token::IsCompareOp(op)); | 1536 DCHECK(Token::IsCompareOp(op)); |
| 1537 switch (op) { | 1537 switch (op) { |
| 1538 case Token::EQ: | 1538 case Token::EQ: |
| 1539 case Token::EQ_STRICT: return (op1 == op2); | 1539 case Token::EQ_STRICT: return (op1 == op2); |
| 1540 case Token::NE: return (op1 != op2); | 1540 case Token::NE: return (op1 != op2); |
| 1541 case Token::LT: return (op1 < op2); | 1541 case Token::LT: return (op1 < op2); |
| 1542 case Token::GT: return (op1 > op2); | 1542 case Token::GT: return (op1 > op2); |
| 1543 case Token::LTE: return (op1 <= op2); | 1543 case Token::LTE: return (op1 <= op2); |
| 1544 case Token::GTE: return (op1 >= op2); | 1544 case Token::GTE: return (op1 >= op2); |
| 1545 default: | 1545 default: |
| 1546 UNREACHABLE(); | 1546 UNREACHABLE(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1562 } | 1562 } |
| 1563 | 1563 |
| 1564 | 1564 |
| 1565 ExternalReference ExternalReference::debug_step_in_fp_address( | 1565 ExternalReference ExternalReference::debug_step_in_fp_address( |
| 1566 Isolate* isolate) { | 1566 Isolate* isolate) { |
| 1567 return ExternalReference(isolate->debug()->step_in_fp_addr()); | 1567 return ExternalReference(isolate->debug()->step_in_fp_addr()); |
| 1568 } | 1568 } |
| 1569 | 1569 |
| 1570 | 1570 |
| 1571 void PositionsRecorder::RecordPosition(int pos) { | 1571 void PositionsRecorder::RecordPosition(int pos) { |
| 1572 ASSERT(pos != RelocInfo::kNoPosition); | 1572 DCHECK(pos != RelocInfo::kNoPosition); |
| 1573 ASSERT(pos >= 0); | 1573 DCHECK(pos >= 0); |
| 1574 state_.current_position = pos; | 1574 state_.current_position = pos; |
| 1575 LOG_CODE_EVENT(assembler_->isolate(), | 1575 LOG_CODE_EVENT(assembler_->isolate(), |
| 1576 CodeLinePosInfoAddPositionEvent(jit_handler_data_, | 1576 CodeLinePosInfoAddPositionEvent(jit_handler_data_, |
| 1577 assembler_->pc_offset(), | 1577 assembler_->pc_offset(), |
| 1578 pos)); | 1578 pos)); |
| 1579 } | 1579 } |
| 1580 | 1580 |
| 1581 | 1581 |
| 1582 void PositionsRecorder::RecordStatementPosition(int pos) { | 1582 void PositionsRecorder::RecordStatementPosition(int pos) { |
| 1583 ASSERT(pos != RelocInfo::kNoPosition); | 1583 DCHECK(pos != RelocInfo::kNoPosition); |
| 1584 ASSERT(pos >= 0); | 1584 DCHECK(pos >= 0); |
| 1585 state_.current_statement_position = pos; | 1585 state_.current_statement_position = pos; |
| 1586 LOG_CODE_EVENT(assembler_->isolate(), | 1586 LOG_CODE_EVENT(assembler_->isolate(), |
| 1587 CodeLinePosInfoAddStatementPositionEvent( | 1587 CodeLinePosInfoAddStatementPositionEvent( |
| 1588 jit_handler_data_, | 1588 jit_handler_data_, |
| 1589 assembler_->pc_offset(), | 1589 assembler_->pc_offset(), |
| 1590 pos)); | 1590 pos)); |
| 1591 } | 1591 } |
| 1592 | 1592 |
| 1593 | 1593 |
| 1594 bool PositionsRecorder::WriteRecordedPositions() { | 1594 bool PositionsRecorder::WriteRecordedPositions() { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1613 state_.written_position = state_.current_position; | 1613 state_.written_position = state_.current_position; |
| 1614 written = true; | 1614 written = true; |
| 1615 } | 1615 } |
| 1616 | 1616 |
| 1617 // Return whether something was written. | 1617 // Return whether something was written. |
| 1618 return written; | 1618 return written; |
| 1619 } | 1619 } |
| 1620 | 1620 |
| 1621 | 1621 |
| 1622 MultiplierAndShift::MultiplierAndShift(int32_t d) { | 1622 MultiplierAndShift::MultiplierAndShift(int32_t d) { |
| 1623 ASSERT(d <= -2 || 2 <= d); | 1623 DCHECK(d <= -2 || 2 <= d); |
| 1624 const uint32_t two31 = 0x80000000; | 1624 const uint32_t two31 = 0x80000000; |
| 1625 uint32_t ad = Abs(d); | 1625 uint32_t ad = Abs(d); |
| 1626 uint32_t t = two31 + (uint32_t(d) >> 31); | 1626 uint32_t t = two31 + (uint32_t(d) >> 31); |
| 1627 uint32_t anc = t - 1 - t % ad; // Absolute value of nc. | 1627 uint32_t anc = t - 1 - t % ad; // Absolute value of nc. |
| 1628 int32_t p = 31; // Init. p. | 1628 int32_t p = 31; // Init. p. |
| 1629 uint32_t q1 = two31 / anc; // Init. q1 = 2**p/|nc|. | 1629 uint32_t q1 = two31 / anc; // Init. q1 = 2**p/|nc|. |
| 1630 uint32_t r1 = two31 - q1 * anc; // Init. r1 = rem(2**p, |nc|). | 1630 uint32_t r1 = two31 - q1 * anc; // Init. r1 = rem(2**p, |nc|). |
| 1631 uint32_t q2 = two31 / ad; // Init. q2 = 2**p/|d|. | 1631 uint32_t q2 = two31 / ad; // Init. q2 = 2**p/|d|. |
| 1632 uint32_t r2 = two31 - q2 * ad; // Init. r2 = rem(2**p, |d|). | 1632 uint32_t r2 = two31 - q2 * ad; // Init. r2 = rem(2**p, |d|). |
| 1633 uint32_t delta; | 1633 uint32_t delta; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1646 r2 = r2 - ad; | 1646 r2 = r2 - ad; |
| 1647 } | 1647 } |
| 1648 delta = ad - r2; | 1648 delta = ad - r2; |
| 1649 } while (q1 < delta || (q1 == delta && r1 == 0)); | 1649 } while (q1 < delta || (q1 == delta && r1 == 0)); |
| 1650 int32_t mul = static_cast<int32_t>(q2 + 1); | 1650 int32_t mul = static_cast<int32_t>(q2 + 1); |
| 1651 multiplier_ = (d < 0) ? -mul : mul; | 1651 multiplier_ = (d < 0) ? -mul : mul; |
| 1652 shift_ = p - 32; | 1652 shift_ = p - 32; |
| 1653 } | 1653 } |
| 1654 | 1654 |
| 1655 } } // namespace v8::internal | 1655 } } // namespace v8::internal |
| OLD | NEW |