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

Unified Diff: runtime/vm/code_generator.cc

Issue 375693004: Don't assign safepoint at the definition to the definition's live-range. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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 | « no previous file | runtime/vm/flow_graph_allocator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_generator.cc
diff --git a/runtime/vm/code_generator.cc b/runtime/vm/code_generator.cc
index 6ee109850c178993a3913654881724c6e9b03a4d..0bde86872025011b8f8c660b1b54c343732d98e8 100644
--- a/runtime/vm/code_generator.cc
+++ b/runtime/vm/code_generator.cc
@@ -70,6 +70,11 @@ DEFINE_FLAG(int, deoptimize_every, 0,
DEFINE_FLAG(charp, deoptimize_filter, NULL,
"Deoptimize in named function on stack overflow checks");
+#ifdef DEBUG
+DEFINE_FLAG(charp, gc_at_instance_allocation, NULL,
+ "Perform a GC before allocation of instances of "
+ "the specified class");
+#endif
DEFINE_RUNTIME_ENTRY(TraceFunctionEntry, 1) {
const Function& function = Function::CheckedHandle(arguments.ArgAt(0));
@@ -141,7 +146,20 @@ static intptr_t GetCallerLocation() {
// Return value: newly allocated object.
DEFINE_RUNTIME_ENTRY(AllocateObject, 2) {
const Class& cls = Class::CheckedHandle(arguments.ArgAt(0));
+
+#ifdef DEBUG
+ if (FLAG_gc_at_instance_allocation != NULL) {
+ const String& name = String::Handle(cls.Name());
+ if (String::EqualsIgnoringPrivateKey(
+ name,
+ String::Handle(String::New(FLAG_gc_at_instance_allocation)))) {
+ Isolate::Current()->heap()->CollectAllGarbage();
+ }
+ }
+#endif
+
const Instance& instance = Instance::Handle(Instance::New(cls));
+
arguments.SetReturn(instance);
if (cls.NumTypeArguments() == 0) {
// No type arguments required for a non-parameterized type.
« no previous file with comments | « no previous file | runtime/vm/flow_graph_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698