| 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 own_buffer_ = true; | 310 own_buffer_ = true; |
| 311 | 311 |
| 312 } else { | 312 } else { |
| 313 // Use externally provided buffer instead. | 313 // Use externally provided buffer instead. |
| 314 ASSERT(buffer_size > 0); | 314 ASSERT(buffer_size > 0); |
| 315 buffer_ = static_cast<byte*>(buffer); | 315 buffer_ = static_cast<byte*>(buffer); |
| 316 buffer_size_ = buffer_size; | 316 buffer_size_ = buffer_size; |
| 317 own_buffer_ = false; | 317 own_buffer_ = false; |
| 318 } | 318 } |
| 319 | 319 |
| 320 // Setup buffer pointers. | 320 // Set up buffer pointers. |
| 321 ASSERT(buffer_ != NULL); | 321 ASSERT(buffer_ != NULL); |
| 322 pc_ = buffer_; | 322 pc_ = buffer_; |
| 323 reloc_info_writer.Reposition(buffer_ + buffer_size, pc_); | 323 reloc_info_writer.Reposition(buffer_ + buffer_size, pc_); |
| 324 num_pending_reloc_info_ = 0; | 324 num_pending_reloc_info_ = 0; |
| 325 next_buffer_check_ = 0; | 325 next_buffer_check_ = 0; |
| 326 const_pool_blocked_nesting_ = 0; | 326 const_pool_blocked_nesting_ = 0; |
| 327 no_const_pool_before_ = 0; | 327 no_const_pool_before_ = 0; |
| 328 first_const_pool_use_ = -1; | 328 first_const_pool_use_ = -1; |
| 329 last_bound_pos_ = 0; | 329 last_bound_pos_ = 0; |
| 330 ClearRecordedAstId(); | 330 ClearRecordedAstId(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 } | 344 } |
| 345 | 345 |
| 346 | 346 |
| 347 void Assembler::GetCode(CodeDesc* desc) { | 347 void Assembler::GetCode(CodeDesc* desc) { |
| 348 // Emit constant pool if necessary. | 348 // Emit constant pool if necessary. |
| 349 CheckConstPool(true, false); | 349 CheckConstPool(true, false); |
| 350 ASSERT(num_pending_reloc_info_ == 0); | 350 ASSERT(num_pending_reloc_info_ == 0); |
| 351 | 351 |
| 352 // Setup code descriptor. | 352 // Set up code descriptor. |
| 353 desc->buffer = buffer_; | 353 desc->buffer = buffer_; |
| 354 desc->buffer_size = buffer_size_; | 354 desc->buffer_size = buffer_size_; |
| 355 desc->instr_size = pc_offset(); | 355 desc->instr_size = pc_offset(); |
| 356 desc->reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); | 356 desc->reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); |
| 357 } | 357 } |
| 358 | 358 |
| 359 | 359 |
| 360 void Assembler::Align(int m) { | 360 void Assembler::Align(int m) { |
| 361 ASSERT(m >= 4 && IsPowerOf2(m)); | 361 ASSERT(m >= 4 && IsPowerOf2(m)); |
| 362 while ((pc_offset() & (m - 1)) != 0) { | 362 while ((pc_offset() & (m - 1)) != 0) { |
| (...skipping 2076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2439 CodeDesc desc; // the new buffer | 2439 CodeDesc desc; // the new buffer |
| 2440 if (buffer_size_ < 4*KB) { | 2440 if (buffer_size_ < 4*KB) { |
| 2441 desc.buffer_size = 4*KB; | 2441 desc.buffer_size = 4*KB; |
| 2442 } else if (buffer_size_ < 1*MB) { | 2442 } else if (buffer_size_ < 1*MB) { |
| 2443 desc.buffer_size = 2*buffer_size_; | 2443 desc.buffer_size = 2*buffer_size_; |
| 2444 } else { | 2444 } else { |
| 2445 desc.buffer_size = buffer_size_ + 1*MB; | 2445 desc.buffer_size = buffer_size_ + 1*MB; |
| 2446 } | 2446 } |
| 2447 CHECK_GT(desc.buffer_size, 0); // no overflow | 2447 CHECK_GT(desc.buffer_size, 0); // no overflow |
| 2448 | 2448 |
| 2449 // Setup new buffer. | 2449 // Set up new buffer. |
| 2450 desc.buffer = NewArray<byte>(desc.buffer_size); | 2450 desc.buffer = NewArray<byte>(desc.buffer_size); |
| 2451 | 2451 |
| 2452 desc.instr_size = pc_offset(); | 2452 desc.instr_size = pc_offset(); |
| 2453 desc.reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); | 2453 desc.reloc_size = (buffer_ + buffer_size_) - reloc_info_writer.pos(); |
| 2454 | 2454 |
| 2455 // Copy the data. | 2455 // Copy the data. |
| 2456 int pc_delta = desc.buffer - buffer_; | 2456 int pc_delta = desc.buffer - buffer_; |
| 2457 int rc_delta = (desc.buffer + desc.buffer_size) - (buffer_ + buffer_size_); | 2457 int rc_delta = (desc.buffer + desc.buffer_size) - (buffer_ + buffer_size_); |
| 2458 memmove(desc.buffer, buffer_, desc.instr_size); | 2458 memmove(desc.buffer, buffer_, desc.instr_size); |
| 2459 memmove(reloc_info_writer.pos() + rc_delta, | 2459 memmove(reloc_info_writer.pos() + rc_delta, |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2654 | 2654 |
| 2655 // Since a constant pool was just emitted, move the check offset forward by | 2655 // Since a constant pool was just emitted, move the check offset forward by |
| 2656 // the standard interval. | 2656 // the standard interval. |
| 2657 next_buffer_check_ = pc_offset() + kCheckPoolInterval; | 2657 next_buffer_check_ = pc_offset() + kCheckPoolInterval; |
| 2658 } | 2658 } |
| 2659 | 2659 |
| 2660 | 2660 |
| 2661 } } // namespace v8::internal | 2661 } } // namespace v8::internal |
| 2662 | 2662 |
| 2663 #endif // V8_TARGET_ARCH_ARM | 2663 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |