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/globals.h" | 6 #include "vm/globals.h" |
7 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 7 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
8 | 8 |
9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
11 #include "vm/code_descriptors.h" | 11 #include "vm/code_descriptors.h" |
12 #include "vm/compiler.h" | 12 #include "vm/compiler.h" |
13 #include "vm/dart_entry.h" | 13 #include "vm/dart_entry.h" |
14 #include "vm/native_entry.h" | 14 #include "vm/native_entry.h" |
15 #include "vm/parser.h" | 15 #include "vm/parser.h" |
| 16 #include "vm/symbols.h" |
16 #include "vm/unit_test.h" | 17 #include "vm/unit_test.h" |
17 | 18 |
18 namespace dart { | 19 namespace dart { |
19 | 20 |
20 static const intptr_t kPos = Scanner::kDummyTokenIndex; | 21 static const intptr_t kPos = Scanner::kDummyTokenIndex; |
21 | 22 |
22 | 23 |
23 CODEGEN_TEST_GENERATE(StackmapCodegen, test) { | 24 CODEGEN_TEST_GENERATE(StackmapCodegen, test) { |
24 Assembler assembler; | 25 Assembler assembler; |
25 const String& function_name = String::ZoneHandle(String::NewSymbol("test")); | 26 const String& function_name = String::ZoneHandle(Symbols::New("test")); |
26 const Function& function = Function::Handle( | 27 const Function& function = Function::Handle( |
27 Function::New(function_name, RawFunction::kRegularFunction, | 28 Function::New(function_name, RawFunction::kRegularFunction, |
28 true, false, 0)); | 29 true, false, 0)); |
29 function.set_result_type(Type::Handle(Type::DynamicType())); | 30 function.set_result_type(Type::Handle(Type::DynamicType())); |
30 Class& cls = Class::ZoneHandle(); | 31 Class& cls = Class::ZoneHandle(); |
31 const Script& script = Script::Handle(); | 32 const Script& script = Script::Handle(); |
32 cls = Class::New(function_name, script, Scanner::kDummyTokenIndex); | 33 cls = Class::New(function_name, script, Scanner::kDummyTokenIndex); |
33 const Array& functions = Array::Handle(Array::New(1)); | 34 const Array& functions = Array::Handle(Array::New(1)); |
34 functions.SetAt(0, function); | 35 functions.SetAt(0, function); |
35 cls.SetFunctions(functions); | 36 cls.SetFunctions(functions); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 " Expect.equals(30, i);" | 169 " Expect.equals(30, i);" |
169 " }\n" | 170 " }\n" |
170 "}\n"; | 171 "}\n"; |
171 // First setup the script and compile the script. | 172 // First setup the script and compile the script. |
172 TestCase::LoadTestScript(kScriptChars, native_resolver); | 173 TestCase::LoadTestScript(kScriptChars, native_resolver); |
173 EXPECT(ClassFinalizer::FinalizePendingClasses()); | 174 EXPECT(ClassFinalizer::FinalizePendingClasses()); |
174 const String& name = String::Handle(String::New(TestCase::url())); | 175 const String& name = String::Handle(String::New(TestCase::url())); |
175 const Library& lib = Library::Handle(Library::LookupLibrary(name)); | 176 const Library& lib = Library::Handle(Library::LookupLibrary(name)); |
176 EXPECT(!lib.IsNull()); | 177 EXPECT(!lib.IsNull()); |
177 Class& cls = Class::Handle( | 178 Class& cls = Class::Handle( |
178 lib.LookupClass(String::Handle(String::NewSymbol("A")))); | 179 lib.LookupClass(String::Handle(Symbols::New("A")))); |
179 EXPECT(!cls.IsNull()); | 180 EXPECT(!cls.IsNull()); |
180 | 181 |
181 // Now compile the two functions 'A.foo' and 'A.moo' | 182 // Now compile the two functions 'A.foo' and 'A.moo' |
182 String& function_moo_name = String::Handle(String::New("moo")); | 183 String& function_moo_name = String::Handle(String::New("moo")); |
183 Function& function_moo = | 184 Function& function_moo = |
184 Function::Handle(cls.LookupStaticFunction(function_moo_name)); | 185 Function::Handle(cls.LookupStaticFunction(function_moo_name)); |
185 EXPECT(CompilerTest::TestCompileFunction(function_moo)); | 186 EXPECT(CompilerTest::TestCompileFunction(function_moo)); |
186 EXPECT(function_moo.HasCode()); | 187 EXPECT(function_moo.HasCode()); |
187 | 188 |
188 String& function_foo_name = String::Handle(String::New("foo")); | 189 String& function_foo_name = String::Handle(String::New("foo")); |
(...skipping 22 matching lines...) Expand all Loading... |
211 GrowableArray<const Object*> arguments; | 212 GrowableArray<const Object*> arguments; |
212 const Array& kNoArgumentNames = Array::Handle(); | 213 const Array& kNoArgumentNames = Array::Handle(); |
213 Object& result = Object::Handle(); | 214 Object& result = Object::Handle(); |
214 result = DartEntry::InvokeStatic(function_foo, arguments, kNoArgumentNames); | 215 result = DartEntry::InvokeStatic(function_foo, arguments, kNoArgumentNames); |
215 EXPECT(!result.IsError()); | 216 EXPECT(!result.IsError()); |
216 } | 217 } |
217 | 218 |
218 } // namespace dart | 219 } // namespace dart |
219 | 220 |
220 #endif // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64) | 221 #endif // defined TARGET_ARCH_IA32 || defined(TARGET_ARCH_X64) |
OLD | NEW |