| 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/globals.h" // Needed here to get TARGET_ARCH_XXX. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX. |
| 6 | 6 |
| 7 #include "vm/flow_graph_compiler.h" | 7 #include "vm/flow_graph_compiler.h" |
| 8 | 8 |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/debugger.h" | 10 #include "vm/debugger.h" |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 try_index); | 411 try_index); |
| 412 } | 412 } |
| 413 | 413 |
| 414 | 414 |
| 415 void FlowGraphCompiler::GenerateNumberTypeCheck(Register kClassIdReg, | 415 void FlowGraphCompiler::GenerateNumberTypeCheck(Register kClassIdReg, |
| 416 const AbstractType& type, | 416 const AbstractType& type, |
| 417 Label* is_instance_lbl, | 417 Label* is_instance_lbl, |
| 418 Label* is_not_instance_lbl) { | 418 Label* is_not_instance_lbl) { |
| 419 GrowableArray<intptr_t> args; | 419 GrowableArray<intptr_t> args; |
| 420 if (type.IsNumberInterface()) { | 420 if (type.IsNumberInterface()) { |
| 421 args.Add(kDouble); | 421 args.Add(kDoubleCid); |
| 422 args.Add(kMint); | 422 args.Add(kMintCid); |
| 423 args.Add(kBigint); | 423 args.Add(kBigintCid); |
| 424 } else if (type.IsIntInterface()) { | 424 } else if (type.IsIntInterface()) { |
| 425 args.Add(kMint); | 425 args.Add(kMintCid); |
| 426 args.Add(kBigint); | 426 args.Add(kBigintCid); |
| 427 } else if (type.IsDoubleInterface()) { | 427 } else if (type.IsDoubleInterface()) { |
| 428 args.Add(kDouble); | 428 args.Add(kDoubleCid); |
| 429 } | 429 } |
| 430 CheckClassIds(kClassIdReg, args, is_instance_lbl, is_not_instance_lbl); | 430 CheckClassIds(kClassIdReg, args, is_instance_lbl, is_not_instance_lbl); |
| 431 } | 431 } |
| 432 | 432 |
| 433 | 433 |
| 434 void FlowGraphCompiler::GenerateStringTypeCheck(Register kClassIdReg, | 434 void FlowGraphCompiler::GenerateStringTypeCheck(Register kClassIdReg, |
| 435 Label* is_instance_lbl, | 435 Label* is_instance_lbl, |
| 436 Label* is_not_instance_lbl) { | 436 Label* is_not_instance_lbl) { |
| 437 GrowableArray<intptr_t> args; | 437 GrowableArray<intptr_t> args; |
| 438 args.Add(kOneByteString); | 438 args.Add(kOneByteStringCid); |
| 439 args.Add(kTwoByteString); | 439 args.Add(kTwoByteStringCid); |
| 440 args.Add(kFourByteString); | 440 args.Add(kFourByteStringCid); |
| 441 args.Add(kExternalOneByteString); | 441 args.Add(kExternalOneByteStringCid); |
| 442 args.Add(kExternalTwoByteString); | 442 args.Add(kExternalTwoByteStringCid); |
| 443 args.Add(kExternalFourByteString); | 443 args.Add(kExternalFourByteStringCid); |
| 444 CheckClassIds(kClassIdReg, args, is_instance_lbl, is_not_instance_lbl); | 444 CheckClassIds(kClassIdReg, args, is_instance_lbl, is_not_instance_lbl); |
| 445 } | 445 } |
| 446 | 446 |
| 447 | 447 |
| 448 void FlowGraphCompiler::GenerateListTypeCheck(Register kClassIdReg, | 448 void FlowGraphCompiler::GenerateListTypeCheck(Register kClassIdReg, |
| 449 Label* is_instance_lbl) { | 449 Label* is_instance_lbl) { |
| 450 Label unknown; | 450 Label unknown; |
| 451 GrowableArray<intptr_t> args; | 451 GrowableArray<intptr_t> args; |
| 452 args.Add(kArray); | 452 args.Add(kArrayCid); |
| 453 args.Add(kGrowableObjectArray); | 453 args.Add(kGrowableObjectArrayCid); |
| 454 args.Add(kImmutableArray); | 454 args.Add(kImmutableArrayCid); |
| 455 CheckClassIds(kClassIdReg, args, is_instance_lbl, &unknown); | 455 CheckClassIds(kClassIdReg, args, is_instance_lbl, &unknown); |
| 456 assembler()->Bind(&unknown); | 456 assembler()->Bind(&unknown); |
| 457 } | 457 } |
| 458 | 458 |
| 459 | 459 |
| 460 void FlowGraphCompiler::EmitComment(Instruction* instr) { | 460 void FlowGraphCompiler::EmitComment(Instruction* instr) { |
| 461 char buffer[256]; | 461 char buffer[256]; |
| 462 BufferFormatter f(buffer, sizeof(buffer)); | 462 BufferFormatter f(buffer, sizeof(buffer)); |
| 463 instr->PrintTo(&f); | 463 instr->PrintTo(&f); |
| 464 assembler()->Comment("%s", buffer); | 464 assembler()->Comment("%s", buffer); |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 return; | 852 return; |
| 853 } | 853 } |
| 854 } | 854 } |
| 855 | 855 |
| 856 // This move is not blocked. | 856 // This move is not blocked. |
| 857 EmitMove(index); | 857 EmitMove(index); |
| 858 } | 858 } |
| 859 | 859 |
| 860 | 860 |
| 861 } // namespace dart | 861 } // namespace dart |
| OLD | NEW |