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

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

Issue 11359127: Refactoring: Make predictable code flag handling architecture-independent. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 8 years, 1 month 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
« no previous file with comments | « src/assembler.cc ('k') | src/x64/assembler-x64.h » ('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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 // for code generation and assumes its size to be buffer_size. If the buffer 580 // for code generation and assumes its size to be buffer_size. If the buffer
581 // is too small, a fatal error occurs. No deallocation of the buffer is done 581 // is too small, a fatal error occurs. No deallocation of the buffer is done
582 // upon destruction of the assembler. 582 // upon destruction of the assembler.
583 // TODO(vitalyr): the assembler does not need an isolate. 583 // TODO(vitalyr): the assembler does not need an isolate.
584 Assembler(Isolate* isolate, void* buffer, int buffer_size); 584 Assembler(Isolate* isolate, void* buffer, int buffer_size);
585 ~Assembler(); 585 ~Assembler();
586 586
587 // Overrides the default provided by FLAG_debug_code. 587 // Overrides the default provided by FLAG_debug_code.
588 void set_emit_debug_code(bool value) { emit_debug_code_ = value; } 588 void set_emit_debug_code(bool value) { emit_debug_code_ = value; }
589 589
590 // Avoids using instructions that vary in size in unpredictable ways between
591 // the snapshot and the running VM. This is needed by the full compiler so
592 // that it can recompile code with debug support and fix the PC.
593 void set_predictable_code_size(bool value) { predictable_code_size_ = value; }
594
595 // GetCode emits any pending (non-emitted) code and fills the descriptor 590 // GetCode emits any pending (non-emitted) code and fills the descriptor
596 // desc. GetCode() is idempotent; it returns the same result if no other 591 // desc. GetCode() is idempotent; it returns the same result if no other
597 // Assembler functions are invoked in between GetCode() calls. 592 // Assembler functions are invoked in between GetCode() calls.
598 void GetCode(CodeDesc* desc); 593 void GetCode(CodeDesc* desc);
599 594
600 // Read/Modify the code target in the branch/call instruction at pc. 595 // Read/Modify the code target in the branch/call instruction at pc.
601 inline static Address target_address_at(Address pc); 596 inline static Address target_address_at(Address pc);
602 inline static void set_target_address_at(Address pc, Address target); 597 inline static void set_target_address_at(Address pc, Address target);
603 598
604 // Return the code target address at a call site from the return address 599 // Return the code target address at a call site from the return address
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 1114
1120 // Avoid overflows for displacements etc. 1115 // Avoid overflows for displacements etc.
1121 static const int kMaximalBufferSize = 512*MB; 1116 static const int kMaximalBufferSize = 512*MB;
1122 static const int kMinimalBufferSize = 4*KB; 1117 static const int kMinimalBufferSize = 4*KB;
1123 1118
1124 byte byte_at(int pos) { return buffer_[pos]; } 1119 byte byte_at(int pos) { return buffer_[pos]; }
1125 void set_byte_at(int pos, byte value) { buffer_[pos] = value; } 1120 void set_byte_at(int pos, byte value) { buffer_[pos] = value; }
1126 1121
1127 protected: 1122 protected:
1128 bool emit_debug_code() const { return emit_debug_code_; } 1123 bool emit_debug_code() const { return emit_debug_code_; }
1129 bool predictable_code_size() const { return predictable_code_size_ ; }
1130 1124
1131 void movsd(XMMRegister dst, const Operand& src); 1125 void movsd(XMMRegister dst, const Operand& src);
1132 void movsd(const Operand& dst, XMMRegister src); 1126 void movsd(const Operand& dst, XMMRegister src);
1133 1127
1134 void emit_sse_operand(XMMRegister reg, const Operand& adr); 1128 void emit_sse_operand(XMMRegister reg, const Operand& adr);
1135 void emit_sse_operand(XMMRegister dst, XMMRegister src); 1129 void emit_sse_operand(XMMRegister dst, XMMRegister src);
1136 void emit_sse_operand(Register dst, XMMRegister src); 1130 void emit_sse_operand(Register dst, XMMRegister src);
1137 1131
1138 byte* addr_at(int pos) { return buffer_ + pos; } 1132 byte* addr_at(int pos) { return buffer_ + pos; }
1139 1133
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 // True if the assembler owns the buffer, false if buffer is external. 1189 // True if the assembler owns the buffer, false if buffer is external.
1196 bool own_buffer_; 1190 bool own_buffer_;
1197 1191
1198 // code generation 1192 // code generation
1199 byte* pc_; // the program counter; moves forward 1193 byte* pc_; // the program counter; moves forward
1200 RelocInfoWriter reloc_info_writer; 1194 RelocInfoWriter reloc_info_writer;
1201 1195
1202 PositionsRecorder positions_recorder_; 1196 PositionsRecorder positions_recorder_;
1203 1197
1204 bool emit_debug_code_; 1198 bool emit_debug_code_;
1205 bool predictable_code_size_;
1206 1199
1207 friend class PositionsRecorder; 1200 friend class PositionsRecorder;
1208 }; 1201 };
1209 1202
1210 1203
1211 // Helper class that ensures that there is enough space for generating 1204 // Helper class that ensures that there is enough space for generating
1212 // instructions and relocation information. The constructor makes 1205 // instructions and relocation information. The constructor makes
1213 // sure that there is enough space and (in debug mode) the destructor 1206 // sure that there is enough space and (in debug mode) the destructor
1214 // checks that we did not generate too much. 1207 // checks that we did not generate too much.
1215 class EnsureSpace BASE_EMBEDDED { 1208 class EnsureSpace BASE_EMBEDDED {
(...skipping 15 matching lines...) Expand all
1231 private: 1224 private:
1232 Assembler* assembler_; 1225 Assembler* assembler_;
1233 #ifdef DEBUG 1226 #ifdef DEBUG
1234 int space_before_; 1227 int space_before_;
1235 #endif 1228 #endif
1236 }; 1229 };
1237 1230
1238 } } // namespace v8::internal 1231 } } // namespace v8::internal
1239 1232
1240 #endif // V8_IA32_ASSEMBLER_IA32_H_ 1233 #endif // V8_IA32_ASSEMBLER_IA32_H_
OLDNEW
« no previous file with comments | « src/assembler.cc ('k') | src/x64/assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698