| OLD | NEW |
| 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 11994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12005 private: | 12005 private: |
| 12006 static uword HashValue(intptr_t url_hash, intptr_t pos) { | 12006 static uword HashValue(intptr_t url_hash, intptr_t pos) { |
| 12007 return url_hash * pos % (Smi::kMaxValue - 13); | 12007 return url_hash * pos % (Smi::kMaxValue - 13); |
| 12008 } | 12008 } |
| 12009 }; | 12009 }; |
| 12010 typedef UnorderedHashMap<ConstMapKeyEqualsTraits> ConstantsMap; | 12010 typedef UnorderedHashMap<ConstMapKeyEqualsTraits> ConstantsMap; |
| 12011 | 12011 |
| 12012 | 12012 |
| 12013 void Parser::CacheConstantValue(TokenPosition token_pos, | 12013 void Parser::CacheConstantValue(TokenPosition token_pos, |
| 12014 const Instance& value) { | 12014 const Instance& value) { |
| 12015 if (current_function().kind() == RawFunction::kImplicitStaticFinalGetter) { |
| 12016 // Don't cache constants in initializer expressions. They get |
| 12017 // evaluated only once. |
| 12018 return; |
| 12019 } |
| 12015 ConstantPosKey key(String::Handle(Z, script_.url()), token_pos); | 12020 ConstantPosKey key(String::Handle(Z, script_.url()), token_pos); |
| 12016 if (isolate()->object_store()->compile_time_constants() == Array::null()) { | 12021 if (isolate()->object_store()->compile_time_constants() == Array::null()) { |
| 12017 const intptr_t kInitialConstMapSize = 16; | 12022 const intptr_t kInitialConstMapSize = 16; |
| 12018 isolate()->object_store()->set_compile_time_constants( | 12023 isolate()->object_store()->set_compile_time_constants( |
| 12019 Array::Handle(Z, HashTables::New<ConstantsMap>(kInitialConstMapSize, | 12024 Array::Handle(Z, HashTables::New<ConstantsMap>(kInitialConstMapSize, |
| 12020 Heap::kNew))); | 12025 Heap::kNew))); |
| 12021 } | 12026 } |
| 12022 ConstantsMap constants(isolate()->object_store()->compile_time_constants()); | 12027 ConstantsMap constants(isolate()->object_store()->compile_time_constants()); |
| 12023 constants.InsertNewOrGetValue(key, value); | 12028 constants.InsertNewOrGetValue(key, value); |
| 12024 if (FLAG_compiler_stats) { | 12029 if (FLAG_compiler_stats) { |
| (...skipping 2449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14474 const ArgumentListNode& function_args, | 14479 const ArgumentListNode& function_args, |
| 14475 const LocalVariable* temp_for_last_arg, | 14480 const LocalVariable* temp_for_last_arg, |
| 14476 bool is_super_invocation) { | 14481 bool is_super_invocation) { |
| 14477 UNREACHABLE(); | 14482 UNREACHABLE(); |
| 14478 return NULL; | 14483 return NULL; |
| 14479 } | 14484 } |
| 14480 | 14485 |
| 14481 } // namespace dart | 14486 } // namespace dart |
| 14482 | 14487 |
| 14483 #endif // DART_PRECOMPILED_RUNTIME | 14488 #endif // DART_PRECOMPILED_RUNTIME |
| OLD | NEW |