| 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 al | B26 | Offset | kRegister_fp_Code * B16; | 311 al | B26 | Offset | kRegister_fp_Code * B16; |
| 312 const Instr kLdrRegFpNegOffsetPattern = | 312 const Instr kLdrRegFpNegOffsetPattern = |
| 313 al | B26 | L | NegOffset | kRegister_fp_Code * B16; | 313 al | B26 | L | NegOffset | kRegister_fp_Code * B16; |
| 314 const Instr kStrRegFpNegOffsetPattern = | 314 const Instr kStrRegFpNegOffsetPattern = |
| 315 al | B26 | NegOffset | kRegister_fp_Code * B16; | 315 al | B26 | NegOffset | kRegister_fp_Code * B16; |
| 316 const Instr kLdrStrInstrTypeMask = 0xffff0000; | 316 const Instr kLdrStrInstrTypeMask = 0xffff0000; |
| 317 const Instr kLdrStrInstrArgumentMask = 0x0000ffff; | 317 const Instr kLdrStrInstrArgumentMask = 0x0000ffff; |
| 318 const Instr kLdrStrOffsetMask = 0x00000fff; | 318 const Instr kLdrStrOffsetMask = 0x00000fff; |
| 319 | 319 |
| 320 | 320 |
| 321 // Spare buffer. | 321 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) |
| 322 static const int kMinimalBufferSize = 4*KB; | 322 : AssemblerBase(isolate, buffer, buffer_size), |
| 323 | |
| 324 | |
| 325 Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size) | |
| 326 : AssemblerBase(arg_isolate), | |
| 327 recorded_ast_id_(TypeFeedbackId::None()), | 323 recorded_ast_id_(TypeFeedbackId::None()), |
| 328 positions_recorder_(this) { | 324 positions_recorder_(this) { |
| 329 if (buffer == NULL) { | 325 reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_); |
| 330 // Do our own buffer management. | |
| 331 if (buffer_size <= kMinimalBufferSize) { | |
| 332 buffer_size = kMinimalBufferSize; | |
| 333 | |
| 334 if (isolate()->assembler_spare_buffer() != NULL) { | |
| 335 buffer = isolate()->assembler_spare_buffer(); | |
| 336 isolate()->set_assembler_spare_buffer(NULL); | |
| 337 } | |
| 338 } | |
| 339 if (buffer == NULL) { | |
| 340 buffer_ = NewArray<byte>(buffer_size); | |
| 341 } else { | |
| 342 buffer_ = static_cast<byte*>(buffer); | |
| 343 } | |
| 344 buffer_size_ = buffer_size; | |
| 345 own_buffer_ = true; | |
| 346 | |
| 347 } else { | |
| 348 // Use externally provided buffer instead. | |
| 349 ASSERT(buffer_size > 0); | |
| 350 buffer_ = static_cast<byte*>(buffer); | |
| 351 buffer_size_ = buffer_size; | |
| 352 own_buffer_ = false; | |
| 353 } | |
| 354 | |
| 355 // Set up buffer pointers. | |
| 356 ASSERT(buffer_ != NULL); | |
| 357 pc_ = buffer_; | |
| 358 reloc_info_writer.Reposition(buffer_ + buffer_size, pc_); | |
| 359 num_pending_reloc_info_ = 0; | 326 num_pending_reloc_info_ = 0; |
| 360 next_buffer_check_ = 0; | 327 next_buffer_check_ = 0; |
| 361 const_pool_blocked_nesting_ = 0; | 328 const_pool_blocked_nesting_ = 0; |
| 362 no_const_pool_before_ = 0; | 329 no_const_pool_before_ = 0; |
| 363 first_const_pool_use_ = -1; | 330 first_const_pool_use_ = -1; |
| 364 last_bound_pos_ = 0; | 331 last_bound_pos_ = 0; |
| 365 ClearRecordedAstId(); | 332 ClearRecordedAstId(); |
| 366 } | 333 } |
| 367 | 334 |
| 368 | 335 |
| 369 Assembler::~Assembler() { | 336 Assembler::~Assembler() { |
| 370 ASSERT(const_pool_blocked_nesting_ == 0); | 337 ASSERT(const_pool_blocked_nesting_ == 0); |
| 371 if (own_buffer_) { | |
| 372 if (isolate()->assembler_spare_buffer() == NULL && | |
| 373 buffer_size_ == kMinimalBufferSize) { | |
| 374 isolate()->set_assembler_spare_buffer(buffer_); | |
| 375 } else { | |
| 376 DeleteArray(buffer_); | |
| 377 } | |
| 378 } | |
| 379 } | 338 } |
| 380 | 339 |
| 381 | 340 |
| 382 void Assembler::GetCode(CodeDesc* desc) { | 341 void Assembler::GetCode(CodeDesc* desc) { |
| 383 // Emit constant pool if necessary. | 342 // Emit constant pool if necessary. |
| 384 CheckConstPool(true, false); | 343 CheckConstPool(true, false); |
| 385 ASSERT(num_pending_reloc_info_ == 0); | 344 ASSERT(num_pending_reloc_info_ == 0); |
| 386 | 345 |
| 387 // Set up code descriptor. | 346 // Set up code descriptor. |
| 388 desc->buffer = buffer_; | 347 desc->buffer = buffer_; |
| (...skipping 2395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2784 | 2743 |
| 2785 // Since a constant pool was just emitted, move the check offset forward by | 2744 // Since a constant pool was just emitted, move the check offset forward by |
| 2786 // the standard interval. | 2745 // the standard interval. |
| 2787 next_buffer_check_ = pc_offset() + kCheckPoolInterval; | 2746 next_buffer_check_ = pc_offset() + kCheckPoolInterval; |
| 2788 } | 2747 } |
| 2789 | 2748 |
| 2790 | 2749 |
| 2791 } } // namespace v8::internal | 2750 } } // namespace v8::internal |
| 2792 | 2751 |
| 2793 #endif // V8_TARGET_ARCH_ARM | 2752 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |