| 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 | 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 const Instr kLdrRegFpNegOffsetPattern = | 441 const Instr kLdrRegFpNegOffsetPattern = |
| 442 al | B26 | L | NegOffset | kRegister_fp_Code * B16; | 442 al | B26 | L | NegOffset | kRegister_fp_Code * B16; |
| 443 const Instr kStrRegFpNegOffsetPattern = | 443 const Instr kStrRegFpNegOffsetPattern = |
| 444 al | B26 | NegOffset | kRegister_fp_Code * B16; | 444 al | B26 | NegOffset | kRegister_fp_Code * B16; |
| 445 const Instr kLdrStrInstrTypeMask = 0xffff0000; | 445 const Instr kLdrStrInstrTypeMask = 0xffff0000; |
| 446 | 446 |
| 447 | 447 |
| 448 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) | 448 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) |
| 449 : AssemblerBase(isolate, buffer, buffer_size), | 449 : AssemblerBase(isolate, buffer, buffer_size), |
| 450 recorded_ast_id_(TypeFeedbackId::None()), | 450 recorded_ast_id_(TypeFeedbackId::None()), |
| 451 pending_32_bit_constants_(&pending_32_bit_constants_buffer_[0]), | |
| 452 pending_64_bit_constants_(&pending_64_bit_constants_buffer_[0]), | |
| 453 constant_pool_builder_(kLdrMaxReachBits, kVldrMaxReachBits), | 451 constant_pool_builder_(kLdrMaxReachBits, kVldrMaxReachBits), |
| 454 positions_recorder_(this) { | 452 positions_recorder_(this) { |
| 455 reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_); | 453 reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_); |
| 456 num_pending_32_bit_constants_ = 0; | 454 num_pending_32_bit_constants_ = 0; |
| 457 num_pending_64_bit_constants_ = 0; | 455 num_pending_64_bit_constants_ = 0; |
| 458 next_buffer_check_ = 0; | 456 next_buffer_check_ = 0; |
| 459 const_pool_blocked_nesting_ = 0; | 457 const_pool_blocked_nesting_ = 0; |
| 460 no_const_pool_before_ = 0; | 458 no_const_pool_before_ = 0; |
| 461 first_const_pool_32_use_ = -1; | 459 first_const_pool_32_use_ = -1; |
| 462 first_const_pool_64_use_ = -1; | 460 first_const_pool_64_use_ = -1; |
| 463 last_bound_pos_ = 0; | 461 last_bound_pos_ = 0; |
| 464 ClearRecordedAstId(); | 462 ClearRecordedAstId(); |
| 465 } | 463 } |
| 466 | 464 |
| 467 | 465 |
| 468 Assembler::~Assembler() { | 466 Assembler::~Assembler() { |
| 469 DCHECK(const_pool_blocked_nesting_ == 0); | 467 DCHECK(const_pool_blocked_nesting_ == 0); |
| 470 if (pending_32_bit_constants_ != &pending_32_bit_constants_buffer_[0]) { | |
| 471 delete[] pending_32_bit_constants_; | |
| 472 } | |
| 473 if (pending_64_bit_constants_ != &pending_64_bit_constants_buffer_[0]) { | |
| 474 delete[] pending_64_bit_constants_; | |
| 475 } | |
| 476 } | 468 } |
| 477 | 469 |
| 478 | 470 |
| 479 void Assembler::GetCode(CodeDesc* desc) { | 471 void Assembler::GetCode(CodeDesc* desc) { |
| 480 reloc_info_writer.Finish(); | 472 reloc_info_writer.Finish(); |
| 481 | 473 |
| 482 // Emit constant pool if necessary. | 474 // Emit constant pool if necessary. |
| 483 int constant_pool_offset = 0; | 475 int constant_pool_offset = 0; |
| 484 if (FLAG_enable_embedded_constant_pool) { | 476 if (FLAG_enable_embedded_constant_pool) { |
| 485 constant_pool_offset = EmitEmbeddedConstantPool(); | 477 constant_pool_offset = EmitEmbeddedConstantPool(); |
| (...skipping 3179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3665 rmode != RelocInfo::STATEMENT_POSITION && | 3657 rmode != RelocInfo::STATEMENT_POSITION && |
| 3666 rmode != RelocInfo::CONST_POOL && rmode != RelocInfo::NONE64); | 3658 rmode != RelocInfo::CONST_POOL && rmode != RelocInfo::NONE64); |
| 3667 bool sharing_ok = RelocInfo::IsNone(rmode) || | 3659 bool sharing_ok = RelocInfo::IsNone(rmode) || |
| 3668 !(serializer_enabled() || rmode < RelocInfo::CELL); | 3660 !(serializer_enabled() || rmode < RelocInfo::CELL); |
| 3669 if (FLAG_enable_embedded_constant_pool) { | 3661 if (FLAG_enable_embedded_constant_pool) { |
| 3670 return constant_pool_builder_.AddEntry(position, value, sharing_ok); | 3662 return constant_pool_builder_.AddEntry(position, value, sharing_ok); |
| 3671 } else { | 3663 } else { |
| 3672 DCHECK(num_pending_32_bit_constants_ < kMaxNumPending32Constants); | 3664 DCHECK(num_pending_32_bit_constants_ < kMaxNumPending32Constants); |
| 3673 if (num_pending_32_bit_constants_ == 0) { | 3665 if (num_pending_32_bit_constants_ == 0) { |
| 3674 first_const_pool_32_use_ = position; | 3666 first_const_pool_32_use_ = position; |
| 3675 } else if (num_pending_32_bit_constants_ == kMinNumPendingConstants && | |
| 3676 pending_32_bit_constants_ == | |
| 3677 &pending_32_bit_constants_buffer_[0]) { | |
| 3678 // Inline buffer is full, switch to dynamically allocated buffer. | |
| 3679 pending_32_bit_constants_ = | |
| 3680 new ConstantPoolEntry[kMaxNumPending32Constants]; | |
| 3681 std::copy(&pending_32_bit_constants_buffer_[0], | |
| 3682 &pending_32_bit_constants_buffer_[kMinNumPendingConstants], | |
| 3683 &pending_32_bit_constants_[0]); | |
| 3684 } | 3667 } |
| 3685 ConstantPoolEntry entry(position, value, sharing_ok); | 3668 ConstantPoolEntry entry(position, value, sharing_ok); |
| 3686 pending_32_bit_constants_[num_pending_32_bit_constants_++] = entry; | 3669 pending_32_bit_constants_[num_pending_32_bit_constants_++] = entry; |
| 3687 | 3670 |
| 3688 // Make sure the constant pool is not emitted in place of the next | 3671 // Make sure the constant pool is not emitted in place of the next |
| 3689 // instruction for which we just recorded relocation info. | 3672 // instruction for which we just recorded relocation info. |
| 3690 BlockConstPoolFor(1); | 3673 BlockConstPoolFor(1); |
| 3691 return ConstantPoolEntry::REGULAR; | 3674 return ConstantPoolEntry::REGULAR; |
| 3692 } | 3675 } |
| 3693 } | 3676 } |
| 3694 | 3677 |
| 3695 | 3678 |
| 3696 ConstantPoolEntry::Access Assembler::ConstantPoolAddEntry(int position, | 3679 ConstantPoolEntry::Access Assembler::ConstantPoolAddEntry(int position, |
| 3697 double value) { | 3680 double value) { |
| 3698 if (FLAG_enable_embedded_constant_pool) { | 3681 if (FLAG_enable_embedded_constant_pool) { |
| 3699 return constant_pool_builder_.AddEntry(position, value); | 3682 return constant_pool_builder_.AddEntry(position, value); |
| 3700 } else { | 3683 } else { |
| 3701 DCHECK(num_pending_64_bit_constants_ < kMaxNumPending64Constants); | 3684 DCHECK(num_pending_64_bit_constants_ < kMaxNumPending64Constants); |
| 3702 if (num_pending_64_bit_constants_ == 0) { | 3685 if (num_pending_64_bit_constants_ == 0) { |
| 3703 first_const_pool_64_use_ = position; | 3686 first_const_pool_64_use_ = position; |
| 3704 } else if (num_pending_64_bit_constants_ == kMinNumPendingConstants && | |
| 3705 pending_64_bit_constants_ == | |
| 3706 &pending_64_bit_constants_buffer_[0]) { | |
| 3707 // Inline buffer is full, switch to dynamically allocated buffer. | |
| 3708 pending_64_bit_constants_ = | |
| 3709 new ConstantPoolEntry[kMaxNumPending64Constants]; | |
| 3710 std::copy(&pending_64_bit_constants_buffer_[0], | |
| 3711 &pending_64_bit_constants_buffer_[kMinNumPendingConstants], | |
| 3712 &pending_64_bit_constants_[0]); | |
| 3713 } | 3687 } |
| 3714 ConstantPoolEntry entry(position, value); | 3688 ConstantPoolEntry entry(position, value); |
| 3715 pending_64_bit_constants_[num_pending_64_bit_constants_++] = entry; | 3689 pending_64_bit_constants_[num_pending_64_bit_constants_++] = entry; |
| 3716 | 3690 |
| 3717 // Make sure the constant pool is not emitted in place of the next | 3691 // Make sure the constant pool is not emitted in place of the next |
| 3718 // instruction for which we just recorded relocation info. | 3692 // instruction for which we just recorded relocation info. |
| 3719 BlockConstPoolFor(1); | 3693 BlockConstPoolFor(1); |
| 3720 return ConstantPoolEntry::REGULAR; | 3694 return ConstantPoolEntry::REGULAR; |
| 3721 } | 3695 } |
| 3722 } | 3696 } |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4023 DCHECK(is_uint12(offset)); | 3997 DCHECK(is_uint12(offset)); |
| 4024 instr_at_put(pc, SetLdrRegisterImmediateOffset(instr, offset)); | 3998 instr_at_put(pc, SetLdrRegisterImmediateOffset(instr, offset)); |
| 4025 } | 3999 } |
| 4026 } | 4000 } |
| 4027 | 4001 |
| 4028 | 4002 |
| 4029 } // namespace internal | 4003 } // namespace internal |
| 4030 } // namespace v8 | 4004 } // namespace v8 |
| 4031 | 4005 |
| 4032 #endif // V8_TARGET_ARCH_ARM | 4006 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |