| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| 11 #include "vm/flow_graph.h" | 11 #include "vm/flow_graph.h" |
| 12 #include "vm/flow_graph_compiler.h" | 12 #include "vm/flow_graph_compiler.h" |
| 13 #include "vm/flow_graph_range_analysis.h" | 13 #include "vm/flow_graph_range_analysis.h" |
| 14 #include "vm/locations.h" | 14 #include "vm/locations.h" |
| 15 #include "vm/object_store.h" | 15 #include "vm/object_store.h" |
| 16 #include "vm/parser.h" | 16 #include "vm/parser.h" |
| 17 #include "vm/stack_frame.h" | 17 #include "vm/stack_frame.h" |
| 18 #include "vm/stub_code.h" | 18 #include "vm/stub_code.h" |
| 19 #include "vm/symbols.h" | 19 #include "vm/symbols.h" |
| 20 | 20 |
| 21 #define __ compiler->assembler()-> | 21 #define __ compiler->assembler()-> |
| 22 | 22 |
| 23 namespace dart { | 23 namespace dart { |
| 24 | 24 |
| 25 DECLARE_FLAG(bool, emit_edge_counters); | 25 DECLARE_FLAG(bool, emit_edge_counters); |
| 26 DECLARE_FLAG(int, optimization_counter_threshold); | 26 DECLARE_FLAG(int, optimization_counter_threshold); |
| 27 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); |
| 27 DECLARE_FLAG(bool, use_osr); | 28 DECLARE_FLAG(bool, use_osr); |
| 28 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); | |
| 29 | 29 |
| 30 // Generic summary for call instructions that have all arguments pushed | 30 // Generic summary for call instructions that have all arguments pushed |
| 31 // on the stack and return the result in a fixed register EAX. | 31 // on the stack and return the result in a fixed register EAX. |
| 32 LocationSummary* Instruction::MakeCallSummary(Zone* zone) { | 32 LocationSummary* Instruction::MakeCallSummary(Zone* zone) { |
| 33 const intptr_t kNumInputs = 0; | 33 const intptr_t kNumInputs = 0; |
| 34 const intptr_t kNumTemps = 0; | 34 const intptr_t kNumTemps = 0; |
| 35 LocationSummary* result = new(zone) LocationSummary( | 35 LocationSummary* result = new(zone) LocationSummary( |
| 36 zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 36 zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
| 37 result->set_out(0, Location::RegisterLocation(EAX)); | 37 result->set_out(0, Location::RegisterLocation(EAX)); |
| 38 return result; | 38 return result; |
| (...skipping 5644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5683 UNIMPLEMENTED(); | 5683 UNIMPLEMENTED(); |
| 5684 } | 5684 } |
| 5685 | 5685 |
| 5686 | 5686 |
| 5687 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( | 5687 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( |
| 5688 Zone* zone, bool opt) const { | 5688 Zone* zone, bool opt) const { |
| 5689 return MakeCallSummary(zone); | 5689 return MakeCallSummary(zone); |
| 5690 } | 5690 } |
| 5691 | 5691 |
| 5692 | 5692 |
| 5693 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | |
| 5694 ASSERT(ic_data().NumArgsTested() == 1); | |
| 5695 if (!with_checks()) { | |
| 5696 ASSERT(ic_data().HasOneTarget()); | |
| 5697 const Function& target = Function::ZoneHandle(ic_data().GetTargetAt(0)); | |
| 5698 compiler->GenerateStaticCall(deopt_id(), | |
| 5699 instance_call()->token_pos(), | |
| 5700 target, | |
| 5701 instance_call()->ArgumentCount(), | |
| 5702 instance_call()->argument_names(), | |
| 5703 locs(), | |
| 5704 ICData::Handle()); | |
| 5705 return; | |
| 5706 } | |
| 5707 | |
| 5708 Label* deopt = compiler->AddDeoptStub( | |
| 5709 deopt_id(), ICData::kDeoptPolymorphicInstanceCallTestFail); | |
| 5710 Label ok; | |
| 5711 compiler->EmitTestAndCall(ic_data(), | |
| 5712 instance_call()->ArgumentCount(), | |
| 5713 instance_call()->argument_names(), | |
| 5714 deopt, | |
| 5715 &ok, | |
| 5716 deopt_id(), | |
| 5717 instance_call()->token_pos(), | |
| 5718 locs()); | |
| 5719 __ Bind(&ok); | |
| 5720 } | |
| 5721 | |
| 5722 | |
| 5723 LocationSummary* BranchInstr::MakeLocationSummary(Zone* zone, | 5693 LocationSummary* BranchInstr::MakeLocationSummary(Zone* zone, |
| 5724 bool opt) const { | 5694 bool opt) const { |
| 5725 comparison()->InitializeLocationSummary(zone, opt); | 5695 comparison()->InitializeLocationSummary(zone, opt); |
| 5726 // Branches don't produce a result. | 5696 // Branches don't produce a result. |
| 5727 comparison()->locs()->set_out(0, Location::NoLocation()); | 5697 comparison()->locs()->set_out(0, Location::NoLocation()); |
| 5728 return comparison()->locs(); | 5698 return comparison()->locs(); |
| 5729 } | 5699 } |
| 5730 | 5700 |
| 5731 | 5701 |
| 5732 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5702 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| (...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6878 __ Drop(1); | 6848 __ Drop(1); |
| 6879 __ popl(result); | 6849 __ popl(result); |
| 6880 } | 6850 } |
| 6881 | 6851 |
| 6882 | 6852 |
| 6883 } // namespace dart | 6853 } // namespace dart |
| 6884 | 6854 |
| 6885 #undef __ | 6855 #undef __ |
| 6886 | 6856 |
| 6887 #endif // defined TARGET_ARCH_IA32 | 6857 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |