| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 friend class SafepointTableBuilder; | 171 friend class SafepointTableBuilder; |
| 172 friend class SafepointEntry; | 172 friend class SafepointEntry; |
| 173 | 173 |
| 174 DISALLOW_COPY_AND_ASSIGN(SafepointTable); | 174 DISALLOW_COPY_AND_ASSIGN(SafepointTable); |
| 175 }; | 175 }; |
| 176 | 176 |
| 177 | 177 |
| 178 class Safepoint BASE_EMBEDDED { | 178 class Safepoint BASE_EMBEDDED { |
| 179 public: | 179 public: |
| 180 typedef enum { |
| 181 kSimple = 0, |
| 182 kWithRegisters = 1 << 0, |
| 183 kWithDoubles = 1 << 1, |
| 184 kWithRegistersAndDoubles = kWithRegisters | kWithDoubles |
| 185 } Kind; |
| 186 |
| 180 static const int kNoDeoptimizationIndex = | 187 static const int kNoDeoptimizationIndex = |
| 181 (1 << (SafepointEntry::kDeoptIndexBits)) - 1; | 188 (1 << (SafepointEntry::kDeoptIndexBits)) - 1; |
| 182 | 189 |
| 183 void DefinePointerSlot(int index) { indexes_->Add(index); } | 190 void DefinePointerSlot(int index) { indexes_->Add(index); } |
| 184 void DefinePointerRegister(Register reg); | 191 void DefinePointerRegister(Register reg); |
| 185 | 192 |
| 186 private: | 193 private: |
| 187 Safepoint(ZoneList<int>* indexes, ZoneList<int>* registers) : | 194 Safepoint(ZoneList<int>* indexes, ZoneList<int>* registers) : |
| 188 indexes_(indexes), registers_(registers) { } | 195 indexes_(indexes), registers_(registers) { } |
| 189 ZoneList<int>* indexes_; | 196 ZoneList<int>* indexes_; |
| 190 ZoneList<int>* registers_; | 197 ZoneList<int>* registers_; |
| 191 | 198 |
| 192 friend class SafepointTableBuilder; | 199 friend class SafepointTableBuilder; |
| 193 }; | 200 }; |
| 194 | 201 |
| 195 | 202 |
| 196 class SafepointTableBuilder BASE_EMBEDDED { | 203 class SafepointTableBuilder BASE_EMBEDDED { |
| 197 public: | 204 public: |
| 198 SafepointTableBuilder() | 205 SafepointTableBuilder() |
| 199 : deoptimization_info_(32), | 206 : deoptimization_info_(32), |
| 200 indexes_(32), | 207 indexes_(32), |
| 201 registers_(32), | 208 registers_(32), |
| 202 emitted_(false) { } | 209 emitted_(false) { } |
| 203 | 210 |
| 204 // Get the offset of the emitted safepoint table in the code. | 211 // Get the offset of the emitted safepoint table in the code. |
| 205 unsigned GetCodeOffset() const; | 212 unsigned GetCodeOffset() const; |
| 206 | 213 |
| 207 // Define a new safepoint for the current position in the body. | 214 // Define a new safepoint for the current position in the body. |
| 208 Safepoint DefineSafepoint( | 215 Safepoint DefineSafepoint(Assembler* assembler, |
| 209 Assembler* assembler, | 216 Safepoint::Kind kind, |
| 210 int deoptimization_index = Safepoint::kNoDeoptimizationIndex); | 217 int arguments, |
| 211 | 218 int deoptimization_index); |
| 212 // Define a new safepoint with registers on the stack for the | |
| 213 // current position in the body and take the number of arguments on | |
| 214 // top of the registers into account. | |
| 215 Safepoint DefineSafepointWithRegisters( | |
| 216 Assembler* assembler, | |
| 217 int arguments, | |
| 218 int deoptimization_index = Safepoint::kNoDeoptimizationIndex); | |
| 219 | |
| 220 // Define a new safepoint with all double registers and the normal | |
| 221 // registers on the stack for the current position in the body and | |
| 222 // take the number of arguments on top of the registers into account. | |
| 223 // TODO(1043) Rewrite the three SafepointTableBuilder::DefineSafepoint | |
| 224 // methods to one method that uses template arguments. | |
| 225 Safepoint DefineSafepointWithRegistersAndDoubles( | |
| 226 Assembler* assembler, | |
| 227 int arguments, | |
| 228 int deoptimization_index = Safepoint::kNoDeoptimizationIndex); | |
| 229 | 219 |
| 230 // Update the last safepoint with the size of the code generated for the gap | 220 // Update the last safepoint with the size of the code generated for the gap |
| 231 // following it. | 221 // following it. |
| 232 void SetPcAfterGap(int pc) { | 222 void SetPcAfterGap(int pc) { |
| 233 ASSERT(!deoptimization_info_.is_empty()); | 223 ASSERT(!deoptimization_info_.is_empty()); |
| 234 int index = deoptimization_info_.length() - 1; | 224 int index = deoptimization_info_.length() - 1; |
| 235 deoptimization_info_[index].pc_after_gap = pc; | 225 deoptimization_info_[index].pc_after_gap = pc; |
| 236 } | 226 } |
| 237 | 227 |
| 238 // Emit the safepoint table after the body. The number of bits per | 228 // Emit the safepoint table after the body. The number of bits per |
| (...skipping 17 matching lines...) Expand all Loading... |
| 256 | 246 |
| 257 bool emitted_; | 247 bool emitted_; |
| 258 unsigned offset_; | 248 unsigned offset_; |
| 259 | 249 |
| 260 DISALLOW_COPY_AND_ASSIGN(SafepointTableBuilder); | 250 DISALLOW_COPY_AND_ASSIGN(SafepointTableBuilder); |
| 261 }; | 251 }; |
| 262 | 252 |
| 263 } } // namespace v8::internal | 253 } } // namespace v8::internal |
| 264 | 254 |
| 265 #endif // V8_SAFEPOINT_TABLE_H_ | 255 #endif // V8_SAFEPOINT_TABLE_H_ |
| OLD | NEW |