| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 | 122 |
| 123 Safepoint SafepointTableBuilder::DefineSafepoint(Assembler* assembler, | 123 Safepoint SafepointTableBuilder::DefineSafepoint(Assembler* assembler, |
| 124 int deoptimization_index) { | 124 int deoptimization_index) { |
| 125 ASSERT(deoptimization_index != -1); | 125 ASSERT(deoptimization_index != -1); |
| 126 DeoptimizationInfo pc_and_deoptimization_index; | 126 DeoptimizationInfo pc_and_deoptimization_index; |
| 127 pc_and_deoptimization_index.pc = assembler->pc_offset(); | 127 pc_and_deoptimization_index.pc = assembler->pc_offset(); |
| 128 pc_and_deoptimization_index.deoptimization_index = deoptimization_index; | 128 pc_and_deoptimization_index.deoptimization_index = deoptimization_index; |
| 129 pc_and_deoptimization_index.pc_after_gap = assembler->pc_offset(); | 129 pc_and_deoptimization_index.pc_after_gap = assembler->pc_offset(); |
| 130 pc_and_deoptimization_index.arguments = 0; | 130 pc_and_deoptimization_index.arguments = 0; |
| 131 pc_and_deoptimization_index.has_doubles = false; |
| 131 deoptimization_info_.Add(pc_and_deoptimization_index); | 132 deoptimization_info_.Add(pc_and_deoptimization_index); |
| 132 indexes_.Add(new ZoneList<int>(8)); | 133 indexes_.Add(new ZoneList<int>(8)); |
| 133 registers_.Add(NULL); | 134 registers_.Add(NULL); |
| 134 return Safepoint(indexes_.last(), registers_.last()); | 135 return Safepoint(indexes_.last(), registers_.last()); |
| 135 } | 136 } |
| 136 | 137 |
| 137 | 138 |
| 138 Safepoint SafepointTableBuilder::DefineSafepointWithRegisters( | 139 Safepoint SafepointTableBuilder::DefineSafepointWithRegisters( |
| 139 Assembler* assembler, int arguments, int deoptimization_index) { | 140 Assembler* assembler, int arguments, int deoptimization_index) { |
| 140 ASSERT(deoptimization_index != -1); | 141 ASSERT(deoptimization_index != -1); |
| 141 ASSERT(arguments >= 0); | 142 ASSERT(arguments >= 0); |
| 142 DeoptimizationInfo pc_and_deoptimization_index; | 143 DeoptimizationInfo pc_and_deoptimization_index; |
| 143 pc_and_deoptimization_index.pc = assembler->pc_offset(); | 144 pc_and_deoptimization_index.pc = assembler->pc_offset(); |
| 144 pc_and_deoptimization_index.deoptimization_index = deoptimization_index; | 145 pc_and_deoptimization_index.deoptimization_index = deoptimization_index; |
| 145 pc_and_deoptimization_index.pc_after_gap = assembler->pc_offset(); | 146 pc_and_deoptimization_index.pc_after_gap = assembler->pc_offset(); |
| 146 pc_and_deoptimization_index.arguments = arguments; | 147 pc_and_deoptimization_index.arguments = arguments; |
| 148 pc_and_deoptimization_index.has_doubles = false; |
| 147 deoptimization_info_.Add(pc_and_deoptimization_index); | 149 deoptimization_info_.Add(pc_and_deoptimization_index); |
| 148 indexes_.Add(new ZoneList<int>(8)); | 150 indexes_.Add(new ZoneList<int>(8)); |
| 149 registers_.Add(new ZoneList<int>(4)); | 151 registers_.Add(new ZoneList<int>(4)); |
| 150 return Safepoint(indexes_.last(), registers_.last()); | 152 return Safepoint(indexes_.last(), registers_.last()); |
| 151 } | 153 } |
| 152 | 154 |
| 153 | 155 |
| 156 Safepoint SafepointTableBuilder::DefineSafepointWithRegistersAndDoubles( |
| 157 Assembler* assembler, int arguments, int deoptimization_index) { |
| 158 ASSERT(deoptimization_index != -1); |
| 159 ASSERT(arguments >= 0); |
| 160 DeoptimizationInfo pc_and_deoptimization_index; |
| 161 pc_and_deoptimization_index.pc = assembler->pc_offset(); |
| 162 pc_and_deoptimization_index.deoptimization_index = deoptimization_index; |
| 163 pc_and_deoptimization_index.pc_after_gap = assembler->pc_offset(); |
| 164 pc_and_deoptimization_index.arguments = arguments; |
| 165 pc_and_deoptimization_index.has_doubles = true; |
| 166 deoptimization_info_.Add(pc_and_deoptimization_index); |
| 167 indexes_.Add(new ZoneList<int>(8)); |
| 168 registers_.Add(new ZoneList<int>(4)); |
| 169 return Safepoint(indexes_.last(), registers_.last()); |
| 170 } |
| 171 |
| 154 unsigned SafepointTableBuilder::GetCodeOffset() const { | 172 unsigned SafepointTableBuilder::GetCodeOffset() const { |
| 155 ASSERT(emitted_); | 173 ASSERT(emitted_); |
| 156 return offset_; | 174 return offset_; |
| 157 } | 175 } |
| 158 | 176 |
| 159 | 177 |
| 160 void SafepointTableBuilder::Emit(Assembler* assembler, int bits_per_entry) { | 178 void SafepointTableBuilder::Emit(Assembler* assembler, int bits_per_entry) { |
| 161 // Make sure the safepoint table is properly aligned. Pad with nops. | 179 // Make sure the safepoint table is properly aligned. Pad with nops. |
| 162 assembler->Align(kIntSize); | 180 assembler->Align(kIntSize); |
| 163 assembler->RecordComment(";;; Safepoint table."); | 181 assembler->RecordComment(";;; Safepoint table."); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 emitted_ = true; | 241 emitted_ = true; |
| 224 } | 242 } |
| 225 | 243 |
| 226 | 244 |
| 227 uint32_t SafepointTableBuilder::EncodeExceptPC(const DeoptimizationInfo& info) { | 245 uint32_t SafepointTableBuilder::EncodeExceptPC(const DeoptimizationInfo& info) { |
| 228 unsigned index = info.deoptimization_index; | 246 unsigned index = info.deoptimization_index; |
| 229 unsigned gap_size = info.pc_after_gap - info.pc; | 247 unsigned gap_size = info.pc_after_gap - info.pc; |
| 230 uint32_t encoding = SafepointEntry::DeoptimizationIndexField::encode(index); | 248 uint32_t encoding = SafepointEntry::DeoptimizationIndexField::encode(index); |
| 231 encoding |= SafepointEntry::GapCodeSizeField::encode(gap_size); | 249 encoding |= SafepointEntry::GapCodeSizeField::encode(gap_size); |
| 232 encoding |= SafepointEntry::ArgumentsField::encode(info.arguments); | 250 encoding |= SafepointEntry::ArgumentsField::encode(info.arguments); |
| 251 encoding |= SafepointEntry::SaveDoublesField::encode(info.has_doubles); |
| 233 return encoding; | 252 return encoding; |
| 234 } | 253 } |
| 235 | 254 |
| 236 | 255 |
| 237 } } // namespace v8::internal | 256 } } // namespace v8::internal |
| OLD | NEW |