| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 explicit AssemblerBase(Isolate* isolate); |
| 60 | 60 |
| 61 Isolate* isolate() const { return isolate_; } | 61 Isolate* isolate() const { return isolate_; } |
| 62 int jit_cookie() { return jit_cookie_; } | 62 int jit_cookie() const { return jit_cookie_; } |
| 63 |
| 64 bool predictable_code_size() const { return predictable_code_size_; } |
| 65 void set_predictable_code_size(bool value) { predictable_code_size_ = value; } |
| 63 | 66 |
| 64 // Overwrite a host NaN with a quiet target NaN. Used by mksnapshot for | 67 // Overwrite a host NaN with a quiet target NaN. Used by mksnapshot for |
| 65 // cross-snapshotting. | 68 // cross-snapshotting. |
| 66 static void QuietNaN(HeapObject* nan) { } | 69 static void QuietNaN(HeapObject* nan) { } |
| 67 | 70 |
| 68 private: | 71 private: |
| 69 Isolate* isolate_; | 72 Isolate* isolate_; |
| 70 int jit_cookie_; | 73 int jit_cookie_; |
| 74 bool predictable_code_size_; |
| 71 }; | 75 }; |
| 72 | 76 |
| 73 | 77 |
| 78 // Avoids using instructions that vary in size in unpredictable ways between the |
| 79 // snapshot and the running VM. |
| 80 class PredictableCodeSizeScope { |
| 81 public: |
| 82 explicit PredictableCodeSizeScope(AssemblerBase* assembler) |
| 83 : assembler_(assembler) { |
| 84 old_value_ = assembler_->predictable_code_size(); |
| 85 assembler_->set_predictable_code_size(true); |
| 86 } |
| 87 |
| 88 ~PredictableCodeSizeScope() { |
| 89 assembler_->set_predictable_code_size(old_value_); |
| 90 } |
| 91 |
| 92 private: |
| 93 AssemblerBase* assembler_; |
| 94 bool old_value_; |
| 95 }; |
| 96 |
| 97 |
| 74 // ----------------------------------------------------------------------------- | 98 // ----------------------------------------------------------------------------- |
| 75 // Labels represent pc locations; they are typically jump or call targets. | 99 // Labels represent pc locations; they are typically jump or call targets. |
| 76 // After declaration, a label can be freely used to denote known or (yet) | 100 // After declaration, a label can be freely used to denote known or (yet) |
| 77 // unknown pc location. Assembler::bind() is used to bind a label to the | 101 // unknown pc location. Assembler::bind() is used to bind a label to the |
| 78 // current pc. A label can be bound only once. | 102 // current pc. A label can be bound only once. |
| 79 | 103 |
| 80 class Label BASE_EMBEDDED { | 104 class Label BASE_EMBEDDED { |
| 81 public: | 105 public: |
| 82 enum Distance { | 106 enum Distance { |
| 83 kNear, kFar | 107 kNear, kFar |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 public: | 933 public: |
| 910 NullCallWrapper() { } | 934 NullCallWrapper() { } |
| 911 virtual ~NullCallWrapper() { } | 935 virtual ~NullCallWrapper() { } |
| 912 virtual void BeforeCall(int call_size) const { } | 936 virtual void BeforeCall(int call_size) const { } |
| 913 virtual void AfterCall() const { } | 937 virtual void AfterCall() const { } |
| 914 }; | 938 }; |
| 915 | 939 |
| 916 } } // namespace v8::internal | 940 } } // namespace v8::internal |
| 917 | 941 |
| 918 #endif // V8_ASSEMBLER_H_ | 942 #endif // V8_ASSEMBLER_H_ |
| OLD | NEW |