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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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" |
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 // stub generates the redirection address when running under the simulator | 1005 // stub generates the redirection address when running under the simulator |
1006 // and hence we do not change 'entry' here. | 1006 // and hence we do not change 'entry' here. |
1007 stub_entry = StubCode::CallNativeCFunction_entry(); | 1007 stub_entry = StubCode::CallNativeCFunction_entry(); |
1008 #if defined(USING_SIMULATOR) | 1008 #if defined(USING_SIMULATOR) |
1009 if (!function().IsNativeAutoSetupScope()) { | 1009 if (!function().IsNativeAutoSetupScope()) { |
1010 entry = Simulator::RedirectExternalReference( | 1010 entry = Simulator::RedirectExternalReference( |
1011 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); | 1011 entry, Simulator::kBootstrapNativeCall, function().NumParameters()); |
1012 } | 1012 } |
1013 #endif | 1013 #endif |
1014 } | 1014 } |
1015 __ LoadImmediate(T5, entry); | 1015 ExternalLabel label(entry); |
| 1016 __ LoadExternalLabel(T5, &label, kNotPatchable); |
1016 __ LoadImmediate(A1, argc_tag); | 1017 __ LoadImmediate(A1, argc_tag); |
1017 compiler->GenerateCall(token_pos(), | 1018 compiler->GenerateCall(token_pos(), |
1018 *stub_entry, | 1019 *stub_entry, |
1019 RawPcDescriptors::kOther, | 1020 RawPcDescriptors::kOther, |
1020 locs()); | 1021 locs()); |
1021 __ Pop(result); | 1022 __ Pop(result); |
1022 } | 1023 } |
1023 | 1024 |
1024 | 1025 |
1025 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Zone* zone, | 1026 LocationSummary* StringFromCharCodeInstr::MakeLocationSummary(Zone* zone, |
1026 bool opt) const { | 1027 bool opt) const { |
1027 const intptr_t kNumInputs = 1; | 1028 const intptr_t kNumInputs = 1; |
1028 // TODO(fschneider): Allow immediate operands for the char code. | 1029 // TODO(fschneider): Allow immediate operands for the char code. |
1029 return LocationSummary::Make(zone, | 1030 return LocationSummary::Make(zone, |
1030 kNumInputs, | 1031 kNumInputs, |
1031 Location::RequiresRegister(), | 1032 Location::RequiresRegister(), |
1032 LocationSummary::kNoCall); | 1033 LocationSummary::kNoCall); |
1033 } | 1034 } |
1034 | 1035 |
1035 | 1036 |
1036 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1037 void StringFromCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1037 ASSERT(compiler->is_optimizing()); | 1038 ASSERT(compiler->is_optimizing()); |
1038 Register char_code = locs()->in(0).reg(); | 1039 Register char_code = locs()->in(0).reg(); |
1039 Register result = locs()->out(0).reg(); | 1040 Register result = locs()->out(0).reg(); |
1040 | 1041 |
1041 __ Comment("StringFromCharCodeInstr"); | 1042 __ Comment("StringFromCharCodeInstr"); |
1042 | 1043 |
1043 __ LoadImmediate(result, | 1044 ExternalLabel label(reinterpret_cast<uword>(Symbols::PredefinedAddress())); |
1044 reinterpret_cast<uword>(Symbols::PredefinedAddress())); | 1045 __ LoadExternalLabel(result, &label, kNotPatchable); |
1045 __ AddImmediate(result, Symbols::kNullCharCodeSymbolOffset * kWordSize); | 1046 __ AddImmediate(result, Symbols::kNullCharCodeSymbolOffset * kWordSize); |
1046 __ sll(TMP, char_code, 1); // Char code is a smi. | 1047 __ sll(TMP, char_code, 1); // Char code is a smi. |
1047 __ addu(TMP, TMP, result); | 1048 __ addu(TMP, TMP, result); |
1048 __ lw(result, Address(TMP)); | 1049 __ lw(result, Address(TMP)); |
1049 } | 1050 } |
1050 | 1051 |
1051 | 1052 |
1052 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(Zone* zone, | 1053 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(Zone* zone, |
1053 bool opt) const { | 1054 bool opt) const { |
1054 const intptr_t kNumInputs = 1; | 1055 const intptr_t kNumInputs = 1; |
(...skipping 4530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5585 1, | 5586 1, |
5586 locs()); | 5587 locs()); |
5587 __ lw(result, Address(SP, 1 * kWordSize)); | 5588 __ lw(result, Address(SP, 1 * kWordSize)); |
5588 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 5589 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
5589 } | 5590 } |
5590 | 5591 |
5591 | 5592 |
5592 } // namespace dart | 5593 } // namespace dart |
5593 | 5594 |
5594 #endif // defined TARGET_ARCH_MIPS | 5595 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |