| 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 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 __ call(&StubCode::CallStaticFunctionLabel()); | 1039 __ call(&StubCode::CallStaticFunctionLabel()); |
| 1040 AddCurrentDescriptor(PcDescriptors::kFuncCall, deopt_id, token_pos); | 1040 AddCurrentDescriptor(PcDescriptors::kFuncCall, deopt_id, token_pos); |
| 1041 RecordSafepoint(locs); | 1041 RecordSafepoint(locs); |
| 1042 if (is_optimizing()) { | 1042 if (is_optimizing()) { |
| 1043 AddDeoptIndexAtCall(deopt_id, token_pos); | 1043 AddDeoptIndexAtCall(deopt_id, token_pos); |
| 1044 } | 1044 } |
| 1045 __ Drop(argument_count); | 1045 __ Drop(argument_count); |
| 1046 } | 1046 } |
| 1047 | 1047 |
| 1048 | 1048 |
| 1049 // Checks class id of instance against all 'class_ids'. Jump to 'deopt' label | |
| 1050 // if no match or instance is Smi. | |
| 1051 void FlowGraphCompiler::EmitClassChecksNoSmi(const ICData& ic_data, | |
| 1052 Register instance_reg, | |
| 1053 Register temp_reg, | |
| 1054 Label* deopt) { | |
| 1055 Label ok; | |
| 1056 ASSERT(ic_data.GetReceiverClassIdAt(0) != kSmiCid); | |
| 1057 __ testl(instance_reg, Immediate(kSmiTagMask)); | |
| 1058 __ j(ZERO, deopt); | |
| 1059 Label is_ok; | |
| 1060 const intptr_t num_checks = ic_data.NumberOfChecks(); | |
| 1061 const bool use_near_jump = num_checks < 5; | |
| 1062 __ LoadClassId(temp_reg, instance_reg); | |
| 1063 for (intptr_t i = 0; i < num_checks; i++) { | |
| 1064 __ cmpl(temp_reg, Immediate(ic_data.GetReceiverClassIdAt(i))); | |
| 1065 if (i == (num_checks - 1)) { | |
| 1066 __ j(NOT_EQUAL, deopt); | |
| 1067 } else { | |
| 1068 if (use_near_jump) { | |
| 1069 __ j(EQUAL, &is_ok, Assembler::kNearJump); | |
| 1070 } else { | |
| 1071 __ j(EQUAL, &is_ok); | |
| 1072 } | |
| 1073 } | |
| 1074 } | |
| 1075 __ Bind(&is_ok); | |
| 1076 } | |
| 1077 | |
| 1078 | |
| 1079 void FlowGraphCompiler::LoadDoubleOrSmiToXmm(XmmRegister result, | 1049 void FlowGraphCompiler::LoadDoubleOrSmiToXmm(XmmRegister result, |
| 1080 Register reg, | 1050 Register reg, |
| 1081 Register temp, | 1051 Register temp, |
| 1082 Label* not_double_or_smi) { | 1052 Label* not_double_or_smi) { |
| 1083 Label is_smi, done; | 1053 Label is_smi, done; |
| 1084 __ testl(reg, Immediate(kSmiTagMask)); | 1054 __ testl(reg, Immediate(kSmiTagMask)); |
| 1085 __ j(ZERO, &is_smi); | 1055 __ j(ZERO, &is_smi); |
| 1086 __ CompareClassId(reg, kDoubleCid, temp); | 1056 __ CompareClassId(reg, kDoubleCid, temp); |
| 1087 __ j(NOT_EQUAL, not_double_or_smi); | 1057 __ j(NOT_EQUAL, not_double_or_smi); |
| 1088 __ movsd(result, FieldAddress(reg, Double::value_offset())); | 1058 __ movsd(result, FieldAddress(reg, Double::value_offset())); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 __ popl(ECX); | 1268 __ popl(ECX); |
| 1299 __ popl(EAX); | 1269 __ popl(EAX); |
| 1300 } | 1270 } |
| 1301 | 1271 |
| 1302 | 1272 |
| 1303 #undef __ | 1273 #undef __ |
| 1304 | 1274 |
| 1305 } // namespace dart | 1275 } // namespace dart |
| 1306 | 1276 |
| 1307 #endif // defined TARGET_ARCH_IA32 | 1277 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |