| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/deopt_instructions.h" | 5 #include "vm/deopt_instructions.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
| 9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
| 10 #include "vm/locations.h" | 10 #include "vm/locations.h" |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 OS::PrintErr("*%" Pd ". [%" Px "] %#014" Px " [%s]\n", | 294 OS::PrintErr("*%" Pd ". [%" Px "] %#014" Px " [%s]\n", |
| 295 i, | 295 i, |
| 296 reinterpret_cast<uword>(&start[i]), | 296 reinterpret_cast<uword>(&start[i]), |
| 297 start[i], | 297 start[i], |
| 298 deopt_instructions[i + (len - frame_size)]->ToCString()); | 298 deopt_instructions[i + (len - frame_size)]->ToCString()); |
| 299 } | 299 } |
| 300 } | 300 } |
| 301 } | 301 } |
| 302 | 302 |
| 303 | 303 |
| 304 static void FillDeferredSlots(DeoptContext* deopt_context, | 304 static void FillDeferredSlots(DeferredSlot** slot_list) { |
| 305 DeferredSlot** slot_list) { | |
| 306 DeferredSlot* slot = *slot_list; | 305 DeferredSlot* slot = *slot_list; |
| 307 *slot_list = NULL; | 306 *slot_list = NULL; |
| 308 | 307 |
| 309 while (slot != NULL) { | 308 while (slot != NULL) { |
| 310 DeferredSlot* current = slot; | 309 DeferredSlot* current = slot; |
| 311 slot = slot->next(); | 310 slot = slot->next(); |
| 312 | 311 |
| 313 current->Materialize(deopt_context); | 312 current->Materialize(); |
| 314 | 313 |
| 315 delete current; | 314 delete current; |
| 316 } | 315 } |
| 317 } | 316 } |
| 318 | 317 |
| 319 | 318 |
| 320 // Materializes all deferred objects. Returns the total number of | 319 // Materializes all deferred objects. Returns the total number of |
| 321 // artificial arguments used during deoptimization. | 320 // artificial arguments used during deoptimization. |
| 322 intptr_t DeoptContext::MaterializeDeferredObjects() { | 321 intptr_t DeoptContext::MaterializeDeferredObjects() { |
| 323 // First materialize all unboxed "primitive" values (doubles, mints, simd) | 322 // First materialize all unboxed "primitive" values (doubles, mints, simd) |
| 324 // then materialize objects. The order is important: objects might be | 323 // then materialize objects. The order is important: objects might be |
| 325 // referencing boxes allocated on the first step. At the same time | 324 // referencing boxes allocated on the first step. At the same time |
| 326 // objects can't be referencing other deferred objects because storing | 325 // objects can't be referencing other deferred objects because storing |
| 327 // an object into a field is always conservatively treated as escaping by | 326 // an object into a field is always conservatively treated as escaping by |
| 328 // allocation sinking and load forwarding. | 327 // allocation sinking and load forwarding. |
| 329 FillDeferredSlots(this, &deferred_boxes_); | 328 FillDeferredSlots(&deferred_boxes_); |
| 330 FillDeferredSlots(this, &deferred_object_refs_); | 329 FillDeferredSlots(&deferred_object_refs_); |
| 331 | 330 |
| 332 // Compute total number of artificial arguments used during deoptimization. | 331 // Compute total number of artificial arguments used during deoptimization. |
| 333 intptr_t deopt_arg_count = 0; | 332 intptr_t deopt_arg_count = 0; |
| 334 for (intptr_t i = 0; i < DeferredObjectsCount(); i++) { | 333 for (intptr_t i = 0; i < DeferredObjectsCount(); i++) { |
| 335 deopt_arg_count += GetDeferredObject(i)->ArgumentCount(); | 334 deopt_arg_count += GetDeferredObject(i)->ArgumentCount(); |
| 336 } | 335 } |
| 337 | 336 |
| 338 // Since this is the only step where GC can occur during deoptimization, | 337 // Since this is the only step where GC can occur during deoptimization, |
| 339 // use it to report the source line where deoptimization occured. | 338 // use it to report the source line where deoptimization occured. |
| 340 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { | 339 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { |
| (...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1407 Smi* offset, | 1406 Smi* offset, |
| 1408 DeoptInfo* info, | 1407 DeoptInfo* info, |
| 1409 Smi* reason) { | 1408 Smi* reason) { |
| 1410 intptr_t i = index * kEntrySize; | 1409 intptr_t i = index * kEntrySize; |
| 1411 *offset ^= table.At(i); | 1410 *offset ^= table.At(i); |
| 1412 *info ^= table.At(i + 1); | 1411 *info ^= table.At(i + 1); |
| 1413 *reason ^= table.At(i + 2); | 1412 *reason ^= table.At(i + 2); |
| 1414 } | 1413 } |
| 1415 | 1414 |
| 1416 } // namespace dart | 1415 } // namespace dart |
| OLD | NEW |