| 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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/cpu.h" | 8 #include "vm/cpu.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flow_graph_allocator.h" | 10 #include "vm/flow_graph_allocator.h" |
| (...skipping 2252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2263 Scanner::kNoSourcePos); | 2263 Scanner::kNoSourcePos); |
| 2264 } | 2264 } |
| 2265 if (HasParallelMove()) { | 2265 if (HasParallelMove()) { |
| 2266 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 2266 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
| 2267 } | 2267 } |
| 2268 } | 2268 } |
| 2269 | 2269 |
| 2270 | 2270 |
| 2271 LocationSummary* TargetEntryInstr::MakeLocationSummary(Isolate* isolate, | 2271 LocationSummary* TargetEntryInstr::MakeLocationSummary(Isolate* isolate, |
| 2272 bool optimizing) const { | 2272 bool optimizing) const { |
| 2273 // FlowGraphCompiler::EmitInstructionPrologue is not called for block | |
| 2274 // entry instructions, so this function is unused. If it becomes | |
| 2275 // reachable, note that the deoptimization descriptor in unoptimized code | |
| 2276 // comes after the point of local register allocation due to pattern | |
| 2277 // matching the edge counter code backwards (as a code reuse convenience | |
| 2278 // on some platforms). | |
| 2279 UNREACHABLE(); | 2273 UNREACHABLE(); |
| 2280 return NULL; | 2274 return NULL; |
| 2281 } | 2275 } |
| 2282 | 2276 |
| 2283 | 2277 |
| 2278 void TargetEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2279 __ Bind(compiler->GetJumpLabel(this)); |
| 2280 if (!compiler->is_optimizing()) { |
| 2281 if (compiler->NeedsEdgeCounter(this)) { |
| 2282 compiler->EmitEdgeCounter(); |
| 2283 } |
| 2284 // The deoptimization descriptor points after the edge counter code for |
| 2285 // uniformity with ARM and MIPS, where we can reuse pattern matching |
| 2286 // code that matches backwards from the end of the pattern. |
| 2287 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, |
| 2288 deopt_id_, |
| 2289 Scanner::kNoSourcePos); |
| 2290 } |
| 2291 if (HasParallelMove()) { |
| 2292 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
| 2293 } |
| 2294 } |
| 2295 |
| 2296 |
| 2284 LocationSummary* PhiInstr::MakeLocationSummary(Isolate* isolate, | 2297 LocationSummary* PhiInstr::MakeLocationSummary(Isolate* isolate, |
| 2285 bool optimizing) const { | 2298 bool optimizing) const { |
| 2286 UNREACHABLE(); | 2299 UNREACHABLE(); |
| 2287 return NULL; | 2300 return NULL; |
| 2288 } | 2301 } |
| 2289 | 2302 |
| 2290 | 2303 |
| 2291 void PhiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2304 void PhiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2292 UNREACHABLE(); | 2305 UNREACHABLE(); |
| 2293 } | 2306 } |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2506 // Call was not visited yet, use original ICData in order to populate it. | 2519 // Call was not visited yet, use original ICData in order to populate it. |
| 2507 compiler->GenerateInstanceCall(deopt_id(), | 2520 compiler->GenerateInstanceCall(deopt_id(), |
| 2508 token_pos(), | 2521 token_pos(), |
| 2509 ArgumentCount(), | 2522 ArgumentCount(), |
| 2510 locs(), | 2523 locs(), |
| 2511 *call_ic_data); | 2524 *call_ic_data); |
| 2512 } | 2525 } |
| 2513 } else { | 2526 } else { |
| 2514 // Unoptimized code. | 2527 // Unoptimized code. |
| 2515 ASSERT(!HasICData()); | 2528 ASSERT(!HasICData()); |
| 2516 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, | |
| 2517 deopt_id(), | |
| 2518 token_pos()); | |
| 2519 bool is_smi_two_args_op = false; | 2529 bool is_smi_two_args_op = false; |
| 2520 const uword label_address = TwoArgsSmiOpInlineCacheEntry(token_kind()); | 2530 const uword label_address = TwoArgsSmiOpInlineCacheEntry(token_kind()); |
| 2521 if (label_address != 0) { | 2531 if (label_address != 0) { |
| 2522 // We have a dedicated inline cache stub for this operation, add an | 2532 // We have a dedicated inline cache stub for this operation, add an |
| 2523 // an initial Smi/Smi check with count 0. | 2533 // an initial Smi/Smi check with count 0. |
| 2524 ASSERT(call_ic_data->NumArgsTested() == 2); | 2534 ASSERT(call_ic_data->NumArgsTested() == 2); |
| 2525 const String& name = String::Handle(isolate, call_ic_data->target_name()); | 2535 const String& name = String::Handle(isolate, call_ic_data->target_name()); |
| 2526 const Class& smi_class = Class::Handle(isolate, Smi::Class()); | 2536 const Class& smi_class = Class::Handle(isolate, Smi::Class()); |
| 2527 const Function& smi_op_target = | 2537 const Function& smi_op_target = |
| 2528 Function::Handle(Resolver::ResolveDynamicAnyArgs(smi_class, name)); | 2538 Function::Handle(Resolver::ResolveDynamicAnyArgs(smi_class, name)); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2606 default: | 2616 default: |
| 2607 break; | 2617 break; |
| 2608 } | 2618 } |
| 2609 call_ic_data = compiler->GetOrAddStaticCallICData(deopt_id(), | 2619 call_ic_data = compiler->GetOrAddStaticCallICData(deopt_id(), |
| 2610 function(), | 2620 function(), |
| 2611 arguments_descriptor, | 2621 arguments_descriptor, |
| 2612 num_args_checked); | 2622 num_args_checked); |
| 2613 } else { | 2623 } else { |
| 2614 call_ic_data = &ICData::ZoneHandle(ic_data()->raw()); | 2624 call_ic_data = &ICData::ZoneHandle(ic_data()->raw()); |
| 2615 } | 2625 } |
| 2616 if (!compiler->is_optimizing()) { | |
| 2617 // Some static calls can be optimized by the optimizing compiler (e.g. sqrt) | |
| 2618 // and therefore need a deoptimization descriptor. | |
| 2619 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, | |
| 2620 deopt_id(), | |
| 2621 token_pos()); | |
| 2622 } | |
| 2623 compiler->GenerateStaticCall(deopt_id(), | 2626 compiler->GenerateStaticCall(deopt_id(), |
| 2624 token_pos(), | 2627 token_pos(), |
| 2625 function(), | 2628 function(), |
| 2626 ArgumentCount(), | 2629 ArgumentCount(), |
| 2627 argument_names(), | 2630 argument_names(), |
| 2628 locs(), | 2631 locs(), |
| 2629 *call_ic_data); | 2632 *call_ic_data); |
| 2630 } | 2633 } |
| 2631 | 2634 |
| 2632 | 2635 |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3092 case Token::kTRUNCDIV: return 0; | 3095 case Token::kTRUNCDIV: return 0; |
| 3093 case Token::kMOD: return 1; | 3096 case Token::kMOD: return 1; |
| 3094 default: UNIMPLEMENTED(); return -1; | 3097 default: UNIMPLEMENTED(); return -1; |
| 3095 } | 3098 } |
| 3096 } | 3099 } |
| 3097 | 3100 |
| 3098 | 3101 |
| 3099 #undef __ | 3102 #undef __ |
| 3100 | 3103 |
| 3101 } // namespace dart | 3104 } // namespace dart |
| OLD | NEW |