Chromium Code Reviews| 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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1015 intptr_t try_index, | 1015 intptr_t try_index, |
| 1016 const RuntimeEntry& entry) { | 1016 const RuntimeEntry& entry) { |
| 1017 ASSERT(frame_register_allocator()->IsSpilled()); | 1017 ASSERT(frame_register_allocator()->IsSpilled()); |
| 1018 __ CallRuntime(entry); | 1018 __ CallRuntime(entry); |
| 1019 AddCurrentDescriptor(PcDescriptors::kOther, cid, token_index, try_index); | 1019 AddCurrentDescriptor(PcDescriptors::kOther, cid, token_index, try_index); |
| 1020 } | 1020 } |
| 1021 | 1021 |
| 1022 | 1022 |
| 1023 // Checks class id of instance against all 'class_ids'. Jump to 'deopt' label | 1023 // Checks class id of instance against all 'class_ids'. Jump to 'deopt' label |
| 1024 // if no match or instance is Smi. | 1024 // if no match or instance is Smi. |
| 1025 void FlowGraphCompiler::EmitClassChecksNoSmi( | 1025 void FlowGraphCompiler::EmitClassChecksNoSmi(const ICData& ic_data, |
| 1026 const ZoneGrowableArray<intptr_t>& class_ids, | 1026 Register instance_reg, |
| 1027 Register instance_reg, | 1027 Register temp_reg, |
| 1028 Register temp_reg, | 1028 Label* deopt) { |
| 1029 Label* deopt) { | |
| 1030 Label ok; | 1029 Label ok; |
| 1031 ASSERT(class_ids[0] != kSmi); | 1030 ASSERT(ic_data.GetReceiverClassIdAt(0) != kSmi); |
| 1032 __ testq(instance_reg, Immediate(kSmiTagMask)); | 1031 __ testq(instance_reg, Immediate(kSmiTagMask)); |
| 1033 __ j(ZERO, deopt); | 1032 __ j(ZERO, deopt); |
| 1034 Label is_ok; | 1033 Label is_ok; |
| 1035 bool use_near_jump = class_ids.length() < 5; | 1034 const intptr_t num_checks = ic_data.NumberOfChecks(); |
| 1035 const bool use_near_jump = num_checks < 5; | |
| 1036 __ LoadClassId(temp_reg, instance_reg); | 1036 __ LoadClassId(temp_reg, instance_reg); |
| 1037 for (intptr_t i = 0; i < class_ids.length(); i++) { | 1037 for (intptr_t i = 0; i < num_checks; i++) { |
| 1038 __ cmpl(temp_reg, Immediate(class_ids[i])); | 1038 __ cmpl(temp_reg, Immediate(ic_data.GetReceiverClassIdAt(i))); |
| 1039 if (i == (class_ids.length() - 1)) { | 1039 if (i == (num_checks - 1)) { |
| 1040 __ j(NOT_EQUAL, deopt); | 1040 __ j(NOT_EQUAL, deopt); |
| 1041 } else { | 1041 } else { |
| 1042 if (use_near_jump) { | 1042 if (use_near_jump) { |
|
regis
2012/06/19 21:14:18
Since Assembler::kNearJump is bool true, you could
srdjan
2012/06/19 21:28:17
Leaving it as it is.
| |
| 1043 __ j(EQUAL, &is_ok, Assembler::kNearJump); | 1043 __ j(EQUAL, &is_ok, Assembler::kNearJump); |
| 1044 } else { | 1044 } else { |
| 1045 __ j(EQUAL, &is_ok); | 1045 __ j(EQUAL, &is_ok); |
| 1046 } | 1046 } |
| 1047 } | 1047 } |
| 1048 } | 1048 } |
| 1049 __ Bind(&is_ok); | 1049 __ Bind(&is_ok); |
| 1050 } | 1050 } |
| 1051 | 1051 |
| 1052 | 1052 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1067 __ cvtsi2sd(result, temp); | 1067 __ cvtsi2sd(result, temp); |
| 1068 __ Bind(&done); | 1068 __ Bind(&done); |
| 1069 } | 1069 } |
| 1070 | 1070 |
| 1071 | 1071 |
| 1072 #undef __ | 1072 #undef __ |
| 1073 | 1073 |
| 1074 } // namespace dart | 1074 } // namespace dart |
| 1075 | 1075 |
| 1076 #endif // defined TARGET_ARCH_X64 | 1076 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |