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

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

Issue 41613002: Don't inline functions if they have an active breakpoint. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "vm/assembler.h" 5 #include "vm/assembler.h"
6 #include "vm/bigint_operations.h" 6 #include "vm/bigint_operations.h"
7 #include "vm/class_finalizer.h" 7 #include "vm/class_finalizer.h"
8 #include "vm/dart_api_impl.h" 8 #include "vm/dart_api_impl.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/debugger.h"
10 #include "vm/isolate.h" 11 #include "vm/isolate.h"
11 #include "vm/object.h" 12 #include "vm/object.h"
12 #include "vm/object_store.h" 13 #include "vm/object_store.h"
13 #include "vm/simulator.h" 14 #include "vm/simulator.h"
14 #include "vm/symbols.h" 15 #include "vm/symbols.h"
15 #include "vm/unit_test.h" 16 #include "vm/unit_test.h"
16 17
17 namespace dart { 18 namespace dart {
18 19
19 static RawClass* CreateDummyClass(const String& class_name, 20 static RawClass* CreateDummyClass(const String& class_name,
(...skipping 3519 matching lines...) Expand 10 before | Expand all | Expand 10 after
3539 EXPECT_EQ(a_test1.SourceFingerprint(), b_test1.SourceFingerprint()); 3540 EXPECT_EQ(a_test1.SourceFingerprint(), b_test1.SourceFingerprint());
3540 EXPECT_NE(a_test1.SourceFingerprint(), a_test2.SourceFingerprint()); 3541 EXPECT_NE(a_test1.SourceFingerprint(), a_test2.SourceFingerprint());
3541 EXPECT_NE(a_test2.SourceFingerprint(), a_test3.SourceFingerprint()); 3542 EXPECT_NE(a_test2.SourceFingerprint(), a_test3.SourceFingerprint());
3542 EXPECT_NE(a_test3.SourceFingerprint(), a_test4.SourceFingerprint()); 3543 EXPECT_NE(a_test3.SourceFingerprint(), a_test4.SourceFingerprint());
3543 EXPECT_NE(a_test4.SourceFingerprint(), a_test5.SourceFingerprint()); 3544 EXPECT_NE(a_test4.SourceFingerprint(), a_test5.SourceFingerprint());
3544 EXPECT_EQ(a_test5.SourceFingerprint(), b_test5.SourceFingerprint()); 3545 EXPECT_EQ(a_test5.SourceFingerprint(), b_test5.SourceFingerprint());
3545 EXPECT_NE(a_test6.SourceFingerprint(), b_test6.SourceFingerprint()); 3546 EXPECT_NE(a_test6.SourceFingerprint(), b_test6.SourceFingerprint());
3546 } 3547 }
3547 3548
3548 3549
3550 TEST_CASE(FunctionWithBreakpointNotInlined) {
3551 const char* kScriptChars =
3552 "class A {\n"
3553 " a() {\n"
3554 " }\n"
3555 " b() {\n"
3556 " a();\n" // This is line 5.
3557 " }\n"
3558 "}\n"
3559 "test() {\n"
3560 " new A().b();\n"
3561 "}";
3562 const int kBreakpointLine = 5;
3563 Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
3564 EXPECT_VALID(lib);
3565
3566 // Run function A.b one time.
3567 Dart_Handle result = Dart_Invoke(lib, NewString("test"), 0, NULL);
3568 EXPECT_VALID(result);
3569
3570 // With no breakpoint, function A.b is inlineable.
3571 const String& name = String::Handle(String::New(TestCase::url()));
3572 const Library& vmlib = Library::Handle(Library::LookupLibrary(name));
3573 EXPECT(!vmlib.IsNull());
3574 const Class& class_a = Class::Handle(
3575 vmlib.LookupClass(String::Handle(Symbols::New("A"))));
3576 const Function& func_b =
3577 Function::Handle(GetFunction(class_a, "b"));
3578 EXPECT(func_b.IsInlineable());
3579
3580 // After setting a breakpoint in a function A.b, it is no longer inlineable.
3581 SourceBreakpoint* bpt =
3582 Isolate::Current()->debugger()->SetBreakpointAtLine(name,
3583 kBreakpointLine);
3584 ASSERT(bpt != NULL);
3585 EXPECT(!func_b.IsInlineable());
3586 }
3587
3588
3549 TEST_CASE(SpecialClassesHaveEmptyArrays) { 3589 TEST_CASE(SpecialClassesHaveEmptyArrays) {
3550 ObjectStore* object_store = Isolate::Current()->object_store(); 3590 ObjectStore* object_store = Isolate::Current()->object_store();
3551 Class& cls = Class::Handle(); 3591 Class& cls = Class::Handle();
3552 Object& array = Object::Handle(); 3592 Object& array = Object::Handle();
3553 3593
3554 cls = object_store->null_class(); 3594 cls = object_store->null_class();
3555 array = cls.fields(); 3595 array = cls.fields();
3556 EXPECT(!array.IsNull()); 3596 EXPECT(!array.IsNull());
3557 EXPECT(array.IsArray()); 3597 EXPECT(array.IsArray());
3558 array = cls.functions(); 3598 array = cls.functions();
(...skipping 11 matching lines...) Expand all
3570 cls = Object::dynamic_class(); 3610 cls = Object::dynamic_class();
3571 array = cls.fields(); 3611 array = cls.fields();
3572 EXPECT(!array.IsNull()); 3612 EXPECT(!array.IsNull());
3573 EXPECT(array.IsArray()); 3613 EXPECT(array.IsArray());
3574 array = cls.functions(); 3614 array = cls.functions();
3575 EXPECT(!array.IsNull()); 3615 EXPECT(!array.IsNull());
3576 EXPECT(array.IsArray()); 3616 EXPECT(array.IsArray());
3577 } 3617 }
3578 3618
3579 } // namespace dart 3619 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698