OLD | NEW |
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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
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 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 __ movq(RBX, Address(RSP, 1 * kWordSize)); // Value. | 977 __ movq(RBX, Address(RSP, 1 * kWordSize)); // Value. |
978 __ StoreIntoObject(RAX, FieldAddress(RAX, offset), RBX); | 978 __ StoreIntoObject(RAX, FieldAddress(RAX, offset), RBX); |
979 __ LoadObject(RAX, Object::null_object()); | 979 __ LoadObject(RAX, Object::null_object()); |
980 __ ret(); | 980 __ ret(); |
981 } | 981 } |
982 | 982 |
983 | 983 |
984 // NOTE: If the entry code shape changes, ReturnAddressLocator in profiler.cc | 984 // NOTE: If the entry code shape changes, ReturnAddressLocator in profiler.cc |
985 // needs to be updated to match. | 985 // needs to be updated to match. |
986 void FlowGraphCompiler::EmitFrameEntry() { | 986 void FlowGraphCompiler::EmitFrameEntry() { |
987 const Function& function = parsed_function().function(); | |
988 // Load pool pointer. | |
989 | |
990 if (flow_graph().IsCompiledForOsr()) { | 987 if (flow_graph().IsCompiledForOsr()) { |
991 intptr_t extra_slots = StackSize() | 988 intptr_t extra_slots = StackSize() |
992 - flow_graph().num_stack_locals() | 989 - flow_graph().num_stack_locals() |
993 - flow_graph().num_copied_params(); | 990 - flow_graph().num_copied_params(); |
994 ASSERT(extra_slots >= 0); | 991 ASSERT(extra_slots >= 0); |
995 __ EnterOsrFrame(extra_slots * kWordSize); | 992 __ EnterOsrFrame(extra_slots * kWordSize); |
996 } else { | 993 } else { |
997 const Register new_pp = R13; | 994 const Register new_pp = R13; |
998 __ LoadPoolPointer(new_pp); | 995 __ LoadPoolPointer(new_pp); |
999 | 996 |
| 997 const Function& function = parsed_function().function(); |
1000 if (CanOptimizeFunction() && | 998 if (CanOptimizeFunction() && |
1001 function.IsOptimizable() && | 999 function.IsOptimizable() && |
1002 (!is_optimizing() || may_reoptimize())) { | 1000 (!is_optimizing() || may_reoptimize())) { |
1003 __ Comment("Invocation Count Check"); | 1001 __ Comment("Invocation Count Check"); |
1004 const Register function_reg = RDI; | 1002 const Register function_reg = RDI; |
1005 // Load function object using the callee's pool pointer. | 1003 // Load function object using the callee's pool pointer. |
1006 __ LoadFunctionFromCalleePool(function_reg, function, new_pp); | 1004 __ LoadFunctionFromCalleePool(function_reg, function, new_pp); |
1007 | 1005 |
1008 // Reoptimization of an optimized function is triggered by counting in | 1006 // Reoptimization of an optimized function is triggered by counting in |
1009 // IC stubs, but not at the entry of the function. | 1007 // IC stubs, but not at the entry of the function. |
(...skipping 10 matching lines...) Expand all Loading... |
1020 } | 1018 } |
1021 ASSERT(StackSize() >= 0); | 1019 ASSERT(StackSize() >= 0); |
1022 __ Comment("Enter frame"); | 1020 __ Comment("Enter frame"); |
1023 __ EnterDartFrame(StackSize() * kWordSize, new_pp); | 1021 __ EnterDartFrame(StackSize() * kWordSize, new_pp); |
1024 } | 1022 } |
1025 } | 1023 } |
1026 | 1024 |
1027 | 1025 |
1028 void FlowGraphCompiler::CompileGraph() { | 1026 void FlowGraphCompiler::CompileGraph() { |
1029 InitCompiler(); | 1027 InitCompiler(); |
| 1028 const Function& function = parsed_function().function(); |
| 1029 |
| 1030 #ifdef DART_PRECOMPILER |
| 1031 if (function.IsDynamicFunction()) { |
| 1032 __ MonomorphicCheckedEntry(); |
| 1033 } |
| 1034 #endif // DART_PRECOMPILER |
1030 | 1035 |
1031 if (TryIntrinsify()) { | 1036 if (TryIntrinsify()) { |
1032 // Skip regular code generation. | 1037 // Skip regular code generation. |
1033 return; | 1038 return; |
1034 } | 1039 } |
1035 | 1040 |
1036 EmitFrameEntry(); | 1041 EmitFrameEntry(); |
1037 ASSERT(assembler()->constant_pool_allowed()); | 1042 ASSERT(assembler()->constant_pool_allowed()); |
1038 | 1043 |
1039 const Function& function = parsed_function().function(); | |
1040 | |
1041 const int num_fixed_params = function.num_fixed_parameters(); | 1044 const int num_fixed_params = function.num_fixed_parameters(); |
1042 const int num_copied_params = parsed_function().num_copied_params(); | 1045 const int num_copied_params = parsed_function().num_copied_params(); |
1043 const int num_locals = parsed_function().num_stack_locals(); | 1046 const int num_locals = parsed_function().num_stack_locals(); |
1044 | 1047 |
1045 // We check the number of passed arguments when we have to copy them due to | 1048 // We check the number of passed arguments when we have to copy them due to |
1046 // the presence of optional parameters. | 1049 // the presence of optional parameters. |
1047 // No such checking code is generated if only fixed parameters are declared, | 1050 // No such checking code is generated if only fixed parameters are declared, |
1048 // unless we are in debug mode or unless we are compiling a closure. | 1051 // unless we are in debug mode or unless we are compiling a closure. |
1049 if (num_copied_params == 0) { | 1052 if (num_copied_params == 0) { |
1050 const bool check_arguments = | 1053 const bool check_arguments = |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1840 __ movups(reg, Address(RSP, 0)); | 1843 __ movups(reg, Address(RSP, 0)); |
1841 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); | 1844 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); |
1842 } | 1845 } |
1843 | 1846 |
1844 | 1847 |
1845 #undef __ | 1848 #undef __ |
1846 | 1849 |
1847 } // namespace dart | 1850 } // namespace dart |
1848 | 1851 |
1849 #endif // defined TARGET_ARCH_X64 | 1852 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |