| 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/native_entry_test.h" | 5 #include "vm/native_entry_test.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
| 9 #include "vm/native_entry.h" | 9 #include "vm/native_entry.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 Dart_NativeFunction NativeTestEntry_Lookup(const String& name, | 27 Dart_NativeFunction NativeTestEntry_Lookup(const String& name, |
| 28 int argument_count) { | 28 int argument_count) { |
| 29 int num_entries = sizeof(TestEntries) / sizeof(struct NativeTestEntries); | 29 int num_entries = sizeof(TestEntries) / sizeof(struct NativeTestEntries); |
| 30 for (int i = 0; i < num_entries; i++) { | 30 for (int i = 0; i < num_entries; i++) { |
| 31 struct NativeTestEntries* entry = &(TestEntries[i]); | 31 struct NativeTestEntries* entry = &(TestEntries[i]); |
| 32 if (name.Equals(entry->name_)) { | 32 if (name.Equals(entry->name_)) { |
| 33 if (entry->argument_count_ == argument_count) { | 33 if (entry->argument_count_ == argument_count) { |
| 34 return entry->function_; | 34 return entry->function_; |
| 35 } else { | 35 } else { |
| 36 // Wrong number of arguments. | 36 // Wrong number of arguments. |
| 37 // TODO(regis): Should we pass a buffer for error reporting? | |
| 38 return NULL; | 37 return NULL; |
| 39 } | 38 } |
| 40 } | 39 } |
| 41 } | 40 } |
| 42 return NULL; | 41 return NULL; |
| 43 } | 42 } |
| 44 | 43 |
| 45 | 44 |
| 46 // A native call for test purposes. | 45 // A native call for test purposes. |
| 47 // Arg0: a smi. | 46 // Arg0: a smi. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 &target_function, | 80 &target_function, |
| 82 &target_address); | 81 &target_address); |
| 83 EXPECT(String::Handle(target_function.name()). | 82 EXPECT(String::Handle(target_function.name()). |
| 84 Equals(String::Handle(String::New("NativePatchStaticCall")))); | 83 Equals(String::Handle(String::New("NativePatchStaticCall")))); |
| 85 const uword function_entry_address = | 84 const uword function_entry_address = |
| 86 Code::Handle(target_function.CurrentCode()).EntryPoint(); | 85 Code::Handle(target_function.CurrentCode()).EntryPoint(); |
| 87 EXPECT_EQ(function_entry_address, target_address); | 86 EXPECT_EQ(function_entry_address, target_address); |
| 88 } | 87 } |
| 89 | 88 |
| 90 } // namespace dart | 89 } // namespace dart |
| OLD | NEW |