| 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/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/intermediate_language.h" | 10 #include "vm/intermediate_language.h" |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 // right before control switches to the unoptimized code. | 305 // right before control switches to the unoptimized code. |
| 306 const intptr_t num_materializations = | 306 const intptr_t num_materializations = |
| 307 DeoptInfo::NumMaterializations(deopt_instructions); | 307 DeoptInfo::NumMaterializations(deopt_instructions); |
| 308 PrepareForDeferredMaterialization(num_materializations); | 308 PrepareForDeferredMaterialization(num_materializations); |
| 309 for (intptr_t from_index = 0, to_index = kDartFrameFixedSize; | 309 for (intptr_t from_index = 0, to_index = kDartFrameFixedSize; |
| 310 from_index < num_materializations; | 310 from_index < num_materializations; |
| 311 from_index++) { | 311 from_index++) { |
| 312 const intptr_t field_count = | 312 const intptr_t field_count = |
| 313 DeoptInstr::GetFieldCount(deopt_instructions[from_index]); | 313 DeoptInstr::GetFieldCount(deopt_instructions[from_index]); |
| 314 intptr_t* args = GetDestFrameAddressAt(to_index); | 314 intptr_t* args = GetDestFrameAddressAt(to_index); |
| 315 // OS::PrintErr("FillDestFrame: num_materializations = %ld, from_index = %ld
, to_index = %ld, field_count = %ld, args = %p\n", |
| 316 // num_materializations, from_index, to_index, field_count, args); |
| 315 DeferredObject* obj = new DeferredObject(field_count, args); | 317 DeferredObject* obj = new DeferredObject(field_count, args); |
| 316 SetDeferredObjectAt(from_index, obj); | 318 SetDeferredObjectAt(from_index, obj); |
| 317 to_index += obj->ArgumentCount(); | 319 to_index += obj->ArgumentCount(); |
| 318 } | 320 } |
| 319 | 321 |
| 320 // Populate stack frames. | 322 // Populate stack frames. |
| 321 for (intptr_t to_index = frame_size - 1, from_index = len - 1; | 323 for (intptr_t to_index = frame_size - 1, from_index = len - 1; |
| 322 to_index >= 0; | 324 to_index >= 0; |
| 323 to_index--, from_index--) { | 325 to_index--, from_index--) { |
| 324 intptr_t* to_addr = GetDestFrameAddressAt(to_index); | 326 intptr_t* to_addr = GetDestFrameAddressAt(to_index); |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 void Execute(DeoptContext* deopt_context, intptr_t* dest_addr) { | 687 void Execute(DeoptContext* deopt_context, intptr_t* dest_addr) { |
| 686 Function& function = Function::Handle(deopt_context->zone()); | 688 Function& function = Function::Handle(deopt_context->zone()); |
| 687 function ^= deopt_context->ObjectAt(object_table_index_); | 689 function ^= deopt_context->ObjectAt(object_table_index_); |
| 688 if (function.IsNull()) { | 690 if (function.IsNull()) { |
| 689 *reinterpret_cast<RawObject**>(dest_addr) = deopt_context->is_lazy_deopt() | 691 *reinterpret_cast<RawObject**>(dest_addr) = deopt_context->is_lazy_deopt() |
| 690 ? StubCode::DeoptimizeLazy_entry()->code() | 692 ? StubCode::DeoptimizeLazy_entry()->code() |
| 691 : StubCode::Deoptimize_entry()->code(); | 693 : StubCode::Deoptimize_entry()->code(); |
| 692 return; | 694 return; |
| 693 } | 695 } |
| 694 | 696 |
| 695 #if !defined(TARGET_ARCH_DBC) | |
| 696 // We don't always have the Code object for the frame's corresponding | 697 // We don't always have the Code object for the frame's corresponding |
| 697 // unoptimized code as it may have been collected. Use a stub as the pc | 698 // unoptimized code as it may have been collected. Use a stub as the pc |
| 698 // marker until we can recreate that Code object during deferred | 699 // marker until we can recreate that Code object during deferred |
| 699 // materialization to maintain the invariant that Dart frames always have | 700 // materialization to maintain the invariant that Dart frames always have |
| 700 // a pc marker. | 701 // a pc marker. |
| 701 *reinterpret_cast<RawObject**>(dest_addr) = | 702 *reinterpret_cast<RawObject**>(dest_addr) = |
| 702 StubCode::FrameAwaitingMaterialization_entry()->code(); | 703 StubCode::FrameAwaitingMaterialization_entry()->code(); |
| 703 #endif | |
| 704 deopt_context->DeferPcMarkerMaterialization(object_table_index_, dest_addr); | 704 deopt_context->DeferPcMarkerMaterialization(object_table_index_, dest_addr); |
| 705 } | 705 } |
| 706 | 706 |
| 707 private: | 707 private: |
| 708 intptr_t object_table_index_; | 708 intptr_t object_table_index_; |
| 709 | 709 |
| 710 DISALLOW_COPY_AND_ASSIGN(DeoptPcMarkerInstr); | 710 DISALLOW_COPY_AND_ASSIGN(DeoptPcMarkerInstr); |
| 711 }; | 711 }; |
| 712 | 712 |
| 713 | 713 |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 Smi* offset, | 1342 Smi* offset, |
| 1343 TypedData* info, | 1343 TypedData* info, |
| 1344 Smi* reason) { | 1344 Smi* reason) { |
| 1345 intptr_t i = index * kEntrySize; | 1345 intptr_t i = index * kEntrySize; |
| 1346 *offset ^= table.At(i); | 1346 *offset ^= table.At(i); |
| 1347 *info ^= table.At(i + 1); | 1347 *info ^= table.At(i + 1); |
| 1348 *reason ^= table.At(i + 2); | 1348 *reason ^= table.At(i + 2); |
| 1349 } | 1349 } |
| 1350 | 1350 |
| 1351 } // namespace dart | 1351 } // namespace dart |
| OLD | NEW |