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