Index: runtime/vm/object.cc |
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
index b6b4ab7192b568de35d5328df0d888e348f5ed40..e59f2239f2b6ff3f6cd2268f6e319876f24d22e8 100644 |
--- a/runtime/vm/object.cc |
+++ b/runtime/vm/object.cc |
@@ -43,6 +43,7 @@ |
#include "vm/symbols.h" |
#include "vm/tags.h" |
#include "vm/timer.h" |
+#include "vm/trace_buffer.h" |
#include "vm/unicode.h" |
namespace dart { |
@@ -5889,6 +5890,7 @@ RawFunction* Function::New(const String& name, |
result.set_is_optimizable(is_native ? false : true); |
result.set_is_inlinable(true); |
result.set_allows_hoisting_check_class(true); |
+ result.set_log(new TraceBuffer()); |
turnidge
2014/04/14 16:41:17
Each function gets its own TraceBuffer and the def
|
if (kind == RawFunction::kClosureFunction) { |
const ClosureData& data = ClosureData::Handle(ClosureData::New()); |
result.set_data(data); |
@@ -5917,6 +5919,7 @@ RawFunction* Function::Clone(const Class& new_owner) const { |
clone.set_deoptimization_counter(0); |
clone.set_optimized_instruction_count(0); |
clone.set_optimized_call_site_count(0); |
+ clone.set_log(new TraceBuffer()); |
return clone.raw(); |
} |
@@ -6450,10 +6453,15 @@ void Function::PrintToJSONStream(JSONStream* stream, bool ref) const { |
jsobj.AddProperty("is_const", is_const()); |
jsobj.AddProperty("is_optimizable", is_optimizable()); |
jsobj.AddProperty("is_inlinable", IsInlineable()); |
- jsobj.AddProperty("unoptimized_code", Object::Handle(unoptimized_code())); |
+ jsobj.AddProperty("code", Object::Handle(unoptimized_code())); |
+ if (HasOptimizedCode()) { |
+ jsobj.AddProperty("optimized", true); |
+ jsobj.AddProperty("optimizedCode", Object::Handle(CurrentCode())); |
+ } else { |
+ jsobj.AddProperty("optimized", false); |
turnidge
2014/04/14 16:41:17
What do you think of dropping "optimized" -- is it
Cutch
2014/04/15 20:47:58
Done.
|
+ } |
turnidge
2014/04/14 16:41:17
Should we add OSR code objects too?
Cutch
2014/04/15 20:47:58
Discussed offline.
|
jsobj.AddProperty("usage_counter", usage_counter()); |
jsobj.AddProperty("optimized_call_site_count", optimized_call_site_count()); |
- jsobj.AddProperty("code", Object::Handle(CurrentCode())); |
jsobj.AddProperty("deoptimizations", |
static_cast<intptr_t>(deoptimization_counter())); |
@@ -6463,6 +6471,10 @@ void Function::PrintToJSONStream(JSONStream* stream, bool ref) const { |
jsobj.AddProperty("tokenPos", token_pos()); |
jsobj.AddProperty("endTokenPos", end_token_pos()); |
} |
+ if (log() != NULL) { |
+ JSONObject l(&jsobj, "log"); |
+ log()->PrintToJSONObject(&l); |
+ } |
} |