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

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

Issue 10834085: Fix full code generator to not use --debug-code if it is in (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 // If the provided buffer is not NULL, the assembler uses the provided buffer 554 // If the provided buffer is not NULL, the assembler uses the provided buffer
555 // for code generation and assumes its size to be buffer_size. If the buffer 555 // for code generation and assumes its size to be buffer_size. If the buffer
556 // is too small, a fatal error occurs. No deallocation of the buffer is done 556 // is too small, a fatal error occurs. No deallocation of the buffer is done
557 // upon destruction of the assembler. 557 // upon destruction of the assembler.
558 Assembler(Isolate* isolate, void* buffer, int buffer_size); 558 Assembler(Isolate* isolate, void* buffer, int buffer_size);
559 ~Assembler(); 559 ~Assembler();
560 560
561 // Overrides the default provided by FLAG_debug_code. 561 // Overrides the default provided by FLAG_debug_code.
562 void set_emit_debug_code(bool value) { emit_debug_code_ = value; } 562 void set_emit_debug_code(bool value) { emit_debug_code_ = value; }
563 563
564 // Avoids using instructions that vary in size in unpredictable ways between
565 // the snapshot and the running VM. This is needed by the full compiler so
566 // that it can recompile code with debug support and fix the PC.
567 void set_predictable_code_size(bool value) { predictable_code_size_ = value; }
568
564 // GetCode emits any pending (non-emitted) code and fills the descriptor 569 // GetCode emits any pending (non-emitted) code and fills the descriptor
565 // desc. GetCode() is idempotent; it returns the same result if no other 570 // desc. GetCode() is idempotent; it returns the same result if no other
566 // Assembler functions are invoked in between GetCode() calls. 571 // Assembler functions are invoked in between GetCode() calls.
567 void GetCode(CodeDesc* desc); 572 void GetCode(CodeDesc* desc);
568 573
569 // Read/Modify the code target in the relative branch/call instruction at pc. 574 // Read/Modify the code target in the relative branch/call instruction at pc.
570 // On the x64 architecture, we use relative jumps with a 32-bit displacement 575 // On the x64 architecture, we use relative jumps with a 32-bit displacement
571 // to jump to other Code objects in the Code space in the heap. 576 // to jump to other Code objects in the Code space in the heap.
572 // Jumps to C functions are done indirectly through a 64-bit register holding 577 // Jumps to C functions are done indirectly through a 64-bit register holding
573 // the absolute address of the target. 578 // the absolute address of the target.
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
1426 1431
1427 // Avoid overflows for displacements etc. 1432 // Avoid overflows for displacements etc.
1428 static const int kMaximalBufferSize = 512*MB; 1433 static const int kMaximalBufferSize = 512*MB;
1429 static const int kMinimalBufferSize = 4*KB; 1434 static const int kMinimalBufferSize = 4*KB;
1430 1435
1431 byte byte_at(int pos) { return buffer_[pos]; } 1436 byte byte_at(int pos) { return buffer_[pos]; }
1432 void set_byte_at(int pos, byte value) { buffer_[pos] = value; } 1437 void set_byte_at(int pos, byte value) { buffer_[pos] = value; }
1433 1438
1434 protected: 1439 protected:
1435 bool emit_debug_code() const { return emit_debug_code_; } 1440 bool emit_debug_code() const { return emit_debug_code_; }
1441 bool predictable_code_size() const { return predictable_code_size_; }
1436 1442
1437 private: 1443 private:
1438 byte* addr_at(int pos) { return buffer_ + pos; } 1444 byte* addr_at(int pos) { return buffer_ + pos; }
1439 uint32_t long_at(int pos) { 1445 uint32_t long_at(int pos) {
1440 return *reinterpret_cast<uint32_t*>(addr_at(pos)); 1446 return *reinterpret_cast<uint32_t*>(addr_at(pos));
1441 } 1447 }
1442 void long_at_put(int pos, uint32_t x) { 1448 void long_at_put(int pos, uint32_t x) {
1443 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x; 1449 *reinterpret_cast<uint32_t*>(addr_at(pos)) = x;
1444 } 1450 }
1445 1451
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 1636
1631 // code generation 1637 // code generation
1632 byte* pc_; // the program counter; moves forward 1638 byte* pc_; // the program counter; moves forward
1633 RelocInfoWriter reloc_info_writer; 1639 RelocInfoWriter reloc_info_writer;
1634 1640
1635 List< Handle<Code> > code_targets_; 1641 List< Handle<Code> > code_targets_;
1636 1642
1637 PositionsRecorder positions_recorder_; 1643 PositionsRecorder positions_recorder_;
1638 1644
1639 bool emit_debug_code_; 1645 bool emit_debug_code_;
1646 bool predictable_code_size_;
1640 1647
1641 friend class PositionsRecorder; 1648 friend class PositionsRecorder;
1642 }; 1649 };
1643 1650
1644 1651
1645 // Helper class that ensures that there is enough space for generating 1652 // Helper class that ensures that there is enough space for generating
1646 // instructions and relocation information. The constructor makes 1653 // instructions and relocation information. The constructor makes
1647 // sure that there is enough space and (in debug mode) the destructor 1654 // sure that there is enough space and (in debug mode) the destructor
1648 // checks that we did not generate too much. 1655 // checks that we did not generate too much.
1649 class EnsureSpace BASE_EMBEDDED { 1656 class EnsureSpace BASE_EMBEDDED {
(...skipping 15 matching lines...) Expand all
1665 private: 1672 private:
1666 Assembler* assembler_; 1673 Assembler* assembler_;
1667 #ifdef DEBUG 1674 #ifdef DEBUG
1668 int space_before_; 1675 int space_before_;
1669 #endif 1676 #endif
1670 }; 1677 };
1671 1678
1672 } } // namespace v8::internal 1679 } } // namespace v8::internal
1673 1680
1674 #endif // V8_X64_ASSEMBLER_X64_H_ 1681 #endif // V8_X64_ASSEMBLER_X64_H_
OLDNEW
« no previous file with comments | « src/serialize.cc ('k') | src/x64/assembler-x64.cc » ('j') | src/x64/assembler-x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698