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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/bootstrap.h" |
8 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
9 #include "vm/constant_propagator.h" | 10 #include "vm/constant_propagator.h" |
10 #include "vm/cpu.h" | 11 #include "vm/cpu.h" |
11 #include "vm/dart_entry.h" | 12 #include "vm/dart_entry.h" |
12 #include "vm/flow_graph_allocator.h" | 13 #include "vm/flow_graph_allocator.h" |
13 #include "vm/flow_graph_builder.h" | 14 #include "vm/flow_graph_builder.h" |
14 #include "vm/flow_graph_compiler.h" | 15 #include "vm/flow_graph_compiler.h" |
15 #include "vm/flow_graph_optimizer.h" | 16 #include "vm/flow_graph_optimizer.h" |
16 #include "vm/flow_graph_range_analysis.h" | 17 #include "vm/flow_graph_range_analysis.h" |
17 #include "vm/locations.h" | 18 #include "vm/locations.h" |
(...skipping 3631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3649 | 3650 |
3650 intptr_t MergedMathInstr::OutputIndexOf(Token::Kind token) { | 3651 intptr_t MergedMathInstr::OutputIndexOf(Token::Kind token) { |
3651 switch (token) { | 3652 switch (token) { |
3652 case Token::kTRUNCDIV: return 0; | 3653 case Token::kTRUNCDIV: return 0; |
3653 case Token::kMOD: return 1; | 3654 case Token::kMOD: return 1; |
3654 default: UNIMPLEMENTED(); return -1; | 3655 default: UNIMPLEMENTED(); return -1; |
3655 } | 3656 } |
3656 } | 3657 } |
3657 | 3658 |
3658 | 3659 |
| 3660 void NativeCallInstr::SetupNative() { |
| 3661 Zone* Z = Thread::Current()->zone(); |
| 3662 const Class& cls = Class::Handle(Z, function().Owner()); |
| 3663 const Library& library = Library::Handle(Z, cls.library()); |
| 3664 const int num_params = |
| 3665 NativeArguments::ParameterCountForResolution(function()); |
| 3666 bool auto_setup_scope = true; |
| 3667 NativeFunction native_function = NativeEntry::ResolveNative( |
| 3668 library, native_name(), num_params, &auto_setup_scope); |
| 3669 if (native_function == NULL) { |
| 3670 Report::MessageF(Report::kError, |
| 3671 Script::Handle(function().script()), |
| 3672 function().token_pos(), |
| 3673 "native function '%s' (%" Pd " arguments) cannot be found", |
| 3674 native_name().ToCString(), |
| 3675 function().NumParameters()); |
| 3676 } |
| 3677 set_native_c_function(native_function); |
| 3678 function().SetIsNativeAutoSetupScope(auto_setup_scope); |
| 3679 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); |
| 3680 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); |
| 3681 set_is_bootstrap_native(is_bootstrap_native); |
| 3682 } |
| 3683 |
3659 #undef __ | 3684 #undef __ |
3660 | 3685 |
3661 } // namespace dart | 3686 } // namespace dart |
OLD | NEW |