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

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

Issue 1841213003: Move CompilerStats from isolate to thread. Aggregate stats. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: review comments addressed Created 4 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
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/thread.h » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/parser.h" 5 #include "vm/parser.h"
6 #include "vm/flags.h" 6 #include "vm/flags.h"
7 7
8 #ifndef DART_PRECOMPILED_RUNTIME 8 #ifndef DART_PRECOMPILED_RUNTIME
9 9
10 #include "lib/invocation_mirror.h" 10 #include "lib/invocation_mirror.h"
(...skipping 12001 matching lines...) Expand 10 before | Expand all | Expand 10 after
12012 ConstantPosKey key(String::Handle(Z, script_.url()), token_pos); 12012 ConstantPosKey key(String::Handle(Z, script_.url()), token_pos);
12013 if (isolate()->object_store()->compile_time_constants() == Array::null()) { 12013 if (isolate()->object_store()->compile_time_constants() == Array::null()) {
12014 const intptr_t kInitialConstMapSize = 16; 12014 const intptr_t kInitialConstMapSize = 16;
12015 isolate()->object_store()->set_compile_time_constants( 12015 isolate()->object_store()->set_compile_time_constants(
12016 Array::Handle(Z, HashTables::New<ConstantsMap>(kInitialConstMapSize, 12016 Array::Handle(Z, HashTables::New<ConstantsMap>(kInitialConstMapSize,
12017 Heap::kNew))); 12017 Heap::kNew)));
12018 } 12018 }
12019 ConstantsMap constants(isolate()->object_store()->compile_time_constants()); 12019 ConstantsMap constants(isolate()->object_store()->compile_time_constants());
12020 constants.InsertNewOrGetValue(key, value); 12020 constants.InsertNewOrGetValue(key, value);
12021 if (FLAG_compiler_stats) { 12021 if (FLAG_compiler_stats) {
12022 isolate_->compiler_stats()->num_cached_consts = constants.NumOccupied(); 12022 thread_->compiler_stats()->num_cached_consts = constants.NumOccupied();
12023 } 12023 }
12024 isolate()->object_store()->set_compile_time_constants(constants.Release()); 12024 isolate()->object_store()->set_compile_time_constants(constants.Release());
12025 } 12025 }
12026 12026
12027 12027
12028 bool Parser::GetCachedConstant(TokenPosition token_pos, Instance* value) { 12028 bool Parser::GetCachedConstant(TokenPosition token_pos, Instance* value) {
12029 if (isolate()->object_store()->compile_time_constants() == Array::null()) { 12029 if (isolate()->object_store()->compile_time_constants() == Array::null()) {
12030 return false; 12030 return false;
12031 } 12031 }
12032 ConstantPosKey key(String::Handle(Z, script_.url()), token_pos); 12032 ConstantPosKey key(String::Handle(Z, script_.url()), token_pos);
12033 ConstantsMap constants(isolate()->object_store()->compile_time_constants()); 12033 ConstantsMap constants(isolate()->object_store()->compile_time_constants());
12034 bool is_present = false; 12034 bool is_present = false;
12035 *value ^= constants.GetOrNull(key, &is_present); 12035 *value ^= constants.GetOrNull(key, &is_present);
12036 // Mutator compiler thread may add constants while background compiler 12036 // Mutator compiler thread may add constants while background compiler
12037 // is running , and thus change the value of 'compile_time_constants'; 12037 // is running , and thus change the value of 'compile_time_constants';
12038 // do not assert that 'compile_time_constants' has not changed. 12038 // do not assert that 'compile_time_constants' has not changed.
12039 constants.Release(); 12039 constants.Release();
12040 if (FLAG_compiler_stats && is_present) { 12040 if (FLAG_compiler_stats && is_present) {
12041 isolate_->compiler_stats()->num_const_cache_hits++; 12041 thread_->compiler_stats()->num_const_cache_hits++;
12042 } 12042 }
12043 return is_present; 12043 return is_present;
12044 } 12044 }
12045 12045
12046 12046
12047 RawInstance* Parser::TryCanonicalize(const Instance& instance, 12047 RawInstance* Parser::TryCanonicalize(const Instance& instance,
12048 TokenPosition token_pos) { 12048 TokenPosition token_pos) {
12049 if (instance.IsNull()) { 12049 if (instance.IsNull()) {
12050 return instance.raw(); 12050 return instance.raw();
12051 } 12051 }
(...skipping 2410 matching lines...) Expand 10 before | Expand all | Expand 10 after
14462 const ArgumentListNode& function_args, 14462 const ArgumentListNode& function_args,
14463 const LocalVariable* temp_for_last_arg, 14463 const LocalVariable* temp_for_last_arg,
14464 bool is_super_invocation) { 14464 bool is_super_invocation) {
14465 UNREACHABLE(); 14465 UNREACHABLE();
14466 return NULL; 14466 return NULL;
14467 } 14467 }
14468 14468
14469 } // namespace dart 14469 } // namespace dart
14470 14470
14471 #endif // DART_PRECOMPILED_RUNTIME 14471 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698