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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 INLINE(explicit Operand(intptr_t immediate, | 296 INLINE(explicit Operand(intptr_t immediate, |
297 RelocInfo::Mode rmode = kRelocInfo_NONEPTR)); | 297 RelocInfo::Mode rmode = kRelocInfo_NONEPTR)); |
298 INLINE(static Operand Zero()) { return Operand(static_cast<intptr_t>(0)); } | 298 INLINE(static Operand Zero()) { return Operand(static_cast<intptr_t>(0)); } |
299 INLINE(explicit Operand(const ExternalReference& f)); | 299 INLINE(explicit Operand(const ExternalReference& f)); |
300 explicit Operand(Handle<Object> handle); | 300 explicit Operand(Handle<Object> handle); |
301 INLINE(explicit Operand(Smi* value)); | 301 INLINE(explicit Operand(Smi* value)); |
302 | 302 |
303 // rm | 303 // rm |
304 INLINE(explicit Operand(Register rm)); | 304 INLINE(explicit Operand(Register rm)); |
305 | 305 |
| 306 static Operand EmbeddedNumber(double value); // Smi or HeapNumber |
| 307 |
306 // Return true if this is a register operand. | 308 // Return true if this is a register operand. |
307 INLINE(bool is_reg() const); | 309 INLINE(bool is_reg() const); |
308 | 310 |
309 bool must_output_reloc_info(const Assembler* assembler) const; | 311 bool must_output_reloc_info(const Assembler* assembler) const; |
310 | 312 |
311 inline intptr_t immediate() const { | 313 inline intptr_t immediate() const { |
312 DCHECK(!rm_.is_valid()); | 314 DCHECK(!rm_.is_valid()); |
313 return imm_; | 315 DCHECK(!is_heap_number()); |
| 316 return value_.immediate; |
| 317 } |
| 318 |
| 319 double heap_number() const { |
| 320 DCHECK(is_heap_number()); |
| 321 return value_.heap_number; |
314 } | 322 } |
315 | 323 |
316 inline void setBits(int n) { | 324 inline void setBits(int n) { |
317 imm_ = (static_cast<uint32_t>(imm_) << (32 - n)) >> (32 - n); | 325 value_.immediate = (static_cast<uint32_t>(value_.immediate) |
| 326 << (32 - n)) >> (32 - n); |
318 } | 327 } |
319 | 328 |
320 Register rm() const { return rm_; } | 329 Register rm() const { return rm_; } |
321 | 330 |
| 331 bool is_heap_number() const { |
| 332 DCHECK_IMPLIES(is_heap_number_, !rm_.is_valid()); |
| 333 DCHECK_IMPLIES(is_heap_number_, rmode_ == RelocInfo::EMBEDDED_OBJECT); |
| 334 return is_heap_number_; |
| 335 } |
| 336 |
322 private: | 337 private: |
323 Register rm_; | 338 Register rm_; |
324 intptr_t imm_; // valid if rm_ == no_reg | 339 int shift_imm_; // valid if rm_ != no_reg && rs_ == no_reg |
| 340 union { |
| 341 double heap_number; // if is_heap_number_ |
| 342 int32_t immediate; // otherwise |
| 343 } value_; // valid if rm_ == no_reg |
| 344 bool is_heap_number_ = false; |
| 345 |
325 RelocInfo::Mode rmode_; | 346 RelocInfo::Mode rmode_; |
326 | 347 |
327 friend class Assembler; | 348 friend class Assembler; |
328 friend class MacroAssembler; | 349 friend class MacroAssembler; |
329 }; | 350 }; |
330 | 351 |
331 typedef int32_t Disp; | 352 typedef int32_t Disp; |
332 | 353 |
333 // Class MemOperand represents a memory operand in load and store instructions | 354 // Class MemOperand represents a memory operand in load and store instructions |
334 // On S390, we have various flavours of memory operands: | 355 // On S390, we have various flavours of memory operands: |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 // is too small, a fatal error occurs. No deallocation of the buffer is done | 419 // is too small, a fatal error occurs. No deallocation of the buffer is done |
399 // upon destruction of the assembler. | 420 // upon destruction of the assembler. |
400 Assembler(Isolate* isolate, void* buffer, int buffer_size) | 421 Assembler(Isolate* isolate, void* buffer, int buffer_size) |
401 : Assembler(IsolateData(isolate), buffer, buffer_size) {} | 422 : Assembler(IsolateData(isolate), buffer, buffer_size) {} |
402 Assembler(IsolateData isolate_data, void* buffer, int buffer_size); | 423 Assembler(IsolateData isolate_data, void* buffer, int buffer_size); |
403 virtual ~Assembler() {} | 424 virtual ~Assembler() {} |
404 | 425 |
405 // GetCode emits any pending (non-emitted) code and fills the descriptor | 426 // GetCode emits any pending (non-emitted) code and fills the descriptor |
406 // desc. GetCode() is idempotent; it returns the same result if no other | 427 // desc. GetCode() is idempotent; it returns the same result if no other |
407 // Assembler functions are invoked in between GetCode() calls. | 428 // Assembler functions are invoked in between GetCode() calls. |
408 void GetCode(CodeDesc* desc); | 429 void GetCode(Isolate* isolate, CodeDesc* desc); |
409 | 430 |
410 // Label operations & relative jumps (PPUM Appendix D) | 431 // Label operations & relative jumps (PPUM Appendix D) |
411 // | 432 // |
412 // Takes a branch opcode (cc) and a label (L) and generates | 433 // Takes a branch opcode (cc) and a label (L) and generates |
413 // either a backward branch or a forward branch and links it | 434 // either a backward branch or a forward branch and links it |
414 // to the label fixup chain. Usage: | 435 // to the label fixup chain. Usage: |
415 // | 436 // |
416 // Label L; // unbound label | 437 // Label L; // unbound label |
417 // j(cc, &L); // forward branch to unbound label | 438 // j(cc, &L); // forward branch to unbound label |
418 // bind(&L); // bind label to the current pc | 439 // bind(&L); // bind label to the current pc |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 void ClearRecordedAstId() { recorded_ast_id_ = TypeFeedbackId::None(); } | 1302 void ClearRecordedAstId() { recorded_ast_id_ = TypeFeedbackId::None(); } |
1282 | 1303 |
1283 // Record a comment relocation entry that can be used by a disassembler. | 1304 // Record a comment relocation entry that can be used by a disassembler. |
1284 // Use --code-comments to enable. | 1305 // Use --code-comments to enable. |
1285 void RecordComment(const char* msg); | 1306 void RecordComment(const char* msg); |
1286 | 1307 |
1287 // Record a deoptimization reason that can be used by a log or cpu profiler. | 1308 // Record a deoptimization reason that can be used by a log or cpu profiler. |
1288 // Use --trace-deopt to enable. | 1309 // Use --trace-deopt to enable. |
1289 void RecordDeoptReason(DeoptimizeReason reason, SourcePosition position, | 1310 void RecordDeoptReason(DeoptimizeReason reason, SourcePosition position, |
1290 int id); | 1311 int id); |
| 1312 // Patch the dummy heap number that we emitted during code assembly in the |
| 1313 // constant pool entry referenced by {pc}. Replace it with the actual heap |
| 1314 // object (handle). |
| 1315 static void set_heap_number(Handle<HeapObject> number, Address pc) { |
| 1316 Memory::Object_Handle_at(pc) = number; |
| 1317 } |
1291 | 1318 |
1292 // Writes a single byte or word of data in the code stream. Used | 1319 // Writes a single byte or word of data in the code stream. Used |
1293 // for inline tables, e.g., jump-tables. | 1320 // for inline tables, e.g., jump-tables. |
1294 void db(uint8_t data); | 1321 void db(uint8_t data); |
1295 void dd(uint32_t data); | 1322 void dd(uint32_t data); |
1296 void dq(uint64_t data); | 1323 void dq(uint64_t data); |
1297 void dp(uintptr_t data); | 1324 void dp(uintptr_t data); |
1298 | 1325 |
1299 void PatchConstantPoolAccessInstruction(int pc_offset, int offset, | 1326 void PatchConstantPoolAccessInstruction(int pc_offset, int offset, |
1300 ConstantPoolEntry::Access access, | 1327 ConstantPoolEntry::Access access, |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1478 | 1505 |
1479 class EnsureSpace BASE_EMBEDDED { | 1506 class EnsureSpace BASE_EMBEDDED { |
1480 public: | 1507 public: |
1481 explicit EnsureSpace(Assembler* assembler) { assembler->CheckBuffer(); } | 1508 explicit EnsureSpace(Assembler* assembler) { assembler->CheckBuffer(); } |
1482 }; | 1509 }; |
1483 | 1510 |
1484 } // namespace internal | 1511 } // namespace internal |
1485 } // namespace v8 | 1512 } // namespace v8 |
1486 | 1513 |
1487 #endif // V8_S390_ASSEMBLER_S390_H_ | 1514 #endif // V8_S390_ASSEMBLER_S390_H_ |
OLD | NEW |