Chromium Code Reviews| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 if (expected_size_ >= 0) { | 170 if (expected_size_ >= 0) { |
| 171 CHECK_EQ(expected_size_, assembler_->pc_offset() - start_offset_); | 171 CHECK_EQ(expected_size_, assembler_->pc_offset() - start_offset_); |
| 172 } | 172 } |
| 173 assembler_->set_predictable_code_size(old_value_); | 173 assembler_->set_predictable_code_size(old_value_); |
| 174 } | 174 } |
| 175 | 175 |
| 176 | 176 |
| 177 // ----------------------------------------------------------------------------- | 177 // ----------------------------------------------------------------------------- |
| 178 // Implementation of CpuFeatureScope | 178 // Implementation of CpuFeatureScope |
| 179 | 179 |
| 180 #ifdef DEBUG | 180 #if DCHECK_IS_ON |
| 181 CpuFeatureScope::CpuFeatureScope(AssemblerBase* assembler, CpuFeature f) | 181 CpuFeatureScope::CpuFeatureScope(AssemblerBase* assembler, CpuFeature f) |
| 182 : assembler_(assembler) { | 182 : assembler_(assembler) { |
| 183 DCHECK(CpuFeatures::IsSupported(f)); | 183 DCHECK(CpuFeatures::IsSupported(f)); |
| 184 old_enabled_ = assembler_->enabled_cpu_features(); | 184 old_enabled_ = assembler_->enabled_cpu_features(); |
| 185 uint64_t mask = static_cast<uint64_t>(1) << f; | 185 uint64_t mask = static_cast<uint64_t>(1) << f; |
| 186 // TODO(svenpanne) This special case below doesn't belong here! | 186 // TODO(svenpanne) This special case below doesn't belong here! |
| 187 #if V8_TARGET_ARCH_ARM | 187 #if V8_TARGET_ARCH_ARM |
| 188 // ARMv7 is implied by VFP3. | 188 // ARMv7 is implied by VFP3. |
| 189 if (f == VFP3) { | 189 if (f == VFP3) { |
| 190 mask |= static_cast<uint64_t>(1) << ARMv7; | 190 mask |= static_cast<uint64_t>(1) << ARMv7; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 // or | 282 // or |
| 283 // pc-jump (variable length): | 283 // pc-jump (variable length): |
| 284 // 01 1111 11, | 284 // 01 1111 11, |
| 285 // [7 bits data] 0 | 285 // [7 bits data] 0 |
| 286 // ... | 286 // ... |
| 287 // [7 bits data] 1 | 287 // [7 bits data] 1 |
| 288 // (Bits 6..31 of pc delta, with leading zeroes | 288 // (Bits 6..31 of pc delta, with leading zeroes |
| 289 // dropped, and last non-zero chunk tagged with 1.) | 289 // dropped, and last non-zero chunk tagged with 1.) |
| 290 | 290 |
| 291 | 291 |
| 292 #ifdef DEBUG | 292 #if DCHECK_IS_ON |
| 293 const int kMaxStandardNonCompactModes = 14; | 293 const int kMaxStandardNonCompactModes = 14; |
| 294 #endif | 294 #endif |
| 295 | 295 |
| 296 const int kTagBits = 2; | 296 const int kTagBits = 2; |
| 297 const int kTagMask = (1 << kTagBits) - 1; | 297 const int kTagMask = (1 << kTagBits) - 1; |
| 298 const int kExtraTagBits = 4; | 298 const int kExtraTagBits = 4; |
| 299 const int kLocatableTypeTagBits = 2; | 299 const int kLocatableTypeTagBits = 2; |
| 300 const int kSmallDataBits = kBitsPerByte - kLocatableTypeTagBits; | 300 const int kSmallDataBits = kBitsPerByte - kLocatableTypeTagBits; |
| 301 | 301 |
| 302 const int kEmbeddedObjectTag = 0; | 302 const int kEmbeddedObjectTag = 0; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 401 WriteExtraTag(kDataJumpExtraTag, top_tag); | 401 WriteExtraTag(kDataJumpExtraTag, top_tag); |
| 402 for (int i = 0; i < kIntptrSize; i++) { | 402 for (int i = 0; i < kIntptrSize; i++) { |
| 403 *--pos_ = static_cast<byte>(data_delta); | 403 *--pos_ = static_cast<byte>(data_delta); |
| 404 // Signed right shift is arithmetic shift. Tested in test-utils.cc. | 404 // Signed right shift is arithmetic shift. Tested in test-utils.cc. |
| 405 data_delta = data_delta >> kBitsPerByte; | 405 data_delta = data_delta >> kBitsPerByte; |
| 406 } | 406 } |
| 407 } | 407 } |
| 408 | 408 |
| 409 | 409 |
| 410 void RelocInfoWriter::Write(const RelocInfo* rinfo) { | 410 void RelocInfoWriter::Write(const RelocInfo* rinfo) { |
| 411 #ifdef DEBUG | 411 #if DCHECK_IS_ON |
| 412 byte* begin_pos = pos_; | 412 byte* begin_pos = pos_; |
| 413 #endif | 413 #endif |
| 414 DCHECK(rinfo->rmode() < RelocInfo::NUMBER_OF_MODES); | 414 DCHECK(rinfo->rmode() < RelocInfo::NUMBER_OF_MODES); |
| 415 DCHECK(rinfo->pc() - last_pc_ >= 0); | 415 DCHECK(rinfo->pc() - last_pc_ >= 0); |
| 416 DCHECK(RelocInfo::LAST_STANDARD_NONCOMPACT_ENUM - RelocInfo::LAST_COMPACT_ENUM | 416 DCHECK(RelocInfo::LAST_STANDARD_NONCOMPACT_ENUM - RelocInfo::LAST_COMPACT_ENUM |
| 417 <= kMaxStandardNonCompactModes); | 417 <= kMaxStandardNonCompactModes); |
| 418 // Use unsigned delta-encoding for pc. | 418 // Use unsigned delta-encoding for pc. |
| 419 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_); | 419 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_); |
| 420 RelocInfo::Mode rmode = rinfo->rmode(); | 420 RelocInfo::Mode rmode = rinfo->rmode(); |
| 421 | 421 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 467 : kVeneerPoolTag); | 467 : kVeneerPoolTag); |
| 468 } else { | 468 } else { |
| 469 DCHECK(rmode > RelocInfo::LAST_COMPACT_ENUM); | 469 DCHECK(rmode > RelocInfo::LAST_COMPACT_ENUM); |
| 470 int saved_mode = rmode - RelocInfo::LAST_COMPACT_ENUM; | 470 int saved_mode = rmode - RelocInfo::LAST_COMPACT_ENUM; |
| 471 // For all other modes we simply use the mode as the extra tag. | 471 // For all other modes we simply use the mode as the extra tag. |
| 472 // None of these modes need a data component. | 472 // None of these modes need a data component. |
| 473 DCHECK(saved_mode < kPCJumpExtraTag && saved_mode < kDataJumpExtraTag); | 473 DCHECK(saved_mode < kPCJumpExtraTag && saved_mode < kDataJumpExtraTag); |
| 474 WriteExtraTaggedPC(pc_delta, saved_mode); | 474 WriteExtraTaggedPC(pc_delta, saved_mode); |
| 475 } | 475 } |
| 476 last_pc_ = rinfo->pc(); | 476 last_pc_ = rinfo->pc(); |
| 477 #ifdef DEBUG | 477 #if DCHECK_IS_ON |
|
Jakob Kummerow
2014/12/03 10:53:53
nit: just drop this #if
| |
| 478 DCHECK(begin_pos - pos_ <= kMaxSize); | 478 DCHECK(begin_pos - pos_ <= kMaxSize); |
| 479 #endif | 479 #endif |
| 480 } | 480 } |
| 481 | 481 |
| 482 | 482 |
| 483 inline int RelocIterator::AdvanceGetTag() { | 483 inline int RelocIterator::AdvanceGetTag() { |
| 484 return *--pos_ & kTagMask; | 484 return *--pos_ & kTagMask; |
| 485 } | 485 } |
| 486 | 486 |
| 487 | 487 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 725 code_age_sequence_ = NULL; | 725 code_age_sequence_ = NULL; |
| 726 if (mode_mask_ == 0) pos_ = end_; | 726 if (mode_mask_ == 0) pos_ = end_; |
| 727 next(); | 727 next(); |
| 728 } | 728 } |
| 729 | 729 |
| 730 | 730 |
| 731 // ----------------------------------------------------------------------------- | 731 // ----------------------------------------------------------------------------- |
| 732 // Implementation of RelocInfo | 732 // Implementation of RelocInfo |
| 733 | 733 |
| 734 | 734 |
| 735 #ifdef DEBUG | 735 #if DCHECK_IS_ON |
| 736 bool RelocInfo::RequiresRelocation(const CodeDesc& desc) { | 736 bool RelocInfo::RequiresRelocation(const CodeDesc& desc) { |
| 737 // Ensure there are no code targets or embedded objects present in the | 737 // Ensure there are no code targets or embedded objects present in the |
| 738 // deoptimization entries, they would require relocation after code | 738 // deoptimization entries, they would require relocation after code |
| 739 // generation. | 739 // generation. |
| 740 int mode_mask = RelocInfo::kCodeTargetMask | | 740 int mode_mask = RelocInfo::kCodeTargetMask | |
| 741 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | | 741 RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT) | |
| 742 RelocInfo::ModeMask(RelocInfo::CELL) | | 742 RelocInfo::ModeMask(RelocInfo::CELL) | |
| 743 RelocInfo::kApplyMask; | 743 RelocInfo::kApplyMask; |
| 744 RelocIterator it(desc, mode_mask); | 744 RelocIterator it(desc, mode_mask); |
| 745 return !it.done(); | 745 return !it.done(); |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1590 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); | 1590 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); |
| 1591 state_.written_position = state_.current_position; | 1591 state_.written_position = state_.current_position; |
| 1592 written = true; | 1592 written = true; |
| 1593 } | 1593 } |
| 1594 | 1594 |
| 1595 // Return whether something was written. | 1595 // Return whether something was written. |
| 1596 return written; | 1596 return written; |
| 1597 } | 1597 } |
| 1598 | 1598 |
| 1599 } } // namespace v8::internal | 1599 } } // namespace v8::internal |
| OLD | NEW |