| 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 #include "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "platform/assert.h" | 6 #include "platform/assert.h" |
| 7 #include "vm/dart_api_impl.h" | 7 #include "vm/dart_api_impl.h" |
| 8 #include "vm/unit_test.h" | 8 #include "vm/unit_test.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| 11 | 11 |
| 12 // Only ia32 and x64 can run execution tests. | 12 // Only ia32 and x64 can run execution tests. |
| 13 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 13 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
| 14 #define FUNCTION_NAME(name) UnhandledExcp_##name | 14 #define FUNCTION_NAME(name) UnhandledExcp_##name |
| 15 #define REGISTER_FUNCTION(name, count) \ | 15 #define REGISTER_FUNCTION(name, count) \ |
| 16 { ""#name, FUNCTION_NAME(name), count }, | 16 { ""#name, FUNCTION_NAME(name), count }, |
| 17 | 17 |
| 18 | 18 |
| 19 void FUNCTION_NAME(Unhandled_equals)(Dart_NativeArguments args) { | 19 void FUNCTION_NAME(Unhandled_equals)(Dart_NativeArguments args) { |
| 20 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); | 20 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); |
| 21 const Instance& expected = Instance::CheckedHandle(arguments->At(0)); | 21 const Instance& expected = Instance::CheckedHandle(arguments->NativeArgAt(0)); |
| 22 const Instance& actual = Instance::CheckedHandle(arguments->At(1)); | 22 const Instance& actual = Instance::CheckedHandle(arguments->NativeArgAt(1)); |
| 23 if (!expected.Equals(actual)) { | 23 if (!expected.Equals(actual)) { |
| 24 OS::Print("expected: '%s' actual: '%s'\n", | 24 OS::Print("expected: '%s' actual: '%s'\n", |
| 25 expected.ToCString(), actual.ToCString()); | 25 expected.ToCString(), actual.ToCString()); |
| 26 FATAL("Unhandled_equals fails.\n"); | 26 FATAL("Unhandled_equals fails.\n"); |
| 27 } | 27 } |
| 28 } | 28 } |
| 29 | 29 |
| 30 | 30 |
| 31 void FUNCTION_NAME(Unhandled_invoke)(Dart_NativeArguments args) { | 31 void FUNCTION_NAME(Unhandled_invoke)(Dart_NativeArguments args) { |
| 32 // Invoke the specified entry point. | 32 // Invoke the specified entry point. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 " UnhandledExceptions.equals(3, Second.method3(1));\n" | 125 " UnhandledExceptions.equals(3, Second.method3(1));\n" |
| 126 "}"; | 126 "}"; |
| 127 Dart_Handle lib = TestCase::LoadTestScript( | 127 Dart_Handle lib = TestCase::LoadTestScript( |
| 128 kScriptChars, | 128 kScriptChars, |
| 129 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup)); | 129 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup)); |
| 130 EXPECT_VALID(Dart_Invoke(lib, NewString("testMain"), 0, NULL)); | 130 EXPECT_VALID(Dart_Invoke(lib, NewString("testMain"), 0, NULL)); |
| 131 } | 131 } |
| 132 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). | 132 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). |
| 133 | 133 |
| 134 } // namespace dart | 134 } // namespace dart |
| OLD | NEW |