| 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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| 11 #include "vm/dart_entry.h" | 11 #include "vm/dart_entry.h" |
| 12 #include "vm/flow_graph_compiler.h" | 12 #include "vm/flow_graph_compiler.h" |
| 13 #include "vm/locations.h" | 13 #include "vm/locations.h" |
| 14 #include "vm/object_store.h" | 14 #include "vm/object_store.h" |
| 15 #include "vm/parser.h" | 15 #include "vm/parser.h" |
| 16 #include "vm/simulator.h" |
| 16 #include "vm/stub_code.h" | 17 #include "vm/stub_code.h" |
| 17 #include "vm/symbols.h" | 18 #include "vm/symbols.h" |
| 18 | 19 |
| 19 #define __ compiler->assembler()-> | 20 #define __ compiler->assembler()-> |
| 20 | 21 |
| 21 namespace dart { | 22 namespace dart { |
| 22 | 23 |
| 23 DECLARE_FLAG(int, optimization_counter_threshold); | 24 DECLARE_FLAG(int, optimization_counter_threshold); |
| 24 DECLARE_FLAG(bool, propagate_ic_data); | 25 DECLARE_FLAG(bool, propagate_ic_data); |
| 25 | 26 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 } | 185 } |
| 185 | 186 |
| 186 | 187 |
| 187 void RelationalOpInstr::EmitBranchCode(FlowGraphCompiler* compiler, | 188 void RelationalOpInstr::EmitBranchCode(FlowGraphCompiler* compiler, |
| 188 BranchInstr* branch) { | 189 BranchInstr* branch) { |
| 189 UNIMPLEMENTED(); | 190 UNIMPLEMENTED(); |
| 190 } | 191 } |
| 191 | 192 |
| 192 | 193 |
| 193 LocationSummary* NativeCallInstr::MakeLocationSummary() const { | 194 LocationSummary* NativeCallInstr::MakeLocationSummary() const { |
| 194 UNIMPLEMENTED(); | 195 const intptr_t kNumInputs = 0; |
| 195 return NULL; | 196 const intptr_t kNumTemps = 3; |
| 197 LocationSummary* locs = |
| 198 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 199 locs->set_temp(0, Location::RegisterLocation(R1)); |
| 200 locs->set_temp(1, Location::RegisterLocation(R2)); |
| 201 locs->set_temp(2, Location::RegisterLocation(R5)); |
| 202 locs->set_out(Location::RegisterLocation(R0)); |
| 203 return locs; |
| 196 } | 204 } |
| 197 | 205 |
| 198 | 206 |
| 199 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 207 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 200 UNIMPLEMENTED(); | 208 ASSERT(locs()->temp(0).reg() == R1); |
| 209 ASSERT(locs()->temp(1).reg() == R2); |
| 210 ASSERT(locs()->temp(2).reg() == R5); |
| 211 Register result = locs()->out().reg(); |
| 212 |
| 213 // Push the result place holder initialized to NULL. |
| 214 __ PushObject(Object::ZoneHandle()); |
| 215 // Pass a pointer to the first argument in R2. |
| 216 if (!function().HasOptionalParameters()) { |
| 217 __ AddImmediate(R2, FP, (2 + function().NumParameters()) * kWordSize); |
| 218 } else { |
| 219 __ AddImmediate(R2, FP, ParsedFunction::kFirstLocalSlotIndex * kWordSize); |
| 220 } |
| 221 // Compute the effective address. When running under the simulator, |
| 222 // this is a redirection address that forces the simulator to call |
| 223 // into the runtime system. |
| 224 uword entry = reinterpret_cast<uword>(native_c_function()); |
| 225 #if defined(USING_SIMULATOR) |
| 226 entry = Simulator::RedirectExternalReference(entry, Simulator::kNativeCall); |
| 227 #endif |
| 228 __ LoadImmediate(R5, entry); |
| 229 __ LoadImmediate(R1, NativeArguments::ComputeArgcTag(function())); |
| 230 compiler->GenerateCall(token_pos(), |
| 231 &StubCode::CallNativeCFunctionLabel(), |
| 232 PcDescriptors::kOther, |
| 233 locs()); |
| 234 __ Pop(result); |
| 201 } | 235 } |
| 202 | 236 |
| 203 | 237 |
| 204 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary() const { | 238 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary() const { |
| 205 UNIMPLEMENTED(); | 239 UNIMPLEMENTED(); |
| 206 return NULL; | 240 return NULL; |
| 207 } | 241 } |
| 208 | 242 |
| 209 | 243 |
| 210 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 244 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 | 859 |
| 826 | 860 |
| 827 void CreateClosureInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 861 void CreateClosureInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 828 UNIMPLEMENTED(); | 862 UNIMPLEMENTED(); |
| 829 } | 863 } |
| 830 | 864 |
| 831 } // namespace dart | 865 } // namespace dart |
| 832 | 866 |
| 833 #endif // defined TARGET_ARCH_ARM | 867 #endif // defined TARGET_ARCH_ARM |
| 834 | 868 |
| OLD | NEW |