Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: runtime/vm/flow_graph_compiler_ia32.cc

Issue 10885039: Deoptimization can occur at Dart calls (includes native calls to C) but not at runtime calls. This … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 const ExternalLabel* label, 990 const ExternalLabel* label,
991 PcDescriptors::Kind kind, 991 PcDescriptors::Kind kind,
992 LocationSummary* locs) { 992 LocationSummary* locs) {
993 ASSERT(!IsLeaf()); 993 ASSERT(!IsLeaf());
994 __ call(label); 994 __ call(label);
995 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); 995 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos);
996 RecordSafepoint(locs); 996 RecordSafepoint(locs);
997 } 997 }
998 998
999 999
1000 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id,
1001 intptr_t token_pos,
1002 const ExternalLabel* label,
1003 PcDescriptors::Kind kind,
1004 LocationSummary* locs) {
1005 ASSERT(!IsLeaf());
1006 __ call(label);
1007 AddCurrentDescriptor(kind, deopt_id, token_pos);
1008 RecordSafepoint(locs);
1009 // Marks either the continuation point in unoptimized code or the
1010 // deoptimization point in optimized code, after call.
1011 if (is_optimizing()) {
1012 AddDeoptIndexAtCall(deopt_id, token_pos);
1013 } else {
1014 // Add deoptimization continuation point after the call and before the
1015 // arguments are removed.
1016 AddCurrentDescriptor(PcDescriptors::kDeoptAfter,
1017 deopt_id,
1018 token_pos);
1019 }
1020 }
1021
1022
1000 void FlowGraphCompiler::GenerateCallRuntime(intptr_t deopt_id, 1023 void FlowGraphCompiler::GenerateCallRuntime(intptr_t deopt_id,
1001 intptr_t token_pos, 1024 intptr_t token_pos,
1002 const RuntimeEntry& entry, 1025 const RuntimeEntry& entry,
1003 LocationSummary* locs) { 1026 LocationSummary* locs) {
1004 ASSERT(!IsLeaf()); 1027 ASSERT(!IsLeaf());
1005 __ CallRuntime(entry); 1028 __ CallRuntime(entry);
1006 AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos); 1029 AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos);
1007 RecordSafepoint(locs); 1030 RecordSafepoint(locs);
1008 } 1031 }
1009 1032
1010 1033
1011 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, 1034 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label,
1012 const ICData& ic_data, 1035 const ICData& ic_data,
1013 const Array& arguments_descriptor, 1036 const Array& arguments_descriptor,
1014 intptr_t argument_count, 1037 intptr_t argument_count,
1015 intptr_t deopt_id, 1038 intptr_t deopt_id,
1016 intptr_t token_pos, 1039 intptr_t token_pos,
1017 LocationSummary* locs) { 1040 LocationSummary* locs) {
1018 ASSERT(!IsLeaf()); 1041 ASSERT(!IsLeaf());
1019 __ LoadObject(ECX, ic_data); 1042 __ LoadObject(ECX, ic_data);
1020 __ LoadObject(EDX, arguments_descriptor); 1043 __ LoadObject(EDX, arguments_descriptor);
1021 1044 GenerateDartCall(deopt_id,
1022 __ call(target_label); 1045 token_pos,
1023 AddCurrentDescriptor(PcDescriptors::kIcCall, deopt_id, token_pos); 1046 target_label,
1024 RecordSafepoint(locs); 1047 PcDescriptors::kIcCall,
1025 1048 locs);
1026 __ Drop(argument_count); 1049 __ Drop(argument_count);
1027 } 1050 }
1028 1051
1029 1052
1030 void FlowGraphCompiler::EmitStaticCall(const Function& function, 1053 void FlowGraphCompiler::EmitStaticCall(const Function& function,
1031 const Array& arguments_descriptor, 1054 const Array& arguments_descriptor,
1032 intptr_t argument_count, 1055 intptr_t argument_count,
1033 intptr_t deopt_id, 1056 intptr_t deopt_id,
1034 intptr_t token_pos, 1057 intptr_t token_pos,
1035 LocationSummary* locs) { 1058 LocationSummary* locs) {
1036 ASSERT(!IsLeaf()); 1059 ASSERT(!IsLeaf());
1037 __ LoadObject(ECX, function); 1060 __ LoadObject(ECX, function);
1038 __ LoadObject(EDX, arguments_descriptor); 1061 __ LoadObject(EDX, arguments_descriptor);
1039 __ call(&StubCode::CallStaticFunctionLabel()); 1062 GenerateDartCall(deopt_id,
1040 AddCurrentDescriptor(PcDescriptors::kFuncCall, deopt_id, token_pos); 1063 token_pos,
1041 RecordSafepoint(locs); 1064 &StubCode::CallStaticFunctionLabel(),
1042 if (is_optimizing()) { 1065 PcDescriptors::kFuncCall,
1043 AddDeoptIndexAtCall(deopt_id, token_pos); 1066 locs);
1044 }
1045 __ Drop(argument_count); 1067 __ Drop(argument_count);
1046 } 1068 }
1047 1069
1048 1070
1049 // Checks class id of instance against all 'class_ids'. Jump to 'deopt' label 1071 // Checks class id of instance against all 'class_ids'. Jump to 'deopt' label
1050 // if no match or instance is Smi. 1072 // if no match or instance is Smi.
1051 void FlowGraphCompiler::EmitClassChecksNoSmi(const ICData& ic_data, 1073 void FlowGraphCompiler::EmitClassChecksNoSmi(const ICData& ic_data,
1052 Register instance_reg, 1074 Register instance_reg,
1053 Register temp_reg, 1075 Register temp_reg,
1054 Label* deopt) { 1076 Label* deopt) {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 __ popl(ECX); 1320 __ popl(ECX);
1299 __ popl(EAX); 1321 __ popl(EAX);
1300 } 1322 }
1301 1323
1302 1324
1303 #undef __ 1325 #undef __
1304 1326
1305 } // namespace dart 1327 } // namespace dart
1306 1328
1307 #endif // defined TARGET_ARCH_IA32 1329 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698