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

Unified 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, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object_test.cc
===================================================================
--- runtime/vm/object_test.cc (revision 29383)
+++ runtime/vm/object_test.cc (working copy)
@@ -7,6 +7,7 @@
#include "vm/class_finalizer.h"
#include "vm/dart_api_impl.h"
#include "vm/dart_entry.h"
+#include "vm/debugger.h"
#include "vm/isolate.h"
#include "vm/object.h"
#include "vm/object_store.h"
@@ -3546,6 +3547,45 @@
}
+TEST_CASE(FunctionWithBreakpointNotInlined) {
+ const char* kScriptChars =
+ "class A {\n"
+ " a() {\n"
+ " }\n"
+ " b() {\n"
+ " a();\n" // This is line 5.
+ " }\n"
+ "}\n"
+ "test() {\n"
+ " new A().b();\n"
+ "}";
+ const int kBreakpointLine = 5;
+ Dart_Handle lib = TestCase::LoadTestScript(kScriptChars, NULL);
+ EXPECT_VALID(lib);
+
+ // Run function A.b one time.
+ Dart_Handle result = Dart_Invoke(lib, NewString("test"), 0, NULL);
+ EXPECT_VALID(result);
+
+ // With no breakpoint, function A.b is inlineable.
+ const String& name = String::Handle(String::New(TestCase::url()));
+ const Library& vmlib = Library::Handle(Library::LookupLibrary(name));
+ EXPECT(!vmlib.IsNull());
+ const Class& class_a = Class::Handle(
+ vmlib.LookupClass(String::Handle(Symbols::New("A"))));
+ const Function& func_b =
+ Function::Handle(GetFunction(class_a, "b"));
+ EXPECT(func_b.IsInlineable());
+
+ // After setting a breakpoint in a function A.b, it is no longer inlineable.
+ SourceBreakpoint* bpt =
+ Isolate::Current()->debugger()->SetBreakpointAtLine(name,
+ kBreakpointLine);
+ ASSERT(bpt != NULL);
+ EXPECT(!func_b.IsInlineable());
+}
+
+
TEST_CASE(SpecialClassesHaveEmptyArrays) {
ObjectStore* object_store = Isolate::Current()->object_store();
Class& cls = Class::Handle();
« 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