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 are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // 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 3006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3017 CodeDesc desc; // The new buffer. | 3017 CodeDesc desc; // The new buffer. |
3018 if (buffer_size_ < 1 * MB) { | 3018 if (buffer_size_ < 1 * MB) { |
3019 desc.buffer_size = 2*buffer_size_; | 3019 desc.buffer_size = 2*buffer_size_; |
3020 } else { | 3020 } else { |
3021 desc.buffer_size = buffer_size_ + 1*MB; | 3021 desc.buffer_size = buffer_size_ + 1*MB; |
3022 } | 3022 } |
3023 CHECK_GT(desc.buffer_size, 0); // No overflow. | 3023 CHECK_GT(desc.buffer_size, 0); // No overflow. |
3024 | 3024 |
3025 // Set up new buffer. | 3025 // Set up new buffer. |
3026 desc.buffer = NewArray<byte>(desc.buffer_size); | 3026 desc.buffer = NewArray<byte>(desc.buffer_size); |
| 3027 desc.origin = this; |
3027 | 3028 |
3028 desc.instr_size = pc_offset(); | 3029 desc.instr_size = pc_offset(); |
3029 desc.reloc_size = | 3030 desc.reloc_size = |
3030 static_cast<int>((buffer_ + buffer_size_) - reloc_info_writer.pos()); | 3031 static_cast<int>((buffer_ + buffer_size_) - reloc_info_writer.pos()); |
3031 | 3032 |
3032 // Copy the data. | 3033 // Copy the data. |
3033 intptr_t pc_delta = desc.buffer - buffer_; | 3034 intptr_t pc_delta = desc.buffer - buffer_; |
3034 intptr_t rc_delta = (desc.buffer + desc.buffer_size) - | 3035 intptr_t rc_delta = (desc.buffer + desc.buffer_size) - |
3035 (buffer_ + buffer_size_); | 3036 (buffer_ + buffer_size_); |
3036 MemMove(desc.buffer, buffer_, desc.instr_size); | 3037 MemMove(desc.buffer, buffer_, desc.instr_size); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3096 void Assembler::emit_code_stub_address(Code* stub) { | 3097 void Assembler::emit_code_stub_address(Code* stub) { |
3097 CheckBuffer(); | 3098 CheckBuffer(); |
3098 *reinterpret_cast<uint64_t*>(pc_) = | 3099 *reinterpret_cast<uint64_t*>(pc_) = |
3099 reinterpret_cast<uint64_t>(stub->instruction_start()); | 3100 reinterpret_cast<uint64_t>(stub->instruction_start()); |
3100 pc_ += sizeof(uint64_t); | 3101 pc_ += sizeof(uint64_t); |
3101 } | 3102 } |
3102 | 3103 |
3103 | 3104 |
3104 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { | 3105 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { |
3105 // We do not try to reuse pool constants. | 3106 // We do not try to reuse pool constants. |
3106 RelocInfo rinfo(pc_, rmode, data, NULL); | 3107 RelocInfo rinfo(isolate(), pc_, rmode, data, NULL); |
3107 if (rmode >= RelocInfo::COMMENT && | 3108 if (rmode >= RelocInfo::COMMENT && |
3108 rmode <= RelocInfo::DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL) { | 3109 rmode <= RelocInfo::DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL) { |
3109 // Adjust code for new modes. | 3110 // Adjust code for new modes. |
3110 DCHECK(RelocInfo::IsDebugBreakSlot(rmode) | 3111 DCHECK(RelocInfo::IsDebugBreakSlot(rmode) |
3111 || RelocInfo::IsComment(rmode) | 3112 || RelocInfo::IsComment(rmode) |
3112 || RelocInfo::IsPosition(rmode)); | 3113 || RelocInfo::IsPosition(rmode)); |
3113 // These modes do not need an entry in the constant pool. | 3114 // These modes do not need an entry in the constant pool. |
3114 } | 3115 } |
3115 if (!RelocInfo::IsNone(rinfo.rmode())) { | 3116 if (!RelocInfo::IsNone(rinfo.rmode())) { |
3116 // Don't record external references unless the heap will be serialized. | 3117 // Don't record external references unless the heap will be serialized. |
3117 if (rmode == RelocInfo::EXTERNAL_REFERENCE && | 3118 if (rmode == RelocInfo::EXTERNAL_REFERENCE && |
3118 !serializer_enabled() && !emit_debug_code()) { | 3119 !serializer_enabled() && !emit_debug_code()) { |
3119 return; | 3120 return; |
3120 } | 3121 } |
3121 DCHECK(buffer_space() >= kMaxRelocSize); // Too late to grow buffer here. | 3122 DCHECK(buffer_space() >= kMaxRelocSize); // Too late to grow buffer here. |
3122 if (rmode == RelocInfo::CODE_TARGET_WITH_ID) { | 3123 if (rmode == RelocInfo::CODE_TARGET_WITH_ID) { |
3123 RelocInfo reloc_info_with_ast_id(pc_, | 3124 RelocInfo reloc_info_with_ast_id(isolate(), pc_, rmode, |
3124 rmode, | 3125 RecordedAstId().ToInt(), NULL); |
3125 RecordedAstId().ToInt(), | |
3126 NULL); | |
3127 ClearRecordedAstId(); | 3126 ClearRecordedAstId(); |
3128 reloc_info_writer.Write(&reloc_info_with_ast_id); | 3127 reloc_info_writer.Write(&reloc_info_with_ast_id); |
3129 } else { | 3128 } else { |
3130 reloc_info_writer.Write(&rinfo); | 3129 reloc_info_writer.Write(&rinfo); |
3131 } | 3130 } |
3132 } | 3131 } |
3133 } | 3132 } |
3134 | 3133 |
3135 | 3134 |
3136 void Assembler::BlockTrampolinePoolFor(int instructions) { | 3135 void Assembler::BlockTrampolinePoolFor(int instructions) { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3276 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 3275 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
3277 Assembler::FlushICacheWithoutIsolate(pc, 4 * Assembler::kInstrSize); | 3276 Assembler::FlushICacheWithoutIsolate(pc, 4 * Assembler::kInstrSize); |
3278 } | 3277 } |
3279 } | 3278 } |
3280 | 3279 |
3281 | 3280 |
3282 } // namespace internal | 3281 } // namespace internal |
3283 } // namespace v8 | 3282 } // namespace v8 |
3284 | 3283 |
3285 #endif // V8_TARGET_ARCH_MIPS64 | 3284 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |