OLD | NEW |
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 <map> | 5 #include <map> |
6 #include <set> | 6 #include <set> |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "vm/kernel_to_il.h" | 9 #include "vm/kernel_to_il.h" |
10 | 10 |
(...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1477 // evaluated only once. | 1477 // evaluated only once. |
1478 return false; | 1478 return false; |
1479 } | 1479 } |
1480 | 1480 |
1481 bool is_present = false; | 1481 bool is_present = false; |
1482 ASSERT(!script_.InVMHeap()); | 1482 ASSERT(!script_.InVMHeap()); |
1483 if (script_.compile_time_constants() == Array::null()) { | 1483 if (script_.compile_time_constants() == Array::null()) { |
1484 return false; | 1484 return false; |
1485 } | 1485 } |
1486 KernelConstantsMap constants(script_.compile_time_constants()); | 1486 KernelConstantsMap constants(script_.compile_time_constants()); |
1487 *value ^= constants.GetOrNull(node, &is_present); | 1487 *value ^= constants.GetOrNull(node->kernel_offset(), &is_present); |
1488 // Mutator compiler thread may add constants while background compiler | 1488 // Mutator compiler thread may add constants while background compiler |
1489 // is running, and thus change the value of 'compile_time_constants'; | 1489 // is running, and thus change the value of 'compile_time_constants'; |
1490 // do not assert that 'compile_time_constants' has not changed. | 1490 // do not assert that 'compile_time_constants' has not changed. |
1491 constants.Release(); | 1491 constants.Release(); |
1492 if (FLAG_compiler_stats && is_present) { | 1492 if (FLAG_compiler_stats && is_present) { |
1493 H.thread()->compiler_stats()->num_const_cache_hits++; | 1493 H.thread()->compiler_stats()->num_const_cache_hits++; |
1494 } | 1494 } |
1495 return is_present; | 1495 return is_present; |
1496 } | 1496 } |
1497 | 1497 |
(...skipping 11 matching lines...) Expand all Loading... |
1509 return; | 1509 return; |
1510 } | 1510 } |
1511 const intptr_t kInitialConstMapSize = 16; | 1511 const intptr_t kInitialConstMapSize = 16; |
1512 ASSERT(!script_.InVMHeap()); | 1512 ASSERT(!script_.InVMHeap()); |
1513 if (script_.compile_time_constants() == Array::null()) { | 1513 if (script_.compile_time_constants() == Array::null()) { |
1514 const Array& array = Array::Handle( | 1514 const Array& array = Array::Handle( |
1515 HashTables::New<KernelConstantsMap>(kInitialConstMapSize, Heap::kNew)); | 1515 HashTables::New<KernelConstantsMap>(kInitialConstMapSize, Heap::kNew)); |
1516 script_.set_compile_time_constants(array); | 1516 script_.set_compile_time_constants(array); |
1517 } | 1517 } |
1518 KernelConstantsMap constants(script_.compile_time_constants()); | 1518 KernelConstantsMap constants(script_.compile_time_constants()); |
1519 constants.InsertNewOrGetValue(node, value); | 1519 constants.InsertNewOrGetValue(node->kernel_offset(), value); |
1520 script_.set_compile_time_constants(constants.Release()); | 1520 script_.set_compile_time_constants(constants.Release()); |
1521 } | 1521 } |
1522 | 1522 |
1523 | 1523 |
1524 void ConstantEvaluator::VisitSymbolLiteral(SymbolLiteral* node) { | 1524 void ConstantEvaluator::VisitSymbolLiteral(SymbolLiteral* node) { |
1525 const dart::String& symbol_value = H.DartSymbol(node->value()); | 1525 const dart::String& symbol_value = H.DartSymbol(node->value()); |
1526 | 1526 |
1527 const dart::Class& symbol_class = | 1527 const dart::Class& symbol_class = |
1528 dart::Class::ZoneHandle(Z, I->object_store()->symbol_class()); | 1528 dart::Class::ZoneHandle(Z, I->object_store()->symbol_class()); |
1529 ASSERT(!symbol_class.IsNull()); | 1529 ASSERT(!symbol_class.IsNull()); |
(...skipping 4930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6460 thread->clear_sticky_error(); | 6460 thread->clear_sticky_error(); |
6461 return error.raw(); | 6461 return error.raw(); |
6462 } | 6462 } |
6463 } | 6463 } |
6464 | 6464 |
6465 | 6465 |
6466 } // namespace kernel | 6466 } // namespace kernel |
6467 } // namespace dart | 6467 } // namespace dart |
6468 | 6468 |
6469 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 6469 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
OLD | NEW |