OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #if !defined(DART_PRECOMPILED_RUNTIME) | 5 #if !defined(DART_PRECOMPILED_RUNTIME) |
6 | 6 |
7 #include "vm/flow_graph_builder.h" | 7 #include "vm/flow_graph_builder.h" |
8 | 8 |
9 #include "lib/invocation_mirror.h" | 9 #include "lib/invocation_mirror.h" |
10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
(...skipping 3863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3874 } | 3874 } |
3875 #endif | 3875 #endif |
3876 | 3876 |
3877 // This check may be deleted if the generated code is leaf. | 3877 // This check may be deleted if the generated code is leaf. |
3878 // Native functions don't need a stack check at entry. | 3878 // Native functions don't need a stack check at entry. |
3879 if (is_top_level_sequence && !function.is_native()) { | 3879 if (is_top_level_sequence && !function.is_native()) { |
3880 // Always allocate CheckOverflowInstr so that deopt-ids match regardless | 3880 // Always allocate CheckOverflowInstr so that deopt-ids match regardless |
3881 // if we inline or not. | 3881 // if we inline or not. |
3882 if (!function.IsImplicitGetterFunction() && | 3882 if (!function.IsImplicitGetterFunction() && |
3883 !function.IsImplicitSetterFunction()) { | 3883 !function.IsImplicitSetterFunction()) { |
| 3884 // We want the stack overlow error to be reported at the opening '{' or |
| 3885 // at the '=>' location. So, we get the sequence node corresponding to the |
| 3886 // body inside |node| and use its token position. |
| 3887 ASSERT(node->length() > 0); |
3884 CheckStackOverflowInstr* check = new (Z) CheckStackOverflowInstr( | 3888 CheckStackOverflowInstr* check = new (Z) CheckStackOverflowInstr( |
3885 node->token_pos(), 0, owner()->GetNextDeoptId()); | 3889 node->NodeAt(0)->token_pos(), 0, owner()->GetNextDeoptId()); |
3886 // If we are inlining don't actually attach the stack check. We must still | 3890 // If we are inlining don't actually attach the stack check. We must still |
3887 // create the stack check in order to allocate a deopt id. | 3891 // create the stack check in order to allocate a deopt id. |
3888 if (!owner()->IsInlining()) { | 3892 if (!owner()->IsInlining()) { |
3889 AddInstruction(check); | 3893 AddInstruction(check); |
3890 } | 3894 } |
3891 } | 3895 } |
3892 } | 3896 } |
3893 | 3897 |
3894 if (Isolate::Current()->type_checks() && is_top_level_sequence) { | 3898 if (Isolate::Current()->type_checks() && is_top_level_sequence) { |
3895 const int num_params = function.NumParameters(); | 3899 const int num_params = function.NumParameters(); |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4417 // Bail if the type has any type parameters. | 4421 // Bail if the type has any type parameters. |
4418 if (type_class.IsGeneric()) return false; | 4422 if (type_class.IsGeneric()) return false; |
4419 | 4423 |
4420 // Finally a simple class for instance of checking. | 4424 // Finally a simple class for instance of checking. |
4421 return true; | 4425 return true; |
4422 } | 4426 } |
4423 | 4427 |
4424 } // namespace dart | 4428 } // namespace dart |
4425 | 4429 |
4426 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 4430 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
OLD | NEW |