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 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 ASSERT(arguments.Count() == | 814 ASSERT(arguments.Count() == |
815 kClosureArgumentMismatchRuntimeEntry.argument_count()); | 815 kClosureArgumentMismatchRuntimeEntry.argument_count()); |
816 GrowableArray<const Object*> args; | 816 GrowableArray<const Object*> args; |
817 Exceptions::ThrowByType(Exceptions::kClosureArgumentMismatch, args); | 817 Exceptions::ThrowByType(Exceptions::kClosureArgumentMismatch, args); |
818 } | 818 } |
819 | 819 |
820 | 820 |
821 DEFINE_RUNTIME_ENTRY(StackOverflow, 0) { | 821 DEFINE_RUNTIME_ENTRY(StackOverflow, 0) { |
822 ASSERT(arguments.Count() == | 822 ASSERT(arguments.Count() == |
823 kStackOverflowRuntimeEntry.argument_count()); | 823 kStackOverflowRuntimeEntry.argument_count()); |
824 // Use a preallocated stack overflow exception to avoid calling into | 824 uword stack_pos; |
825 // dart code. | 825 stack_pos = (uword) &stack_pos; |
826 const Instance& exception = | 826 |
827 Instance::Handle(isolate->object_store()->stack_overflow()); | 827 // If an interrupt happens at the same time as a stack overflow, we |
828 Exceptions::Throw(exception); | 828 // process the stack overflow first. |
829 UNREACHABLE(); | 829 if (stack_pos < isolate->saved_stack_limit()) { |
| 830 // Use a preallocated stack overflow exception to avoid calling |
| 831 // into dart code. |
| 832 const Instance& exception = |
| 833 Instance::Handle(isolate->object_store()->stack_overflow()); |
| 834 Exceptions::Throw(exception); |
| 835 UNREACHABLE(); |
| 836 } |
| 837 |
| 838 uword interrupt_bits = isolate->GetAndClearInterrupts(); |
| 839 if (interrupt_bits & Isolate::kApiInterrupt) { |
| 840 Dart_IsolateInterruptCallback callback = isolate->InterruptCallback(); |
| 841 if (callback) { |
| 842 if ((*callback)()) { |
| 843 return; |
| 844 } else { |
| 845 UNIMPLEMENTED(); |
| 846 } |
| 847 } |
| 848 } |
830 } | 849 } |
831 | 850 |
832 | 851 |
833 // Only unoptimized code has invocation counter threshold checking. | 852 // Only unoptimized code has invocation counter threshold checking. |
834 // Once the invocation counter threshold is reached any entry into the | 853 // Once the invocation counter threshold is reached any entry into the |
835 // unoptimized code is redirected to this function. | 854 // unoptimized code is redirected to this function. |
836 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { | 855 DEFINE_RUNTIME_ENTRY(OptimizeInvokedFunction, 1) { |
837 ASSERT(arguments.Count() == | 856 ASSERT(arguments.Count() == |
838 kOptimizeInvokedFunctionRuntimeEntry.argument_count()); | 857 kOptimizeInvokedFunctionRuntimeEntry.argument_count()); |
839 const Function& function = Function::CheckedHandle(arguments.At(0)); | 858 const Function& function = Function::CheckedHandle(arguments.At(0)); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 } | 1057 } |
1039 } | 1058 } |
1040 } | 1059 } |
1041 // The cache is null terminated, therefore the loop above should never | 1060 // The cache is null terminated, therefore the loop above should never |
1042 // terminate by itself. | 1061 // terminate by itself. |
1043 UNREACHABLE(); | 1062 UNREACHABLE(); |
1044 return Code::null(); | 1063 return Code::null(); |
1045 } | 1064 } |
1046 | 1065 |
1047 } // namespace dart | 1066 } // namespace dart |
OLD | NEW |