Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Side by Side Diff: src/x64/assembler-x64.h

Issue 6677044: Use a class field instead of global FLAG_debug_code in assember and (Closed)
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/x64/assembler-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 // buffer, and buffer_size determines the initial buffer size. The buffer is 504 // buffer, and buffer_size determines the initial buffer size. The buffer is
505 // owned by the assembler and deallocated upon destruction of the assembler. 505 // owned by the assembler and deallocated upon destruction of the assembler.
506 // 506 //
507 // If the provided buffer is not NULL, the assembler uses the provided buffer 507 // If the provided buffer is not NULL, the assembler uses the provided buffer
508 // for code generation and assumes its size to be buffer_size. If the buffer 508 // for code generation and assumes its size to be buffer_size. If the buffer
509 // is too small, a fatal error occurs. No deallocation of the buffer is done 509 // is too small, a fatal error occurs. No deallocation of the buffer is done
510 // upon destruction of the assembler. 510 // upon destruction of the assembler.
511 Assembler(void* buffer, int buffer_size); 511 Assembler(void* buffer, int buffer_size);
512 ~Assembler(); 512 ~Assembler();
513 513
514 // Overrides the default provided by FLAG_debug_code.
515 void set_emit_debug_code(bool value) { emit_debug_code_ = value; }
516
514 // GetCode emits any pending (non-emitted) code and fills the descriptor 517 // GetCode emits any pending (non-emitted) code and fills the descriptor
515 // desc. GetCode() is idempotent; it returns the same result if no other 518 // desc. GetCode() is idempotent; it returns the same result if no other
516 // Assembler functions are invoked in between GetCode() calls. 519 // Assembler functions are invoked in between GetCode() calls.
517 void GetCode(CodeDesc* desc); 520 void GetCode(CodeDesc* desc);
518 521
519 // Read/Modify the code target in the relative branch/call instruction at pc. 522 // Read/Modify the code target in the relative branch/call instruction at pc.
520 // On the x64 architecture, we use relative jumps with a 32-bit displacement 523 // On the x64 architecture, we use relative jumps with a 32-bit displacement
521 // to jump to other Code objects in the Code space in the heap. 524 // to jump to other Code objects in the Code space in the heap.
522 // Jumps to C functions are done indirectly through a 64-bit register holding 525 // Jumps to C functions are done indirectly through a 64-bit register holding
523 // the absolute address of the target. 526 // the absolute address of the target.
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 inline int available_space() const { 1346 inline int available_space() const {
1344 return static_cast<int>(reloc_info_writer.pos() - pc_); 1347 return static_cast<int>(reloc_info_writer.pos() - pc_);
1345 } 1348 }
1346 1349
1347 static bool IsNop(Address addr) { return *addr == 0x90; } 1350 static bool IsNop(Address addr) { return *addr == 0x90; }
1348 1351
1349 // Avoid overflows for displacements etc. 1352 // Avoid overflows for displacements etc.
1350 static const int kMaximalBufferSize = 512*MB; 1353 static const int kMaximalBufferSize = 512*MB;
1351 static const int kMinimalBufferSize = 4*KB; 1354 static const int kMinimalBufferSize = 4*KB;
1352 1355
1356 protected:
1357 bool emit_debug_code() const { return emit_debug_code_; }
1358
1353 private: 1359 private:
1354 byte* addr_at(int pos) { return buffer_ + pos; } 1360 byte* addr_at(int pos) { return buffer_ + pos; }
1355 byte byte_at(int pos) { return buffer_[pos]; } 1361 byte byte_at(int pos) { return buffer_[pos]; }
1356 void set_byte_at(int pos, byte value) { buffer_[pos] = value; } 1362 void set_byte_at(int pos, byte value) { buffer_[pos] = value; }
1357 uint32_t long_at(int pos) { 1363 uint32_t long_at(int pos) {
1358 return *reinterpret_cast<uint32_t*>(addr_at(pos)); 1364 return *reinterpret_cast<uint32_t*>(addr_at(pos));
1359 } 1365 }
1360 void long_at_put(int pos, uint32_t x) { 1366 void long_at_put(int pos, uint32_t x) {
1361 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x; 1367 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x;
1362 } 1368 }
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 1554
1549 // code generation 1555 // code generation
1550 byte* pc_; // the program counter; moves forward 1556 byte* pc_; // the program counter; moves forward
1551 RelocInfoWriter reloc_info_writer; 1557 RelocInfoWriter reloc_info_writer;
1552 1558
1553 List< Handle<Code> > code_targets_; 1559 List< Handle<Code> > code_targets_;
1554 // push-pop elimination 1560 // push-pop elimination
1555 byte* last_pc_; 1561 byte* last_pc_;
1556 1562
1557 PositionsRecorder positions_recorder_; 1563 PositionsRecorder positions_recorder_;
1564
1565 bool emit_debug_code_;
1566
1558 friend class PositionsRecorder; 1567 friend class PositionsRecorder;
1559 }; 1568 };
1560 1569
1561 1570
1562 // Helper class that ensures that there is enough space for generating 1571 // Helper class that ensures that there is enough space for generating
1563 // instructions and relocation information. The constructor makes 1572 // instructions and relocation information. The constructor makes
1564 // sure that there is enough space and (in debug mode) the destructor 1573 // sure that there is enough space and (in debug mode) the destructor
1565 // checks that we did not generate too much. 1574 // checks that we did not generate too much.
1566 class EnsureSpace BASE_EMBEDDED { 1575 class EnsureSpace BASE_EMBEDDED {
1567 public: 1576 public:
(...skipping 14 matching lines...) Expand all
1582 private: 1591 private:
1583 Assembler* assembler_; 1592 Assembler* assembler_;
1584 #ifdef DEBUG 1593 #ifdef DEBUG
1585 int space_before_; 1594 int space_before_;
1586 #endif 1595 #endif
1587 }; 1596 };
1588 1597
1589 } } // namespace v8::internal 1598 } } // namespace v8::internal
1590 1599
1591 #endif // V8_X64_ASSEMBLER_X64_H_ 1600 #endif // V8_X64_ASSEMBLER_X64_H_
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/x64/assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698