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 3777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3788 instr_at_put(pc, unbox | (imm26 & kImm26Mask)); | 3788 instr_at_put(pc, unbox | (imm26 & kImm26Mask)); |
3789 return 1; // Number of instructions patched. | 3789 return 1; // Number of instructions patched. |
3790 } | 3790 } |
3791 } | 3791 } |
3792 | 3792 |
3793 | 3793 |
3794 void Assembler::GrowBuffer() { | 3794 void Assembler::GrowBuffer() { |
3795 if (!own_buffer_) FATAL("external code buffer is too small"); | 3795 if (!own_buffer_) FATAL("external code buffer is too small"); |
3796 | 3796 |
3797 // Compute new buffer size. | 3797 // Compute new buffer size. |
3798 CodeDesc desc; // The new buffer. | 3798 CodeDesc desc; // the new buffer |
3799 if (buffer_size_ < 1 * MB) { | 3799 if (buffer_size_ < 1 * MB) { |
3800 desc.buffer_size = 2*buffer_size_; | 3800 desc.buffer_size = 2*buffer_size_; |
3801 } else { | 3801 } else { |
3802 desc.buffer_size = buffer_size_ + 1*MB; | 3802 desc.buffer_size = buffer_size_ + 1*MB; |
3803 } | 3803 } |
3804 CHECK_GT(desc.buffer_size, 0); // No overflow. | 3804 |
| 3805 // Some internal data structures overflow for very large buffers, |
| 3806 // they must ensure that kMaximalBufferSize is not too large. |
| 3807 if (desc.buffer_size > kMaximalBufferSize || |
| 3808 static_cast<size_t>(desc.buffer_size) > |
| 3809 isolate_data().max_old_generation_size_) { |
| 3810 V8::FatalProcessOutOfMemory("Assembler::GrowBuffer"); |
| 3811 } |
3805 | 3812 |
3806 // Set up new buffer. | 3813 // Set up new buffer. |
3807 desc.buffer = NewArray<byte>(desc.buffer_size); | 3814 desc.buffer = NewArray<byte>(desc.buffer_size); |
3808 desc.origin = this; | 3815 desc.origin = this; |
3809 | 3816 |
3810 desc.instr_size = pc_offset(); | 3817 desc.instr_size = pc_offset(); |
3811 desc.reloc_size = | 3818 desc.reloc_size = |
3812 static_cast<int>((buffer_ + buffer_size_) - reloc_info_writer.pos()); | 3819 static_cast<int>((buffer_ + buffer_size_) - reloc_info_writer.pos()); |
3813 | 3820 |
3814 // Copy the data. | 3821 // Copy the data. |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4046 | 4053 |
4047 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 4054 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
4048 Assembler::FlushICache(isolate, pc, 4 * Assembler::kInstrSize); | 4055 Assembler::FlushICache(isolate, pc, 4 * Assembler::kInstrSize); |
4049 } | 4056 } |
4050 } | 4057 } |
4051 | 4058 |
4052 } // namespace internal | 4059 } // namespace internal |
4053 } // namespace v8 | 4060 } // namespace v8 |
4054 | 4061 |
4055 #endif // V8_TARGET_ARCH_MIPS64 | 4062 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |