| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
| 6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler, | 152 void CompilerDeoptInfoWithStub::GenerateCode(FlowGraphCompiler* compiler, |
| 153 intptr_t stub_ix) { | 153 intptr_t stub_ix) { |
| 154 // Calls do not need stubs, they share a deoptimization trampoline. | 154 // Calls do not need stubs, they share a deoptimization trampoline. |
| 155 ASSERT(reason() != ICData::kDeoptAtCall); | 155 ASSERT(reason() != ICData::kDeoptAtCall); |
| 156 Assembler* assem = compiler->assembler(); | 156 Assembler* assem = compiler->assembler(); |
| 157 #define __ assem-> | 157 #define __ assem-> |
| 158 __ Comment("Deopt stub for id %" Pd "", deopt_id()); | 158 __ Comment("Deopt stub for id %" Pd "", deopt_id()); |
| 159 __ Bind(entry_label()); | 159 __ Bind(entry_label()); |
| 160 if (FLAG_trap_on_deoptimization) { | 160 if (FLAG_trap_on_deoptimization) { |
| 161 __ hlt(0); | 161 __ brk(0); |
| 162 } | 162 } |
| 163 | 163 |
| 164 ASSERT(deopt_env() != NULL); | 164 ASSERT(deopt_env() != NULL); |
| 165 | 165 |
| 166 __ BranchLink(&StubCode::DeoptimizeLabel(), PP); | 166 __ BranchLink(&StubCode::DeoptimizeLabel(), PP); |
| 167 set_pc_offset(assem->CodeSize()); | 167 set_pc_offset(assem->CodeSize()); |
| 168 #undef __ | 168 #undef __ |
| 169 } | 169 } |
| 170 | 170 |
| 171 | 171 |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. | 657 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. |
| 658 __ Push(R0); // Push the source object. | 658 __ Push(R0); // Push the source object. |
| 659 __ PushObject(dst_name, PP); // Push the name of the destination. | 659 __ PushObject(dst_name, PP); // Push the name of the destination. |
| 660 __ PushObject(dst_type, PP); // Push the type of the destination. | 660 __ PushObject(dst_type, PP); // Push the type of the destination. |
| 661 GenerateRuntimeCall(token_pos, | 661 GenerateRuntimeCall(token_pos, |
| 662 deopt_id, | 662 deopt_id, |
| 663 kBadTypeErrorRuntimeEntry, | 663 kBadTypeErrorRuntimeEntry, |
| 664 3, | 664 3, |
| 665 locs); | 665 locs); |
| 666 // We should never return here. | 666 // We should never return here. |
| 667 __ hlt(0); | 667 __ brk(0); |
| 668 | 668 |
| 669 __ Bind(&is_assignable); // For a null object. | 669 __ Bind(&is_assignable); // For a null object. |
| 670 // Restore instantiator (R2) and its type arguments (R1). | 670 // Restore instantiator (R2) and its type arguments (R1). |
| 671 __ Pop(R1); | 671 __ Pop(R1); |
| 672 __ Pop(R2); | 672 __ Pop(R2); |
| 673 return; | 673 return; |
| 674 } | 674 } |
| 675 | 675 |
| 676 // Generate inline type check, linking to runtime call if not assignable. | 676 // Generate inline type check, linking to runtime call if not assignable. |
| 677 SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(); | 677 SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(); |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 if (function.IsClosureFunction()) { | 894 if (function.IsClosureFunction()) { |
| 895 // Invoke noSuchMethod function passing "call" as the original name. | 895 // Invoke noSuchMethod function passing "call" as the original name. |
| 896 const int kNumArgsChecked = 1; | 896 const int kNumArgsChecked = 1; |
| 897 const ICData& ic_data = ICData::ZoneHandle( | 897 const ICData& ic_data = ICData::ZoneHandle( |
| 898 ICData::New(function, Symbols::Call(), Object::empty_array(), | 898 ICData::New(function, Symbols::Call(), Object::empty_array(), |
| 899 Isolate::kNoDeoptId, kNumArgsChecked)); | 899 Isolate::kNoDeoptId, kNumArgsChecked)); |
| 900 __ LoadObject(R5, ic_data, PP); | 900 __ LoadObject(R5, ic_data, PP); |
| 901 __ LeaveDartFrame(); // The arguments are still on the stack. | 901 __ LeaveDartFrame(); // The arguments are still on the stack. |
| 902 __ BranchPatchable(&StubCode::CallNoSuchMethodFunctionLabel()); | 902 __ BranchPatchable(&StubCode::CallNoSuchMethodFunctionLabel()); |
| 903 // The noSuchMethod call may return to the caller, but not here. | 903 // The noSuchMethod call may return to the caller, but not here. |
| 904 __ hlt(0); | 904 __ brk(0); |
| 905 } else if (check_correct_named_args) { | 905 } else if (check_correct_named_args) { |
| 906 __ Stop("Wrong arguments"); | 906 __ Stop("Wrong arguments"); |
| 907 } | 907 } |
| 908 | 908 |
| 909 __ Bind(&all_arguments_processed); | 909 __ Bind(&all_arguments_processed); |
| 910 // Nullify originally passed arguments only after they have been copied and | 910 // Nullify originally passed arguments only after they have been copied and |
| 911 // checked, otherwise noSuchMethod would not see their original values. | 911 // checked, otherwise noSuchMethod would not see their original values. |
| 912 // This step can be skipped in case we decide that formal parameters are | 912 // This step can be skipped in case we decide that formal parameters are |
| 913 // implicitly final, since garbage collecting the unmodified value is not | 913 // implicitly final, since garbage collecting the unmodified value is not |
| 914 // an issue anymore. | 914 // an issue anymore. |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 ? Symbols::Call().raw() | 1066 ? Symbols::Call().raw() |
| 1067 : function.name()); | 1067 : function.name()); |
| 1068 const int kNumArgsChecked = 1; | 1068 const int kNumArgsChecked = 1; |
| 1069 const ICData& ic_data = ICData::ZoneHandle( | 1069 const ICData& ic_data = ICData::ZoneHandle( |
| 1070 ICData::New(function, name, Object::empty_array(), | 1070 ICData::New(function, name, Object::empty_array(), |
| 1071 Isolate::kNoDeoptId, kNumArgsChecked)); | 1071 Isolate::kNoDeoptId, kNumArgsChecked)); |
| 1072 __ LoadObject(R5, ic_data, PP); | 1072 __ LoadObject(R5, ic_data, PP); |
| 1073 __ LeaveDartFrame(); // The arguments are still on the stack. | 1073 __ LeaveDartFrame(); // The arguments are still on the stack. |
| 1074 __ BranchPatchable(&StubCode::CallNoSuchMethodFunctionLabel()); | 1074 __ BranchPatchable(&StubCode::CallNoSuchMethodFunctionLabel()); |
| 1075 // The noSuchMethod call may return to the caller, but not here. | 1075 // The noSuchMethod call may return to the caller, but not here. |
| 1076 __ hlt(0); | 1076 __ brk(0); |
| 1077 } else { | 1077 } else { |
| 1078 __ Stop("Wrong number of arguments"); | 1078 __ Stop("Wrong number of arguments"); |
| 1079 } | 1079 } |
| 1080 __ Bind(&correct_num_arguments); | 1080 __ Bind(&correct_num_arguments); |
| 1081 } | 1081 } |
| 1082 } else if (!flow_graph().IsCompiledForOsr()) { | 1082 } else if (!flow_graph().IsCompiledForOsr()) { |
| 1083 CopyParameters(); | 1083 CopyParameters(); |
| 1084 } | 1084 } |
| 1085 | 1085 |
| 1086 // In unoptimized code, initialize (non-argument) stack allocated slots to | 1086 // In unoptimized code, initialize (non-argument) stack allocated slots to |
| 1087 // null. | 1087 // null. |
| 1088 if (!is_optimizing() && (num_locals > 0)) { | 1088 if (!is_optimizing() && (num_locals > 0)) { |
| 1089 __ Comment("Initialize spill slots"); | 1089 __ Comment("Initialize spill slots"); |
| 1090 const intptr_t slot_base = parsed_function().first_stack_local_index(); | 1090 const intptr_t slot_base = parsed_function().first_stack_local_index(); |
| 1091 __ LoadObject(R0, Object::null_object(), PP); | 1091 __ LoadObject(R0, Object::null_object(), PP); |
| 1092 for (intptr_t i = 0; i < num_locals; ++i) { | 1092 for (intptr_t i = 0; i < num_locals; ++i) { |
| 1093 // Subtract index i (locals lie at lower addresses than FP). | 1093 // Subtract index i (locals lie at lower addresses than FP). |
| 1094 __ StoreToOffset(R0, FP, (slot_base - i) * kWordSize, PP); | 1094 __ StoreToOffset(R0, FP, (slot_base - i) * kWordSize, PP); |
| 1095 } | 1095 } |
| 1096 } | 1096 } |
| 1097 | 1097 |
| 1098 VisitBlocks(); | 1098 VisitBlocks(); |
| 1099 | 1099 |
| 1100 __ hlt(0); | 1100 __ brk(0); |
| 1101 GenerateDeferredCode(); | 1101 GenerateDeferredCode(); |
| 1102 | 1102 |
| 1103 // Emit function patching code. This will be swapped with the first 3 | 1103 // Emit function patching code. This will be swapped with the first 3 |
| 1104 // instructions at entry point. | 1104 // instructions at entry point. |
| 1105 patch_code_pc_offset_ = assembler()->CodeSize(); | 1105 patch_code_pc_offset_ = assembler()->CodeSize(); |
| 1106 __ BranchPatchable(&StubCode::FixCallersTargetLabel()); | 1106 __ BranchPatchable(&StubCode::FixCallersTargetLabel()); |
| 1107 | 1107 |
| 1108 if (is_optimizing()) { | 1108 if (is_optimizing()) { |
| 1109 lazy_deopt_pc_offset_ = assembler()->CodeSize(); | 1109 lazy_deopt_pc_offset_ = assembler()->CodeSize(); |
| 1110 __ BranchPatchable(&StubCode::DeoptimizeLazyLabel()); | 1110 __ BranchPatchable(&StubCode::DeoptimizeLazyLabel()); |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1725 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1725 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
| 1726 UNIMPLEMENTED(); | 1726 UNIMPLEMENTED(); |
| 1727 } | 1727 } |
| 1728 | 1728 |
| 1729 | 1729 |
| 1730 #undef __ | 1730 #undef __ |
| 1731 | 1731 |
| 1732 } // namespace dart | 1732 } // namespace dart |
| 1733 | 1733 |
| 1734 #endif // defined TARGET_ARCH_ARM64 | 1734 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |