| 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 | 7 |
| 8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/code_descriptors.h" | 10 #include "vm/code_descriptors.h" |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 " var i = A.foo();" | 218 " var i = A.foo();" |
| 219 " Expect.equals(30, i);" | 219 " Expect.equals(30, i);" |
| 220 " }\n" | 220 " }\n" |
| 221 "}\n"; | 221 "}\n"; |
| 222 // First setup the script and compile the script. | 222 // First setup the script and compile the script. |
| 223 TestCase::LoadTestScript(kScriptChars, native_resolver); | 223 TestCase::LoadTestScript(kScriptChars, native_resolver); |
| 224 EXPECT(ClassFinalizer::FinalizePendingClasses()); | 224 EXPECT(ClassFinalizer::FinalizePendingClasses()); |
| 225 const String& name = String::Handle(String::New(TestCase::url())); | 225 const String& name = String::Handle(String::New(TestCase::url())); |
| 226 const Library& lib = Library::Handle(Library::LookupLibrary(name)); | 226 const Library& lib = Library::Handle(Library::LookupLibrary(name)); |
| 227 EXPECT(!lib.IsNull()); | 227 EXPECT(!lib.IsNull()); |
| 228 String& ambiguity_error_msg = String::Handle(); |
| 228 Class& cls = Class::Handle( | 229 Class& cls = Class::Handle( |
| 229 lib.LookupClass(String::Handle(Symbols::New("A")))); | 230 lib.LookupClass(String::Handle(Symbols::New("A")), &ambiguity_error_msg)); |
| 230 EXPECT(!cls.IsNull()); | 231 EXPECT(!cls.IsNull()); // No ambiguity error expected. |
| 231 | 232 |
| 232 // Now compile the two functions 'A.foo' and 'A.moo' | 233 // Now compile the two functions 'A.foo' and 'A.moo' |
| 233 String& function_moo_name = String::Handle(String::New("moo")); | 234 String& function_moo_name = String::Handle(String::New("moo")); |
| 234 Function& function_moo = | 235 Function& function_moo = |
| 235 Function::Handle(cls.LookupStaticFunction(function_moo_name)); | 236 Function::Handle(cls.LookupStaticFunction(function_moo_name)); |
| 236 EXPECT(CompilerTest::TestCompileFunction(function_moo)); | 237 EXPECT(CompilerTest::TestCompileFunction(function_moo)); |
| 237 EXPECT(function_moo.HasCode()); | 238 EXPECT(function_moo.HasCode()); |
| 238 | 239 |
| 239 String& function_foo_name = String::Handle(String::New("foo")); | 240 String& function_foo_name = String::Handle(String::New("foo")); |
| 240 Function& function_foo = | 241 Function& function_foo = |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 // Now invoke 'A.moo' and it will trigger a GC when the native function | 277 // Now invoke 'A.moo' and it will trigger a GC when the native function |
| 277 // is called, this should then cause the stack map of function 'A.foo' | 278 // is called, this should then cause the stack map of function 'A.foo' |
| 278 // to be traversed and the appropriate objects visited. | 279 // to be traversed and the appropriate objects visited. |
| 279 const Object& result = Object::Handle( | 280 const Object& result = Object::Handle( |
| 280 DartEntry::InvokeFunction(function_foo, Object::empty_array())); | 281 DartEntry::InvokeFunction(function_foo, Object::empty_array())); |
| 281 EXPECT(!result.IsError()); | 282 EXPECT(!result.IsError()); |
| 282 } | 283 } |
| 283 | 284 |
| 284 } // namespace dart | 285 } // namespace dart |
| 285 | 286 |
| OLD | NEW |