OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/flow_graph_compiler_shared.h" | 5 #include "vm/flow_graph_compiler_shared.h" |
6 | 6 |
7 #include "vm/debugger.h" | 7 #include "vm/debugger.h" |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 #include "vm/intrinsifier.h" | 9 #include "vm/intrinsifier.h" |
10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 } | 270 } |
271 } | 271 } |
272 // Even if an intrinsified version of the function was successfully | 272 // Even if an intrinsified version of the function was successfully |
273 // generated, it may fall through to the non-intrinsified method body. | 273 // generated, it may fall through to the non-intrinsified method body. |
274 if (!FLAG_trace_functions) { | 274 if (!FLAG_trace_functions) { |
275 return Intrinsifier::Intrinsify(parsed_function().function(), assembler()); | 275 return Intrinsifier::Intrinsify(parsed_function().function(), assembler()); |
276 } | 276 } |
277 return false; | 277 return false; |
278 } | 278 } |
279 | 279 |
| 280 |
| 281 void FlowGraphCompilerShared::GenerateNumberTypeCheck( |
| 282 Register kClassIdReg, |
| 283 const AbstractType& type, |
| 284 Label* is_instance_lbl, |
| 285 Label* is_not_instance_lbl) { |
| 286 GrowableArray<intptr_t> args; |
| 287 if (type.IsNumberInterface()) { |
| 288 args.Add(kDouble); |
| 289 args.Add(kMint); |
| 290 args.Add(kBigint); |
| 291 } else if (type.IsIntInterface()) { |
| 292 args.Add(kMint); |
| 293 args.Add(kBigint); |
| 294 } else if (type.IsDoubleInterface()) { |
| 295 args.Add(kDouble); |
| 296 } |
| 297 CheckClassIds(kClassIdReg, args, is_instance_lbl, is_not_instance_lbl); |
| 298 } |
| 299 |
| 300 |
| 301 void FlowGraphCompilerShared::GenerateStringTypeCheck( |
| 302 Register kClassIdReg, |
| 303 Label* is_instance_lbl, |
| 304 Label* is_not_instance_lbl) { |
| 305 GrowableArray<intptr_t> args; |
| 306 args.Add(kOneByteString); |
| 307 args.Add(kTwoByteString); |
| 308 args.Add(kFourByteString); |
| 309 args.Add(kExternalOneByteString); |
| 310 args.Add(kExternalTwoByteString); |
| 311 args.Add(kExternalFourByteString); |
| 312 CheckClassIds(kClassIdReg, args, is_instance_lbl, is_not_instance_lbl); |
| 313 } |
| 314 |
| 315 |
| 316 void FlowGraphCompilerShared::GenerateListTypeCheck( |
| 317 Register kClassIdReg, |
| 318 Label* is_instance_lbl) { |
| 319 Label unknown; |
| 320 GrowableArray<intptr_t> args; |
| 321 args.Add(kArray); |
| 322 args.Add(kGrowableObjectArray); |
| 323 args.Add(kImmutableArray); |
| 324 CheckClassIds(kClassIdReg, args, is_instance_lbl, &unknown); |
| 325 assembler()->Bind(&unknown); |
| 326 } |
| 327 |
280 } // namespace dart | 328 } // namespace dart |
281 | 329 |
282 | 330 |
OLD | NEW |