| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 // Emit a single byte. Must always be inlined. | 294 // Emit a single byte. Must always be inlined. |
| 295 #define EMIT(x) \ | 295 #define EMIT(x) \ |
| 296 *pc_++ = (x) | 296 *pc_++ = (x) |
| 297 | 297 |
| 298 | 298 |
| 299 #ifdef GENERATED_CODE_COVERAGE | 299 #ifdef GENERATED_CODE_COVERAGE |
| 300 static void InitCoverageLog(); | 300 static void InitCoverageLog(); |
| 301 #endif | 301 #endif |
| 302 | 302 |
| 303 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) | 303 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) |
| 304 : AssemblerBase(isolate, buffer, buffer_size), | 304 : AssemblerBase(isolate, buffer, buffer_size) { |
| 305 positions_recorder_(this) { | 305 // Clear the buffer in debug mode unless it was provided by the |
| 306 // Clear the buffer in debug mode unless it was provided by the | 306 // caller in which case we can't be sure it's okay to overwrite |
| 307 // caller in which case we can't be sure it's okay to overwrite | 307 // existing code in it; see CodePatcher::CodePatcher(...). |
| 308 // existing code in it; see CodePatcher::CodePatcher(...). | |
| 309 #ifdef DEBUG | 308 #ifdef DEBUG |
| 310 if (own_buffer_) { | 309 if (own_buffer_) { |
| 311 memset(buffer_, 0xCC, buffer_size_); // int3 | 310 memset(buffer_, 0xCC, buffer_size_); // int3 |
| 312 } | 311 } |
| 313 #endif | 312 #endif |
| 314 | 313 |
| 315 reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_); | 314 reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_); |
| 316 | 315 |
| 317 #ifdef GENERATED_CODE_COVERAGE | 316 #ifdef GENERATED_CODE_COVERAGE |
| 318 InitCoverageLog(); | 317 InitCoverageLog(); |
| 319 #endif | 318 #endif |
| 320 } | 319 } |
| 321 | 320 |
| 322 | 321 |
| 323 void Assembler::GetCode(CodeDesc* desc) { | 322 void Assembler::GetCode(CodeDesc* desc) { |
| 324 // Finalize code (at this point overflow() may be true, but the gap ensures | 323 // Finalize code (at this point overflow() may be true, but the gap ensures |
| 325 // that we are still not overlapping instructions and relocation info). | 324 // that we are still not overlapping instructions and relocation info). |
| 326 reloc_info_writer.Finish(); | |
| 327 DCHECK(pc_ <= reloc_info_writer.pos()); // No overlap. | 325 DCHECK(pc_ <= reloc_info_writer.pos()); // No overlap. |
| 328 // Set up code descriptor. | 326 // Set up code descriptor. |
| 329 desc->buffer = buffer_; | 327 desc->buffer = buffer_; |
| 330 desc->buffer_size = buffer_size_; | 328 desc->buffer_size = buffer_size_; |
| 331 desc->instr_size = pc_offset(); | 329 desc->instr_size = pc_offset(); |
| 332 desc->reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); | 330 desc->reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); |
| 333 desc->origin = this; | 331 desc->origin = this; |
| 334 desc->constant_pool_size = 0; | 332 desc->constant_pool_size = 0; |
| 335 desc->unwinding_info_size = 0; | 333 desc->unwinding_info_size = 0; |
| 336 desc->unwinding_info = nullptr; | 334 desc->unwinding_info = nullptr; |
| (...skipping 2737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3074 fflush(coverage_log); | 3072 fflush(coverage_log); |
| 3075 } | 3073 } |
| 3076 } | 3074 } |
| 3077 | 3075 |
| 3078 #endif | 3076 #endif |
| 3079 | 3077 |
| 3080 } // namespace internal | 3078 } // namespace internal |
| 3081 } // namespace v8 | 3079 } // namespace v8 |
| 3082 | 3080 |
| 3083 #endif // V8_TARGET_ARCH_IA32 | 3081 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |