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

Unified Diff: runtime/vm/parser.cc

Issue 2147493005: Remove per-isolate compile-time constants cache. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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/parser.h ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 6af310070ea1e24b478bda2aff4811f1104355cc..6c0bd7df21a00ac562e3cb86218b3022b1bb842c 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -12145,34 +12145,16 @@ void Parser::InsertCachedConstantValue(const Script& script,
const Instance& value) {
ASSERT(Thread::Current()->IsMutatorThread());
const intptr_t kInitialConstMapSize = 16;
- if (script.InVMHeap()) {
- // For scripts in the vm heap, their constants are in a shared
- // per-isolate map.
- Isolate* isolate = Isolate::Current();
- const String& url = String::Handle(script.url());
- UrlAndPosKey key(url, token_pos);
- if (isolate->object_store()->vm_compile_time_constants() == Array::null()) {
- isolate->object_store()->set_vm_compile_time_constants(
- Array::Handle(HashTables::New<VMConstantsMap>(
- kInitialConstMapSize, Heap::kNew)));
- }
- VMConstantsMap constants(
- isolate->object_store()->vm_compile_time_constants());
- constants.InsertNewOrGetValue(key, value);
- isolate->object_store()->set_vm_compile_time_constants(constants.Release());
- } else {
- // For scripts which are not in the vm heap, their constants are
- // stored in the script itself.
- if (script.compile_time_constants() == Array::null()) {
- const Array& array =
- Array::Handle(HashTables::New<ConstantsMap>(kInitialConstMapSize,
- Heap::kNew));
- script.set_compile_time_constants(array);
- }
- ConstantsMap constants(script.compile_time_constants());
- constants.InsertNewOrGetValue(token_pos, value);
- script.set_compile_time_constants(constants.Release());
+ ASSERT(!script.InVMHeap());
+ if (script.compile_time_constants() == Array::null()) {
+ const Array& array =
+ Array::Handle(HashTables::New<ConstantsMap>(kInitialConstMapSize,
+ Heap::kNew));
+ script.set_compile_time_constants(array);
}
+ ConstantsMap constants(script.compile_time_constants());
+ constants.InsertNewOrGetValue(token_pos, value);
+ script.set_compile_time_constants(constants.Release());
}
@@ -12189,34 +12171,16 @@ void Parser::CacheConstantValue(TokenPosition token_pos,
bool Parser::GetCachedConstant(TokenPosition token_pos, Instance* value) {
bool is_present = false;
- if (script_.InVMHeap()) {
- // For scripts in the vm heap, their constants are in a shared
- // per-isolate map.
- if (isolate()->object_store()->vm_compile_time_constants() ==
- Array::null()) {
- return false;
- }
- UrlAndPosKey key(String::Handle(Z, script_.url()), token_pos);
- VMConstantsMap constants(
- isolate()->object_store()->vm_compile_time_constants());
- *value ^= constants.GetOrNull(key, &is_present);
- // Mutator compiler thread may add constants while background compiler
- // is running, and thus change the value of 'vm_compile_time_constants';
- // do not assert that 'vm_compile_time_constants' has not changed.
- constants.Release();
- } else {
- // For scripts which are not in the vm heap, their constants are
- // stored in the script itself.
- if (script_.compile_time_constants() == Array::null()) {
- return false;
- }
- ConstantsMap constants(script_.compile_time_constants());
- *value ^= constants.GetOrNull(token_pos, &is_present);
- // Mutator compiler thread may add constants while background compiler
- // is running, and thus change the value of 'compile_time_constants';
- // do not assert that 'compile_time_constants' has not changed.
- constants.Release();
+ ASSERT(!script_.InVMHeap());
+ if (script_.compile_time_constants() == Array::null()) {
+ return false;
}
+ ConstantsMap constants(script_.compile_time_constants());
+ *value ^= constants.GetOrNull(token_pos, &is_present);
+ // Mutator compiler thread may add constants while background compiler
+ // is running, and thus change the value of 'compile_time_constants';
+ // do not assert that 'compile_time_constants' has not changed.
+ constants.Release();
if (FLAG_compiler_stats && is_present) {
thread_->compiler_stats()->num_const_cache_hits++;
}
« no previous file with comments | « runtime/vm/parser.h ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698