Chromium Code Reviews| 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 14 matching lines...) Expand all Loading... | |
| 25 | 25 |
| 26 namespace dart { | 26 namespace dart { |
| 27 | 27 |
| 28 DECLARE_FLAG(bool, emit_edge_counters); | 28 DECLARE_FLAG(bool, emit_edge_counters); |
| 29 DECLARE_FLAG(int, optimization_counter_threshold); | 29 DECLARE_FLAG(int, optimization_counter_threshold); |
| 30 | 30 |
| 31 // List of instructions that are still unimplemented by DBC backend. | 31 // List of instructions that are still unimplemented by DBC backend. |
| 32 #define FOR_EACH_UNIMPLEMENTED_INSTRUCTION(M) \ | 32 #define FOR_EACH_UNIMPLEMENTED_INSTRUCTION(M) \ |
| 33 M(IndirectGoto) \ | 33 M(IndirectGoto) \ |
| 34 M(LoadCodeUnits) \ | 34 M(LoadCodeUnits) \ |
| 35 M(InstanceOf) \ | |
| 36 M(LoadUntagged) \ | 35 M(LoadUntagged) \ |
| 37 M(AllocateUninitializedContext) \ | 36 M(AllocateUninitializedContext) \ |
| 38 M(BinaryInt32Op) \ | 37 M(BinaryInt32Op) \ |
| 39 M(UnaryDoubleOp) \ | 38 M(UnaryDoubleOp) \ |
| 40 M(SmiToDouble) \ | 39 M(SmiToDouble) \ |
| 41 M(Int32ToDouble) \ | 40 M(Int32ToDouble) \ |
| 42 M(MintToDouble) \ | 41 M(MintToDouble) \ |
| 43 M(DoubleToInteger) \ | 42 M(DoubleToInteger) \ |
| 44 M(DoubleToSmi) \ | 43 M(DoubleToSmi) \ |
| 45 M(DoubleToDouble) \ | 44 M(DoubleToDouble) \ |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 FOR_EACH_UNIMPLEMENTED_INSTRUCTION(DEFINE_UNIMPLEMENTED) | 171 FOR_EACH_UNIMPLEMENTED_INSTRUCTION(DEFINE_UNIMPLEMENTED) |
| 173 | 172 |
| 174 #undef DEFINE_UNIMPLEMENTED | 173 #undef DEFINE_UNIMPLEMENTED |
| 175 | 174 |
| 176 DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(TestCids) | 175 DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(TestCids) |
| 177 DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(TestSmi) | 176 DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(TestSmi) |
| 178 DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(RelationalOp) | 177 DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(RelationalOp) |
| 179 DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(EqualityCompare) | 178 DEFINE_UNIMPLEMENTED_EMIT_BRANCH_CODE(EqualityCompare) |
| 180 | 179 |
| 181 | 180 |
| 181 DEFINE_MAKE_LOCATION_SUMMARY(InstanceOf, 2, | |
| 182 Location::SameAsFirstInput(), | |
| 183 LocationSummary::kCall); | |
| 184 | |
| 185 | |
| 186 void InstanceOfInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | |
| 187 if (compiler->is_optimizing()) { | |
| 188 __ Push(locs()->in(0).reg()); // Value. | |
| 189 __ Push(locs()->in(1).reg()); // Instantiator type arguments. | |
| 190 } | |
| 191 | |
| 192 const SubtypeTestCache& cache = | |
| 193 SubtypeTestCache::ZoneHandle(SubtypeTestCache::New()); | |
| 194 | |
| 195 __ PushConstant(type()); | |
| 196 __ PushConstant(cache); | |
| 197 __ InstanceOf(); | |
| 198 compiler->RecordSafepoint(locs()); | |
| 199 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther, | |
| 200 deopt_id(), | |
| 201 token_pos()); | |
| 202 if (negate_result()) { | |
|
zra
2016/06/28 19:28:05
I think we should fold this into the InstanceOf in
rmacnak
2016/06/28 21:21:50
Done.
| |
| 203 __ LogicalNot(); | |
| 204 } | |
| 205 | |
| 206 if (compiler->is_optimizing()) { | |
| 207 __ PopLocal(locs()->out(0).reg()); | |
| 208 } | |
| 209 } | |
| 210 | |
| 211 | |
| 182 DEFINE_MAKE_LOCATION_SUMMARY(AssertAssignable, 2, | 212 DEFINE_MAKE_LOCATION_SUMMARY(AssertAssignable, 2, |
| 183 Location::SameAsFirstInput(), | 213 Location::SameAsFirstInput(), |
| 184 LocationSummary::kCall); | 214 LocationSummary::kCall); |
| 185 | 215 |
| 186 | 216 |
| 187 EMIT_NATIVE_CODE(AssertBoolean, | 217 EMIT_NATIVE_CODE(AssertBoolean, |
| 188 1, Location::SameAsFirstInput(), | 218 1, Location::SameAsFirstInput(), |
| 189 LocationSummary::kCall) { | 219 LocationSummary::kCall) { |
| 190 if (compiler->is_optimizing()) { | 220 if (compiler->is_optimizing()) { |
| 191 __ Push(locs()->in(0).reg()); | 221 __ Push(locs()->in(0).reg()); |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1014 __ BitNot(locs()->out(0).reg(), locs()->in(0).reg()); | 1044 __ BitNot(locs()->out(0).reg(), locs()->in(0).reg()); |
| 1015 break; | 1045 break; |
| 1016 default: | 1046 default: |
| 1017 UNREACHABLE(); | 1047 UNREACHABLE(); |
| 1018 } | 1048 } |
| 1019 } | 1049 } |
| 1020 | 1050 |
| 1021 } // namespace dart | 1051 } // namespace dart |
| 1022 | 1052 |
| 1023 #endif // defined TARGET_ARCH_DBC | 1053 #endif // defined TARGET_ARCH_DBC |
| OLD | NEW |