| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
| 4 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
| 5 // met: | 5 // met: |
| 6 // | 6 // |
| 7 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
| 8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
| 9 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
| 10 // copyright notice, this list of conditions and the following | 10 // copyright notice, this list of conditions and the following |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) | 276 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) |
| 277 : AssemblerBase(isolate, buffer, buffer_size), | 277 : AssemblerBase(isolate, buffer, buffer_size), |
| 278 recorded_ast_id_(TypeFeedbackId::None()), | 278 recorded_ast_id_(TypeFeedbackId::None()), |
| 279 positions_recorder_(this) { | 279 positions_recorder_(this) { |
| 280 const_pool_blocked_nesting_ = 0; | 280 const_pool_blocked_nesting_ = 0; |
| 281 Reset(); | 281 Reset(); |
| 282 } | 282 } |
| 283 | 283 |
| 284 | 284 |
| 285 Assembler::~Assembler() { | 285 Assembler::~Assembler() { |
| 286 ASSERT(finalized_ || (pc_ == buffer_)); | |
| 287 ASSERT(num_pending_reloc_info_ == 0); | 286 ASSERT(num_pending_reloc_info_ == 0); |
| 288 ASSERT(const_pool_blocked_nesting_ == 0); | 287 ASSERT(const_pool_blocked_nesting_ == 0); |
| 289 } | 288 } |
| 290 | 289 |
| 291 | 290 |
| 292 void Assembler::Reset() { | 291 void Assembler::Reset() { |
| 293 #ifdef DEBUG | 292 #ifdef DEBUG |
| 294 ASSERT((pc_ >= buffer_) && (pc_ < buffer_ + buffer_size_)); | 293 ASSERT((pc_ >= buffer_) && (pc_ < buffer_ + buffer_size_)); |
| 295 ASSERT(const_pool_blocked_nesting_ == 0); | 294 ASSERT(const_pool_blocked_nesting_ == 0); |
| 296 memset(buffer_, 0, pc_ - buffer_); | 295 memset(buffer_, 0, pc_ - buffer_); |
| 297 finalized_ = false; | |
| 298 #endif | 296 #endif |
| 299 pc_ = buffer_; | 297 pc_ = buffer_; |
| 300 reloc_info_writer.Reposition(reinterpret_cast<byte*>(buffer_ + buffer_size_), | 298 reloc_info_writer.Reposition(reinterpret_cast<byte*>(buffer_ + buffer_size_), |
| 301 reinterpret_cast<byte*>(pc_)); | 299 reinterpret_cast<byte*>(pc_)); |
| 302 num_pending_reloc_info_ = 0; | 300 num_pending_reloc_info_ = 0; |
| 303 next_buffer_check_ = 0; | 301 next_buffer_check_ = 0; |
| 304 no_const_pool_before_ = 0; | 302 no_const_pool_before_ = 0; |
| 305 first_const_pool_use_ = -1; | 303 first_const_pool_use_ = -1; |
| 306 ClearRecordedAstId(); | 304 ClearRecordedAstId(); |
| 307 } | 305 } |
| 308 | 306 |
| 309 | 307 |
| 310 void Assembler::GetCode(CodeDesc* desc) { | 308 void Assembler::GetCode(CodeDesc* desc) { |
| 311 // Emit constant pool if necessary. | 309 // Emit constant pool if necessary. |
| 312 CheckConstPool(true, false); | 310 CheckConstPool(true, false); |
| 313 ASSERT(num_pending_reloc_info_ == 0); | 311 ASSERT(num_pending_reloc_info_ == 0); |
| 314 | 312 |
| 315 // Set up code descriptor. | 313 // Set up code descriptor. |
| 316 if (desc) { | 314 if (desc) { |
| 317 desc->buffer = reinterpret_cast<byte*>(buffer_); | 315 desc->buffer = reinterpret_cast<byte*>(buffer_); |
| 318 desc->buffer_size = buffer_size_; | 316 desc->buffer_size = buffer_size_; |
| 319 desc->instr_size = pc_offset(); | 317 desc->instr_size = pc_offset(); |
| 320 desc->reloc_size = (reinterpret_cast<byte*>(buffer_) + buffer_size_) - | 318 desc->reloc_size = (reinterpret_cast<byte*>(buffer_) + buffer_size_) - |
| 321 reloc_info_writer.pos(); | 319 reloc_info_writer.pos(); |
| 322 desc->origin = this; | 320 desc->origin = this; |
| 323 } | 321 } |
| 324 | |
| 325 #ifdef DEBUG | |
| 326 finalized_ = true; | |
| 327 #endif | |
| 328 } | 322 } |
| 329 | 323 |
| 330 | 324 |
| 331 void Assembler::Align(int m) { | 325 void Assembler::Align(int m) { |
| 332 ASSERT(m >= 4 && IsPowerOf2(m)); | 326 ASSERT(m >= 4 && IsPowerOf2(m)); |
| 333 while ((pc_offset() & (m - 1)) != 0) { | 327 while ((pc_offset() & (m - 1)) != 0) { |
| 334 nop(); | 328 nop(); |
| 335 } | 329 } |
| 336 } | 330 } |
| 337 | 331 |
| (...skipping 2147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2485 // code. | 2479 // code. |
| 2486 #ifdef ENABLE_DEBUGGER_SUPPORT | 2480 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 2487 RecordRelocInfo(RelocInfo::CONST_POOL, static_cast<intptr_t>(size)); | 2481 RecordRelocInfo(RelocInfo::CONST_POOL, static_cast<intptr_t>(size)); |
| 2488 #endif | 2482 #endif |
| 2489 } | 2483 } |
| 2490 | 2484 |
| 2491 | 2485 |
| 2492 } } // namespace v8::internal | 2486 } } // namespace v8::internal |
| 2493 | 2487 |
| 2494 #endif // V8_TARGET_ARCH_A64 | 2488 #endif // V8_TARGET_ARCH_A64 |
| OLD | NEW |