| OLD | NEW | 
|---|
| 1 // Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_DBC. | 5 #include "vm/globals.h"  // Needed here to get TARGET_ARCH_DBC. | 
| 6 #if defined(TARGET_ARCH_DBC) | 6 #if defined(TARGET_ARCH_DBC) | 
| 7 | 7 | 
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" | 
| 9 | 9 | 
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" | 
| (...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1178   const intptr_t deopt_id = Thread::ToDeoptAfter(GetDeoptId()); | 1178   const intptr_t deopt_id = Thread::ToDeoptAfter(GetDeoptId()); | 
| 1179   if (compiler->is_optimizing()) { | 1179   if (compiler->is_optimizing()) { | 
| 1180     compiler->AddDeoptIndexAtCall(deopt_id); | 1180     compiler->AddDeoptIndexAtCall(deopt_id); | 
| 1181   } else { | 1181   } else { | 
| 1182     compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id, | 1182     compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id, | 
| 1183                                    TokenPosition::kNoSource); | 1183                                    TokenPosition::kNoSource); | 
| 1184   } | 1184   } | 
| 1185   if (HasParallelMove()) { | 1185   if (HasParallelMove()) { | 
| 1186     compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 1186     compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 
| 1187   } | 1187   } | 
| 1188   if (compiler->is_optimizing()) { | 1188 | 
| 1189     // In optimized code, variables at the catch block entry reside at the top | 1189   Register context_reg = kNoRegister; | 
| 1190     // of the allocatable register range. | 1190 | 
| 1191     const intptr_t num_non_copied_params = | 1191   // Auxiliary variables introduced by the try catch can be captured if we are | 
| 1192         compiler->flow_graph().num_non_copied_params(); | 1192   // inside a function with yield/resume points. In this case we first need | 
| 1193     const intptr_t exception_reg = | 1193   // to restore the context to match the context at entry into the closure. | 
| 1194         kNumberOfCpuRegisters - | 1194   if (should_restore_closure_context()) { | 
| 1195         (-exception_var().index() + num_non_copied_params); | 1195     const ParsedFunction& parsed_function = compiler->parsed_function(); | 
| 1196     const intptr_t stacktrace_reg = | 1196 | 
| 1197         kNumberOfCpuRegisters - | 1197     ASSERT(parsed_function.function().IsClosureFunction()); | 
| 1198         (-stacktrace_var().index() + num_non_copied_params); | 1198     LocalScope* scope = parsed_function.node_sequence()->scope(); | 
| 1199     __ MoveSpecial(exception_reg, Simulator::kExceptionSpecialIndex); | 1199 | 
| 1200     __ MoveSpecial(stacktrace_reg, Simulator::kStackTraceSpecialIndex); | 1200     LocalVariable* closure_parameter = scope->VariableAt(0); | 
|  | 1201     ASSERT(!closure_parameter->is_captured()); | 
|  | 1202 | 
|  | 1203     const LocalVariable& current_context_var = | 
|  | 1204         *parsed_function.current_context_var(); | 
|  | 1205 | 
|  | 1206     context_reg = compiler->is_optimizing() | 
|  | 1207                       ? compiler->CatchEntryRegForVariable(current_context_var) | 
|  | 1208                       : LocalVarIndex(0, current_context_var.index()); | 
|  | 1209 | 
|  | 1210     Register closure_reg; | 
|  | 1211     if (closure_parameter->index() > 0) { | 
|  | 1212       __ Move(context_reg, LocalVarIndex(0, closure_parameter->index())); | 
|  | 1213       closure_reg = context_reg; | 
|  | 1214     } else { | 
|  | 1215       closure_reg = LocalVarIndex(0, closure_parameter->index()); | 
|  | 1216     } | 
|  | 1217 | 
|  | 1218     __ LoadField(context_reg, closure_reg, | 
|  | 1219                  Closure::context_offset() / kWordSize); | 
|  | 1220   } | 
|  | 1221 | 
|  | 1222   if (exception_var().is_captured()) { | 
|  | 1223     ASSERT(stacktrace_var().is_captured()); | 
|  | 1224     ASSERT(context_reg != kNoRegister); | 
|  | 1225     // This will be SP[1] register so we are free to use it as a temporary. | 
|  | 1226     const Register temp = compiler->StackSize(); | 
|  | 1227     __ MoveSpecial(temp, Simulator::kExceptionSpecialIndex); | 
|  | 1228     __ StoreField(context_reg, | 
|  | 1229                   Context::variable_offset(exception_var().index()) / kWordSize, | 
|  | 1230                   temp); | 
|  | 1231     __ MoveSpecial(temp, Simulator::kStackTraceSpecialIndex); | 
|  | 1232     __ StoreField( | 
|  | 1233         context_reg, | 
|  | 1234         Context::variable_offset(stacktrace_var().index()) / kWordSize, temp); | 
| 1201   } else { | 1235   } else { | 
| 1202     __ MoveSpecial(LocalVarIndex(0, exception_var().index()), | 1236     if (compiler->is_optimizing()) { | 
| 1203                    Simulator::kExceptionSpecialIndex); | 1237       const intptr_t exception_reg = | 
| 1204     __ MoveSpecial(LocalVarIndex(0, stacktrace_var().index()), | 1238           compiler->CatchEntryRegForVariable(exception_var()); | 
| 1205                    Simulator::kStackTraceSpecialIndex); | 1239       const intptr_t stacktrace_reg = | 
|  | 1240           compiler->CatchEntryRegForVariable(stacktrace_var()); | 
|  | 1241       __ MoveSpecial(exception_reg, Simulator::kExceptionSpecialIndex); | 
|  | 1242       __ MoveSpecial(stacktrace_reg, Simulator::kStackTraceSpecialIndex); | 
|  | 1243     } else { | 
|  | 1244       __ MoveSpecial(LocalVarIndex(0, exception_var().index()), | 
|  | 1245                      Simulator::kExceptionSpecialIndex); | 
|  | 1246       __ MoveSpecial(LocalVarIndex(0, stacktrace_var().index()), | 
|  | 1247                      Simulator::kStackTraceSpecialIndex); | 
|  | 1248     } | 
| 1206   } | 1249   } | 
| 1207   __ SetFrame(compiler->StackSize()); | 1250   __ SetFrame(compiler->StackSize()); | 
| 1208 } | 1251 } | 
| 1209 | 1252 | 
| 1210 | 1253 | 
| 1211 EMIT_NATIVE_CODE(Throw, 0, Location::NoLocation(), LocationSummary::kCall) { | 1254 EMIT_NATIVE_CODE(Throw, 0, Location::NoLocation(), LocationSummary::kCall) { | 
| 1212   __ Throw(0); | 1255   __ Throw(0); | 
| 1213   compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(), | 1256   compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id(), | 
| 1214                                  token_pos()); | 1257                                  token_pos()); | 
| 1215   compiler->RecordAfterCall(this, FlowGraphCompiler::kNoResult); | 1258   compiler->RecordAfterCall(this, FlowGraphCompiler::kNoResult); | 
| (...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2050   } | 2093   } | 
| 2051   __ IfULe(length, index); | 2094   __ IfULe(length, index); | 
| 2052   compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckArrayBound, | 2095   compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckArrayBound, | 
| 2053                       (generalized_ ? ICData::kGeneralized : 0) | | 2096                       (generalized_ ? ICData::kGeneralized : 0) | | 
| 2054                           (licm_hoisted_ ? ICData::kHoisted : 0)); | 2097                           (licm_hoisted_ ? ICData::kHoisted : 0)); | 
| 2055 } | 2098 } | 
| 2056 | 2099 | 
| 2057 }  // namespace dart | 2100 }  // namespace dart | 
| 2058 | 2101 | 
| 2059 #endif  // defined TARGET_ARCH_DBC | 2102 #endif  // defined TARGET_ARCH_DBC | 
| OLD | NEW | 
|---|