| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 | 981 |
| 982 // Load instruction inputs into allocated registers. | 982 // Load instruction inputs into allocated registers. |
| 983 for (intptr_t i = locs->input_count() - 1; i >= 0; i--) { | 983 for (intptr_t i = locs->input_count() - 1; i >= 0; i--) { |
| 984 Location loc = locs->in(i); | 984 Location loc = locs->in(i); |
| 985 ASSERT(loc.kind() == Location::kRegister); | 985 ASSERT(loc.kind() == Location::kRegister); |
| 986 __ popl(loc.reg()); | 986 __ popl(loc.reg()); |
| 987 } | 987 } |
| 988 } | 988 } |
| 989 | 989 |
| 990 | 990 |
| 991 // Checks class id of instance against all 'class_ids'. Jump to 'deopt' label |
| 992 // if no match or instance is Smi. |
| 993 void FlowGraphCompiler::EmitClassChecksNoSmi( |
| 994 const ZoneGrowableArray<intptr_t>& class_ids, |
| 995 Register instance_reg, |
| 996 Register temp_reg, |
| 997 Label* deopt) { |
| 998 Label ok; |
| 999 ASSERT(class_ids[0] != kSmi); |
| 1000 __ testl(instance_reg, Immediate(kSmiTagMask)); |
| 1001 __ j(ZERO, deopt); |
| 1002 Label is_ok; |
| 1003 __ LoadClassId(temp_reg, instance_reg); |
| 1004 for (intptr_t i = 0; i < class_ids.length(); i++) { |
| 1005 __ cmpl(temp_reg, Immediate(class_ids[i])); |
| 1006 if (i == class_ids.length() - 1) { |
| 1007 __ j(NOT_EQUAL, deopt); |
| 1008 } else { |
| 1009 __ j(EQUAL, &is_ok, Assembler::kNearJump); |
| 1010 } |
| 1011 } |
| 1012 __ Bind(&is_ok); |
| 1013 } |
| 1014 |
| 1015 |
| 991 void FlowGraphCompiler::VisitBlocks() { | 1016 void FlowGraphCompiler::VisitBlocks() { |
| 992 for (intptr_t i = 0; i < block_order().length(); ++i) { | 1017 for (intptr_t i = 0; i < block_order().length(); ++i) { |
| 993 __ Comment("B%d", i); | 1018 __ Comment("B%d", i); |
| 994 // Compile the block entry. | 1019 // Compile the block entry. |
| 995 set_current_block(block_order()[i]); | 1020 set_current_block(block_order()[i]); |
| 996 current_block()->PrepareEntry(this); | 1021 current_block()->PrepareEntry(this); |
| 997 Instruction* instr = current_block()->StraightLineSuccessor(); | 1022 Instruction* instr = current_block()->StraightLineSuccessor(); |
| 998 // Compile all successors until an exit, branch, or a block entry. | 1023 // Compile all successors until an exit, branch, or a block entry. |
| 999 while ((instr != NULL) && !instr->IsBlockEntry()) { | 1024 while ((instr != NULL) && !instr->IsBlockEntry()) { |
| 1000 if (FLAG_code_comments) EmitComment(instr); | 1025 if (FLAG_code_comments) EmitComment(instr); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1017 } | 1042 } |
| 1018 } | 1043 } |
| 1019 } | 1044 } |
| 1020 } | 1045 } |
| 1021 | 1046 |
| 1022 #undef __ | 1047 #undef __ |
| 1023 | 1048 |
| 1024 } // namespace dart | 1049 } // namespace dart |
| 1025 | 1050 |
| 1026 #endif // defined TARGET_ARCH_IA32 | 1051 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |