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 3531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3542 return 0; | 3542 return 0; |
3543 } | 3543 } |
3544 } | 3544 } |
3545 } | 3545 } |
3546 | 3546 |
3547 | 3547 |
3548 void Assembler::GrowBuffer() { | 3548 void Assembler::GrowBuffer() { |
3549 if (!own_buffer_) FATAL("external code buffer is too small"); | 3549 if (!own_buffer_) FATAL("external code buffer is too small"); |
3550 | 3550 |
3551 // Compute new buffer size. | 3551 // Compute new buffer size. |
3552 CodeDesc desc; // The new buffer. | 3552 CodeDesc desc; // the new buffer |
3553 if (buffer_size_ < 1 * MB) { | 3553 if (buffer_size_ < 1 * MB) { |
3554 desc.buffer_size = 2*buffer_size_; | 3554 desc.buffer_size = 2*buffer_size_; |
3555 } else { | 3555 } else { |
3556 desc.buffer_size = buffer_size_ + 1*MB; | 3556 desc.buffer_size = buffer_size_ + 1*MB; |
3557 } | 3557 } |
3558 CHECK_GT(desc.buffer_size, 0); // No overflow. | 3558 |
| 3559 // Some internal data structures overflow for very large buffers, |
| 3560 // they must ensure that kMaximalBufferSize is not too large. |
| 3561 if (desc.buffer_size > kMaximalBufferSize || |
| 3562 static_cast<size_t>(desc.buffer_size) > |
| 3563 isolate_data().max_old_generation_size_) { |
| 3564 V8::FatalProcessOutOfMemory("Assembler::GrowBuffer"); |
| 3565 } |
3559 | 3566 |
3560 // Set up new buffer. | 3567 // Set up new buffer. |
3561 desc.buffer = NewArray<byte>(desc.buffer_size); | 3568 desc.buffer = NewArray<byte>(desc.buffer_size); |
3562 desc.origin = this; | 3569 desc.origin = this; |
3563 | 3570 |
3564 desc.instr_size = pc_offset(); | 3571 desc.instr_size = pc_offset(); |
3565 desc.reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); | 3572 desc.reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); |
3566 | 3573 |
3567 // Copy the data. | 3574 // Copy the data. |
3568 int pc_delta = desc.buffer - buffer_; | 3575 int pc_delta = desc.buffer - buffer_; |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3821 | 3828 |
3822 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 3829 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
3823 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t)); | 3830 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t)); |
3824 } | 3831 } |
3825 } | 3832 } |
3826 | 3833 |
3827 } // namespace internal | 3834 } // namespace internal |
3828 } // namespace v8 | 3835 } // namespace v8 |
3829 | 3836 |
3830 #endif // V8_TARGET_ARCH_MIPS | 3837 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |