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 4863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4874 void Assembler::GrowBuffer() { | 4874 void Assembler::GrowBuffer() { |
4875 if (!own_buffer_) FATAL("external code buffer is too small"); | 4875 if (!own_buffer_) FATAL("external code buffer is too small"); |
4876 | 4876 |
4877 // Compute new buffer size. | 4877 // Compute new buffer size. |
4878 CodeDesc desc; // the new buffer | 4878 CodeDesc desc; // the new buffer |
4879 if (buffer_size_ < 1 * MB) { | 4879 if (buffer_size_ < 1 * MB) { |
4880 desc.buffer_size = 2*buffer_size_; | 4880 desc.buffer_size = 2*buffer_size_; |
4881 } else { | 4881 } else { |
4882 desc.buffer_size = buffer_size_ + 1*MB; | 4882 desc.buffer_size = buffer_size_ + 1*MB; |
4883 } | 4883 } |
4884 CHECK_GT(desc.buffer_size, 0); // no overflow | 4884 |
| 4885 // Some internal data structures overflow for very large buffers, |
| 4886 // they must ensure that kMaximalBufferSize is not too large. |
| 4887 if (desc.buffer_size > kMaximalBufferSize || |
| 4888 static_cast<size_t>(desc.buffer_size) > |
| 4889 isolate_data().max_old_generation_size_) { |
| 4890 V8::FatalProcessOutOfMemory("Assembler::GrowBuffer"); |
| 4891 } |
4885 | 4892 |
4886 // Set up new buffer. | 4893 // Set up new buffer. |
4887 desc.buffer = NewArray<byte>(desc.buffer_size); | 4894 desc.buffer = NewArray<byte>(desc.buffer_size); |
4888 | 4895 |
4889 desc.instr_size = pc_offset(); | 4896 desc.instr_size = pc_offset(); |
4890 desc.reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); | 4897 desc.reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); |
4891 desc.origin = this; | 4898 desc.origin = this; |
4892 | 4899 |
4893 // Copy the data. | 4900 // Copy the data. |
4894 int pc_delta = desc.buffer - buffer_; | 4901 int pc_delta = desc.buffer - buffer_; |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5262 } | 5269 } |
5263 | 5270 |
5264 void PatchingAssembler::FlushICache(Isolate* isolate) { | 5271 void PatchingAssembler::FlushICache(Isolate* isolate) { |
5265 Assembler::FlushICache(isolate, buffer_, buffer_size_ - kGap); | 5272 Assembler::FlushICache(isolate, buffer_, buffer_size_ - kGap); |
5266 } | 5273 } |
5267 | 5274 |
5268 } // namespace internal | 5275 } // namespace internal |
5269 } // namespace v8 | 5276 } // namespace v8 |
5270 | 5277 |
5271 #endif // V8_TARGET_ARCH_ARM | 5278 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |