Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: runtime/vm/intermediate_language_dbc.cc

Issue 2098573004: DBC: CheckClassInstr (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 M(ExtractNthOutput) \ 98 M(ExtractNthOutput) \
99 M(BinaryUint32Op) \ 99 M(BinaryUint32Op) \
100 M(ShiftUint32Op) \ 100 M(ShiftUint32Op) \
101 M(UnaryUint32Op) \ 101 M(UnaryUint32Op) \
102 M(UnboxedIntConverter) \ 102 M(UnboxedIntConverter) \
103 M(GrowRegExpStack) \ 103 M(GrowRegExpStack) \
104 M(BoxInteger32) \ 104 M(BoxInteger32) \
105 M(UnboxInteger32) \ 105 M(UnboxInteger32) \
106 M(CheckedSmiOp) \ 106 M(CheckedSmiOp) \
107 M(CheckArrayBound) \ 107 M(CheckArrayBound) \
108 M(CheckClass) \
109 M(TestSmi) \ 108 M(TestSmi) \
110 M(RelationalOp) \ 109 M(RelationalOp) \
111 M(EqualityCompare) \ 110 M(EqualityCompare) \
112 M(LoadIndexed) 111 M(LoadIndexed)
113 112
114 // Location summaries actually are not used by the unoptimizing DBC compiler 113 // Location summaries actually are not used by the unoptimizing DBC compiler
115 // because we don't allocate any registers. 114 // because we don't allocate any registers.
116 static LocationSummary* CreateLocationSummary( 115 static LocationSummary* CreateLocationSummary(
117 Zone* zone, 116 Zone* zone,
118 intptr_t num_inputs, 117 intptr_t num_inputs,
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 } 937 }
939 938
940 939
941 EMIT_NATIVE_CODE(CheckClassId, 1) { 940 EMIT_NATIVE_CODE(CheckClassId, 1) {
942 intptr_t cid = __ AddConstant(Smi::Handle(Smi::New(cid_))); 941 intptr_t cid = __ AddConstant(Smi::Handle(Smi::New(cid_)));
943 __ CheckClassId(locs()->in(0).reg(), cid); 942 __ CheckClassId(locs()->in(0).reg(), cid);
944 compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckClass); 943 compiler->EmitDeopt(deopt_id(), ICData::kDeoptCheckClass);
945 } 944 }
946 945
947 946
947 EMIT_NATIVE_CODE(CheckClass, 1) {
948 const Register value = locs()->in(0).reg();
949 if (IsNullCheck()) {
950 ASSERT(DeoptIfNull() || DeoptIfNotNull());
951 __ CheckNull(value, DeoptIfNull() ? 1 : 0);
952 compiler->EmitDeopt(deopt_id(),
953 ICData::kDeoptCheckClass,
954 licm_hoisted_ ? ICData::kHoisted : 0);
955 return;
956 }
957
958 ASSERT((unary_checks().GetReceiverClassIdAt(0) != kSmiCid) ||
959 (unary_checks().NumberOfChecks() > 1));
960 const intptr_t ic_data = __ AddConstant(unary_checks());
961 if (IsDenseSwitch()) {
962 ASSERT(cids_[0] < cids_[cids_.length() - 1]);
963 __ PushConstant(Smi::Handle(Smi::New(cids_[0])));
964 __ PushConstant(Smi::Handle(Smi::New(ComputeCidMask())));
965 __ CheckDenseSwitchTOS(value, ic_data);
966 } else {
967 __ CheckForCid(value, ic_data);
968 }
969 compiler->EmitDeopt(deopt_id(),
970 ICData::kDeoptCheckClass,
971 licm_hoisted_ ? ICData::kHoisted : 0);
972 }
973
974
948 EMIT_NATIVE_CODE(BinarySmiOp, 2, Location::RequiresRegister()) { 975 EMIT_NATIVE_CODE(BinarySmiOp, 2, Location::RequiresRegister()) {
949 const Register left = locs()->in(0).reg(); 976 const Register left = locs()->in(0).reg();
950 const Register right = locs()->in(1).reg(); 977 const Register right = locs()->in(1).reg();
951 const Register out = locs()->out(0).reg(); 978 const Register out = locs()->out(0).reg();
952 const bool can_deopt = CanDeoptimize(); 979 const bool can_deopt = CanDeoptimize();
953 bool needs_nop = false; 980 bool needs_nop = false;
954 switch (op_kind()) { 981 switch (op_kind()) {
955 case Token::kADD: 982 case Token::kADD:
956 __ Add(out, left, right); 983 __ Add(out, left, right);
957 needs_nop = true; 984 needs_nop = true;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 __ BitNot(locs()->out(0).reg(), locs()->in(0).reg()); 1041 __ BitNot(locs()->out(0).reg(), locs()->in(0).reg());
1015 break; 1042 break;
1016 default: 1043 default:
1017 UNREACHABLE(); 1044 UNREACHABLE();
1018 } 1045 }
1019 } 1046 }
1020 1047
1021 } // namespace dart 1048 } // namespace dart
1022 1049
1023 #endif // defined TARGET_ARCH_DBC 1050 #endif // defined TARGET_ARCH_DBC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698