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

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

Issue 2404163004: DBC: Add Smi fastpath to AssertAssignable (Closed)
Patch Set: Remove spurious comment Created 4 years, 2 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
« no previous file with comments | « runtime/vm/constants_dbc.h ('k') | runtime/vm/simulator_dbc.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "vm/ast_printer.h" 10 #include "vm/ast_printer.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 if (is_optimizing()) { 227 if (is_optimizing()) {
228 __ Push(locs->in(0).reg()); 228 __ Push(locs->in(0).reg());
229 __ Push(locs->in(1).reg()); 229 __ Push(locs->in(1).reg());
230 } 230 }
231 __ PushConstant(dst_type); 231 __ PushConstant(dst_type);
232 __ PushConstant(dst_name); 232 __ PushConstant(dst_name);
233 233
234 if (dst_type.IsMalformedOrMalbounded()) { 234 if (dst_type.IsMalformedOrMalbounded()) {
235 __ BadTypeError(); 235 __ BadTypeError();
236 } else { 236 } else {
237 __ AssertAssignable(__ AddConstant(test_cache)); 237 bool may_be_smi = false;
238 if (!dst_type.IsVoidType() && dst_type.IsInstantiated()) {
239 const Class& type_class = Class::Handle(zone(), dst_type.type_class());
240 if (type_class.NumTypeArguments() == 0) {
241 const Class& smi_class = Class::Handle(zone(), Smi::Class());
242 may_be_smi = smi_class.IsSubtypeOf(TypeArguments::Handle(zone()),
243 type_class,
244 TypeArguments::Handle(zone()),
245 NULL,
246 NULL,
247 Heap::kOld);
248 }
249 }
250 __ AssertAssignable(may_be_smi ? 1 : 0, __ AddConstant(test_cache));
238 } 251 }
239 252
240 if (is_optimizing()) { 253 if (is_optimizing()) {
241 // Register allocator does not think that our first input (also used as 254 // Register allocator does not think that our first input (also used as
242 // output) needs to be kept alive across the call because that is how code 255 // output) needs to be kept alive across the call because that is how code
243 // is written on other platforms (where registers are always spilled across 256 // is written on other platforms (where registers are always spilled across
244 // the call): inputs are consumed by operation and output is produced so 257 // the call): inputs are consumed by operation and output is produced so
245 // neither are alive at the safepoint. 258 // neither are alive at the safepoint.
246 // We have to mark the slot alive manually to ensure that GC 259 // We have to mark the slot alive manually to ensure that GC
247 // visits it. 260 // visits it.
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { 557 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) {
545 UNIMPLEMENTED(); 558 UNIMPLEMENTED();
546 } 559 }
547 560
548 561
549 #undef __ 562 #undef __
550 563
551 } // namespace dart 564 } // namespace dart
552 565
553 #endif // defined TARGET_ARCH_DBC 566 #endif // defined TARGET_ARCH_DBC
OLDNEW
« no previous file with comments | « runtime/vm/constants_dbc.h ('k') | runtime/vm/simulator_dbc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698