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

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

Issue 2109743002: DBC: Implement InstanceOf. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fold in negate_result; check the cache in the interpreter 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 14 matching lines...) Expand all
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
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,
zra 2016/06/28 21:37:47 This can just be EMIT_NATIVE_CODE(InstanceOf, 2,
rmacnak 2016/06/28 22:22:55 Done.
182 Location::SameAsFirstInput(),
183 LocationSummary::kCall);
184
185
186 void InstanceOfInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
187 SubtypeTestCache& test_cache = SubtypeTestCache::Handle();
188 if (!type().IsVoidType() && type().IsInstantiated()) {
189 test_cache = SubtypeTestCache::New();
190 }
191
192 if (compiler->is_optimizing()) {
193 __ Push(locs()->in(0).reg()); // Value.
194 __ Push(locs()->in(1).reg()); // Instantiator type arguments.
195 }
196
197 __ PushConstant(type());
198 __ PushConstant(test_cache);
199 __ InstanceOf(negate_result() ? 1 : 0);
200 compiler->RecordSafepoint(locs());
201 compiler->AddCurrentDescriptor(RawPcDescriptors::kOther,
202 deopt_id(),
203 token_pos());
204
205 if (compiler->is_optimizing()) {
206 __ PopLocal(locs()->out(0).reg());
207 }
208 }
209
210
182 DEFINE_MAKE_LOCATION_SUMMARY(AssertAssignable, 2, 211 DEFINE_MAKE_LOCATION_SUMMARY(AssertAssignable, 2,
183 Location::SameAsFirstInput(), 212 Location::SameAsFirstInput(),
184 LocationSummary::kCall); 213 LocationSummary::kCall);
185 214
186 215
187 EMIT_NATIVE_CODE(AssertBoolean, 216 EMIT_NATIVE_CODE(AssertBoolean,
188 1, Location::SameAsFirstInput(), 217 1, Location::SameAsFirstInput(),
189 LocationSummary::kCall) { 218 LocationSummary::kCall) {
190 if (compiler->is_optimizing()) { 219 if (compiler->is_optimizing()) {
191 __ Push(locs()->in(0).reg()); 220 __ Push(locs()->in(0).reg());
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 __ BitNot(locs()->out(0).reg(), locs()->in(0).reg()); 1043 __ BitNot(locs()->out(0).reg(), locs()->in(0).reg());
1015 break; 1044 break;
1016 default: 1045 default:
1017 UNREACHABLE(); 1046 UNREACHABLE();
1018 } 1047 }
1019 } 1048 }
1020 1049
1021 } // namespace dart 1050 } // namespace dart
1022 1051
1023 #endif // defined TARGET_ARCH_DBC 1052 #endif // defined TARGET_ARCH_DBC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698