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

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

Issue 315583002: First step in reducing the size of PC descriptors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: addressed comments, added arm64 file. Created 6 years, 6 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "vm/ast_printer.h" 10 #include "vm/ast_printer.h"
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 } 980 }
981 981
982 982
983 void FlowGraphCompiler::EmitFrameEntry() { 983 void FlowGraphCompiler::EmitFrameEntry() {
984 const Function& function = parsed_function().function(); 984 const Function& function = parsed_function().function();
985 if (CanOptimizeFunction() && 985 if (CanOptimizeFunction() &&
986 function.IsOptimizable() && 986 function.IsOptimizable() &&
987 (!is_optimizing() || may_reoptimize())) { 987 (!is_optimizing() || may_reoptimize())) {
988 const Register function_reg = EDI; 988 const Register function_reg = EDI;
989 __ LoadObject(function_reg, function); 989 __ LoadObject(function_reg, function);
990
990 // Patch point is after the eventually inlined function object. 991 // Patch point is after the eventually inlined function object.
991 AddCurrentDescriptor(PcDescriptors::kEntryPatch, 992 entry_patch_pc_offset_ = assembler()->CodeSize();
992 Isolate::kNoDeoptId, 993
993 0); // No token position.
994 if (is_optimizing()) { 994 if (is_optimizing()) {
995 // Reoptimization of an optimized function is triggered by counting in 995 // Reoptimization of an optimized function is triggered by counting in
996 // IC stubs, but not at the entry of the function. 996 // IC stubs, but not at the entry of the function.
997 __ cmpl(FieldAddress(function_reg, Function::usage_counter_offset()), 997 __ cmpl(FieldAddress(function_reg, Function::usage_counter_offset()),
998 Immediate(FLAG_reoptimization_counter_threshold)); 998 Immediate(FLAG_reoptimization_counter_threshold));
999 } else { 999 } else {
1000 __ incl(FieldAddress(function_reg, Function::usage_counter_offset())); 1000 __ incl(FieldAddress(function_reg, Function::usage_counter_offset()));
1001 __ cmpl(FieldAddress(function_reg, Function::usage_counter_offset()), 1001 __ cmpl(FieldAddress(function_reg, Function::usage_counter_offset()),
1002 Immediate(FLAG_optimization_counter_threshold)); 1002 Immediate(FLAG_optimization_counter_threshold));
1003 } 1003 }
1004 ASSERT(function_reg == EDI); 1004 ASSERT(function_reg == EDI);
1005 __ j(GREATER_EQUAL, &StubCode::OptimizeFunctionLabel()); 1005 __ j(GREATER_EQUAL, &StubCode::OptimizeFunctionLabel());
1006 } else if (!flow_graph().IsCompiledForOsr()) { 1006 } else if (!flow_graph().IsCompiledForOsr()) {
1007 AddCurrentDescriptor(PcDescriptors::kEntryPatch, 1007 entry_patch_pc_offset_ = assembler()->CodeSize();
1008 Isolate::kNoDeoptId,
1009 0); // No token position.
1010 } 1008 }
1011 __ Comment("Enter frame"); 1009 __ Comment("Enter frame");
1012 if (flow_graph().IsCompiledForOsr()) { 1010 if (flow_graph().IsCompiledForOsr()) {
1013 intptr_t extra_slots = StackSize() 1011 intptr_t extra_slots = StackSize()
1014 - flow_graph().num_stack_locals() 1012 - flow_graph().num_stack_locals()
1015 - flow_graph().num_copied_params(); 1013 - flow_graph().num_copied_params();
1016 ASSERT(extra_slots >= 0); 1014 ASSERT(extra_slots >= 0);
1017 __ EnterOsrFrame(extra_slots * kWordSize); 1015 __ EnterOsrFrame(extra_slots * kWordSize);
1018 } else { 1016 } else {
1019 ASSERT(StackSize() >= 0); 1017 ASSERT(StackSize() >= 0);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 } 1097 }
1100 } 1098 }
1101 1099
1102 ASSERT(!block_order().is_empty()); 1100 ASSERT(!block_order().is_empty());
1103 VisitBlocks(); 1101 VisitBlocks();
1104 1102
1105 __ int3(); 1103 __ int3();
1106 GenerateDeferredCode(); 1104 GenerateDeferredCode();
1107 // Emit function patching code. This will be swapped with the first 5 bytes 1105 // Emit function patching code. This will be swapped with the first 5 bytes
1108 // at entry point. 1106 // at entry point.
1109 AddCurrentDescriptor(PcDescriptors::kPatchCode, 1107 patch_code_pc_offset_ = assembler()->CodeSize();
1110 Isolate::kNoDeoptId,
1111 0); // No token position.
1112 __ jmp(&StubCode::FixCallersTargetLabel()); 1108 __ jmp(&StubCode::FixCallersTargetLabel());
1113 AddCurrentDescriptor(PcDescriptors::kLazyDeoptJump, 1109
1114 Isolate::kNoDeoptId, 1110 if (is_optimizing()) {
1115 0); // No token position. 1111 lazy_deopt_pc_offset_ = assembler()->CodeSize();
1116 __ jmp(&StubCode::DeoptimizeLazyLabel()); 1112 __ jmp(&StubCode::DeoptimizeLazyLabel());
1113 }
1117 } 1114 }
1118 1115
1119 1116
1120 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, 1117 void FlowGraphCompiler::GenerateCall(intptr_t token_pos,
1121 const ExternalLabel* label, 1118 const ExternalLabel* label,
1122 PcDescriptors::Kind kind, 1119 PcDescriptors::Kind kind,
1123 LocationSummary* locs) { 1120 LocationSummary* locs) {
1124 __ call(label); 1121 __ call(label);
1125 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); 1122 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos);
1126 RecordSafepoint(locs); 1123 RecordSafepoint(locs);
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
1766 __ movups(reg, Address(ESP, 0)); 1763 __ movups(reg, Address(ESP, 0));
1767 __ addl(ESP, Immediate(kFpuRegisterSize)); 1764 __ addl(ESP, Immediate(kFpuRegisterSize));
1768 } 1765 }
1769 1766
1770 1767
1771 #undef __ 1768 #undef __
1772 1769
1773 } // namespace dart 1770 } // namespace dart
1774 1771
1775 #endif // defined TARGET_ARCH_IA32 1772 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698