| 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(DeferredSlot** slot_list) { | 304 static void FillDeferredSlots(DeoptContext* deopt_context, |
| 305 DeferredSlot** slot_list) { |
| 305 DeferredSlot* slot = *slot_list; | 306 DeferredSlot* slot = *slot_list; |
| 306 *slot_list = NULL; | 307 *slot_list = NULL; |
| 307 | 308 |
| 308 while (slot != NULL) { | 309 while (slot != NULL) { |
| 309 DeferredSlot* current = slot; | 310 DeferredSlot* current = slot; |
| 310 slot = slot->next(); | 311 slot = slot->next(); |
| 311 | 312 |
| 312 current->Materialize(); | 313 current->Materialize(deopt_context); |
| 313 | 314 |
| 314 delete current; | 315 delete current; |
| 315 } | 316 } |
| 316 } | 317 } |
| 317 | 318 |
| 318 | 319 |
| 319 // Materializes all deferred objects. Returns the total number of | 320 // Materializes all deferred objects. Returns the total number of |
| 320 // artificial arguments used during deoptimization. | 321 // artificial arguments used during deoptimization. |
| 321 intptr_t DeoptContext::MaterializeDeferredObjects() { | 322 intptr_t DeoptContext::MaterializeDeferredObjects() { |
| 322 // First materialize all unboxed "primitive" values (doubles, mints, simd) | 323 // First materialize all unboxed "primitive" values (doubles, mints, simd) |
| 323 // then materialize objects. The order is important: objects might be | 324 // then materialize objects. The order is important: objects might be |
| 324 // referencing boxes allocated on the first step. At the same time | 325 // referencing boxes allocated on the first step. At the same time |
| 325 // objects can't be referencing other deferred objects because storing | 326 // objects can't be referencing other deferred objects because storing |
| 326 // an object into a field is always conservatively treated as escaping by | 327 // an object into a field is always conservatively treated as escaping by |
| 327 // allocation sinking and load forwarding. | 328 // allocation sinking and load forwarding. |
| 328 FillDeferredSlots(&deferred_boxes_); | 329 FillDeferredSlots(this, &deferred_boxes_); |
| 329 FillDeferredSlots(&deferred_object_refs_); | 330 FillDeferredSlots(this, &deferred_object_refs_); |
| 330 | 331 |
| 331 // Compute total number of artificial arguments used during deoptimization. | 332 // Compute total number of artificial arguments used during deoptimization. |
| 332 intptr_t deopt_arg_count = 0; | 333 intptr_t deopt_arg_count = 0; |
| 333 for (intptr_t i = 0; i < DeferredObjectsCount(); i++) { | 334 for (intptr_t i = 0; i < DeferredObjectsCount(); i++) { |
| 334 deopt_arg_count += GetDeferredObject(i)->ArgumentCount(); | 335 deopt_arg_count += GetDeferredObject(i)->ArgumentCount(); |
| 335 } | 336 } |
| 336 | 337 |
| 337 // Since this is the only step where GC can occur during deoptimization, | 338 // Since this is the only step where GC can occur during deoptimization, |
| 338 // use it to report the source line where deoptimization occured. | 339 // use it to report the source line where deoptimization occured. |
| 339 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { | 340 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { |
| (...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1406 Smi* offset, | 1407 Smi* offset, |
| 1407 DeoptInfo* info, | 1408 DeoptInfo* info, |
| 1408 Smi* reason) { | 1409 Smi* reason) { |
| 1409 intptr_t i = index * kEntrySize; | 1410 intptr_t i = index * kEntrySize; |
| 1410 *offset ^= table.At(i); | 1411 *offset ^= table.At(i); |
| 1411 *info ^= table.At(i + 1); | 1412 *info ^= table.At(i + 1); |
| 1412 *reason ^= table.At(i + 2); | 1413 *reason ^= table.At(i + 2); |
| 1413 } | 1414 } |
| 1414 | 1415 |
| 1415 } // namespace dart | 1416 } // namespace dart |
| OLD | NEW |