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