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

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

Issue 11086044: Remove support for optimized dart leaf functions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 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
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.h ('k') | runtime/vm/flow_graph_compiler_x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 26 matching lines...) Expand all
37 // Calls do not need stubs, they share a deoptimization trampoline. 37 // Calls do not need stubs, they share a deoptimization trampoline.
38 ASSERT(reason() != kDeoptAtCall); 38 ASSERT(reason() != kDeoptAtCall);
39 Assembler* assem = compiler->assembler(); 39 Assembler* assem = compiler->assembler();
40 #define __ assem-> 40 #define __ assem->
41 __ Comment("Deopt stub for id %"Pd"", deopt_id()); 41 __ Comment("Deopt stub for id %"Pd"", deopt_id());
42 __ Bind(entry_label()); 42 __ Bind(entry_label());
43 if (FLAG_trap_on_deoptimization) __ int3(); 43 if (FLAG_trap_on_deoptimization) __ int3();
44 44
45 ASSERT(deoptimization_env() != NULL); 45 ASSERT(deoptimization_env() != NULL);
46 46
47 if (compiler->IsLeaf()) {
48 Label L;
49 __ pushl(EAX); // Preserve EAX.
50 __ call(&L);
51 const intptr_t offset = assem->CodeSize();
52 __ Bind(&L);
53 __ popl(EAX);
54 __ subl(EAX,
55 Immediate(offset - AssemblerMacros::kOffsetOfSavedPCfromEntrypoint));
56 __ movl(Address(EBP, -kWordSize), EAX);
57 __ popl(EAX);
58 }
59 __ call(&StubCode::DeoptimizeLabel()); 47 __ call(&StubCode::DeoptimizeLabel());
60 set_pc_offset(assem->CodeSize()); 48 set_pc_offset(assem->CodeSize());
61 #undef __ 49 #undef __
62 } 50 }
63 51
64 52
65 #define __ assembler()-> 53 #define __ assembler()->
66 54
67 55
68 // Fall through if bool_register contains null. 56 // Fall through if bool_register contains null.
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 // dropped the spill slots. 806 // dropped the spill slots.
819 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder(); 807 BitmapBuilder* empty_stack_bitmap = new BitmapBuilder();
820 if (function.IsClosureFunction()) { 808 if (function.IsClosureFunction()) {
821 // We do not use GenerateCallRuntime because of the non-standard (empty) 809 // We do not use GenerateCallRuntime because of the non-standard (empty)
822 // stackmap used here. 810 // stackmap used here.
823 __ CallRuntime(kClosureArgumentMismatchRuntimeEntry); 811 __ CallRuntime(kClosureArgumentMismatchRuntimeEntry);
824 AddCurrentDescriptor(PcDescriptors::kOther, 812 AddCurrentDescriptor(PcDescriptors::kOther,
825 Isolate::kNoDeoptId, 813 Isolate::kNoDeoptId,
826 0); // No token position. 814 0); // No token position.
827 } else { 815 } else {
828 ASSERT(!IsLeaf());
829 // Invoke noSuchMethod function. 816 // Invoke noSuchMethod function.
830 const int kNumArgsChecked = 1; 817 const int kNumArgsChecked = 1;
831 ICData& ic_data = ICData::ZoneHandle(); 818 ICData& ic_data = ICData::ZoneHandle();
832 ic_data = ICData::New(function, 819 ic_data = ICData::New(function,
833 String::Handle(function.name()), 820 String::Handle(function.name()),
834 Isolate::kNoDeoptId, 821 Isolate::kNoDeoptId,
835 kNumArgsChecked); 822 kNumArgsChecked);
836 __ LoadObject(ECX, ic_data); 823 __ LoadObject(ECX, ic_data);
837 // EBP - 4 : PC marker, allows easy identification of RawInstruction obj. 824 // EBP - 4 : PC marker, allows easy identification of RawInstruction obj.
838 // EBP : points to previous frame pointer. 825 // EBP : points to previous frame pointer.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 __ jmp(&StubCode::FixCallersTargetLabel()); 913 __ jmp(&StubCode::FixCallersTargetLabel());
927 return; 914 return;
928 } 915 }
929 // Specialized version of entry code from CodeGenerator::GenerateEntryCode. 916 // Specialized version of entry code from CodeGenerator::GenerateEntryCode.
930 const Function& function = parsed_function().function(); 917 const Function& function = parsed_function().function();
931 918
932 const int num_fixed_params = function.num_fixed_parameters(); 919 const int num_fixed_params = function.num_fixed_parameters();
933 const int num_copied_params = parsed_function().num_copied_params(); 920 const int num_copied_params = parsed_function().num_copied_params();
934 const int num_locals = parsed_function().num_stack_locals(); 921 const int num_locals = parsed_function().num_stack_locals();
935 __ Comment("Enter frame"); 922 __ Comment("Enter frame");
936 if (IsLeaf()) { 923 AssemblerMacros::EnterDartFrame(assembler(), (StackSize() * kWordSize));
937 AssemblerMacros::EnterDartLeafFrame(assembler(), (StackSize() * kWordSize));
938 } else {
939 AssemblerMacros::EnterDartFrame(assembler(), (StackSize() * kWordSize));
940 }
941 924
942 // For optimized code, keep a bitmap of the frame in order to build 925 // For optimized code, keep a bitmap of the frame in order to build
943 // stackmaps for GC safepoints in the prologue. 926 // stackmaps for GC safepoints in the prologue.
944 LocationSummary* prologue_locs = NULL; 927 LocationSummary* prologue_locs = NULL;
945 if (is_optimizing()) { 928 if (is_optimizing()) {
946 // Spill slots are allocated but not initialized. 929 // Spill slots are allocated but not initialized.
947 prologue_locs = new LocationSummary(0, 0, LocationSummary::kCall); 930 prologue_locs = new LocationSummary(0, 0, LocationSummary::kCall);
948 prologue_locs->stack_bitmap()->SetLength(StackSize()); 931 prologue_locs->stack_bitmap()->SetLength(StackSize());
949 } 932 }
950 933
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 Isolate::kNoDeoptId, 1017 Isolate::kNoDeoptId,
1035 0); // No token position. 1018 0); // No token position.
1036 __ jmp(&StubCode::DeoptimizeLazyLabel()); 1019 __ jmp(&StubCode::DeoptimizeLazyLabel());
1037 } 1020 }
1038 1021
1039 1022
1040 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, 1023 void FlowGraphCompiler::GenerateCall(intptr_t token_pos,
1041 const ExternalLabel* label, 1024 const ExternalLabel* label,
1042 PcDescriptors::Kind kind, 1025 PcDescriptors::Kind kind,
1043 LocationSummary* locs) { 1026 LocationSummary* locs) {
1044 ASSERT(!IsLeaf());
1045 __ call(label); 1027 __ call(label);
1046 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); 1028 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos);
1047 RecordSafepoint(locs); 1029 RecordSafepoint(locs);
1048 } 1030 }
1049 1031
1050 1032
1051 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, 1033 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id,
1052 intptr_t token_pos, 1034 intptr_t token_pos,
1053 const ExternalLabel* label, 1035 const ExternalLabel* label,
1054 PcDescriptors::Kind kind, 1036 PcDescriptors::Kind kind,
1055 LocationSummary* locs) { 1037 LocationSummary* locs) {
1056 ASSERT(!IsLeaf());
1057 __ call(label); 1038 __ call(label);
1058 AddCurrentDescriptor(kind, deopt_id, token_pos); 1039 AddCurrentDescriptor(kind, deopt_id, token_pos);
1059 RecordSafepoint(locs); 1040 RecordSafepoint(locs);
1060 // Marks either the continuation point in unoptimized code or the 1041 // Marks either the continuation point in unoptimized code or the
1061 // deoptimization point in optimized code, after call. 1042 // deoptimization point in optimized code, after call.
1062 if (is_optimizing()) { 1043 if (is_optimizing()) {
1063 AddDeoptIndexAtCall(deopt_id, token_pos); 1044 AddDeoptIndexAtCall(deopt_id, token_pos);
1064 } else { 1045 } else {
1065 // Add deoptimization continuation point after the call and before the 1046 // Add deoptimization continuation point after the call and before the
1066 // arguments are removed. 1047 // arguments are removed.
1067 AddCurrentDescriptor(PcDescriptors::kDeoptAfter, 1048 AddCurrentDescriptor(PcDescriptors::kDeoptAfter,
1068 deopt_id, 1049 deopt_id,
1069 token_pos); 1050 token_pos);
1070 } 1051 }
1071 } 1052 }
1072 1053
1073 1054
1074 void FlowGraphCompiler::GenerateCallRuntime(intptr_t token_pos, 1055 void FlowGraphCompiler::GenerateCallRuntime(intptr_t token_pos,
1075 const RuntimeEntry& entry, 1056 const RuntimeEntry& entry,
1076 LocationSummary* locs) { 1057 LocationSummary* locs) {
1077 ASSERT(!IsLeaf());
1078 __ CallRuntime(entry); 1058 __ CallRuntime(entry);
1079 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos); 1059 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos);
1080 RecordSafepoint(locs); 1060 RecordSafepoint(locs);
1081 } 1061 }
1082 1062
1083 1063
1084 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, 1064 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label,
1085 const ICData& ic_data, 1065 const ICData& ic_data,
1086 const Array& arguments_descriptor, 1066 const Array& arguments_descriptor,
1087 intptr_t argument_count, 1067 intptr_t argument_count,
1088 intptr_t deopt_id, 1068 intptr_t deopt_id,
1089 intptr_t token_pos, 1069 intptr_t token_pos,
1090 LocationSummary* locs) { 1070 LocationSummary* locs) {
1091 ASSERT(!IsLeaf());
1092 __ LoadObject(ECX, ic_data); 1071 __ LoadObject(ECX, ic_data);
1093 __ LoadObject(EDX, arguments_descriptor); 1072 __ LoadObject(EDX, arguments_descriptor);
1094 GenerateDartCall(deopt_id, 1073 GenerateDartCall(deopt_id,
1095 token_pos, 1074 token_pos,
1096 target_label, 1075 target_label,
1097 PcDescriptors::kIcCall, 1076 PcDescriptors::kIcCall,
1098 locs); 1077 locs);
1099 __ Drop(argument_count); 1078 __ Drop(argument_count);
1100 } 1079 }
1101 1080
1102 1081
1103 void FlowGraphCompiler::EmitStaticCall(const Function& function, 1082 void FlowGraphCompiler::EmitStaticCall(const Function& function,
1104 const Array& arguments_descriptor, 1083 const Array& arguments_descriptor,
1105 intptr_t argument_count, 1084 intptr_t argument_count,
1106 intptr_t deopt_id, 1085 intptr_t deopt_id,
1107 intptr_t token_pos, 1086 intptr_t token_pos,
1108 LocationSummary* locs) { 1087 LocationSummary* locs) {
1109 ASSERT(!IsLeaf());
1110 __ LoadObject(ECX, function); 1088 __ LoadObject(ECX, function);
1111 __ LoadObject(EDX, arguments_descriptor); 1089 __ LoadObject(EDX, arguments_descriptor);
1112 if (function.HasCode()) { 1090 if (function.HasCode()) {
1113 const Code& code = Code::Handle(function.CurrentCode()); 1091 const Code& code = Code::Handle(function.CurrentCode());
1114 ExternalLabel target_label(function.ToFullyQualifiedCString(), 1092 ExternalLabel target_label(function.ToFullyQualifiedCString(),
1115 code.EntryPoint()); 1093 code.EntryPoint());
1116 GenerateDartCall(deopt_id, 1094 GenerateDartCall(deopt_id,
1117 token_pos, 1095 token_pos,
1118 &target_label, 1096 &target_label,
1119 PcDescriptors::kFuncCall, 1097 PcDescriptors::kFuncCall,
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
1381 __ popl(ECX); 1359 __ popl(ECX);
1382 __ popl(EAX); 1360 __ popl(EAX);
1383 } 1361 }
1384 1362
1385 1363
1386 #undef __ 1364 #undef __
1387 1365
1388 } // namespace dart 1366 } // namespace dart
1389 1367
1390 #endif // defined TARGET_ARCH_IA32 1368 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.h ('k') | runtime/vm/flow_graph_compiler_x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698