| 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/code_generator.h" | 5 #include "vm/code_generator.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 DEFINE_RUNTIME_ENTRY(SingleStepHandler, 0) { | 898 DEFINE_RUNTIME_ENTRY(SingleStepHandler, 0) { |
| 899 ASSERT(arguments.ArgCount() == | 899 ASSERT(arguments.ArgCount() == |
| 900 kSingleStepHandlerRuntimeEntry.argument_count()); | 900 kSingleStepHandlerRuntimeEntry.argument_count()); |
| 901 ASSERT(isolate->debugger() != NULL); | 901 ASSERT(isolate->debugger() != NULL); |
| 902 isolate->debugger()->SingleStepCallback(); | 902 isolate->debugger()->SingleStepCallback(); |
| 903 } | 903 } |
| 904 | 904 |
| 905 | 905 |
| 906 static RawFunction* InlineCacheMissHandler( | 906 static RawFunction* InlineCacheMissHandler( |
| 907 const GrowableArray<const Instance*>& args, | 907 const GrowableArray<const Instance*>& args, |
| 908 const ICData& ic_data, | 908 const ICData& ic_data) { |
| 909 const Array& args_descriptor_array) { | |
| 910 const Instance& receiver = *args[0]; | 909 const Instance& receiver = *args[0]; |
| 911 const Code& target_code = | 910 const Code& target_code = |
| 912 Code::Handle(ResolveCompileInstanceCallTarget(receiver, ic_data)); | 911 Code::Handle(ResolveCompileInstanceCallTarget(receiver, ic_data)); |
| 913 if (target_code.IsNull()) { | 912 if (target_code.IsNull()) { |
| 914 // Let the megamorphic stub handle special cases: NoSuchMethod, | 913 // Let the megamorphic stub handle special cases: NoSuchMethod, |
| 915 // closure calls. | 914 // closure calls. |
| 916 if (FLAG_trace_ic) { | 915 if (FLAG_trace_ic) { |
| 917 OS::PrintErr("InlineCacheMissHandler NULL code for %s receiver: %s\n", | 916 OS::PrintErr("InlineCacheMissHandler NULL code for %s receiver: %s\n", |
| 918 String::Handle(ic_data.target_name()).ToCString(), | 917 String::Handle(ic_data.target_name()).ToCString(), |
| 919 receiver.ToCString()); | 918 receiver.ToCString()); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 } | 955 } |
| 957 } | 956 } |
| 958 return target_function.raw(); | 957 return target_function.raw(); |
| 959 } | 958 } |
| 960 | 959 |
| 961 | 960 |
| 962 // Handles inline cache misses by updating the IC data array of the call | 961 // Handles inline cache misses by updating the IC data array of the call |
| 963 // site. | 962 // site. |
| 964 // Arg0: Receiver object. | 963 // Arg0: Receiver object. |
| 965 // Arg1: IC data object. | 964 // Arg1: IC data object. |
| 966 // Arg2: Arguments descriptor array. | |
| 967 // Returns: target function with compiled code or null. | 965 // Returns: target function with compiled code or null. |
| 968 // Modifies the instance call to hold the updated IC data array. | 966 // Modifies the instance call to hold the updated IC data array. |
| 969 DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerOneArg, 3) { | 967 DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerOneArg, 2) { |
| 970 ASSERT(arguments.ArgCount() == | 968 ASSERT(arguments.ArgCount() == |
| 971 kInlineCacheMissHandlerOneArgRuntimeEntry.argument_count()); | 969 kInlineCacheMissHandlerOneArgRuntimeEntry.argument_count()); |
| 972 const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0)); | 970 const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0)); |
| 973 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(1)); | 971 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(1)); |
| 974 const Array& arg_desc_array = Array::CheckedHandle(arguments.ArgAt(2)); | |
| 975 GrowableArray<const Instance*> args(1); | 972 GrowableArray<const Instance*> args(1); |
| 976 args.Add(&receiver); | 973 args.Add(&receiver); |
| 977 const Function& result = | 974 const Function& result = |
| 978 Function::Handle(InlineCacheMissHandler(args, ic_data, arg_desc_array)); | 975 Function::Handle(InlineCacheMissHandler(args, ic_data)); |
| 979 arguments.SetReturn(result); | 976 arguments.SetReturn(result); |
| 980 } | 977 } |
| 981 | 978 |
| 982 | 979 |
| 983 // Handles inline cache misses by updating the IC data array of the call | 980 // Handles inline cache misses by updating the IC data array of the call |
| 984 // site. | 981 // site. |
| 985 // Arg0: Receiver object. | 982 // Arg0: Receiver object. |
| 986 // Arg1: Argument after receiver. | 983 // Arg1: Argument after receiver. |
| 987 // Arg2: IC data object. | 984 // Arg2: IC data object. |
| 988 // Arg3: Arguments descriptor array. | |
| 989 // Returns: target function with compiled code or null. | 985 // Returns: target function with compiled code or null. |
| 990 // Modifies the instance call to hold the updated IC data array. | 986 // Modifies the instance call to hold the updated IC data array. |
| 991 DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerTwoArgs, 4) { | 987 DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerTwoArgs, 3) { |
| 992 ASSERT(arguments.ArgCount() == | 988 ASSERT(arguments.ArgCount() == |
| 993 kInlineCacheMissHandlerTwoArgsRuntimeEntry.argument_count()); | 989 kInlineCacheMissHandlerTwoArgsRuntimeEntry.argument_count()); |
| 994 const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0)); | 990 const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0)); |
| 995 const Instance& other = Instance::CheckedHandle(arguments.ArgAt(1)); | 991 const Instance& other = Instance::CheckedHandle(arguments.ArgAt(1)); |
| 996 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(2)); | 992 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(2)); |
| 997 const Array& arg_desc_array = Array::CheckedHandle(arguments.ArgAt(3)); | |
| 998 GrowableArray<const Instance*> args(2); | 993 GrowableArray<const Instance*> args(2); |
| 999 args.Add(&receiver); | 994 args.Add(&receiver); |
| 1000 args.Add(&other); | 995 args.Add(&other); |
| 1001 const Function& result = | 996 const Function& result = |
| 1002 Function::Handle(InlineCacheMissHandler(args, ic_data, arg_desc_array)); | 997 Function::Handle(InlineCacheMissHandler(args, ic_data)); |
| 1003 arguments.SetReturn(result); | 998 arguments.SetReturn(result); |
| 1004 } | 999 } |
| 1005 | 1000 |
| 1006 | 1001 |
| 1007 // Handles inline cache misses by updating the IC data array of the call | 1002 // Handles inline cache misses by updating the IC data array of the call |
| 1008 // site. | 1003 // site. |
| 1009 // Arg0: Receiver object. | 1004 // Arg0: Receiver object. |
| 1010 // Arg1: Argument after receiver. | 1005 // Arg1: Argument after receiver. |
| 1011 // Arg2: Second argument after receiver. | 1006 // Arg2: Second argument after receiver. |
| 1012 // Arg3: IC data object. | 1007 // Arg3: IC data object. |
| 1013 // Arg4: Arguments descriptor array. | |
| 1014 // Returns: target function with compiled code or null. | 1008 // Returns: target function with compiled code or null. |
| 1015 // Modifies the instance call to hold the updated IC data array. | 1009 // Modifies the instance call to hold the updated IC data array. |
| 1016 DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerThreeArgs, 5) { | 1010 DEFINE_RUNTIME_ENTRY(InlineCacheMissHandlerThreeArgs, 4) { |
| 1017 ASSERT(arguments.ArgCount() == | 1011 ASSERT(arguments.ArgCount() == |
| 1018 kInlineCacheMissHandlerThreeArgsRuntimeEntry.argument_count()); | 1012 kInlineCacheMissHandlerThreeArgsRuntimeEntry.argument_count()); |
| 1019 const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0)); | 1013 const Instance& receiver = Instance::CheckedHandle(arguments.ArgAt(0)); |
| 1020 const Instance& arg1 = Instance::CheckedHandle(arguments.ArgAt(1)); | 1014 const Instance& arg1 = Instance::CheckedHandle(arguments.ArgAt(1)); |
| 1021 const Instance& arg2 = Instance::CheckedHandle(arguments.ArgAt(2)); | 1015 const Instance& arg2 = Instance::CheckedHandle(arguments.ArgAt(2)); |
| 1022 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(3)); | 1016 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(3)); |
| 1023 const Array& arg_desc_array = Array::CheckedHandle(arguments.ArgAt(4)); | |
| 1024 GrowableArray<const Instance*> args(3); | 1017 GrowableArray<const Instance*> args(3); |
| 1025 args.Add(&receiver); | 1018 args.Add(&receiver); |
| 1026 args.Add(&arg1); | 1019 args.Add(&arg1); |
| 1027 args.Add(&arg2); | 1020 args.Add(&arg2); |
| 1028 const Function& result = | 1021 const Function& result = |
| 1029 Function::Handle(InlineCacheMissHandler(args, ic_data, arg_desc_array)); | 1022 Function::Handle(InlineCacheMissHandler(args, ic_data)); |
| 1030 arguments.SetReturn(result); | 1023 arguments.SetReturn(result); |
| 1031 } | 1024 } |
| 1032 | 1025 |
| 1033 | 1026 |
| 1034 // Handle a miss of a megamorphic cache. | 1027 // Handle a miss of a megamorphic cache. |
| 1035 // Arg0: Receiver. | 1028 // Arg0: Receiver. |
| 1036 // Arg1: ICData object. | 1029 // Arg1: ICData object. |
| 1037 // Arg2: Arguments descriptor array. | 1030 // Arg2: Arguments descriptor array. |
| 1038 | 1031 |
| 1039 // Returns: target instructions to call or null if the | 1032 // Returns: target instructions to call or null if the |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1884 // Arg1: Value that is being stored. | 1877 // Arg1: Value that is being stored. |
| 1885 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { | 1878 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { |
| 1886 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); | 1879 ASSERT(arguments.ArgCount() == kUpdateFieldCidRuntimeEntry.argument_count()); |
| 1887 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); | 1880 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); |
| 1888 const Object& value = Object::Handle(arguments.ArgAt(1)); | 1881 const Object& value = Object::Handle(arguments.ArgAt(1)); |
| 1889 | 1882 |
| 1890 field.UpdateCid(value.GetClassId()); | 1883 field.UpdateCid(value.GetClassId()); |
| 1891 } | 1884 } |
| 1892 | 1885 |
| 1893 } // namespace dart | 1886 } // namespace dart |
| OLD | NEW |