OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/code_index_table.h" | 7 #include "vm/code_index_table.h" |
8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 ASSERT(arguments.Count() == | 865 ASSERT(arguments.Count() == |
866 kClosureArgumentMismatchRuntimeEntry.argument_count()); | 866 kClosureArgumentMismatchRuntimeEntry.argument_count()); |
867 GrowableArray<const Object*> args; | 867 GrowableArray<const Object*> args; |
868 Exceptions::ThrowByType(Exceptions::kClosureArgumentMismatch, args); | 868 Exceptions::ThrowByType(Exceptions::kClosureArgumentMismatch, args); |
869 } | 869 } |
870 | 870 |
871 | 871 |
872 DEFINE_RUNTIME_ENTRY(StackOverflow, 0) { | 872 DEFINE_RUNTIME_ENTRY(StackOverflow, 0) { |
873 ASSERT(arguments.Count() == | 873 ASSERT(arguments.Count() == |
874 kStackOverflowRuntimeEntry.argument_count()); | 874 kStackOverflowRuntimeEntry.argument_count()); |
875 // Use a preallocated stack overflow exception to avoid calling into | 875 uword stack_pos = reinterpret_cast<uword>(&arguments); |
876 // dart code. | 876 |
877 const Instance& exception = | 877 // If an interrupt happens at the same time as a stack overflow, we |
878 Instance::Handle(isolate->object_store()->stack_overflow()); | 878 // process the stack overflow first. |
879 Exceptions::Throw(exception); | 879 if (stack_pos < isolate->saved_stack_limit()) { |
880 UNREACHABLE(); | 880 // Use the preallocated stack overflow exception to avoid calling |
| 881 // into dart code. |
| 882 const Instance& exception = |
| 883 Instance::Handle(isolate->object_store()->stack_overflow()); |
| 884 Exceptions::Throw(exception); |
| 885 UNREACHABLE(); |
| 886 } |
| 887 |
| 888 uword interrupt_bits = isolate->GetAndClearInterrupts(); |
| 889 if (interrupt_bits & Isolate::kApiInterrupt) { |
| 890 Dart_IsolateInterruptCallback callback = isolate->InterruptCallback(); |
| 891 if (callback) { |
| 892 if ((*callback)()) { |
| 893 return; |
| 894 } else { |
| 895 // TODO(turnidge): Unwind the stack. |
| 896 UNIMPLEMENTED(); |
| 897 } |
| 898 } |
| 899 } |
881 } | 900 } |
882 | 901 |
883 | 902 |
884 // Only unoptimized code has invocation counter threshold checking. | 903 // Only unoptimized code has invocation counter threshold checking. |
885 // Once the invocation counter threshold is reached any entry into the | 904 // Once the invocation counter threshold is reached any entry into the |
886 // unoptimized code is redirected to this function. | 905 // unoptimized code is redirected to this function. |
887 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { | 906 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { |
888 ASSERT(arguments.Count() == | 907 ASSERT(arguments.Count() == |
889 kOptimizeInvokedFunctionRuntimeEntry.argument_count()); | 908 kOptimizeInvokedFunctionRuntimeEntry.argument_count()); |
890 const Function& function = Function::CheckedHandle(arguments.At(0)); | 909 const Function& function = Function::CheckedHandle(arguments.At(0)); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1089 } | 1108 } |
1090 } | 1109 } |
1091 } | 1110 } |
1092 // The cache is null terminated, therefore the loop above should never | 1111 // The cache is null terminated, therefore the loop above should never |
1093 // terminate by itself. | 1112 // terminate by itself. |
1094 UNREACHABLE(); | 1113 UNREACHABLE(); |
1095 return Code::null(); | 1114 return Code::null(); |
1096 } | 1115 } |
1097 | 1116 |
1098 } // namespace dart | 1117 } // namespace dart |
OLD | NEW |