| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/runtime_entry.h" | 5 #include "vm/runtime_entry.h" |
| 6 | 6 |
| 7 #include "vm/object.h" | 7 #include "vm/object.h" |
| 8 #include "vm/symbols.h" | 8 #include "vm/symbols.h" |
| 9 #include "vm/verifier.h" | 9 #include "vm/verifier.h" |
| 10 | 10 |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 #if defined(TESTING) || defined(DEBUG) |
| 14 void VerifyOnTransition() { |
| 15 Thread* thread = Thread::Current(); |
| 16 TransitionGeneratedToVM transition(thread); |
| 17 thread->isolate()->heap()->WaitForSweeperTasks(); |
| 18 SafepointOperationScope safepoint_scope(thread); |
| 19 VerifyPointersVisitor::VerifyPointers(); |
| 20 thread->isolate()->heap()->Verify(); |
| 21 } |
| 22 #endif |
| 23 |
| 13 | 24 |
| 14 // Add function to a class and that class to the class dictionary so that | 25 // Add function to a class and that class to the class dictionary so that |
| 15 // frame walking can be used. | 26 // frame walking can be used. |
| 16 const Function& RegisterFakeFunction(const char* name, const Code& code) { | 27 const Function& RegisterFakeFunction(const char* name, const Code& code) { |
| 17 Thread* thread = Thread::Current(); | 28 Thread* thread = Thread::Current(); |
| 18 const String& class_name = String::Handle(Symbols::New(thread, "ownerClass")); | 29 const String& class_name = String::Handle(Symbols::New(thread, "ownerClass")); |
| 19 const Script& script = Script::Handle(); | 30 const Script& script = Script::Handle(); |
| 20 const Library& lib = Library::Handle(Library::CoreLibrary()); | 31 const Library& lib = Library::Handle(Library::CoreLibrary()); |
| 21 const Class& owner_class = | 32 const Class& owner_class = |
| 22 Class::Handle(Class::New(lib, class_name, script, | 33 Class::Handle(Class::New(lib, class_name, script, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 34 TokenPosition::kMinSource)); | 45 TokenPosition::kMinSource)); |
| 35 const Array& functions = Array::Handle(Array::New(1)); | 46 const Array& functions = Array::Handle(Array::New(1)); |
| 36 functions.SetAt(0, function); | 47 functions.SetAt(0, function); |
| 37 owner_class.SetFunctions(functions); | 48 owner_class.SetFunctions(functions); |
| 38 lib.AddClass(owner_class); | 49 lib.AddClass(owner_class); |
| 39 function.AttachCode(code); | 50 function.AttachCode(code); |
| 40 return function; | 51 return function; |
| 41 } | 52 } |
| 42 | 53 |
| 43 } // namespace dart | 54 } // namespace dart |
| OLD | NEW |