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 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 GrowableArray<const Instance*> args(3); | 887 GrowableArray<const Instance*> args(3); |
888 args.Add(&receiver); | 888 args.Add(&receiver); |
889 args.Add(&arg1); | 889 args.Add(&arg1); |
890 args.Add(&arg2); | 890 args.Add(&arg2); |
891 const Function& result = | 891 const Function& result = |
892 Function::Handle(InlineCacheMissHandler(args, ic_data)); | 892 Function::Handle(InlineCacheMissHandler(args, ic_data)); |
893 arguments.SetReturn(result); | 893 arguments.SetReturn(result); |
894 } | 894 } |
895 | 895 |
896 | 896 |
| 897 // Handles a static call in unoptimized code that has one argument type not |
| 898 // seen before. Compile the target if necessary and update the ICData. |
| 899 // Arg0: argument. |
| 900 // Arg1: IC data object. |
| 901 DEFINE_RUNTIME_ENTRY(StaticCallMissHandlerOneArg, 2) { |
| 902 const Instance& arg = Instance::CheckedHandle(arguments.ArgAt(0)); |
| 903 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(1)); |
| 904 // IC data for static call is prepopulated with the statically known target. |
| 905 ASSERT(ic_data.NumberOfChecks() == 1); |
| 906 const Function& target = Function::Handle(ic_data.GetTargetAt(0)); |
| 907 if (!target.HasCode()) { |
| 908 const Error& error = Error::Handle(Compiler::CompileFunction(isolate, |
| 909 target)); |
| 910 if (!error.IsNull()) { |
| 911 Exceptions::PropagateError(error); |
| 912 } |
| 913 } |
| 914 ASSERT(!target.IsNull() && target.HasCode()); |
| 915 ic_data.AddReceiverCheck(arg.GetClassId(), target, 1); |
| 916 if (FLAG_trace_ic) { |
| 917 DartFrameIterator iterator; |
| 918 StackFrame* caller_frame = iterator.NextFrame(); |
| 919 ASSERT(caller_frame != NULL); |
| 920 OS::PrintErr("StaticCallMissHandler at %#" Px |
| 921 " target %s (%" Pd ")\n", |
| 922 caller_frame->pc(), target.ToCString(), arg.GetClassId()); |
| 923 } |
| 924 arguments.SetReturn(target); |
| 925 } |
| 926 |
| 927 |
897 // Handles a static call in unoptimized code that has two argument types not | 928 // Handles a static call in unoptimized code that has two argument types not |
898 // seen before. Compile the target if necessary and update the ICData. | 929 // seen before. Compile the target if necessary and update the ICData. |
899 // Arg0: argument 0. | 930 // Arg0: argument 0. |
900 // Arg1: argument 1. | 931 // Arg1: argument 1. |
901 // Arg2: IC data object. | 932 // Arg2: IC data object. |
902 DEFINE_RUNTIME_ENTRY(StaticCallMissHandlerTwoArgs, 3) { | 933 DEFINE_RUNTIME_ENTRY(StaticCallMissHandlerTwoArgs, 3) { |
903 const Instance& arg0 = Instance::CheckedHandle(arguments.ArgAt(0)); | 934 const Instance& arg0 = Instance::CheckedHandle(arguments.ArgAt(0)); |
904 const Instance& arg1 = Instance::CheckedHandle(arguments.ArgAt(1)); | 935 const Instance& arg1 = Instance::CheckedHandle(arguments.ArgAt(1)); |
905 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(2)); | 936 const ICData& ic_data = ICData::CheckedHandle(arguments.ArgAt(2)); |
906 // IC data for static call is prepopulated with the statically known target. | 937 // IC data for static call is prepopulated with the statically known target. |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 field.RecordStore(value); | 1582 field.RecordStore(value); |
1552 } | 1583 } |
1553 | 1584 |
1554 | 1585 |
1555 DEFINE_RUNTIME_ENTRY(InitStaticField, 1) { | 1586 DEFINE_RUNTIME_ENTRY(InitStaticField, 1) { |
1556 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); | 1587 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); |
1557 field.EvaluateInitializer(); | 1588 field.EvaluateInitializer(); |
1558 } | 1589 } |
1559 | 1590 |
1560 } // namespace dart | 1591 } // namespace dart |
OLD | NEW |