| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 class ApiFunction; | 49 class ApiFunction; |
| 50 | 50 |
| 51 namespace internal { | 51 namespace internal { |
| 52 | 52 |
| 53 struct StatsCounter; | 53 struct StatsCounter; |
| 54 // ----------------------------------------------------------------------------- | 54 // ----------------------------------------------------------------------------- |
| 55 // Platform independent assembler base class. | 55 // Platform independent assembler base class. |
| 56 | 56 |
| 57 class AssemblerBase: public Malloced { | 57 class AssemblerBase: public Malloced { |
| 58 public: | 58 public: |
| 59 explicit AssemblerBase(Isolate* isolate); | 59 AssemblerBase(Isolate* isolate, void* buffer, int buffer_size); |
| 60 virtual ~AssemblerBase(); |
| 60 | 61 |
| 61 Isolate* isolate() const { return isolate_; } | 62 Isolate* isolate() const { return isolate_; } |
| 62 int jit_cookie() const { return jit_cookie_; } | 63 int jit_cookie() const { return jit_cookie_; } |
| 63 | 64 |
| 64 bool emit_debug_code() const { return emit_debug_code_; } | 65 bool emit_debug_code() const { return emit_debug_code_; } |
| 65 void set_emit_debug_code(bool value) { emit_debug_code_ = value; } | 66 void set_emit_debug_code(bool value) { emit_debug_code_ = value; } |
| 66 | 67 |
| 67 bool predictable_code_size() const { return predictable_code_size_; } | 68 bool predictable_code_size() const { return predictable_code_size_; } |
| 68 void set_predictable_code_size(bool value) { predictable_code_size_ = value; } | 69 void set_predictable_code_size(bool value) { predictable_code_size_ = value; } |
| 69 | 70 |
| 70 // Overwrite a host NaN with a quiet target NaN. Used by mksnapshot for | 71 // Overwrite a host NaN with a quiet target NaN. Used by mksnapshot for |
| 71 // cross-snapshotting. | 72 // cross-snapshotting. |
| 72 static void QuietNaN(HeapObject* nan) { } | 73 static void QuietNaN(HeapObject* nan) { } |
| 73 | 74 |
| 75 int pc_offset() const { return static_cast<int>(pc_ - buffer_); } |
| 76 |
| 77 static const int kMinimalBufferSize = 4*KB; |
| 78 |
| 79 protected: |
| 80 // The buffer into which code and relocation info are generated. It could |
| 81 // either be owned by the assembler or be provided externally. |
| 82 byte* buffer_; |
| 83 int buffer_size_; |
| 84 bool own_buffer_; |
| 85 |
| 86 // The program counter, which points into the buffer above and moves forward. |
| 87 byte* pc_; |
| 88 |
| 74 private: | 89 private: |
| 75 Isolate* isolate_; | 90 Isolate* isolate_; |
| 76 int jit_cookie_; | 91 int jit_cookie_; |
| 77 bool emit_debug_code_; | 92 bool emit_debug_code_; |
| 78 bool predictable_code_size_; | 93 bool predictable_code_size_; |
| 79 }; | 94 }; |
| 80 | 95 |
| 81 | 96 |
| 82 // Avoids using instructions that vary in size in unpredictable ways between the | 97 // Avoids using instructions that vary in size in unpredictable ways between the |
| 83 // snapshot and the running VM. | 98 // snapshot and the running VM. |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 public: | 952 public: |
| 938 NullCallWrapper() { } | 953 NullCallWrapper() { } |
| 939 virtual ~NullCallWrapper() { } | 954 virtual ~NullCallWrapper() { } |
| 940 virtual void BeforeCall(int call_size) const { } | 955 virtual void BeforeCall(int call_size) const { } |
| 941 virtual void AfterCall() const { } | 956 virtual void AfterCall() const { } |
| 942 }; | 957 }; |
| 943 | 958 |
| 944 } } // namespace v8::internal | 959 } } // namespace v8::internal |
| 945 | 960 |
| 946 #endif // V8_ASSEMBLER_H_ | 961 #endif // V8_ASSEMBLER_H_ |
| OLD | NEW |