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

Side by Side Diff: runtime/vm/kernel_binary_flowgraph.cc

Issue 2790093002: Hacky streaming of VariableGet (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/kernel_binary_flowgraph.h" 5 #include "vm/kernel_binary_flowgraph.h"
6 6
7 #include "vm/object_store.h" 7 #include "vm/object_store.h"
8 8
9 #if !defined(DART_PRECOMPILED_RUNTIME) 9 #if !defined(DART_PRECOMPILED_RUNTIME)
10 10
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 208
209 Fragment StreamingFlowGraphBuilder::BuildAt(intptr_t kernel_offset) { 209 Fragment StreamingFlowGraphBuilder::BuildAt(intptr_t kernel_offset) {
210 SetOffset(kernel_offset); 210 SetOffset(kernel_offset);
211 211
212 uint8_t payload = 0; 212 uint8_t payload = 0;
213 Tag tag = ReadTag(&payload); 213 Tag tag = ReadTag(&payload);
214 switch (tag) { 214 switch (tag) {
215 case kInvalidExpression: 215 case kInvalidExpression:
216 return BuildInvalidExpression(); 216 return BuildInvalidExpression();
217 // case kVariableGet: 217 case kVariableGet:
218 // return VariableGet::ReadFrom(reader_); 218 return BuildVariableGet();
219 // case kSpecializedVariableGet: 219 case kSpecializedVariableGet:
220 // return VariableGet::ReadFrom(reader_, payload); 220 return BuildVariableGet(payload);
221 // case kVariableSet: 221 // case kVariableSet:
222 // return VariableSet::ReadFrom(reader_); 222 // return VariableSet::ReadFrom(reader_);
223 // case kSpecializedVariableSet: 223 // case kSpecializedVariableSet:
224 // return VariableSet::ReadFrom(reader_, payload); 224 // return VariableSet::ReadFrom(reader_, payload);
225 // case kPropertyGet: 225 // case kPropertyGet:
226 // return PropertyGet::ReadFrom(reader_); 226 // return PropertyGet::ReadFrom(reader_);
227 // case kPropertySet: 227 // case kPropertySet:
228 // return PropertySet::ReadFrom(reader_); 228 // return PropertySet::ReadFrom(reader_);
229 // case kDirectPropertyGet: 229 // case kDirectPropertyGet:
230 // return DirectPropertyGet::ReadFrom(reader_); 230 // return DirectPropertyGet::ReadFrom(reader_);
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 intptr_t savedOffset = ReaderOffset(); 476 intptr_t savedOffset = ReaderOffset();
477 477
478 SetOffset(GetStringTableOffset(str_index)); 478 SetOffset(GetStringTableOffset(str_index));
479 uint32_t bytes = ReadUInt(); 479 uint32_t bytes = ReadUInt();
480 const uint8_t* data = &reader_->buffer()[ReaderOffset()]; 480 const uint8_t* data = &reader_->buffer()[ReaderOffset()];
481 481
482 SetOffset(savedOffset); 482 SetOffset(savedOffset);
483 return new String(data, bytes); 483 return new String(data, bytes);
484 } 484 }
485 485
486 dart::LocalVariable* StreamingFlowGraphBuilder::LookupVariable(
487 intptr_t kernel_offset) {
488 return flow_graph_builder_->LookupVariable(kernel_offset);
489 }
490
486 Fragment StreamingFlowGraphBuilder::DebugStepCheck(TokenPosition position) { 491 Fragment StreamingFlowGraphBuilder::DebugStepCheck(TokenPosition position) {
487 return flow_graph_builder_->DebugStepCheck(position); 492 return flow_graph_builder_->DebugStepCheck(position);
488 } 493 }
489 494
490 Fragment StreamingFlowGraphBuilder::LoadLocal(LocalVariable* variable) { 495 Fragment StreamingFlowGraphBuilder::LoadLocal(LocalVariable* variable) {
491 return flow_graph_builder_->LoadLocal(variable); 496 return flow_graph_builder_->LoadLocal(variable);
492 } 497 }
493 498
494 Fragment StreamingFlowGraphBuilder::PushArgument() { 499 Fragment StreamingFlowGraphBuilder::PushArgument() {
495 return flow_graph_builder_->PushArgument(); 500 return flow_graph_builder_->PushArgument();
(...skipping 26 matching lines...) Expand all
522 return flow_graph_builder_->StaticCall(position, target, argument_count); 527 return flow_graph_builder_->StaticCall(position, target, argument_count);
523 } 528 }
524 529
525 Fragment StreamingFlowGraphBuilder::BuildInvalidExpression() { 530 Fragment StreamingFlowGraphBuilder::BuildInvalidExpression() {
526 // The frontend will take care of emitting normal errors (like 531 // The frontend will take care of emitting normal errors (like
527 // [NoSuchMethodError]s) and only emit [InvalidExpression]s in very special 532 // [NoSuchMethodError]s) and only emit [InvalidExpression]s in very special
528 // situations (e.g. an invalid annotation). 533 // situations (e.g. an invalid annotation).
529 return ThrowNoSuchMethodError(); 534 return ThrowNoSuchMethodError();
530 } 535 }
531 536
537 Fragment StreamingFlowGraphBuilder::BuildVariableGet() {
538 ReadPosition();
539 intptr_t variable_kernel_position = ReadUInt();
540 ReadUInt(); // Variable index.
541
542 // TODO(jensj): This is actually a "reader->ReadOptional<DartType>();".
543 // Optional type below: Not currently implemented.
544 Tag tag = ReadTag();
545 if (tag != kNothing) {
546 UNIMPLEMENTED();
547 }
548
549 return LoadLocal(LookupVariable(variable_kernel_position));
550 }
551
552 Fragment StreamingFlowGraphBuilder::BuildVariableGet(uint8_t payload) {
553 ReadPosition();
554 intptr_t variable_kernel_position = ReadUInt();
555 return LoadLocal(LookupVariable(variable_kernel_position));
556 }
557
532 Fragment StreamingFlowGraphBuilder::BuildStaticGet() { 558 Fragment StreamingFlowGraphBuilder::BuildStaticGet() {
533 intptr_t saved_offset = ReaderOffset() - 1; // Include the tag. 559 intptr_t saved_offset = ReaderOffset() - 1; // Include the tag.
534 TokenPosition position = ReadPosition(); 560 TokenPosition position = ReadPosition();
535 int canonical_name_index = ReadUInt(); 561 int canonical_name_index = ReadUInt();
536 CanonicalName* target = GetCanonicalName(canonical_name_index); 562 CanonicalName* target = GetCanonicalName(canonical_name_index);
537 563
538 if (target->IsField()) { 564 if (target->IsField()) {
539 const dart::Field& field = 565 const dart::Field& field =
540 dart::Field::ZoneHandle(Z, H.LookupFieldByKernelField(target)); 566 dart::Field::ZoneHandle(Z, H.LookupFieldByKernelField(target));
541 if (field.is_const()) { 567 if (field.is_const()) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 } 647 }
622 648
623 Fragment StreamingFlowGraphBuilder::BuildNullLiteral() { 649 Fragment StreamingFlowGraphBuilder::BuildNullLiteral() {
624 return Constant(Instance::ZoneHandle(Z, Instance::null())); 650 return Constant(Instance::ZoneHandle(Z, Instance::null()));
625 } 651 }
626 652
627 } // namespace kernel 653 } // namespace kernel
628 } // namespace dart 654 } // namespace dart
629 655
630 #endif // !defined(DART_PRECOMPILED_RUNTIME) 656 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698