| 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 12 matching lines...) Expand all Loading... |
| 23 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 23 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 24 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 24 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 25 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 25 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 26 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | 26 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 27 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 27 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 28 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | 30 |
| 31 // The original source code covered by the above license above has been | 31 // The original source code covered by the above license above has been |
| 32 // modified significantly by Google Inc. | 32 // modified significantly by Google Inc. |
| 33 // Copyright 2011 the V8 project authors. All rights reserved. | 33 // Copyright 2012 the V8 project authors. All rights reserved. |
| 34 | 34 |
| 35 // A light-weight IA32 Assembler. | 35 // A light-weight IA32 Assembler. |
| 36 | 36 |
| 37 #ifndef V8_IA32_ASSEMBLER_IA32_H_ | 37 #ifndef V8_IA32_ASSEMBLER_IA32_H_ |
| 38 #define V8_IA32_ASSEMBLER_IA32_H_ | 38 #define V8_IA32_ASSEMBLER_IA32_H_ |
| 39 | 39 |
| 40 #include "isolate.h" | 40 #include "isolate.h" |
| 41 #include "serialize.h" | 41 #include "serialize.h" |
| 42 | 42 |
| 43 namespace v8 { | 43 namespace v8 { |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 // | 578 // |
| 579 // If the provided buffer is not NULL, the assembler uses the provided buffer | 579 // If the provided buffer is not NULL, the assembler uses the provided buffer |
| 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 bool emit_debug_code() const { return emit_debug_code_; } |
| 588 void set_emit_debug_code(bool value) { emit_debug_code_ = value; } | 589 void set_emit_debug_code(bool value) { emit_debug_code_ = value; } |
| 589 | 590 |
| 590 // Avoids using instructions that vary in size in unpredictable ways between | 591 // 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 // 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 // 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 void set_predictable_code_size(bool value) { predictable_code_size_ = value; } |
| 594 | 595 |
| 595 // GetCode emits any pending (non-emitted) code and fills the descriptor | 596 // GetCode emits any pending (non-emitted) code and fills the descriptor |
| 596 // desc. GetCode() is idempotent; it returns the same result if no other | 597 // desc. GetCode() is idempotent; it returns the same result if no other |
| 597 // Assembler functions are invoked in between GetCode() calls. | 598 // Assembler functions are invoked in between GetCode() calls. |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 } | 1111 } |
| 1111 | 1112 |
| 1112 // Avoid overflows for displacements etc. | 1113 // Avoid overflows for displacements etc. |
| 1113 static const int kMaximalBufferSize = 512*MB; | 1114 static const int kMaximalBufferSize = 512*MB; |
| 1114 static const int kMinimalBufferSize = 4*KB; | 1115 static const int kMinimalBufferSize = 4*KB; |
| 1115 | 1116 |
| 1116 byte byte_at(int pos) { return buffer_[pos]; } | 1117 byte byte_at(int pos) { return buffer_[pos]; } |
| 1117 void set_byte_at(int pos, byte value) { buffer_[pos] = value; } | 1118 void set_byte_at(int pos, byte value) { buffer_[pos] = value; } |
| 1118 | 1119 |
| 1119 protected: | 1120 protected: |
| 1120 bool emit_debug_code() const { return emit_debug_code_; } | |
| 1121 bool predictable_code_size() const { return predictable_code_size_ ; } | 1121 bool predictable_code_size() const { return predictable_code_size_ ; } |
| 1122 | |
| 1123 void movsd(XMMRegister dst, const Operand& src); | 1122 void movsd(XMMRegister dst, const Operand& src); |
| 1124 void movsd(const Operand& dst, XMMRegister src); | 1123 void movsd(const Operand& dst, XMMRegister src); |
| 1125 | 1124 |
| 1126 void emit_sse_operand(XMMRegister reg, const Operand& adr); | 1125 void emit_sse_operand(XMMRegister reg, const Operand& adr); |
| 1127 void emit_sse_operand(XMMRegister dst, XMMRegister src); | 1126 void emit_sse_operand(XMMRegister dst, XMMRegister src); |
| 1128 void emit_sse_operand(Register dst, XMMRegister src); | 1127 void emit_sse_operand(Register dst, XMMRegister src); |
| 1129 | 1128 |
| 1130 byte* addr_at(int pos) { return buffer_ + pos; } | 1129 byte* addr_at(int pos) { return buffer_ + pos; } |
| 1131 | 1130 |
| 1132 | 1131 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 private: | 1222 private: |
| 1224 Assembler* assembler_; | 1223 Assembler* assembler_; |
| 1225 #ifdef DEBUG | 1224 #ifdef DEBUG |
| 1226 int space_before_; | 1225 int space_before_; |
| 1227 #endif | 1226 #endif |
| 1228 }; | 1227 }; |
| 1229 | 1228 |
| 1230 } } // namespace v8::internal | 1229 } } // namespace v8::internal |
| 1231 | 1230 |
| 1232 #endif // V8_IA32_ASSEMBLER_IA32_H_ | 1231 #endif // V8_IA32_ASSEMBLER_IA32_H_ |
| OLD | NEW |