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

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

Issue 2517683002: Don't include usage counters, etc in snapshots with code. If we already have code, eagerly recompil… (Closed)
Patch Set: . Created 4 years, 1 month 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
« no previous file with comments | « runtime/bin/main.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/clustered_snapshot.h" 5 #include "vm/clustered_snapshot.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 if (kind != Snapshot::kAppNoJIT) { 556 if (kind != Snapshot::kAppNoJIT) {
557 s->WriteTokenPosition(func->ptr()->token_pos_); 557 s->WriteTokenPosition(func->ptr()->token_pos_);
558 s->WriteTokenPosition(func->ptr()->end_token_pos_); 558 s->WriteTokenPosition(func->ptr()->end_token_pos_);
559 } 559 }
560 #endif 560 #endif
561 s->Write<int16_t>(func->ptr()->num_fixed_parameters_); 561 s->Write<int16_t>(func->ptr()->num_fixed_parameters_);
562 s->Write<int16_t>(func->ptr()->num_optional_parameters_); 562 s->Write<int16_t>(func->ptr()->num_optional_parameters_);
563 s->Write<uint32_t>(func->ptr()->kind_tag_); 563 s->Write<uint32_t>(func->ptr()->kind_tag_);
564 if (kind == Snapshot::kAppNoJIT) { 564 if (kind == Snapshot::kAppNoJIT) {
565 // Omit fields used to support de/reoptimization. 565 // Omit fields used to support de/reoptimization.
566 } else { 566 } else if (!Snapshot::IncludesCode(kind)) {
567 #if !defined(DART_PRECOMPILED_RUNTIME) 567 #if !defined(DART_PRECOMPILED_RUNTIME)
568 bool is_optimized = Code::IsOptimized(func->ptr()->code_); 568 bool is_optimized = Code::IsOptimized(func->ptr()->code_);
569 if (is_optimized) { 569 if (is_optimized) {
570 s->Write<int32_t>(FLAG_optimization_counter_threshold); 570 s->Write<int32_t>(FLAG_optimization_counter_threshold);
571 } else { 571 } else {
572 s->Write<int32_t>(0); 572 s->Write<int32_t>(0);
573 } 573 }
574 s->Write<int8_t>(func->ptr()->deoptimization_counter_);
575 s->Write<uint16_t>(func->ptr()->optimized_instruction_count_);
576 s->Write<uint16_t>(func->ptr()->optimized_call_site_count_);
577 #endif 574 #endif
578 } 575 }
579 } 576 }
580 } 577 }
581 578
582 private: 579 private:
583 GrowableArray<RawFunction*> objects_; 580 GrowableArray<RawFunction*> objects_;
584 }; 581 };
585 #endif // !DART_PRECOMPILED_RUNTIME 582 #endif // !DART_PRECOMPILED_RUNTIME
586 583
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 func->ptr()->end_token_pos_ = d->ReadTokenPosition(); 633 func->ptr()->end_token_pos_ = d->ReadTokenPosition();
637 } 634 }
638 #endif 635 #endif
639 func->ptr()->num_fixed_parameters_ = d->Read<int16_t>(); 636 func->ptr()->num_fixed_parameters_ = d->Read<int16_t>();
640 func->ptr()->num_optional_parameters_ = d->Read<int16_t>(); 637 func->ptr()->num_optional_parameters_ = d->Read<int16_t>();
641 func->ptr()->kind_tag_ = d->Read<uint32_t>(); 638 func->ptr()->kind_tag_ = d->Read<uint32_t>();
642 if (kind == Snapshot::kAppNoJIT) { 639 if (kind == Snapshot::kAppNoJIT) {
643 // Omit fields used to support de/reoptimization. 640 // Omit fields used to support de/reoptimization.
644 } else { 641 } else {
645 #if !defined(DART_PRECOMPILED_RUNTIME) 642 #if !defined(DART_PRECOMPILED_RUNTIME)
646 func->ptr()->usage_counter_ = d->Read<int32_t>(); 643 if (Snapshot::IncludesCode(kind)) {
647 func->ptr()->deoptimization_counter_ = d->Read<int8_t>(); 644 func->ptr()->usage_counter_ = 0;
648 func->ptr()->optimized_instruction_count_ = d->Read<uint16_t>(); 645 } else {
649 func->ptr()->optimized_call_site_count_ = d->Read<uint16_t>(); 646 func->ptr()->usage_counter_ = d->Read<int32_t>();
647 }
648 func->ptr()->deoptimization_counter_ = 0;
649 func->ptr()->optimized_instruction_count_ = 0;
650 func->ptr()->optimized_call_site_count_ = 0;
650 #endif 651 #endif
651 } 652 }
652 } 653 }
653 } 654 }
654 655
655 void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) { 656 void PostLoad(const Array& refs, Snapshot::Kind kind, Zone* zone) {
656 NOT_IN_PRODUCT(TimelineDurationScope tds( 657 NOT_IN_PRODUCT(TimelineDurationScope tds(
657 Thread::Current(), Timeline::GetIsolateStream(), "PostLoadFunction")); 658 Thread::Current(), Timeline::GetIsolateStream(), "PostLoadFunction"));
658 659
659 if (kind == Snapshot::kAppNoJIT) { 660 if (kind == Snapshot::kAppNoJIT) {
(...skipping 4700 matching lines...) Expand 10 before | Expand all | Expand 10 after
5360 5361
5361 deserializer.ReadVMSnapshot(); 5362 deserializer.ReadVMSnapshot();
5362 5363
5363 Dart::set_instructions_snapshot_buffer(instructions_buffer_); 5364 Dart::set_instructions_snapshot_buffer(instructions_buffer_);
5364 Dart::set_data_snapshot_buffer(data_buffer_); 5365 Dart::set_data_snapshot_buffer(data_buffer_);
5365 5366
5366 return ApiError::null(); 5367 return ApiError::null();
5367 } 5368 }
5368 5369
5369 } // namespace dart 5370 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/main.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698