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

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

Issue 2584613002: PATCH (not to be comitted): Support for printing instruction statistics
Patch Set: Fixed polymorphic call inside try, added more tags for remaining unknown code Created 4 years 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
« no previous file with comments | « runtime/vm/flow_graph_compiler.cc ('k') | runtime/vm/flow_graph_compiler_x64.cc » ('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) 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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
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"
11 #include "vm/compiler.h" 11 #include "vm/compiler.h"
12 #include "vm/cpu.h" 12 #include "vm/cpu.h"
13 #include "vm/dart_entry.h" 13 #include "vm/dart_entry.h"
14 #include "vm/deopt_instructions.h" 14 #include "vm/deopt_instructions.h"
15 #include "vm/il_printer.h" 15 #include "vm/il_printer.h"
16 #include "vm/instructions.h" 16 #include "vm/instructions.h"
17 #include "vm/locations.h" 17 #include "vm/locations.h"
18 #include "vm/object_store.h" 18 #include "vm/object_store.h"
19 #include "vm/parser.h" 19 #include "vm/parser.h"
20 #include "vm/stack_frame.h" 20 #include "vm/stack_frame.h"
21 #include "vm/stub_code.h" 21 #include "vm/stub_code.h"
22 #include "vm/symbols.h" 22 #include "vm/symbols.h"
23 #include "vm/code_statistics.h"
23 24
24 namespace dart { 25 namespace dart {
25 26
26 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); 27 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization.");
27 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); 28 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic.");
28 DEFINE_FLAG(bool, unbox_doubles, true, "Optimize double arithmetic."); 29 DEFINE_FLAG(bool, unbox_doubles, true, "Optimize double arithmetic.");
29 DECLARE_FLAG(bool, enable_simd_inline); 30 DECLARE_FLAG(bool, enable_simd_inline);
30 31
31 32
32 FlowGraphCompiler::~FlowGraphCompiler() { 33 FlowGraphCompiler::~FlowGraphCompiler() {
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 // FP: caller's frame pointer. 984 // FP: caller's frame pointer.
984 // PP: caller's pool pointer. 985 // PP: caller's pool pointer.
985 // R9: ic-data. 986 // R9: ic-data.
986 // R4: arguments descriptor array. 987 // R4: arguments descriptor array.
987 void FlowGraphCompiler::CompileGraph() { 988 void FlowGraphCompiler::CompileGraph() {
988 InitCompiler(); 989 InitCompiler();
989 const Function& function = parsed_function().function(); 990 const Function& function = parsed_function().function();
990 991
991 #ifdef DART_PRECOMPILER 992 #ifdef DART_PRECOMPILER
992 if (function.IsDynamicFunction()) { 993 if (function.IsDynamicFunction()) {
994 SpecialStatsBegin(CombinedCodeStatistics::kTagCheckedEntry);
993 __ MonomorphicCheckedEntry(); 995 __ MonomorphicCheckedEntry();
996 SpecialStatsEnd(CombinedCodeStatistics::kTagCheckedEntry);
994 } 997 }
995 #endif // DART_PRECOMPILER 998 #endif // DART_PRECOMPILER
996 999
997 if (TryIntrinsify()) { 1000 if (TryIntrinsify()) {
998 // Skip regular code generation. 1001 // Skip regular code generation.
999 return; 1002 return;
1000 } 1003 }
1001 1004
1005 SpecialStatsBegin(CombinedCodeStatistics::kTagFrameEntry);
1002 EmitFrameEntry(); 1006 EmitFrameEntry();
1007 SpecialStatsEnd(CombinedCodeStatistics::kTagFrameEntry);
1003 ASSERT(assembler()->constant_pool_allowed()); 1008 ASSERT(assembler()->constant_pool_allowed());
1004 1009
1005 const int num_fixed_params = function.num_fixed_parameters(); 1010 const int num_fixed_params = function.num_fixed_parameters();
1006 const int num_copied_params = parsed_function().num_copied_params(); 1011 const int num_copied_params = parsed_function().num_copied_params();
1007 const int num_locals = parsed_function().num_stack_locals(); 1012 const int num_locals = parsed_function().num_stack_locals();
1008 1013
1009 // We check the number of passed arguments when we have to copy them due to 1014 // We check the number of passed arguments when we have to copy them due to
1010 // the presence of optional parameters. 1015 // the presence of optional parameters.
1011 // No such checking code is generated if only fixed parameters are declared, 1016 // No such checking code is generated if only fixed parameters are declared,
1012 // unless we are in debug mode or unless we are compiling a closure. 1017 // unless we are in debug mode or unless we are compiling a closure.
1013 if (num_copied_params == 0) { 1018 if (num_copied_params == 0) {
1014 const bool check_arguments = 1019 const bool check_arguments =
1015 function.IsClosureFunction() && !flow_graph().IsCompiledForOsr(); 1020 function.IsClosureFunction() && !flow_graph().IsCompiledForOsr();
1016 if (check_arguments) { 1021 if (check_arguments) {
1017 __ Comment("Check argument count"); 1022 __ Comment("Check argument count");
1023 SpecialStatsBegin(CombinedCodeStatistics::kTagCheckArgumentCount);
1018 // Check that exactly num_fixed arguments are passed in. 1024 // Check that exactly num_fixed arguments are passed in.
1019 Label correct_num_arguments, wrong_num_arguments; 1025 Label correct_num_arguments, wrong_num_arguments;
1020 __ ldr(R0, FieldAddress(R4, ArgumentsDescriptor::count_offset())); 1026 __ ldr(R0, FieldAddress(R4, ArgumentsDescriptor::count_offset()));
1021 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params)); 1027 __ CompareImmediate(R0, Smi::RawValue(num_fixed_params));
1022 __ b(&wrong_num_arguments, NE); 1028 __ b(&wrong_num_arguments, NE);
1023 __ ldr(R1, 1029 __ ldr(R1,
1024 FieldAddress(R4, ArgumentsDescriptor::positional_count_offset())); 1030 FieldAddress(R4, ArgumentsDescriptor::positional_count_offset()));
1025 __ cmp(R0, Operand(R1)); 1031 __ cmp(R0, Operand(R1));
1026 __ b(&correct_num_arguments, EQ); 1032 __ b(&correct_num_arguments, EQ);
1027 __ Bind(&wrong_num_arguments); 1033 __ Bind(&wrong_num_arguments);
1028 ASSERT(assembler()->constant_pool_allowed()); 1034 ASSERT(assembler()->constant_pool_allowed());
1029 __ LeaveDartFrame(kKeepCalleePP); // Arguments are still on the stack. 1035 __ LeaveDartFrame(kKeepCalleePP); // Arguments are still on the stack.
1030 __ Branch(*StubCode::CallClosureNoSuchMethod_entry()); 1036 __ Branch(*StubCode::CallClosureNoSuchMethod_entry());
1031 // The noSuchMethod call may return to the caller, but not here. 1037 // The noSuchMethod call may return to the caller, but not here.
1032 __ Bind(&correct_num_arguments); 1038 __ Bind(&correct_num_arguments);
1039 SpecialStatsEnd(CombinedCodeStatistics::kTagCheckArgumentCount);
1033 } 1040 }
1034 } else if (!flow_graph().IsCompiledForOsr()) { 1041 } else if (!flow_graph().IsCompiledForOsr()) {
1042 SpecialStatsBegin(CombinedCodeStatistics::kTagCopyParameters);
1035 CopyParameters(); 1043 CopyParameters();
1044 SpecialStatsEnd(CombinedCodeStatistics::kTagCopyParameters);
1036 } 1045 }
1037 1046
1038 if (function.IsClosureFunction() && !flow_graph().IsCompiledForOsr()) { 1047 if (function.IsClosureFunction() && !flow_graph().IsCompiledForOsr()) {
1048 SpecialStatsBegin(CombinedCodeStatistics::kTagLoadClosureContext);
1039 // Load context from the closure object (first argument). 1049 // Load context from the closure object (first argument).
1040 LocalScope* scope = parsed_function().node_sequence()->scope(); 1050 LocalScope* scope = parsed_function().node_sequence()->scope();
1041 LocalVariable* closure_parameter = scope->VariableAt(0); 1051 LocalVariable* closure_parameter = scope->VariableAt(0);
1042 __ ldr(CTX, Address(FP, closure_parameter->index() * kWordSize)); 1052 __ ldr(CTX, Address(FP, closure_parameter->index() * kWordSize));
1043 __ ldr(CTX, FieldAddress(CTX, Closure::context_offset())); 1053 __ ldr(CTX, FieldAddress(CTX, Closure::context_offset()));
1054 SpecialStatsEnd(CombinedCodeStatistics::kTagLoadClosureContext);
1044 } 1055 }
1045 1056
1046 // In unoptimized code, initialize (non-argument) stack allocated slots to 1057 // In unoptimized code, initialize (non-argument) stack allocated slots to
1047 // null. 1058 // null.
1048 if (!is_optimizing()) { 1059 if (!is_optimizing()) {
1049 ASSERT(num_locals > 0); // There is always at least context_var. 1060 ASSERT(num_locals > 0); // There is always at least context_var.
1050 __ Comment("Initialize spill slots"); 1061 __ Comment("Initialize spill slots");
1051 const intptr_t slot_base = parsed_function().first_stack_local_index(); 1062 const intptr_t slot_base = parsed_function().first_stack_local_index();
1052 const intptr_t context_index = 1063 const intptr_t context_index =
1053 parsed_function().current_context_var()->index(); 1064 parsed_function().current_context_var()->index();
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 DRegister dreg = EvenDRegisterOf(reg); 1922 DRegister dreg = EvenDRegisterOf(reg);
1912 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); 1923 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex));
1913 } 1924 }
1914 1925
1915 1926
1916 #undef __ 1927 #undef __
1917 1928
1918 } // namespace dart 1929 } // namespace dart
1919 1930
1920 #endif // defined TARGET_ARCH_ARM 1931 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler.cc ('k') | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698