| 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 | 5 |
| 6 #include "vm/ast_printer.h" | 6 #include "vm/ast_printer.h" |
| 7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
| 8 #include "vm/debugger.h" | 8 #include "vm/debugger.h" |
| 9 #include "vm/longjump.h" | 9 #include "vm/longjump.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| 11 #include "vm/parser.h" | 11 #include "vm/parser.h" |
| 12 #include "vm/symbols.h" | 12 #include "vm/symbols.h" |
| 13 #include "vm/thread.h" | 13 #include "vm/thread.h" |
| 14 #include "vm/unit_test.h" | 14 #include "vm/unit_test.h" |
| 15 | 15 |
| 16 namespace dart { | 16 namespace dart { |
| 17 | 17 |
| 18 DECLARE_FLAG(bool, show_invisible_frames); | 18 DECLARE_FLAG(bool, show_invisible_frames); |
| 19 | 19 |
| 20 | 20 |
| 21 static void DumpFunction(const Library& lib, | 21 static void DumpFunction(const Library& lib, |
| 22 const char* cname, | 22 const char* cname, |
| 23 const char* fname) { | 23 const char* fname) { |
| 24 const String& classname = String::Handle(Symbols::New(cname)); | 24 const String& classname = String::Handle(Symbols::New(Thread::Current(), |
| 25 cname)); |
| 25 String& funcname = String::Handle(String::New(fname)); | 26 String& funcname = String::Handle(String::New(fname)); |
| 26 | 27 |
| 27 bool retval; | 28 bool retval; |
| 28 EXPECT(Isolate::Current() != NULL); | 29 EXPECT(Isolate::Current() != NULL); |
| 29 LongJumpScope jump; | 30 LongJumpScope jump; |
| 30 if (setjmp(*jump.Set()) == 0) { | 31 if (setjmp(*jump.Set()) == 0) { |
| 31 Class& cls = Class::Handle(lib.LookupClass(classname)); | 32 Class& cls = Class::Handle(lib.LookupClass(classname)); |
| 32 EXPECT(!cls.IsNull()); | 33 EXPECT(!cls.IsNull()); |
| 33 Function& function = | 34 Function& function = |
| 34 Function::ZoneHandle(cls.LookupStaticFunction(funcname)); | 35 Function::ZoneHandle(cls.LookupStaticFunction(funcname)); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 49 } | 50 } |
| 50 EXPECT(retval); | 51 EXPECT(retval); |
| 51 } | 52 } |
| 52 | 53 |
| 53 | 54 |
| 54 void CheckField(const Library& lib, | 55 void CheckField(const Library& lib, |
| 55 const char* class_name, | 56 const char* class_name, |
| 56 const char* field_name, | 57 const char* field_name, |
| 57 bool expect_static, | 58 bool expect_static, |
| 58 bool is_final) { | 59 bool is_final) { |
| 59 const String& classname = String::Handle(Symbols::New(class_name)); | 60 const String& classname = String::Handle(Symbols::New(Thread::Current(), |
| 61 class_name)); |
| 60 Class& cls = Class::Handle(lib.LookupClass(classname)); | 62 Class& cls = Class::Handle(lib.LookupClass(classname)); |
| 61 EXPECT(!cls.IsNull()); | 63 EXPECT(!cls.IsNull()); |
| 62 | 64 |
| 63 String& fieldname = String::Handle(String::New(field_name)); | 65 String& fieldname = String::Handle(String::New(field_name)); |
| 64 String& functionname = String::Handle(); | 66 String& functionname = String::Handle(); |
| 65 Function& function = Function::Handle(); | 67 Function& function = Function::Handle(); |
| 66 Field& field = Field::Handle(); | 68 Field& field = Field::Handle(); |
| 67 if (expect_static) { | 69 if (expect_static) { |
| 68 field ^= cls.LookupStaticFieldAllowPrivate(fieldname); | 70 field ^= cls.LookupStaticFieldAllowPrivate(fieldname); |
| 69 functionname ^= Field::GetterName(fieldname); | 71 functionname ^= Field::GetterName(fieldname); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 84 EXPECT(!field.IsNull()); | 86 EXPECT(!field.IsNull()); |
| 85 | 87 |
| 86 EXPECT_EQ(field.is_static(), expect_static); | 88 EXPECT_EQ(field.is_static(), expect_static); |
| 87 } | 89 } |
| 88 | 90 |
| 89 | 91 |
| 90 void CheckFunction(const Library& lib, | 92 void CheckFunction(const Library& lib, |
| 91 const char* class_name, | 93 const char* class_name, |
| 92 const char* function_name, | 94 const char* function_name, |
| 93 bool expect_static) { | 95 bool expect_static) { |
| 94 const String& classname = String::Handle(Symbols::New(class_name)); | 96 const String& classname = String::Handle(Symbols::New(Thread::Current(), |
| 97 class_name)); |
| 95 Class& cls = Class::Handle(lib.LookupClass(classname)); | 98 Class& cls = Class::Handle(lib.LookupClass(classname)); |
| 96 EXPECT(!cls.IsNull()); | 99 EXPECT(!cls.IsNull()); |
| 97 | 100 |
| 98 String& functionname = String::Handle(String::New(function_name)); | 101 String& functionname = String::Handle(String::New(function_name)); |
| 99 Function& function = Function::Handle(); | 102 Function& function = Function::Handle(); |
| 100 if (expect_static) { | 103 if (expect_static) { |
| 101 function ^= cls.LookupStaticFunction(functionname); | 104 function ^= cls.LookupStaticFunction(functionname); |
| 102 } else { | 105 } else { |
| 103 function ^= cls.LookupDynamicFunction(functionname); | 106 function ^= cls.LookupDynamicFunction(functionname); |
| 104 } | 107 } |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 " name=:current_context_var\n" | 573 " name=:current_context_var\n" |
| 571 " 1 ContextLevel level=1 scope=2 begin=3 end=79\n" | 574 " 1 ContextLevel level=1 scope=2 begin=3 end=79\n" |
| 572 " 2 ContextVar level=1 begin=9 end=79 name=x\n" | 575 " 2 ContextVar level=1 begin=9 end=79 name=x\n" |
| 573 " 3 StackVar scope=2 begin=11 end=79 name=b\n", | 576 " 3 StackVar scope=2 begin=11 end=79 name=b\n", |
| 574 CaptureVarsAtLine(lib, "a", 10)); | 577 CaptureVarsAtLine(lib, "a", 10)); |
| 575 } | 578 } |
| 576 | 579 |
| 577 #endif // !PRODUCT | 580 #endif // !PRODUCT |
| 578 | 581 |
| 579 } // namespace dart | 582 } // namespace dart |
| OLD | NEW |