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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
308 // Setup buffer pointers. | 308 // Setup buffer pointers. |
309 ASSERT(buffer_ != NULL); | 309 ASSERT(buffer_ != NULL); |
310 pc_ = buffer_; | 310 pc_ = buffer_; |
311 reloc_info_writer.Reposition(buffer_ + buffer_size, pc_); | 311 reloc_info_writer.Reposition(buffer_ + buffer_size, pc_); |
312 num_prinfo_ = 0; | 312 num_prinfo_ = 0; |
313 next_buffer_check_ = 0; | 313 next_buffer_check_ = 0; |
314 const_pool_blocked_nesting_ = 0; | 314 const_pool_blocked_nesting_ = 0; |
315 no_const_pool_before_ = 0; | 315 no_const_pool_before_ = 0; |
316 last_const_pool_end_ = 0; | 316 last_const_pool_end_ = 0; |
317 last_bound_pos_ = 0; | 317 last_bound_pos_ = 0; |
318 ast_id_for_reloc_info_ = kNoASTId; | |
318 } | 319 } |
319 | 320 |
320 | 321 |
321 Assembler::~Assembler() { | 322 Assembler::~Assembler() { |
322 ASSERT(const_pool_blocked_nesting_ == 0); | 323 ASSERT(const_pool_blocked_nesting_ == 0); |
323 if (own_buffer_) { | 324 if (own_buffer_) { |
324 if (isolate()->assembler_spare_buffer() == NULL && | 325 if (isolate()->assembler_spare_buffer() == NULL && |
325 buffer_size_ == kMinimalBufferSize) { | 326 buffer_size_ == kMinimalBufferSize) { |
326 isolate()->set_assembler_spare_buffer(buffer_); | 327 isolate()->set_assembler_spare_buffer(buffer_); |
327 } else { | 328 } else { |
(...skipping 2359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2687 // to write pure data with no pointers and the constant pool should | 2688 // to write pure data with no pointers and the constant pool should |
2688 // be emitted before using dd. | 2689 // be emitted before using dd. |
2689 ASSERT(num_prinfo_ == 0); | 2690 ASSERT(num_prinfo_ == 0); |
2690 CheckBuffer(); | 2691 CheckBuffer(); |
2691 *reinterpret_cast<uint32_t*>(pc_) = data; | 2692 *reinterpret_cast<uint32_t*>(pc_) = data; |
2692 pc_ += sizeof(uint32_t); | 2693 pc_ += sizeof(uint32_t); |
2693 } | 2694 } |
2694 | 2695 |
2695 | 2696 |
2696 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { | 2697 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { |
2698 | |
Vitaly Repeshko
2011/04/15 01:24:43
nit: Remove blank line.
| |
2697 RelocInfo rinfo(pc_, rmode, data); // we do not try to reuse pool constants | 2699 RelocInfo rinfo(pc_, rmode, data); // we do not try to reuse pool constants |
2698 if (rmode >= RelocInfo::JS_RETURN && rmode <= RelocInfo::DEBUG_BREAK_SLOT) { | 2700 if (rmode >= RelocInfo::JS_RETURN && rmode <= RelocInfo::DEBUG_BREAK_SLOT) { |
2699 // Adjust code for new modes. | 2701 // Adjust code for new modes. |
2700 ASSERT(RelocInfo::IsDebugBreakSlot(rmode) | 2702 ASSERT(RelocInfo::IsDebugBreakSlot(rmode) |
2701 || RelocInfo::IsJSReturn(rmode) | 2703 || RelocInfo::IsJSReturn(rmode) |
2702 || RelocInfo::IsComment(rmode) | 2704 || RelocInfo::IsComment(rmode) |
2703 || RelocInfo::IsPosition(rmode)); | 2705 || RelocInfo::IsPosition(rmode)); |
2704 // These modes do not need an entry in the constant pool. | 2706 // These modes do not need an entry in the constant pool. |
2705 } else { | 2707 } else { |
2706 ASSERT(num_prinfo_ < kMaxNumPRInfo); | 2708 ASSERT(num_prinfo_ < kMaxNumPRInfo); |
2707 prinfo_[num_prinfo_++] = rinfo; | 2709 prinfo_[num_prinfo_++] = rinfo; |
2708 // Make sure the constant pool is not emitted in place of the next | 2710 // Make sure the constant pool is not emitted in place of the next |
2709 // instruction for which we just recorded relocation info. | 2711 // instruction for which we just recorded relocation info. |
2710 BlockConstPoolBefore(pc_offset() + kInstrSize); | 2712 BlockConstPoolBefore(pc_offset() + kInstrSize); |
2711 } | 2713 } |
2712 if (rinfo.rmode() != RelocInfo::NONE) { | 2714 if (rinfo.rmode() != RelocInfo::NONE) { |
2713 // Don't record external references unless the heap will be serialized. | 2715 // Don't record external references unless the heap will be serialized. |
2714 if (rmode == RelocInfo::EXTERNAL_REFERENCE) { | 2716 if (rmode == RelocInfo::EXTERNAL_REFERENCE) { |
2715 #ifdef DEBUG | 2717 #ifdef DEBUG |
2716 if (!Serializer::enabled()) { | 2718 if (!Serializer::enabled()) { |
2717 Serializer::TooLateToEnableNow(); | 2719 Serializer::TooLateToEnableNow(); |
2718 } | 2720 } |
2719 #endif | 2721 #endif |
2720 if (!Serializer::enabled() && !emit_debug_code()) { | 2722 if (!Serializer::enabled() && !emit_debug_code()) { |
2721 return; | 2723 return; |
2722 } | 2724 } |
2723 } | 2725 } |
2724 ASSERT(buffer_space() >= kMaxRelocSize); // too late to grow buffer here | 2726 ASSERT(buffer_space() >= kMaxRelocSize); // too late to grow buffer here |
2725 reloc_info_writer.Write(&rinfo); | 2727 if (rmode == RelocInfo::CODE_TARGET_WITH_ID) { |
2728 ASSERT(ast_id_for_reloc_info_ != kNoASTId); | |
2729 RelocInfo reloc_info_with_ast_id(pc_, rmode, ast_id_for_reloc_info_); | |
Vitaly Repeshko
2011/04/15 01:24:43
Not using data looks like a hack. There must be a
William Hesse
2011/04/15 11:51:27
We discussed it here, and there is no better way.
| |
2730 ast_id_for_reloc_info_ = kNoASTId; | |
2731 reloc_info_writer.Write(&reloc_info_with_ast_id); | |
2732 } else { | |
2733 reloc_info_writer.Write(&rinfo); | |
2734 } | |
2726 } | 2735 } |
2727 } | 2736 } |
2728 | 2737 |
2729 | 2738 |
2730 void Assembler::CheckConstPool(bool force_emit, bool require_jump) { | 2739 void Assembler::CheckConstPool(bool force_emit, bool require_jump) { |
2731 // Calculate the offset of the next check. It will be overwritten | 2740 // Calculate the offset of the next check. It will be overwritten |
2732 // when a const pool is generated or when const pools are being | 2741 // when a const pool is generated or when const pools are being |
2733 // blocked for a specific range. | 2742 // blocked for a specific range. |
2734 next_buffer_check_ = pc_offset() + kCheckConstInterval; | 2743 next_buffer_check_ = pc_offset() + kCheckConstInterval; |
2735 | 2744 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2831 | 2840 |
2832 // Since a constant pool was just emitted, move the check offset forward by | 2841 // Since a constant pool was just emitted, move the check offset forward by |
2833 // the standard interval. | 2842 // the standard interval. |
2834 next_buffer_check_ = pc_offset() + kCheckConstInterval; | 2843 next_buffer_check_ = pc_offset() + kCheckConstInterval; |
2835 } | 2844 } |
2836 | 2845 |
2837 | 2846 |
2838 } } // namespace v8::internal | 2847 } } // namespace v8::internal |
2839 | 2848 |
2840 #endif // V8_TARGET_ARCH_ARM | 2849 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |