| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 friend class SafepointTableBuilder; | 174 friend class SafepointTableBuilder; |
| 175 friend class SafepointEntry; | 175 friend class SafepointEntry; |
| 176 | 176 |
| 177 DISALLOW_COPY_AND_ASSIGN(SafepointTable); | 177 DISALLOW_COPY_AND_ASSIGN(SafepointTable); |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 | 180 |
| 181 class Safepoint BASE_EMBEDDED { | 181 class Safepoint BASE_EMBEDDED { |
| 182 public: | 182 public: |
| 183 typedef enum { |
| 184 kSimple = 0, |
| 185 kWithRegisters = 1 << 0, |
| 186 kWithDoubles = 1 << 1, |
| 187 kWithRegistersAndDoubles = kWithRegisters | kWithDoubles |
| 188 } Kind; |
| 189 |
| 183 static const int kNoDeoptimizationIndex = | 190 static const int kNoDeoptimizationIndex = |
| 184 (1 << (SafepointEntry::kDeoptIndexBits)) - 1; | 191 (1 << (SafepointEntry::kDeoptIndexBits)) - 1; |
| 185 | 192 |
| 186 void DefinePointerSlot(int index) { indexes_->Add(index); } | 193 void DefinePointerSlot(int index) { indexes_->Add(index); } |
| 187 void DefinePointerRegister(Register reg); | 194 void DefinePointerRegister(Register reg); |
| 188 | 195 |
| 189 private: | 196 private: |
| 190 Safepoint(ZoneList<int>* indexes, ZoneList<int>* registers) : | 197 Safepoint(ZoneList<int>* indexes, ZoneList<int>* registers) : |
| 191 indexes_(indexes), registers_(registers) { } | 198 indexes_(indexes), registers_(registers) { } |
| 192 ZoneList<int>* indexes_; | 199 ZoneList<int>* indexes_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 203 indexes_(32), | 210 indexes_(32), |
| 204 registers_(32), | 211 registers_(32), |
| 205 emitted_(false) { } | 212 emitted_(false) { } |
| 206 | 213 |
| 207 // Get the offset of the emitted safepoint table in the code. | 214 // Get the offset of the emitted safepoint table in the code. |
| 208 unsigned GetCodeOffset() const; | 215 unsigned GetCodeOffset() const; |
| 209 | 216 |
| 210 // Define a new safepoint for the current position in the body. | 217 // Define a new safepoint for the current position in the body. |
| 211 Safepoint DefineSafepoint( | 218 Safepoint DefineSafepoint( |
| 212 Assembler* assembler, | 219 Assembler* assembler, |
| 213 int deoptimization_index = Safepoint::kNoDeoptimizationIndex); | 220 Safepoint::Kind kind, |
| 214 | |
| 215 // Define a new safepoint with registers on the stack for the | |
| 216 // current position in the body and take the number of arguments on | |
| 217 // top of the registers into account. | |
| 218 Safepoint DefineSafepointWithRegisters( | |
| 219 Assembler* assembler, | |
| 220 int arguments, | 221 int arguments, |
| 221 int deoptimization_index = Safepoint::kNoDeoptimizationIndex); | 222 int deoptimization_index = Safepoint::kNoDeoptimizationIndex); |
| 222 | 223 |
| 223 // Define a new safepoint with all double registers and the normal | |
| 224 // registers on the stack for the current position in the body and | |
| 225 // take the number of arguments on top of the registers into account. | |
| 226 // TODO(1043) Rewrite the three SafepointTableBuilder::DefineSafepoint | |
| 227 // methods to one method that uses template arguments. | |
| 228 Safepoint DefineSafepointWithRegistersAndDoubles( | |
| 229 Assembler* assembler, | |
| 230 int arguments, | |
| 231 int deoptimization_index = Safepoint::kNoDeoptimizationIndex); | |
| 232 | |
| 233 // Update the last safepoint with the size of the code generated for the gap | 224 // Update the last safepoint with the size of the code generated for the gap |
| 234 // following it. | 225 // following it. |
| 235 void SetPcAfterGap(int pc) { | 226 void SetPcAfterGap(int pc) { |
| 236 ASSERT(!deoptimization_info_.is_empty()); | 227 ASSERT(!deoptimization_info_.is_empty()); |
| 237 int index = deoptimization_info_.length() - 1; | 228 int index = deoptimization_info_.length() - 1; |
| 238 deoptimization_info_[index].pc_after_gap = pc; | 229 deoptimization_info_[index].pc_after_gap = pc; |
| 239 } | 230 } |
| 240 | 231 |
| 241 // Emit the safepoint table after the body. The number of bits per | 232 // Emit the safepoint table after the body. The number of bits per |
| 242 // entry must be enough to hold all the pointer indexes. | 233 // entry must be enough to hold all the pointer indexes. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 259 | 250 |
| 260 bool emitted_; | 251 bool emitted_; |
| 261 unsigned offset_; | 252 unsigned offset_; |
| 262 | 253 |
| 263 DISALLOW_COPY_AND_ASSIGN(SafepointTableBuilder); | 254 DISALLOW_COPY_AND_ASSIGN(SafepointTableBuilder); |
| 264 }; | 255 }; |
| 265 | 256 |
| 266 } } // namespace v8::internal | 257 } } // namespace v8::internal |
| 267 | 258 |
| 268 #endif // V8_SAFEPOINT_TABLE_H_ | 259 #endif // V8_SAFEPOINT_TABLE_H_ |
| OLD | NEW |