| 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 11 matching lines...) Expand all Loading... |
| 22 #include "vm/symbols.h" | 22 #include "vm/symbols.h" |
| 23 | 23 |
| 24 #define __ compiler->assembler()-> | 24 #define __ compiler->assembler()-> |
| 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(Stop) \ | |
| 34 M(IndirectGoto) \ | 33 M(IndirectGoto) \ |
| 35 M(LoadCodeUnits) \ | 34 M(LoadCodeUnits) \ |
| 36 M(InstanceOf) \ | 35 M(InstanceOf) \ |
| 37 M(LoadUntagged) \ | 36 M(LoadUntagged) \ |
| 38 M(AllocateUninitializedContext) \ | 37 M(AllocateUninitializedContext) \ |
| 39 M(BinaryInt32Op) \ | 38 M(BinaryInt32Op) \ |
| 40 M(UnarySmiOp) \ | |
| 41 M(UnaryDoubleOp) \ | 39 M(UnaryDoubleOp) \ |
| 42 M(SmiToDouble) \ | 40 M(SmiToDouble) \ |
| 43 M(Int32ToDouble) \ | 41 M(Int32ToDouble) \ |
| 44 M(MintToDouble) \ | 42 M(MintToDouble) \ |
| 45 M(DoubleToInteger) \ | 43 M(DoubleToInteger) \ |
| 46 M(DoubleToSmi) \ | 44 M(DoubleToSmi) \ |
| 47 M(DoubleToDouble) \ | 45 M(DoubleToDouble) \ |
| 48 M(DoubleToFloat) \ | 46 M(DoubleToFloat) \ |
| 49 M(FloatToDouble) \ | 47 M(FloatToDouble) \ |
| 50 M(UnboxedConstant) \ | 48 M(UnboxedConstant) \ |
| 51 M(CheckEitherNonSmi) \ | |
| 52 M(BinaryDoubleOp) \ | 49 M(BinaryDoubleOp) \ |
| 53 M(MathUnary) \ | 50 M(MathUnary) \ |
| 54 M(MathMinMax) \ | 51 M(MathMinMax) \ |
| 55 M(Box) \ | 52 M(Box) \ |
| 56 M(Unbox) \ | 53 M(Unbox) \ |
| 57 M(BoxInt64) \ | 54 M(BoxInt64) \ |
| 58 M(CaseInsensitiveCompareUC16) \ | 55 M(CaseInsensitiveCompareUC16) \ |
| 59 M(BinaryMintOp) \ | 56 M(BinaryMintOp) \ |
| 60 M(ShiftMintOp) \ | 57 M(ShiftMintOp) \ |
| 61 M(UnaryMintOp) \ | 58 M(UnaryMintOp) \ |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 209 |
| 213 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 210 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 214 #if defined(PRODUCT) | 211 #if defined(PRODUCT) |
| 215 compiler->Bailout("PolymorphicInstanceCallInstr::EmitNativeCode"); | 212 compiler->Bailout("PolymorphicInstanceCallInstr::EmitNativeCode"); |
| 216 #else // defined(PRODUCT) | 213 #else // defined(PRODUCT) |
| 217 compiler->Bailout(ToCString()); | 214 compiler->Bailout(ToCString()); |
| 218 #endif // defined(PRODUCT) | 215 #endif // defined(PRODUCT) |
| 219 } | 216 } |
| 220 | 217 |
| 221 | 218 |
| 219 EMIT_NATIVE_CODE(Stop, 0) { |
| 220 __ Stop(message()); |
| 221 } |
| 222 |
| 223 |
| 222 EMIT_NATIVE_CODE(CheckStackOverflow, | 224 EMIT_NATIVE_CODE(CheckStackOverflow, |
| 223 0, Location::NoLocation(), | 225 0, Location::NoLocation(), |
| 224 LocationSummary::kCall) { | 226 LocationSummary::kCall) { |
| 225 __ CheckStack(); | 227 __ CheckStack(); |
| 226 compiler->RecordSafepoint(locs()); | 228 compiler->RecordSafepoint(locs()); |
| 227 compiler->AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, | 229 compiler->AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, |
| 228 Thread::kNoDeoptId, | 230 Thread::kNoDeoptId, |
| 229 token_pos()); | 231 token_pos()); |
| 230 } | 232 } |
| 231 | 233 |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 | 909 |
| 908 | 910 |
| 909 EMIT_NATIVE_CODE(CheckSmi, 1) { | 911 EMIT_NATIVE_CODE(CheckSmi, 1) { |
| 910 __ CheckSmi(locs()->in(0).reg()); | 912 __ CheckSmi(locs()->in(0).reg()); |
| 911 compiler->EmitDeopt(deopt_id(), | 913 compiler->EmitDeopt(deopt_id(), |
| 912 ICData::kDeoptCheckSmi, | 914 ICData::kDeoptCheckSmi, |
| 913 licm_hoisted_ ? ICData::kHoisted : 0); | 915 licm_hoisted_ ? ICData::kHoisted : 0); |
| 914 } | 916 } |
| 915 | 917 |
| 916 | 918 |
| 919 EMIT_NATIVE_CODE(CheckEitherNonSmi, 2) { |
| 920 intptr_t left_cid = left()->Type()->ToCid(); |
| 921 intptr_t right_cid = right()->Type()->ToCid(); |
| 922 const Register left = locs()->in(0).reg(); |
| 923 const Register right = locs()->in(1).reg(); |
| 924 if (this->left()->definition() == this->right()->definition()) { |
| 925 __ CheckSmi(left); |
| 926 } else if (left_cid == kSmiCid) { |
| 927 __ CheckSmi(right); |
| 928 } else if (right_cid == kSmiCid) { |
| 929 __ CheckSmi(left); |
| 930 } else { |
| 931 __ CheckSmi(left); |
| 932 compiler->EmitDeopt(deopt_id(), ICData::kDeoptBinaryDoubleOp, |
| 933 licm_hoisted_ ? ICData::kHoisted : 0); |
| 934 __ CheckSmi(right); |
| 935 } |
| 936 compiler->EmitDeopt(deopt_id(), ICData::kDeoptBinaryDoubleOp, |
| 937 licm_hoisted_ ? ICData::kHoisted : 0); |
| 938 } |
| 939 |
| 940 |
| 917 EMIT_NATIVE_CODE(CheckClassId, 1) { | 941 EMIT_NATIVE_CODE(CheckClassId, 1) { |
| 918 __ Push(locs()->in(0).reg()); | 942 intptr_t cid = __ AddConstant(Smi::Handle(Smi::New(cid_))); |
| 919 __ PushConstant(Smi::Handle(Smi::New(cid_))); | 943 __ CheckClassId(locs()->in(0).reg(), cid); |
| 920 __ IfNeStrictTOS(); | |
| 921 compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckClass); | 944 compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckClass); |
| 922 } | 945 } |
| 923 | 946 |
| 924 | 947 |
| 925 EMIT_NATIVE_CODE(BinarySmiOp, 2, Location::RequiresRegister()) { | 948 EMIT_NATIVE_CODE(BinarySmiOp, 2, Location::RequiresRegister()) { |
| 926 const Register left = locs()->in(0).reg(); | 949 const Register left = locs()->in(0).reg(); |
| 927 const Register right = locs()->in(1).reg(); | 950 const Register right = locs()->in(1).reg(); |
| 928 const Register out = locs()->out(0).reg(); | 951 const Register out = locs()->out(0).reg(); |
| 929 const bool can_deopt = CanDeoptimize(); | 952 const bool can_deopt = CanDeoptimize(); |
| 930 bool needs_nop = false; | 953 bool needs_nop = false; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 default: | 995 default: |
| 973 UNREACHABLE(); | 996 UNREACHABLE(); |
| 974 } | 997 } |
| 975 if (can_deopt) { | 998 if (can_deopt) { |
| 976 compiler->EmitDeopt(deopt_id(), ICData::kDeoptBinarySmiOp); | 999 compiler->EmitDeopt(deopt_id(), ICData::kDeoptBinarySmiOp); |
| 977 } else if (needs_nop) { | 1000 } else if (needs_nop) { |
| 978 __ Nop(); | 1001 __ Nop(); |
| 979 } | 1002 } |
| 980 } | 1003 } |
| 981 | 1004 |
| 1005 |
| 1006 EMIT_NATIVE_CODE(UnarySmiOp, 1, Location::RequiresRegister()) { |
| 1007 switch (op_kind()) { |
| 1008 case Token::kNEGATE: { |
| 1009 __ Neg(locs()->out(0).reg(), locs()->in(0).reg()); |
| 1010 compiler->EmitDeopt(deopt_id(), ICData::kDeoptUnaryOp); |
| 1011 break; |
| 1012 } |
| 1013 case Token::kBIT_NOT: |
| 1014 __ BitNot(locs()->out(0).reg(), locs()->in(0).reg()); |
| 1015 break; |
| 1016 default: |
| 1017 UNREACHABLE(); |
| 1018 } |
| 1019 } |
| 1020 |
| 982 } // namespace dart | 1021 } // namespace dart |
| 983 | 1022 |
| 984 #endif // defined TARGET_ARCH_DBC | 1023 #endif // defined TARGET_ARCH_DBC |
| OLD | NEW |