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 1966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1977 desc.buffer_size = 4 * KB; | 1977 desc.buffer_size = 4 * KB; |
1978 } else if (buffer_size_ < 1 * MB) { | 1978 } else if (buffer_size_ < 1 * MB) { |
1979 desc.buffer_size = 2 * buffer_size_; | 1979 desc.buffer_size = 2 * buffer_size_; |
1980 } else { | 1980 } else { |
1981 desc.buffer_size = buffer_size_ + 1 * MB; | 1981 desc.buffer_size = buffer_size_ + 1 * MB; |
1982 } | 1982 } |
1983 int space = buffer_space() + (desc.buffer_size - buffer_size_); | 1983 int space = buffer_space() + (desc.buffer_size - buffer_size_); |
1984 if (space < needed) { | 1984 if (space < needed) { |
1985 desc.buffer_size += needed - space; | 1985 desc.buffer_size += needed - space; |
1986 } | 1986 } |
1987 CHECK_GT(desc.buffer_size, 0); // no overflow | 1987 |
| 1988 // Some internal data structures overflow for very large buffers, |
| 1989 // they must ensure that kMaximalBufferSize is not too large. |
| 1990 if (desc.buffer_size > kMaximalBufferSize || |
| 1991 static_cast<size_t>(desc.buffer_size) > |
| 1992 isolate_data().max_old_generation_size_) { |
| 1993 V8::FatalProcessOutOfMemory("Assembler::GrowBuffer"); |
| 1994 } |
1988 | 1995 |
1989 // Set up new buffer. | 1996 // Set up new buffer. |
1990 desc.buffer = NewArray<byte>(desc.buffer_size); | 1997 desc.buffer = NewArray<byte>(desc.buffer_size); |
1991 desc.origin = this; | 1998 desc.origin = this; |
1992 | 1999 |
1993 desc.instr_size = pc_offset(); | 2000 desc.instr_size = pc_offset(); |
1994 desc.reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); | 2001 desc.reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); |
1995 | 2002 |
1996 // Copy the data. | 2003 // Copy the data. |
1997 intptr_t pc_delta = desc.buffer - buffer_; | 2004 intptr_t pc_delta = desc.buffer - buffer_; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2135 } | 2142 } |
2136 | 2143 |
2137 void PatchingAssembler::FlushICache(Isolate* isolate) { | 2144 void PatchingAssembler::FlushICache(Isolate* isolate) { |
2138 Assembler::FlushICache(isolate, buffer_, buffer_size_ - kGap); | 2145 Assembler::FlushICache(isolate, buffer_, buffer_size_ - kGap); |
2139 } | 2146 } |
2140 | 2147 |
2141 } // namespace internal | 2148 } // namespace internal |
2142 } // namespace v8 | 2149 } // namespace v8 |
2143 | 2150 |
2144 #endif // V8_TARGET_ARCH_PPC | 2151 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |