| 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/globals.h" | 5 #include "platform/globals.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 3994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4005 " return b > 1 ?\n" | 4005 " return b > 1 ?\n" |
| 4006 " b - 2 : b;\n" | 4006 " b - 2 : b;\n" |
| 4007 " }\n" | 4007 " }\n" |
| 4008 " void test6(int a) {\n" | 4008 " void test6(int a) {\n" |
| 4009 " return a > 1 ? a + 1 : a;\n" | 4009 " return a > 1 ? a + 1 : a;\n" |
| 4010 " }\n" | 4010 " }\n" |
| 4011 "}"; | 4011 "}"; |
| 4012 TestCase::LoadTestScript(kScriptChars, NULL); | 4012 TestCase::LoadTestScript(kScriptChars, NULL); |
| 4013 EXPECT(ClassFinalizer::ProcessPendingClasses()); | 4013 EXPECT(ClassFinalizer::ProcessPendingClasses()); |
| 4014 const String& name = String::Handle(String::New(TestCase::url())); | 4014 const String& name = String::Handle(String::New(TestCase::url())); |
| 4015 const Library& lib = Library::Handle(Library::LookupLibrary(name)); | 4015 const Library& lib = Library::Handle(Library::LookupLibrary(thread, name)); |
| 4016 EXPECT(!lib.IsNull()); | 4016 EXPECT(!lib.IsNull()); |
| 4017 | 4017 |
| 4018 const Class& class_a = Class::Handle( | 4018 const Class& class_a = Class::Handle( |
| 4019 lib.LookupClass(String::Handle(Symbols::New(thread, "A")))); | 4019 lib.LookupClass(String::Handle(Symbols::New(thread, "A")))); |
| 4020 const Class& class_b = Class::Handle( | 4020 const Class& class_b = Class::Handle( |
| 4021 lib.LookupClass(String::Handle(Symbols::New(thread, "B")))); | 4021 lib.LookupClass(String::Handle(Symbols::New(thread, "B")))); |
| 4022 const Function& a_test1 = | 4022 const Function& a_test1 = |
| 4023 Function::Handle(GetStaticFunction(class_a, "test1")); | 4023 Function::Handle(GetStaticFunction(class_a, "test1")); |
| 4024 const Function& b_test1 = | 4024 const Function& b_test1 = |
| 4025 Function::Handle(GetStaticFunction(class_b, "test1")); | 4025 Function::Handle(GetStaticFunction(class_b, "test1")); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4070 const int kBreakpointLine = 5; | 4070 const int kBreakpointLine = 5; |
| 4071 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); | 4071 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); |
| 4072 EXPECT_VALID(lib); | 4072 EXPECT_VALID(lib); |
| 4073 | 4073 |
| 4074 // Run function A.b one time. | 4074 // Run function A.b one time. |
| 4075 Dart_Handle result = Dart_Invoke(lib, NewString("test"), 0, NULL); | 4075 Dart_Handle result = Dart_Invoke(lib, NewString("test"), 0, NULL); |
| 4076 EXPECT_VALID(result); | 4076 EXPECT_VALID(result); |
| 4077 | 4077 |
| 4078 // With no breakpoint, function A.b is inlineable. | 4078 // With no breakpoint, function A.b is inlineable. |
| 4079 const String& name = String::Handle(String::New(TestCase::url())); | 4079 const String& name = String::Handle(String::New(TestCase::url())); |
| 4080 const Library& vmlib = Library::Handle(Library::LookupLibrary(name)); | 4080 const Library& vmlib = Library::Handle(Library::LookupLibrary(thread, name)); |
| 4081 EXPECT(!vmlib.IsNull()); | 4081 EXPECT(!vmlib.IsNull()); |
| 4082 const Class& class_a = Class::Handle( | 4082 const Class& class_a = Class::Handle( |
| 4083 vmlib.LookupClass(String::Handle(Symbols::New(thread, "A")))); | 4083 vmlib.LookupClass(String::Handle(Symbols::New(thread, "A")))); |
| 4084 const Function& func_b = | 4084 const Function& func_b = |
| 4085 Function::Handle(GetFunction(class_a, "b")); | 4085 Function::Handle(GetFunction(class_a, "b")); |
| 4086 EXPECT(func_b.CanBeInlined()); | 4086 EXPECT(func_b.CanBeInlined()); |
| 4087 | 4087 |
| 4088 // After setting a breakpoint in a function A.b, it is no longer inlineable. | 4088 // After setting a breakpoint in a function A.b, it is no longer inlineable. |
| 4089 Breakpoint* bpt = | 4089 Breakpoint* bpt = |
| 4090 Isolate::Current()->debugger()->SetBreakpointAtLine(name, | 4090 Isolate::Current()->debugger()->SetBreakpointAtLine(name, |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4727 String& test = String::Handle(); | 4727 String& test = String::Handle(); |
| 4728 String& result = String::Handle(); | 4728 String& result = String::Handle(); |
| 4729 for (size_t i = 0; i < ARRAY_SIZE(tests); i++) { | 4729 for (size_t i = 0; i < ARRAY_SIZE(tests); i++) { |
| 4730 test = String::New(tests[i].in); | 4730 test = String::New(tests[i].in); |
| 4731 result = String::ScrubName(test); | 4731 result = String::ScrubName(test); |
| 4732 EXPECT_STREQ(tests[i].out, result.ToCString()); | 4732 EXPECT_STREQ(tests[i].out, result.ToCString()); |
| 4733 } | 4733 } |
| 4734 } | 4734 } |
| 4735 | 4735 |
| 4736 } // namespace dart | 4736 } // namespace dart |
| OLD | NEW |