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

Unified Diff: runtime/vm/kernel_binary_flowgraph.h

Issue 2783183002: Stream DoubleLiteral (Closed)
Patch Set: Created 3 years, 9 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/kernel_binary_flowgraph.cc » ('j') | runtime/vm/kernel_binary_flowgraph.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/kernel_binary_flowgraph.h
diff --git a/runtime/vm/kernel_binary_flowgraph.h b/runtime/vm/kernel_binary_flowgraph.h
index 37135cae03a8401c11b4d15463fe750a191559a3..f143a291d3e85cae6081cc92008655865eb044d2 100644
--- a/runtime/vm/kernel_binary_flowgraph.h
+++ b/runtime/vm/kernel_binary_flowgraph.h
@@ -17,13 +17,45 @@
namespace dart {
namespace kernel {
+class StreamingConstantEvaluator {
+ public:
+ StreamingConstantEvaluator(StreamingFlowGraphBuilder* builder,
+ Zone* zone,
+ TranslationHelper* h,
+ DartTypeTranslator* type_translator);
+
+ virtual ~StreamingConstantEvaluator() {}
+
+ Instance& EvaluateExpression();
+ void EvaluateDoubleLiteral();
+
+ private:
+ bool GetCachedConstant(intptr_t kernel_offset, Instance* value);
+ void CacheConstantValue(intptr_t kernel_offset, const Instance& value);
+
+ StreamingFlowGraphBuilder* builder_;
+ Isolate* isolate_;
+ Zone* zone_;
+ TranslationHelper& translation_helper_;
+ // DartTypeTranslator& type_translator_;
+
+ Script& script_;
+ Instance& result_;
+};
+
class StreamingFlowGraphBuilder {
public:
- StreamingFlowGraphBuilder(FlowGraphBuilder* flowGraph_builder,
+ StreamingFlowGraphBuilder(FlowGraphBuilder* flow_graph_builder,
const uint8_t* buffer,
intptr_t buffer_length)
- : flow_graph_builder_(flowGraph_builder),
+ : flow_graph_builder_(flow_graph_builder),
+ translation_helper_(flow_graph_builder->translation_helper_),
+ zone_(flow_graph_builder->zone_),
reader_(new kernel::Reader(buffer, buffer_length)),
+ constant_evaluator_(this,
+ flow_graph_builder->zone_,
Kevin Millikin (Google) 2017/03/31 12:23:41 You should be able to use zone_ and &translation_h
+ &flow_graph_builder->translation_helper_,
+ &flow_graph_builder->type_translator_),
string_table_offsets_(NULL),
string_table_size_(-1),
string_table_entries_read_(0) {}
@@ -40,12 +72,20 @@ class StreamingFlowGraphBuilder {
private:
intptr_t GetStringTableOffset(intptr_t index);
+ intptr_t ReaderOffset();
+ void SetOffset(intptr_t offset);
+ void SkipBytes(intptr_t skip);
uint32_t ReadUInt();
intptr_t ReadListLength();
TokenPosition ReadPosition(bool record = true);
+ Tag ReadTag(uint8_t* payload = NULL);
CatchBlock* catch_block();
ScopeBuildingResult* scopes();
+ ParsedFunction* parsed_function();
+
+ dart::String& DartSymbol(intptr_t str_index);
+ dart::String& DartString(intptr_t str_index);
Fragment DebugStepCheck(TokenPosition position);
Fragment LoadLocal(LocalVariable* variable);
@@ -61,14 +101,20 @@ class StreamingFlowGraphBuilder {
Fragment BuildStringLiteral();
Fragment BuildIntLiteral(uint8_t payload);
Fragment BuildIntLiteral(bool is_negative);
+ Fragment BuildDoubleLiteral();
Fragment BuildBoolLiteral(bool value);
Fragment BuildNullLiteral();
FlowGraphBuilder* flow_graph_builder_;
+ TranslationHelper& translation_helper_;
+ Zone* zone_;
kernel::Reader* reader_;
+ StreamingConstantEvaluator constant_evaluator_;
intptr_t* string_table_offsets_;
intptr_t string_table_size_;
intptr_t string_table_entries_read_;
+
+ friend class StreamingConstantEvaluator;
};
} // namespace kernel
« no previous file with comments | « no previous file | runtime/vm/kernel_binary_flowgraph.cc » ('j') | runtime/vm/kernel_binary_flowgraph.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698