| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 PrintF("%c", ((byte & (1 << i)) == 0) ? '0' : '1'); | 110 PrintF("%c", ((byte & (1 << i)) == 0) ? '0' : '1'); |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 | 114 |
| 115 void Safepoint::DefinePointerRegister(Register reg) { | 115 void Safepoint::DefinePointerRegister(Register reg) { |
| 116 registers_->Add(reg.code()); | 116 registers_->Add(reg.code()); |
| 117 } | 117 } |
| 118 | 118 |
| 119 | 119 |
| 120 Safepoint SafepointTableBuilder::DefineSafepoint(Assembler* assembler, | 120 Safepoint SafepointTableBuilder::DefineSafepoint( |
| 121 int deoptimization_index) { | 121 Assembler* assembler, Safepoint::Kind kind, int arguments, |
| 122 ASSERT(deoptimization_index != -1); | 122 int deoptimization_index) { |
| 123 DeoptimizationInfo pc_and_deoptimization_index; | |
| 124 pc_and_deoptimization_index.pc = assembler->pc_offset(); | |
| 125 pc_and_deoptimization_index.deoptimization_index = deoptimization_index; | |
| 126 pc_and_deoptimization_index.pc_after_gap = assembler->pc_offset(); | |
| 127 pc_and_deoptimization_index.arguments = 0; | |
| 128 pc_and_deoptimization_index.has_doubles = false; | |
| 129 deoptimization_info_.Add(pc_and_deoptimization_index); | |
| 130 indexes_.Add(new ZoneList<int>(8)); | |
| 131 registers_.Add(NULL); | |
| 132 return Safepoint(indexes_.last(), registers_.last()); | |
| 133 } | |
| 134 | |
| 135 | |
| 136 Safepoint SafepointTableBuilder::DefineSafepointWithRegisters( | |
| 137 Assembler* assembler, int arguments, int deoptimization_index) { | |
| 138 ASSERT(deoptimization_index != -1); | 123 ASSERT(deoptimization_index != -1); |
| 139 ASSERT(arguments >= 0); | 124 ASSERT(arguments >= 0); |
| 140 DeoptimizationInfo pc_and_deoptimization_index; | 125 DeoptimizationInfo pc_and_deoptimization_index; |
| 141 pc_and_deoptimization_index.pc = assembler->pc_offset(); | 126 pc_and_deoptimization_index.pc = assembler->pc_offset(); |
| 142 pc_and_deoptimization_index.deoptimization_index = deoptimization_index; | 127 pc_and_deoptimization_index.deoptimization_index = deoptimization_index; |
| 143 pc_and_deoptimization_index.pc_after_gap = assembler->pc_offset(); | 128 pc_and_deoptimization_index.pc_after_gap = assembler->pc_offset(); |
| 144 pc_and_deoptimization_index.arguments = arguments; | 129 pc_and_deoptimization_index.arguments = arguments; |
| 145 pc_and_deoptimization_index.has_doubles = false; | 130 pc_and_deoptimization_index.has_doubles = (kind & Safepoint::kWithDoubles); |
| 146 deoptimization_info_.Add(pc_and_deoptimization_index); | 131 deoptimization_info_.Add(pc_and_deoptimization_index); |
| 147 indexes_.Add(new ZoneList<int>(8)); | 132 indexes_.Add(new ZoneList<int>(8)); |
| 148 registers_.Add(new ZoneList<int>(4)); | 133 registers_.Add((kind & Safepoint::kWithRegisters) |
| 134 ? new ZoneList<int>(4) |
| 135 : NULL); |
| 149 return Safepoint(indexes_.last(), registers_.last()); | 136 return Safepoint(indexes_.last(), registers_.last()); |
| 150 } | 137 } |
| 151 | 138 |
| 152 | 139 |
| 153 Safepoint SafepointTableBuilder::DefineSafepointWithRegistersAndDoubles( | |
| 154 Assembler* assembler, int arguments, int deoptimization_index) { | |
| 155 ASSERT(deoptimization_index != -1); | |
| 156 ASSERT(arguments >= 0); | |
| 157 DeoptimizationInfo pc_and_deoptimization_index; | |
| 158 pc_and_deoptimization_index.pc = assembler->pc_offset(); | |
| 159 pc_and_deoptimization_index.deoptimization_index = deoptimization_index; | |
| 160 pc_and_deoptimization_index.pc_after_gap = assembler->pc_offset(); | |
| 161 pc_and_deoptimization_index.arguments = arguments; | |
| 162 pc_and_deoptimization_index.has_doubles = true; | |
| 163 deoptimization_info_.Add(pc_and_deoptimization_index); | |
| 164 indexes_.Add(new ZoneList<int>(8)); | |
| 165 registers_.Add(new ZoneList<int>(4)); | |
| 166 return Safepoint(indexes_.last(), registers_.last()); | |
| 167 } | |
| 168 | |
| 169 unsigned SafepointTableBuilder::GetCodeOffset() const { | 140 unsigned SafepointTableBuilder::GetCodeOffset() const { |
| 170 ASSERT(emitted_); | 141 ASSERT(emitted_); |
| 171 return offset_; | 142 return offset_; |
| 172 } | 143 } |
| 173 | 144 |
| 174 | 145 |
| 175 void SafepointTableBuilder::Emit(Assembler* assembler, int bits_per_entry) { | 146 void SafepointTableBuilder::Emit(Assembler* assembler, int bits_per_entry) { |
| 176 // Make sure the safepoint table is properly aligned. Pad with nops. | 147 // Make sure the safepoint table is properly aligned. Pad with nops. |
| 177 assembler->Align(kIntSize); | 148 assembler->Align(kIntSize); |
| 178 assembler->RecordComment(";;; Safepoint table."); | 149 assembler->RecordComment(";;; Safepoint table."); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 unsigned gap_size = info.pc_after_gap - info.pc; | 215 unsigned gap_size = info.pc_after_gap - info.pc; |
| 245 uint32_t encoding = SafepointEntry::DeoptimizationIndexField::encode(index); | 216 uint32_t encoding = SafepointEntry::DeoptimizationIndexField::encode(index); |
| 246 encoding |= SafepointEntry::GapCodeSizeField::encode(gap_size); | 217 encoding |= SafepointEntry::GapCodeSizeField::encode(gap_size); |
| 247 encoding |= SafepointEntry::ArgumentsField::encode(info.arguments); | 218 encoding |= SafepointEntry::ArgumentsField::encode(info.arguments); |
| 248 encoding |= SafepointEntry::SaveDoublesField::encode(info.has_doubles); | 219 encoding |= SafepointEntry::SaveDoublesField::encode(info.has_doubles); |
| 249 return encoding; | 220 return encoding; |
| 250 } | 221 } |
| 251 | 222 |
| 252 | 223 |
| 253 } } // namespace v8::internal | 224 } } // namespace v8::internal |
| OLD | NEW |