| 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 979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 | 990 |
| 991 frame_register_allocator()->AllocateRegisters(instr); | 991 frame_register_allocator()->AllocateRegisters(instr); |
| 992 | 992 |
| 993 // TODO(vegorov): adjust assertion when we start removing comparison from the | 993 // TODO(vegorov): adjust assertion when we start removing comparison from the |
| 994 // graph when it is merged with a branch. | 994 // graph when it is merged with a branch. |
| 995 ASSERT(locs->is_call() || | 995 ASSERT(locs->is_call() || |
| 996 (instr->IsBranch() && instr->AsBranch()->is_fused_with_comparison()) || | 996 (instr->IsBranch() && instr->AsBranch()->is_fused_with_comparison()) || |
| 997 (locs->input_count() == instr->InputCount())); | 997 (locs->input_count() == instr->InputCount())); |
| 998 } | 998 } |
| 999 | 999 |
| 1000 | |
| 1001 // Checks class id of instance against all 'class_ids'. Jump to 'deopt' label | 1000 // Checks class id of instance against all 'class_ids'. Jump to 'deopt' label |
| 1002 // if no match or instance is Smi. | 1001 // if no match or instance is Smi. |
| 1003 void FlowGraphCompiler::EmitClassChecksNoSmi( | 1002 void FlowGraphCompiler::EmitClassChecksNoSmi(const ICData& ic_data, |
| 1004 const ZoneGrowableArray<intptr_t>& class_ids, | 1003 Register instance_reg, |
| 1005 Register instance_reg, | 1004 Register temp_reg, |
| 1006 Register temp_reg, | 1005 Label* deopt) { |
| 1007 Label* deopt) { | |
| 1008 Label ok; | 1006 Label ok; |
| 1009 ASSERT(class_ids[0] != kSmi); | 1007 ASSERT(ic_data.GetReceiverClassIdAt(0) != kSmi); |
| 1010 __ testl(instance_reg, Immediate(kSmiTagMask)); | 1008 __ testl(instance_reg, Immediate(kSmiTagMask)); |
| 1011 __ j(ZERO, deopt); | 1009 __ j(ZERO, deopt); |
| 1012 Label is_ok; | 1010 Label is_ok; |
| 1013 bool use_near_jump = class_ids.length() < 5; | 1011 const intptr_t num_checks = ic_data.NumberOfChecks(); |
| 1012 const bool use_near_jump = num_checks < 5; |
| 1014 __ LoadClassId(temp_reg, instance_reg); | 1013 __ LoadClassId(temp_reg, instance_reg); |
| 1015 for (intptr_t i = 0; i < class_ids.length(); i++) { | 1014 for (intptr_t i = 0; i < num_checks; i++) { |
| 1016 __ cmpl(temp_reg, Immediate(class_ids[i])); | 1015 __ cmpl(temp_reg, Immediate(ic_data.GetReceiverClassIdAt(i))); |
| 1017 if (i == (class_ids.length() - 1)) { | 1016 if (i == (num_checks - 1)) { |
| 1018 __ j(NOT_EQUAL, deopt); | 1017 __ j(NOT_EQUAL, deopt); |
| 1019 } else { | 1018 } else { |
| 1020 if (use_near_jump) { | 1019 if (use_near_jump) { |
| 1021 __ j(EQUAL, &is_ok, Assembler::kNearJump); | 1020 __ j(EQUAL, &is_ok, Assembler::kNearJump); |
| 1022 } else { | 1021 } else { |
| 1023 __ j(EQUAL, &is_ok); | 1022 __ j(EQUAL, &is_ok); |
| 1024 } | 1023 } |
| 1025 } | 1024 } |
| 1026 } | 1025 } |
| 1027 __ Bind(&is_ok); | 1026 __ Bind(&is_ok); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1046 __ cvtsi2sd(result, temp); | 1045 __ cvtsi2sd(result, temp); |
| 1047 __ Bind(&done); | 1046 __ Bind(&done); |
| 1048 } | 1047 } |
| 1049 | 1048 |
| 1050 | 1049 |
| 1051 #undef __ | 1050 #undef __ |
| 1052 | 1051 |
| 1053 } // namespace dart | 1052 } // namespace dart |
| 1054 | 1053 |
| 1055 #endif // defined TARGET_ARCH_IA32 | 1054 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |