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

Unified Diff: runtime/vm/debugger.cc

Issue 2979163002: Allow setting breakpoints in function literal field initializers under --dfe. (Closed)
Patch Set: Created 3 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
Index: runtime/vm/debugger.cc
diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc
index ac05de0b61080fde02d7aebad73df7c4c1eaafbb..eb434bab0f211ae293098970980b737a7afb29ca 100644
--- a/runtime/vm/debugger.cc
+++ b/runtime/vm/debugger.cc
@@ -16,6 +16,9 @@
#include "vm/flags.h"
#include "vm/globals.h"
#include "vm/json_stream.h"
+#include "vm/kernel_binary.h"
+#include "vm/kernel_binary_flowgraph.h"
+#include "vm/kernel_to_il.h"
#include "vm/longjump.h"
#include "vm/message_handler.h"
#include "vm/object.h"
@@ -2649,6 +2652,7 @@ bool Debugger::FindBestFit(const Script& script,
// that has not been initialized yet. If the field (and hence the
// function literal initializer) has already been initialized, then
// it would have been found above in the object store as a closure.
+ const uint8_t* kernel_data = script.kernel_data();
fields = cls.fields();
if (!fields.IsNull()) {
const intptr_t num_fields = fields.Length();
@@ -2662,7 +2666,28 @@ bool Debugger::FindBestFit(const Script& script,
// the breakpoint in.
continue;
}
- if (Parser::FieldHasFunctionLiteralInitializer(field, &start, &end)) {
+ bool has_func_literal_initializer = false;
+ if (kernel_data != NULL) {
+#ifndef DART_PRECOMPILED_RUNTIME
+ // If we have the kernel program, use it.
+ kernel::TranslationHelper translation_helper(
+ Thread::Current(), script.kernel_string_offsets(),
+ script.kernel_string_data(), script.kernel_canonical_names());
+ kernel::StreamingFlowGraphBuilder* builder =
+ new kernel::StreamingFlowGraphBuilder(&translation_helper, zone,
+ kernel_data,
+ script.kernel_data_size());
+ kernel::FieldHelper field_helper(builder, field.kernel_offset());
+ field_helper.ReadUntilExcluding(kernel::FieldHelper::kEnd, true);
+ has_func_literal_initializer =
+ field_helper.FieldHasFunctionLiteralInitializer(&start, &end);
+ delete builder;
+#endif // !DART_PRECOMPILED_RUNTIME
siva 2017/07/17 22:39:23 Is it possible to abstract this out as a function
sivachandra 2017/07/17 23:49:36 Done.
+ } else {
+ has_func_literal_initializer =
+ Parser::FieldHasFunctionLiteralInitializer(field, &start, &end);
+ }
+ if (has_func_literal_initializer) {
if ((start <= token_pos && token_pos <= end) ||
(token_pos <= start && start <= last_token_pos)) {
return true;

Powered by Google App Engine
This is Rietveld 408576698