| 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 "platform/assert.h" | 5 #include "platform/assert.h" |
| 6 #include "vm/class_finalizer.h" | 6 #include "vm/class_finalizer.h" |
| 7 #include "vm/compiler.h" | 7 #include "vm/compiler.h" |
| 8 #include "vm/object.h" | 8 #include "vm/object.h" |
| 9 #include "vm/symbols.h" | 9 #include "vm/symbols.h" |
| 10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 // Compiler only implemented on IA32 and X64 now. | 14 // Compiler only implemented on IA32, X64, and ARM. |
| 15 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 15 #if defined(TARGET_ARCH_IA32) || \ |
| 16 defined(TARGET_ARCH_X64) || \ |
| 17 defined(TARGET_ARCH_ARM) |
| 16 | 18 |
| 17 TEST_CASE(CompileScript) { | 19 TEST_CASE(CompileScript) { |
| 18 const char* kScriptChars = | 20 const char* kScriptChars = |
| 19 "class A {\n" | 21 "class A {\n" |
| 20 " static foo() { return 42; }\n" | 22 " static foo() { return 42; }\n" |
| 21 "}\n"; | 23 "}\n"; |
| 22 String& url = String::Handle(String::New("dart-test:CompileScript")); | 24 String& url = String::Handle(String::New("dart-test:CompileScript")); |
| 23 String& source = String::Handle(String::New(kScriptChars)); | 25 String& source = String::Handle(String::New(kScriptChars)); |
| 24 Script& script = Script::Handle(Script::New(url, | 26 Script& script = Script::Handle(Script::New(url, |
| 25 source, | 27 source, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 60 |
| 59 String& function_moo_name = String::Handle(String::New("moo")); | 61 String& function_moo_name = String::Handle(String::New("moo")); |
| 60 Function& function_moo = | 62 Function& function_moo = |
| 61 Function::Handle(cls.LookupStaticFunction(function_moo_name)); | 63 Function::Handle(cls.LookupStaticFunction(function_moo_name)); |
| 62 EXPECT(!function_moo.IsNull()); | 64 EXPECT(!function_moo.IsNull()); |
| 63 | 65 |
| 64 EXPECT(CompilerTest::TestCompileFunction(function_moo)); | 66 EXPECT(CompilerTest::TestCompileFunction(function_moo)); |
| 65 EXPECT(function_moo.HasCode()); | 67 EXPECT(function_moo.HasCode()); |
| 66 } | 68 } |
| 67 | 69 |
| 68 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64 | 70 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64 || TARGET_ARCH_ARM |
| 69 | 71 |
| 70 } // namespace dart | 72 } // namespace dart |
| OLD | NEW |