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 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2052 desc.buffer_size = 4 * KB; | 2052 desc.buffer_size = 4 * KB; |
2053 } else if (buffer_size_ < 1 * MB) { | 2053 } else if (buffer_size_ < 1 * MB) { |
2054 desc.buffer_size = 2 * buffer_size_; | 2054 desc.buffer_size = 2 * buffer_size_; |
2055 } else { | 2055 } else { |
2056 desc.buffer_size = buffer_size_ + 1 * MB; | 2056 desc.buffer_size = buffer_size_ + 1 * MB; |
2057 } | 2057 } |
2058 int space = buffer_space() + (desc.buffer_size - buffer_size_); | 2058 int space = buffer_space() + (desc.buffer_size - buffer_size_); |
2059 if (space < needed) { | 2059 if (space < needed) { |
2060 desc.buffer_size += needed - space; | 2060 desc.buffer_size += needed - space; |
2061 } | 2061 } |
2062 CHECK_GT(desc.buffer_size, 0); // no overflow | 2062 |
| 2063 // Some internal data structures overflow for very large buffers, |
| 2064 // they must ensure that kMaximalBufferSize is not too large. |
| 2065 if (desc.buffer_size > kMaximalBufferSize || |
| 2066 static_cast<size_t>(desc.buffer_size) > |
| 2067 isolate_data().max_old_generation_size_) { |
| 2068 V8::FatalProcessOutOfMemory("Assembler::GrowBuffer"); |
| 2069 } |
2063 | 2070 |
2064 // Set up new buffer. | 2071 // Set up new buffer. |
2065 desc.buffer = NewArray<byte>(desc.buffer_size); | 2072 desc.buffer = NewArray<byte>(desc.buffer_size); |
2066 desc.origin = this; | 2073 desc.origin = this; |
2067 | 2074 |
2068 desc.instr_size = pc_offset(); | 2075 desc.instr_size = pc_offset(); |
2069 desc.reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); | 2076 desc.reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); |
2070 | 2077 |
2071 // Copy the data. | 2078 // Copy the data. |
2072 intptr_t pc_delta = desc.buffer - buffer_; | 2079 intptr_t pc_delta = desc.buffer - buffer_; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2159 SKIP_ICACHE_FLUSH); | 2166 SKIP_ICACHE_FLUSH); |
2160 } | 2167 } |
2161 | 2168 |
2162 reloc_info_writer.Write(&rinfo); | 2169 reloc_info_writer.Write(&rinfo); |
2163 } | 2170 } |
2164 } | 2171 } |
2165 | 2172 |
2166 } // namespace internal | 2173 } // namespace internal |
2167 } // namespace v8 | 2174 } // namespace v8 |
2168 #endif // V8_TARGET_ARCH_S390 | 2175 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |