| 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, X64, and ARM. | |
| 15 #if defined(TARGET_ARCH_IA32) || \ | |
| 16 defined(TARGET_ARCH_X64) || \ | |
| 17 defined(TARGET_ARCH_ARM) | |
| 18 | |
| 19 TEST_CASE(CompileScript) { | 14 TEST_CASE(CompileScript) { |
| 20 const char* kScriptChars = | 15 const char* kScriptChars = |
| 21 "class A {\n" | 16 "class A {\n" |
| 22 " static foo() { return 42; }\n" | 17 " static foo() { return 42; }\n" |
| 23 "}\n"; | 18 "}\n"; |
| 24 String& url = String::Handle(String::New("dart-test:CompileScript")); | 19 String& url = String::Handle(String::New("dart-test:CompileScript")); |
| 25 String& source = String::Handle(String::New(kScriptChars)); | 20 String& source = String::Handle(String::New(kScriptChars)); |
| 26 Script& script = Script::Handle(Script::New(url, | 21 Script& script = Script::Handle(Script::New(url, |
| 27 source, | 22 source, |
| 28 RawScript::kScriptTag)); | 23 RawScript::kScriptTag)); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 55 |
| 61 String& function_moo_name = String::Handle(String::New("moo")); | 56 String& function_moo_name = String::Handle(String::New("moo")); |
| 62 Function& function_moo = | 57 Function& function_moo = |
| 63 Function::Handle(cls.LookupStaticFunction(function_moo_name)); | 58 Function::Handle(cls.LookupStaticFunction(function_moo_name)); |
| 64 EXPECT(!function_moo.IsNull()); | 59 EXPECT(!function_moo.IsNull()); |
| 65 | 60 |
| 66 EXPECT(CompilerTest::TestCompileFunction(function_moo)); | 61 EXPECT(CompilerTest::TestCompileFunction(function_moo)); |
| 67 EXPECT(function_moo.HasCode()); | 62 EXPECT(function_moo.HasCode()); |
| 68 } | 63 } |
| 69 | 64 |
| 70 #endif // TARGET_ARCH_IA32 || TARGET_ARCH_X64 || TARGET_ARCH_ARM | |
| 71 | |
| 72 } // namespace dart | 65 } // namespace dart |
| OLD | NEW |