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

Unified Diff: runtime/vm/kernel_binary.h

Issue 2854393002: [kernel] [partial] Streaming of kernel binary without AST nodes (Closed)
Patch Set: Address comments; small fixes; rebased. Created 3 years, 7 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/kernel.h ('k') | runtime/vm/kernel_binary.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/kernel_binary.h
diff --git a/runtime/vm/kernel_binary.h b/runtime/vm/kernel_binary.h
index b8ae51c3b3b78b455c95b06ed5f99cd61d4c537c..0e6459f1dceb1a792e09f902aa1999ad42890ffb 100644
--- a/runtime/vm/kernel_binary.h
+++ b/runtime/vm/kernel_binary.h
@@ -268,19 +268,6 @@ class TypeParameterScope {
};
-template <typename T>
-class SwitchCaseScope {
- public:
- explicit SwitchCaseScope(T* builder) : builder_(builder) {
- builder_->switch_cases().EnterScope();
- }
- ~SwitchCaseScope() { builder_->switch_cases().LeaveScope(); }
-
- private:
- T* builder_;
-};
-
-
// Unlike other scopes, labels from enclosing functions are not visible in
// nested functions. The LabelScope class is used to hide outer labels.
template <typename Builder, typename Block>
@@ -308,7 +295,6 @@ class ReaderHelper {
BlockStack<VariableDeclaration>& variables() { return scope_; }
BlockStack<TypeParameter>& type_parameters() { return type_parameters_; }
- BlockStack<SwitchCase>& switch_cases() { return switch_cases_; }
BlockStack<LabeledStatement>* labels() { return labels_; }
void set_labels(BlockStack<LabeledStatement>* labels) { labels_ = labels; }
@@ -317,7 +303,6 @@ class ReaderHelper {
Program* program_;
BlockStack<VariableDeclaration> scope_;
BlockStack<TypeParameter> type_parameters_;
- BlockStack<SwitchCase> switch_cases_;
BlockStack<LabeledStatement>* labels_;
};
@@ -422,6 +407,8 @@ class Reader {
uint8_t ReadByte() { return buffer_[offset_++]; }
+ uint8_t PeekByte() { return buffer_[offset_]; }
+
bool ReadBool() { return (ReadByte() & 1) == 1; }
word ReadFlags() { return ReadByte(); }
@@ -439,6 +426,19 @@ class Reader {
}
}
+ Tag PeekTag(uint8_t* payload = NULL) {
+ uint8_t byte = PeekByte();
+ bool has_payload = (byte & kSpecializedTagHighBit) != 0;
+ if (has_payload) {
+ if (payload != NULL) {
+ *payload = byte & kSpecializedPayloadMask;
+ }
+ return static_cast<Tag>(byte & kSpecializedTagMask);
+ } else {
+ return static_cast<Tag>(byte);
+ }
+ }
+
const uint8_t* Consume(int count) {
ASSERT(offset_ + count <= size_);
const uint8_t* old = buffer_ + offset_;
« no previous file with comments | « runtime/vm/kernel.h ('k') | runtime/vm/kernel_binary.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698