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