| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 const intptr_t offset = assem->CodeSize(); | 42 const intptr_t offset = assem->CodeSize(); |
| 43 __ Bind(&L); | 43 __ Bind(&L); |
| 44 __ popl(EAX); | 44 __ popl(EAX); |
| 45 __ subl(EAX, | 45 __ subl(EAX, |
| 46 Immediate(offset - AssemblerMacros::kOffsetOfSavedPCfromEntrypoint)); | 46 Immediate(offset - AssemblerMacros::kOffsetOfSavedPCfromEntrypoint)); |
| 47 __ movl(Address(EBP, -kWordSize), EAX); | 47 __ movl(Address(EBP, -kWordSize), EAX); |
| 48 __ popl(EAX); | 48 __ popl(EAX); |
| 49 } | 49 } |
| 50 __ call(&StubCode::DeoptimizeLabel()); | 50 __ call(&StubCode::DeoptimizeLabel()); |
| 51 const intptr_t deopt_info_index = stub_ix; | 51 const intptr_t deopt_info_index = stub_ix; |
| 52 compiler->pc_descriptors_list()->AddDeoptInfo( | 52 compiler->pc_descriptors_list()->AddDeoptIndex( |
| 53 compiler->assembler()->CodeSize(), | 53 compiler->assembler()->CodeSize(), |
| 54 deopt_id_, | 54 deopt_id_, |
| 55 reason_, | 55 reason_, |
| 56 deopt_info_index); | 56 deopt_info_index); |
| 57 #undef __ | 57 #undef __ |
| 58 } | 58 } |
| 59 | 59 |
| 60 | 60 |
| 61 #define __ assembler()-> | 61 #define __ assembler()-> |
| 62 | 62 |
| (...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 const ExternalLabel* label, | 992 const ExternalLabel* label, |
| 993 PcDescriptors::Kind kind, | 993 PcDescriptors::Kind kind, |
| 994 LocationSummary* locs) { | 994 LocationSummary* locs) { |
| 995 ASSERT(!IsLeaf()); | 995 ASSERT(!IsLeaf()); |
| 996 __ call(label); | 996 __ call(label); |
| 997 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); | 997 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); |
| 998 RecordSafepoint(locs); | 998 RecordSafepoint(locs); |
| 999 } | 999 } |
| 1000 | 1000 |
| 1001 | 1001 |
| 1002 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, |
| 1003 intptr_t token_pos, |
| 1004 const ExternalLabel* label, |
| 1005 PcDescriptors::Kind kind, |
| 1006 LocationSummary* locs) { |
| 1007 ASSERT(!IsLeaf()); |
| 1008 __ call(label); |
| 1009 AddCurrentDescriptor(kind, deopt_id, token_pos); |
| 1010 RecordSafepoint(locs); |
| 1011 // Marks either the continuation point in unoptimized code or the |
| 1012 // deoptimization point in optimized code, after call. |
| 1013 if (is_optimizing()) { |
| 1014 AddDeoptIndexAtCall(deopt_id, token_pos); |
| 1015 } else { |
| 1016 // Add deoptimization continuation point after the call and before the |
| 1017 // arguments are removed. |
| 1018 AddCurrentDescriptor(PcDescriptors::kDeoptAfter, |
| 1019 deopt_id, |
| 1020 token_pos); |
| 1021 } |
| 1022 } |
| 1023 |
| 1024 |
| 1002 void FlowGraphCompiler::GenerateCallRuntime(intptr_t deopt_id, | 1025 void FlowGraphCompiler::GenerateCallRuntime(intptr_t deopt_id, |
| 1003 intptr_t token_pos, | 1026 intptr_t token_pos, |
| 1004 const RuntimeEntry& entry, | 1027 const RuntimeEntry& entry, |
| 1005 LocationSummary* locs) { | 1028 LocationSummary* locs) { |
| 1006 ASSERT(!IsLeaf()); | 1029 ASSERT(!IsLeaf()); |
| 1007 __ CallRuntime(entry); | 1030 __ CallRuntime(entry); |
| 1008 AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos); | 1031 AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos); |
| 1009 RecordSafepoint(locs); | 1032 RecordSafepoint(locs); |
| 1010 } | 1033 } |
| 1011 | 1034 |
| 1012 | 1035 |
| 1013 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, | 1036 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, |
| 1014 const ICData& ic_data, | 1037 const ICData& ic_data, |
| 1015 const Array& arguments_descriptor, | 1038 const Array& arguments_descriptor, |
| 1016 intptr_t argument_count, | 1039 intptr_t argument_count, |
| 1017 intptr_t deopt_id, | 1040 intptr_t deopt_id, |
| 1018 intptr_t token_pos, | 1041 intptr_t token_pos, |
| 1019 LocationSummary* locs) { | 1042 LocationSummary* locs) { |
| 1020 ASSERT(!IsLeaf()); | 1043 ASSERT(!IsLeaf()); |
| 1021 __ LoadObject(ECX, ic_data); | 1044 __ LoadObject(ECX, ic_data); |
| 1022 __ LoadObject(EDX, arguments_descriptor); | 1045 __ LoadObject(EDX, arguments_descriptor); |
| 1023 | 1046 GenerateDartCall(deopt_id, |
| 1024 __ call(target_label); | 1047 token_pos, |
| 1025 AddCurrentDescriptor(PcDescriptors::kIcCall, deopt_id, token_pos); | 1048 target_label, |
| 1026 RecordSafepoint(locs); | 1049 PcDescriptors::kIcCall, |
| 1027 | 1050 locs); |
| 1028 __ Drop(argument_count); | 1051 __ Drop(argument_count); |
| 1029 } | 1052 } |
| 1030 | 1053 |
| 1031 | 1054 |
| 1032 void FlowGraphCompiler::EmitStaticCall(const Function& function, | 1055 void FlowGraphCompiler::EmitStaticCall(const Function& function, |
| 1033 const Array& arguments_descriptor, | 1056 const Array& arguments_descriptor, |
| 1034 intptr_t argument_count, | 1057 intptr_t argument_count, |
| 1035 intptr_t deopt_id, | 1058 intptr_t deopt_id, |
| 1036 intptr_t token_pos, | 1059 intptr_t token_pos, |
| 1037 LocationSummary* locs) { | 1060 LocationSummary* locs) { |
| 1038 ASSERT(!IsLeaf()); | 1061 ASSERT(!IsLeaf()); |
| 1039 __ LoadObject(ECX, function); | 1062 __ LoadObject(ECX, function); |
| 1040 __ LoadObject(EDX, arguments_descriptor); | 1063 __ LoadObject(EDX, arguments_descriptor); |
| 1041 __ call(&StubCode::CallStaticFunctionLabel()); | 1064 GenerateDartCall(deopt_id, |
| 1042 AddCurrentDescriptor(PcDescriptors::kFuncCall, deopt_id, token_pos); | 1065 token_pos, |
| 1043 RecordSafepoint(locs); | 1066 &StubCode::CallStaticFunctionLabel(), |
| 1044 if (is_optimizing()) { | 1067 PcDescriptors::kFuncCall, |
| 1045 AddDeoptIndexAtCall(deopt_id, token_pos); | 1068 locs); |
| 1046 } | |
| 1047 __ Drop(argument_count); | 1069 __ Drop(argument_count); |
| 1048 } | 1070 } |
| 1049 | 1071 |
| 1050 | 1072 |
| 1051 void FlowGraphCompiler::LoadDoubleOrSmiToXmm(XmmRegister result, | 1073 void FlowGraphCompiler::LoadDoubleOrSmiToXmm(XmmRegister result, |
| 1052 Register reg, | 1074 Register reg, |
| 1053 Register temp, | 1075 Register temp, |
| 1054 Label* not_double_or_smi) { | 1076 Label* not_double_or_smi) { |
| 1055 Label is_smi, done; | 1077 Label is_smi, done; |
| 1056 __ testl(reg, Immediate(kSmiTagMask)); | 1078 __ testl(reg, Immediate(kSmiTagMask)); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 __ popl(ECX); | 1303 __ popl(ECX); |
| 1282 __ popl(EAX); | 1304 __ popl(EAX); |
| 1283 } | 1305 } |
| 1284 | 1306 |
| 1285 | 1307 |
| 1286 #undef __ | 1308 #undef __ |
| 1287 | 1309 |
| 1288 } // namespace dart | 1310 } // namespace dart |
| 1289 | 1311 |
| 1290 #endif // defined TARGET_ARCH_IA32 | 1312 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |