Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: runtime/vm/object_test.cc

Issue 1955453002: - Use a map to lookup libraries by URL. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix precompiler handling. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 3993 matching lines...) Expand 10 before | Expand all | Expand 10 after
4004 " return b > 1 ?\n" 4004 " return b > 1 ?\n"
4005 " b - 2 : b;\n" 4005 " b - 2 : b;\n"
4006 " }\n" 4006 " }\n"
4007 " void test6(int a) {\n" 4007 " void test6(int a) {\n"
4008 " return a > 1 ? a + 1 : a;\n" 4008 " return a > 1 ? a + 1 : a;\n"
4009 " }\n" 4009 " }\n"
4010 "}"; 4010 "}";
4011 TestCase::LoadTestScript(kScriptChars, NULL); 4011 TestCase::LoadTestScript(kScriptChars, NULL);
4012 EXPECT(ClassFinalizer::ProcessPendingClasses()); 4012 EXPECT(ClassFinalizer::ProcessPendingClasses());
4013 const String& name = String::Handle(String::New(TestCase::url())); 4013 const String& name = String::Handle(String::New(TestCase::url()));
4014 const Library& lib = Library::Handle(Library::LookupLibrary(name)); 4014 const Library& lib = Library::Handle(Library::LookupLibrary(thread, name));
4015 EXPECT(!lib.IsNull()); 4015 EXPECT(!lib.IsNull());
4016 4016
4017 const Class& class_a = Class::Handle( 4017 const Class& class_a = Class::Handle(
4018 lib.LookupClass(String::Handle(Symbols::New(thread, "A")))); 4018 lib.LookupClass(String::Handle(Symbols::New(thread, "A"))));
4019 const Class& class_b = Class::Handle( 4019 const Class& class_b = Class::Handle(
4020 lib.LookupClass(String::Handle(Symbols::New(thread, "B")))); 4020 lib.LookupClass(String::Handle(Symbols::New(thread, "B"))));
4021 const Function& a_test1 = 4021 const Function& a_test1 =
4022 Function::Handle(GetStaticFunction(class_a, "test1")); 4022 Function::Handle(GetStaticFunction(class_a, "test1"));
4023 const Function& b_test1 = 4023 const Function& b_test1 =
4024 Function::Handle(GetStaticFunction(class_b, "test1")); 4024 Function::Handle(GetStaticFunction(class_b, "test1"));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
4069 const int kBreakpointLine = 5; 4069 const int kBreakpointLine = 5;
4070 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL); 4070 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
4071 EXPECT_VALID(lib); 4071 EXPECT_VALID(lib);
4072 4072
4073 // Run function A.b one time. 4073 // Run function A.b one time.
4074 Dart_Handle result = Dart_Invoke(lib, NewString("test"), 0, NULL); 4074 Dart_Handle result = Dart_Invoke(lib, NewString("test"), 0, NULL);
4075 EXPECT_VALID(result); 4075 EXPECT_VALID(result);
4076 4076
4077 // With no breakpoint, function A.b is inlineable. 4077 // With no breakpoint, function A.b is inlineable.
4078 const String& name = String::Handle(String::New(TestCase::url())); 4078 const String& name = String::Handle(String::New(TestCase::url()));
4079 const Library& vmlib = Library::Handle(Library::LookupLibrary(name)); 4079 const Library& vmlib = Library::Handle(Library::LookupLibrary(thread, name));
4080 EXPECT(!vmlib.IsNull()); 4080 EXPECT(!vmlib.IsNull());
4081 const Class& class_a = Class::Handle( 4081 const Class& class_a = Class::Handle(
4082 vmlib.LookupClass(String::Handle(Symbols::New(thread, "A")))); 4082 vmlib.LookupClass(String::Handle(Symbols::New(thread, "A"))));
4083 const Function& func_b = 4083 const Function& func_b =
4084 Function::Handle(GetFunction(class_a, "b")); 4084 Function::Handle(GetFunction(class_a, "b"));
4085 EXPECT(func_b.CanBeInlined()); 4085 EXPECT(func_b.CanBeInlined());
4086 4086
4087 // After setting a breakpoint in a function A.b, it is no longer inlineable. 4087 // After setting a breakpoint in a function A.b, it is no longer inlineable.
4088 Breakpoint* bpt = 4088 Breakpoint* bpt =
4089 Isolate::Current()->debugger()->SetBreakpointAtLine(name, 4089 Isolate::Current()->debugger()->SetBreakpointAtLine(name,
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
4726 String& test = String::Handle(); 4726 String& test = String::Handle();
4727 String& result = String::Handle(); 4727 String& result = String::Handle();
4728 for (size_t i = 0; i < ARRAY_SIZE(tests); i++) { 4728 for (size_t i = 0; i < ARRAY_SIZE(tests); i++) {
4729 test = String::New(tests[i].in); 4729 test = String::New(tests[i].in);
4730 result = String::ScrubName(test); 4730 result = String::ScrubName(test);
4731 EXPECT_STREQ(tests[i].out, result.ToCString()); 4731 EXPECT_STREQ(tests[i].out, result.ToCString());
4732 } 4732 }
4733 } 4733 }
4734 4734
4735 } // namespace dart 4735 } // namespace dart
OLDNEW
« runtime/vm/object.cc ('K') | « runtime/vm/object_store.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698