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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 DCHECK(IsWasmMemorySizeReference(rmode_)); | 203 DCHECK(IsWasmMemorySizeReference(rmode_)); |
204 return reinterpret_cast<uint32_t>(Assembler::target_address_at(pc_, host_)); | 204 return reinterpret_cast<uint32_t>(Assembler::target_address_at(pc_, host_)); |
205 } | 205 } |
206 | 206 |
207 uint32_t RelocInfo::wasm_function_table_size_reference() { | 207 uint32_t RelocInfo::wasm_function_table_size_reference() { |
208 DCHECK(IsWasmFunctionTableSizeReference(rmode_)); | 208 DCHECK(IsWasmFunctionTableSizeReference(rmode_)); |
209 return reinterpret_cast<uint32_t>(Assembler::target_address_at(pc_, host_)); | 209 return reinterpret_cast<uint32_t>(Assembler::target_address_at(pc_, host_)); |
210 } | 210 } |
211 | 211 |
212 void RelocInfo::unchecked_update_wasm_memory_reference( | 212 void RelocInfo::unchecked_update_wasm_memory_reference( |
213 Address address, ICacheFlushMode flush_mode) { | 213 Isolate* isolate, Address address, ICacheFlushMode flush_mode) { |
214 Assembler::set_target_address_at(isolate_, pc_, host_, address, flush_mode); | 214 Assembler::set_target_address_at(isolate, pc_, host_, address, flush_mode); |
215 } | 215 } |
216 | 216 |
217 void RelocInfo::unchecked_update_wasm_size(uint32_t size, | 217 void RelocInfo::unchecked_update_wasm_size(Isolate* isolate, uint32_t size, |
218 ICacheFlushMode flush_mode) { | 218 ICacheFlushMode flush_mode) { |
219 Assembler::set_target_address_at(isolate_, pc_, host_, | 219 Assembler::set_target_address_at(isolate, pc_, host_, |
220 reinterpret_cast<Address>(size), flush_mode); | 220 reinterpret_cast<Address>(size), flush_mode); |
221 } | 221 } |
222 | 222 |
223 // ----------------------------------------------------------------------------- | 223 // ----------------------------------------------------------------------------- |
224 // Implementation of Operand and MemOperand. | 224 // Implementation of Operand and MemOperand. |
225 // See assembler-mips-inl.h for inlined constructors. | 225 // See assembler-mips-inl.h for inlined constructors. |
226 | 226 |
227 Operand::Operand(Handle<Object> handle) { | 227 Operand::Operand(Handle<Object> handle) { |
228 AllowDeferredHandleDereference using_raw_address; | 228 AllowDeferredHandleDereference using_raw_address; |
229 rm_ = no_reg; | 229 rm_ = no_reg; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 (kNegOffset & kImm16Mask); // NOLINT | 281 (kNegOffset & kImm16Mask); // NOLINT |
282 | 282 |
283 const Instr kSwRegFpNegOffsetPattern = SW | (Register::kCode_fp << kRsShift) | | 283 const Instr kSwRegFpNegOffsetPattern = SW | (Register::kCode_fp << kRsShift) | |
284 (kNegOffset & kImm16Mask); // NOLINT | 284 (kNegOffset & kImm16Mask); // NOLINT |
285 // A mask for the Rt register for push, pop, lw, sw instructions. | 285 // A mask for the Rt register for push, pop, lw, sw instructions. |
286 const Instr kRtMask = kRtFieldMask; | 286 const Instr kRtMask = kRtFieldMask; |
287 const Instr kLwSwInstrTypeMask = 0xffe00000; | 287 const Instr kLwSwInstrTypeMask = 0xffe00000; |
288 const Instr kLwSwInstrArgumentMask = ~kLwSwInstrTypeMask; | 288 const Instr kLwSwInstrArgumentMask = ~kLwSwInstrTypeMask; |
289 const Instr kLwSwOffsetMask = kImm16Mask; | 289 const Instr kLwSwOffsetMask = kImm16Mask; |
290 | 290 |
291 Assembler::Assembler(Isolate* isolate, void* buffer, int buffer_size) | 291 Assembler::Assembler(IsolateData isolate_data, void* buffer, int buffer_size) |
292 : AssemblerBase(isolate, buffer, buffer_size), | 292 : AssemblerBase(isolate_data, buffer, buffer_size), |
293 recorded_ast_id_(TypeFeedbackId::None()) { | 293 recorded_ast_id_(TypeFeedbackId::None()) { |
294 reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_); | 294 reloc_info_writer.Reposition(buffer_ + buffer_size_, pc_); |
295 | 295 |
296 last_trampoline_pool_end_ = 0; | 296 last_trampoline_pool_end_ = 0; |
297 no_trampoline_pool_before_ = 0; | 297 no_trampoline_pool_before_ = 0; |
298 trampoline_pool_blocked_nesting_ = 0; | 298 trampoline_pool_blocked_nesting_ = 0; |
299 // We leave space (16 * kTrampolineSlotsSize) | 299 // We leave space (16 * kTrampolineSlotsSize) |
300 // for BlockTrampolinePoolScope buffer. | 300 // for BlockTrampolinePoolScope buffer. |
301 next_buffer_check_ = FLAG_force_long_branches | 301 next_buffer_check_ = FLAG_force_long_branches |
302 ? kMaxInt : kMaxBranchOffset - kTrampolineSlotsSize * 16; | 302 ? kMaxInt : kMaxBranchOffset - kTrampolineSlotsSize * 16; |
(...skipping 2774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3077 unbound_labels_count_++; | 3077 unbound_labels_count_++; |
3078 internal_reference_positions_.insert(label->pos()); | 3078 internal_reference_positions_.insert(label->pos()); |
3079 } | 3079 } |
3080 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE); | 3080 RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE); |
3081 EmitHelper(data); | 3081 EmitHelper(data); |
3082 } | 3082 } |
3083 | 3083 |
3084 | 3084 |
3085 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { | 3085 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { |
3086 // We do not try to reuse pool constants. | 3086 // We do not try to reuse pool constants. |
3087 RelocInfo rinfo(isolate(), pc_, rmode, data, NULL); | 3087 RelocInfo rinfo(pc_, rmode, data, NULL); |
3088 if (rmode >= RelocInfo::COMMENT && | 3088 if (rmode >= RelocInfo::COMMENT && |
3089 rmode <= RelocInfo::DEBUG_BREAK_SLOT_AT_TAIL_CALL) { | 3089 rmode <= RelocInfo::DEBUG_BREAK_SLOT_AT_TAIL_CALL) { |
3090 // Adjust code for new modes. | 3090 // Adjust code for new modes. |
3091 DCHECK(RelocInfo::IsDebugBreakSlot(rmode) || RelocInfo::IsComment(rmode)); | 3091 DCHECK(RelocInfo::IsDebugBreakSlot(rmode) || RelocInfo::IsComment(rmode)); |
3092 // These modes do not need an entry in the constant pool. | 3092 // These modes do not need an entry in the constant pool. |
3093 } | 3093 } |
3094 if (!RelocInfo::IsNone(rinfo.rmode())) { | 3094 if (!RelocInfo::IsNone(rinfo.rmode())) { |
3095 // Don't record external references unless the heap will be serialized. | 3095 // Don't record external references unless the heap will be serialized. |
3096 if (rmode == RelocInfo::EXTERNAL_REFERENCE && | 3096 if (rmode == RelocInfo::EXTERNAL_REFERENCE && |
3097 !serializer_enabled() && !emit_debug_code()) { | 3097 !serializer_enabled() && !emit_debug_code()) { |
3098 return; | 3098 return; |
3099 } | 3099 } |
3100 DCHECK(buffer_space() >= kMaxRelocSize); // Too late to grow buffer here. | 3100 DCHECK(buffer_space() >= kMaxRelocSize); // Too late to grow buffer here. |
3101 if (rmode == RelocInfo::CODE_TARGET_WITH_ID) { | 3101 if (rmode == RelocInfo::CODE_TARGET_WITH_ID) { |
3102 RelocInfo reloc_info_with_ast_id(isolate(), pc_, rmode, | 3102 RelocInfo reloc_info_with_ast_id(pc_, rmode, RecordedAstId().ToInt(), |
3103 RecordedAstId().ToInt(), NULL); | 3103 NULL); |
3104 ClearRecordedAstId(); | 3104 ClearRecordedAstId(); |
3105 reloc_info_writer.Write(&reloc_info_with_ast_id); | 3105 reloc_info_writer.Write(&reloc_info_with_ast_id); |
3106 } else { | 3106 } else { |
3107 reloc_info_writer.Write(&rinfo); | 3107 reloc_info_writer.Write(&rinfo); |
3108 } | 3108 } |
3109 } | 3109 } |
3110 } | 3110 } |
3111 | 3111 |
3112 | 3112 |
3113 void Assembler::BlockTrampolinePoolFor(int instructions) { | 3113 void Assembler::BlockTrampolinePoolFor(int instructions) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3231 // Patching the address must replace both instr, and flush the i-cache. | 3231 // Patching the address must replace both instr, and flush the i-cache. |
3232 // On r6, target address is stored in a lui/jic pair, and both instr have to be | 3232 // On r6, target address is stored in a lui/jic pair, and both instr have to be |
3233 // patched. | 3233 // patched. |
3234 // | 3234 // |
3235 // There is an optimization below, which emits a nop when the address | 3235 // There is an optimization below, which emits a nop when the address |
3236 // fits in just 16 bits. This is unlikely to help, and should be benchmarked, | 3236 // fits in just 16 bits. This is unlikely to help, and should be benchmarked, |
3237 // and possibly removed. | 3237 // and possibly removed. |
3238 void Assembler::set_target_address_at(Isolate* isolate, Address pc, | 3238 void Assembler::set_target_address_at(Isolate* isolate, Address pc, |
3239 Address target, | 3239 Address target, |
3240 ICacheFlushMode icache_flush_mode) { | 3240 ICacheFlushMode icache_flush_mode) { |
| 3241 DCHECK_IMPLIES(isolate == nullptr, icache_flush_mode == SKIP_ICACHE_FLUSH); |
| 3242 |
3241 Instr instr2 = instr_at(pc + kInstrSize); | 3243 Instr instr2 = instr_at(pc + kInstrSize); |
3242 uint32_t rt_code = GetRtField(instr2); | 3244 uint32_t rt_code = GetRtField(instr2); |
3243 uint32_t* p = reinterpret_cast<uint32_t*>(pc); | 3245 uint32_t* p = reinterpret_cast<uint32_t*>(pc); |
3244 uint32_t itarget = reinterpret_cast<uint32_t>(target); | 3246 uint32_t itarget = reinterpret_cast<uint32_t>(target); |
3245 | 3247 |
3246 #ifdef DEBUG | 3248 #ifdef DEBUG |
3247 // Check we have the result from a li macro-instruction, using instr pair. | 3249 // Check we have the result from a li macro-instruction, using instr pair. |
3248 Instr instr1 = instr_at(pc); | 3250 Instr instr1 = instr_at(pc); |
3249 CHECK(IsLui(instr1) && (IsOri(instr2) || IsJicOrJialc(instr2))); | 3251 CHECK(IsLui(instr1) && (IsOri(instr2) || IsJicOrJialc(instr2))); |
3250 #endif | 3252 #endif |
(...skipping 19 matching lines...) Expand all Loading... |
3270 | 3272 |
3271 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 3273 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
3272 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t)); | 3274 Assembler::FlushICache(isolate, pc, 2 * sizeof(int32_t)); |
3273 } | 3275 } |
3274 } | 3276 } |
3275 | 3277 |
3276 } // namespace internal | 3278 } // namespace internal |
3277 } // namespace v8 | 3279 } // namespace v8 |
3278 | 3280 |
3279 #endif // V8_TARGET_ARCH_MIPS | 3281 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |