| 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/globals.h" // Needed here to get TARGET_ARCH_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 7 | 7 |
| 8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 | 9 |
| 10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 Environment* current = deopt_env_; | 54 Environment* current = deopt_env_; |
| 55 | 55 |
| 56 // Emit all kMaterializeObject instructions describing objects to be | 56 // Emit all kMaterializeObject instructions describing objects to be |
| 57 // materialized on the deoptimization as a prefix to the deoptimization info. | 57 // materialized on the deoptimization as a prefix to the deoptimization info. |
| 58 EmitMaterializations(deopt_env_, builder); | 58 EmitMaterializations(deopt_env_, builder); |
| 59 | 59 |
| 60 // The real frame starts here. | 60 // The real frame starts here. |
| 61 builder->MarkFrameStart(); | 61 builder->MarkFrameStart(); |
| 62 | 62 |
| 63 // Current PP, FP, and PC. | 63 // Current PP, FP, and PC. |
| 64 builder->AddPp(current->function(), slot_ix++); | 64 builder->AddPp(current->code(), slot_ix++); |
| 65 builder->AddCallerFp(slot_ix++); | 65 builder->AddCallerFp(slot_ix++); |
| 66 builder->AddReturnAddress(current->function(), deopt_id(), slot_ix++); | 66 builder->AddReturnAddress(current->code(), deopt_id(), slot_ix++); |
| 67 | 67 |
| 68 // Callee's PC marker is not used anymore. Pass Function::null() to set to 0. | 68 // Callee's PC marker is not used anymore. Pass Code::null() to set to 0. |
| 69 builder->AddPcMarker(Function::Handle(), slot_ix++); | 69 builder->AddPcMarker(Code::Handle(), slot_ix++); |
| 70 | 70 |
| 71 // Emit all values that are needed for materialization as a part of the | 71 // Emit all values that are needed for materialization as a part of the |
| 72 // expression stack for the bottom-most frame. This guarantees that GC | 72 // expression stack for the bottom-most frame. This guarantees that GC |
| 73 // will be able to find them during materialization. | 73 // will be able to find them during materialization. |
| 74 slot_ix = builder->EmitMaterializationArguments(slot_ix); | 74 slot_ix = builder->EmitMaterializationArguments(slot_ix); |
| 75 | 75 |
| 76 // For the innermost environment, set outgoing arguments and the locals. | 76 // For the innermost environment, set outgoing arguments and the locals. |
| 77 for (intptr_t i = current->Length() - 1; | 77 for (intptr_t i = current->Length() - 1; |
| 78 i >= current->fixed_parameter_count(); | 78 i >= current->fixed_parameter_count(); |
| 79 i--) { | 79 i--) { |
| 80 builder->AddCopy(current->ValueAt(i), current->LocationAt(i), slot_ix++); | 80 builder->AddCopy(current->ValueAt(i), current->LocationAt(i), slot_ix++); |
| 81 } | 81 } |
| 82 | 82 |
| 83 Environment* previous = current; | 83 Environment* previous = current; |
| 84 current = current->outer(); | 84 current = current->outer(); |
| 85 while (current != NULL) { | 85 while (current != NULL) { |
| 86 // PP, FP, and PC. | 86 // PP, FP, and PC. |
| 87 builder->AddPp(current->function(), slot_ix++); | 87 builder->AddPp(current->code(), slot_ix++); |
| 88 builder->AddCallerFp(slot_ix++); | 88 builder->AddCallerFp(slot_ix++); |
| 89 | 89 |
| 90 // For any outer environment the deopt id is that of the call instruction | 90 // For any outer environment the deopt id is that of the call instruction |
| 91 // which is recorded in the outer environment. | 91 // which is recorded in the outer environment. |
| 92 builder->AddReturnAddress(current->function(), | 92 builder->AddReturnAddress(current->code(), |
| 93 Isolate::ToDeoptAfter(current->deopt_id()), | 93 Isolate::ToDeoptAfter(current->deopt_id()), |
| 94 slot_ix++); | 94 slot_ix++); |
| 95 | 95 |
| 96 // PC marker. | 96 // PC marker. |
| 97 builder->AddPcMarker(previous->function(), slot_ix++); | 97 builder->AddPcMarker(previous->code(), slot_ix++); |
| 98 | 98 |
| 99 // The values of outgoing arguments can be changed from the inlined call so | 99 // The values of outgoing arguments can be changed from the inlined call so |
| 100 // we must read them from the previous environment. | 100 // we must read them from the previous environment. |
| 101 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { | 101 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { |
| 102 builder->AddCopy(previous->ValueAt(i), | 102 builder->AddCopy(previous->ValueAt(i), |
| 103 previous->LocationAt(i), | 103 previous->LocationAt(i), |
| 104 slot_ix++); | 104 slot_ix++); |
| 105 } | 105 } |
| 106 | 106 |
| 107 // Set the locals, note that outgoing arguments are not in the environment. | 107 // Set the locals, note that outgoing arguments are not in the environment. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 119 } | 119 } |
| 120 // The previous pointer is now the outermost environment. | 120 // The previous pointer is now the outermost environment. |
| 121 ASSERT(previous != NULL); | 121 ASSERT(previous != NULL); |
| 122 | 122 |
| 123 // For the outermost environment, set caller PC, caller PP, and caller FP. | 123 // For the outermost environment, set caller PC, caller PP, and caller FP. |
| 124 builder->AddCallerPp(slot_ix++); | 124 builder->AddCallerPp(slot_ix++); |
| 125 builder->AddCallerFp(slot_ix++); | 125 builder->AddCallerFp(slot_ix++); |
| 126 builder->AddCallerPc(slot_ix++); | 126 builder->AddCallerPc(slot_ix++); |
| 127 | 127 |
| 128 // PC marker. | 128 // PC marker. |
| 129 builder->AddPcMarker(previous->function(), slot_ix++); | 129 builder->AddPcMarker(previous->code(), slot_ix++); |
| 130 | 130 |
| 131 // For the outermost environment, set the incoming arguments. | 131 // For the outermost environment, set the incoming arguments. |
| 132 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { | 132 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { |
| 133 builder->AddCopy(previous->ValueAt(i), previous->LocationAt(i), slot_ix++); | 133 builder->AddCopy(previous->ValueAt(i), previous->LocationAt(i), slot_ix++); |
| 134 } | 134 } |
| 135 | 135 |
| 136 const DeoptInfo& deopt_info = | 136 const DeoptInfo& deopt_info = |
| 137 DeoptInfo::Handle(builder->CreateDeoptInfo(deopt_table)); | 137 DeoptInfo::Handle(builder->CreateDeoptInfo(deopt_table)); |
| 138 return deopt_info.raw(); | 138 return deopt_info.raw(); |
| 139 } | 139 } |
| (...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1396 __ sll(T1, T3, 2); | 1396 __ sll(T1, T3, 2); |
| 1397 __ addu(T1, T2, T1); | 1397 __ addu(T1, T2, T1); |
| 1398 __ lw(T0, FieldAddress(T1, base + kWordSize)); | 1398 __ lw(T0, FieldAddress(T1, base + kWordSize)); |
| 1399 __ lw(T1, FieldAddress(T0, Function::code_offset())); | 1399 __ lw(T1, FieldAddress(T0, Function::code_offset())); |
| 1400 if (FLAG_collect_code) { | 1400 if (FLAG_collect_code) { |
| 1401 // If we are collecting code, the code object may be null. | 1401 // If we are collecting code, the code object may be null. |
| 1402 Label is_compiled; | 1402 Label is_compiled; |
| 1403 __ BranchNotEqual(T1, reinterpret_cast<int32_t>(Object::null()), | 1403 __ BranchNotEqual(T1, reinterpret_cast<int32_t>(Object::null()), |
| 1404 &is_compiled); | 1404 &is_compiled); |
| 1405 __ BranchLink(&StubCode::CompileFunctionRuntimeCallLabel()); | 1405 __ BranchLink(&StubCode::CompileFunctionRuntimeCallLabel()); |
| 1406 AddCurrentDescriptor(PcDescriptors::kRuntimeCall, |
| 1407 Isolate::kNoDeoptId, |
| 1408 token_pos); |
| 1409 RecordSafepoint(locs); |
| 1406 __ lw(T1, FieldAddress(T0, Function::code_offset())); | 1410 __ lw(T1, FieldAddress(T0, Function::code_offset())); |
| 1407 __ Bind(&is_compiled); | 1411 __ Bind(&is_compiled); |
| 1408 } | 1412 } |
| 1409 __ lw(T0, FieldAddress(T1, Code::instructions_offset())); | 1413 __ lw(T0, FieldAddress(T1, Code::instructions_offset())); |
| 1410 __ LoadObject(S5, ic_data); | 1414 __ LoadObject(S5, ic_data); |
| 1411 __ LoadObject(S4, arguments_descriptor); | 1415 __ LoadObject(S4, arguments_descriptor); |
| 1412 __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag); | 1416 __ AddImmediate(T0, Instructions::HeaderSize() - kHeapObjectTag); |
| 1413 __ jalr(T0); | 1417 __ jalr(T0); |
| 1414 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos); | 1418 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos); |
| 1415 RecordSafepoint(locs); | 1419 RecordSafepoint(locs); |
| (...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1925 __ AddImmediate(SP, kDoubleSize); | 1929 __ AddImmediate(SP, kDoubleSize); |
| 1926 } | 1930 } |
| 1927 | 1931 |
| 1928 | 1932 |
| 1929 #undef __ | 1933 #undef __ |
| 1930 | 1934 |
| 1931 | 1935 |
| 1932 } // namespace dart | 1936 } // namespace dart |
| 1933 | 1937 |
| 1934 #endif // defined TARGET_ARCH_MIPS | 1938 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |