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

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

Issue 2677473003: Fix an assertion about canonical types in the precompiler. (Closed)
Patch Set: add same assertion for type arguments Created 3 years, 10 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/object.cc ('k') | no next file » | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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/precompiler.h" 5 #include "vm/precompiler.h"
6 6
7 #include "vm/aot_optimizer.h" 7 #include "vm/aot_optimizer.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/branch_optimizer.h" 10 #include "vm/branch_optimizer.h"
(...skipping 2659 matching lines...) Expand 10 before | Expand all | Expand 10 after
2670 2670
2671 // Rehash the canonical Types table. 2671 // Rehash the canonical Types table.
2672 ObjectStore* object_store = I->object_store(); 2672 ObjectStore* object_store = I->object_store();
2673 GrowableObjectArray& types = 2673 GrowableObjectArray& types =
2674 GrowableObjectArray::Handle(Z, GrowableObjectArray::New()); 2674 GrowableObjectArray::Handle(Z, GrowableObjectArray::New());
2675 Array& types_array = Array::Handle(Z); 2675 Array& types_array = Array::Handle(Z);
2676 Type& type = Type::Handle(Z); 2676 Type& type = Type::Handle(Z);
2677 { 2677 {
2678 CanonicalTypeSet types_table(Z, object_store->canonical_types()); 2678 CanonicalTypeSet types_table(Z, object_store->canonical_types());
2679 types_array = HashTables::ToArray(types_table, false); 2679 types_array = HashTables::ToArray(types_table, false);
2680 for (intptr_t i = 0; i < (types_array.Length() - 1); i++) { 2680 for (intptr_t i = 0; i < types_array.Length(); i++) {
2681 type ^= types_array.At(i); 2681 type ^= types_array.At(i);
2682 types.Add(type); 2682 types.Add(type);
2683 } 2683 }
2684 types_table.Release(); 2684 types_table.Release();
2685 } 2685 }
2686 2686
2687 intptr_t dict_size = Utils::RoundUpToPowerOfTwo(types.Length() * 4 / 3); 2687 intptr_t dict_size = Utils::RoundUpToPowerOfTwo(types.Length() * 4 / 3);
2688 types_array = HashTables::New<CanonicalTypeSet>(dict_size, Heap::kOld); 2688 types_array = HashTables::New<CanonicalTypeSet>(dict_size, Heap::kOld);
2689 CanonicalTypeSet types_table(Z, types_array.raw()); 2689 CanonicalTypeSet types_table(Z, types_array.raw());
2690 for (intptr_t i = 0; i < types.Length(); i++) { 2690 for (intptr_t i = 0; i < types.Length(); i++) {
2691 type ^= types.At(i); 2691 type ^= types.At(i);
2692 bool present = types_table.Insert(type); 2692 bool present = types_table.Insert(type);
2693 ASSERT(!present); 2693 ASSERT(!present || type.IsRecursive());
2694 } 2694 }
2695 object_store->set_canonical_types(types_table.Release()); 2695 object_store->set_canonical_types(types_table.Release());
2696 2696
2697 // Rehash the canonical TypeArguments table. 2697 // Rehash the canonical TypeArguments table.
2698 Array& typeargs_array = Array::Handle(Z); 2698 Array& typeargs_array = Array::Handle(Z);
2699 GrowableObjectArray& typeargs = 2699 GrowableObjectArray& typeargs =
2700 GrowableObjectArray::Handle(Z, GrowableObjectArray::New()); 2700 GrowableObjectArray::Handle(Z, GrowableObjectArray::New());
2701 TypeArguments& typearg = TypeArguments::Handle(Z); 2701 TypeArguments& typearg = TypeArguments::Handle(Z);
2702 { 2702 {
2703 CanonicalTypeArgumentsSet typeargs_table( 2703 CanonicalTypeArgumentsSet typeargs_table(
2704 Z, object_store->canonical_type_arguments()); 2704 Z, object_store->canonical_type_arguments());
2705 typeargs_array = HashTables::ToArray(typeargs_table, false); 2705 typeargs_array = HashTables::ToArray(typeargs_table, false);
2706 for (intptr_t i = 0; i < (typeargs_array.Length() - 1); i++) { 2706 for (intptr_t i = 0; i < typeargs_array.Length(); i++) {
2707 typearg ^= typeargs_array.At(i); 2707 typearg ^= typeargs_array.At(i);
2708 typeargs.Add(typearg); 2708 typeargs.Add(typearg);
2709 } 2709 }
2710 typeargs_table.Release(); 2710 typeargs_table.Release();
2711 } 2711 }
2712 2712
2713 dict_size = Utils::RoundUpToPowerOfTwo(typeargs.Length() * 4 / 3); 2713 dict_size = Utils::RoundUpToPowerOfTwo(typeargs.Length() * 4 / 3);
2714 typeargs_array = 2714 typeargs_array =
2715 HashTables::New<CanonicalTypeArgumentsSet>(dict_size, Heap::kOld); 2715 HashTables::New<CanonicalTypeArgumentsSet>(dict_size, Heap::kOld);
2716 CanonicalTypeArgumentsSet typeargs_table(Z, typeargs_array.raw()); 2716 CanonicalTypeArgumentsSet typeargs_table(Z, typeargs_array.raw());
2717 for (intptr_t i = 0; i < typeargs.Length(); i++) { 2717 for (intptr_t i = 0; i < typeargs.Length(); i++) {
2718 typearg ^= typeargs.At(i); 2718 typearg ^= typeargs.At(i);
2719 bool present = typeargs_table.Insert(typearg); 2719 bool present = typeargs_table.Insert(typearg);
2720 ASSERT(!present); 2720 ASSERT(!present || typearg.IsRecursive());
2721 } 2721 }
2722 object_store->set_canonical_type_arguments(typeargs_table.Release()); 2722 object_store->set_canonical_type_arguments(typeargs_table.Release());
2723 } 2723 }
2724 2724
2725 2725
2726 void Precompiler::VerifyJITFeedback() { 2726 void Precompiler::VerifyJITFeedback() {
2727 if (jit_feedback_ == NULL) return; 2727 if (jit_feedback_ == NULL) return;
2728 2728
2729 ParsedJSONString* js_vmversion = jit_feedback_->StringAt("vmVersion"); 2729 ParsedJSONString* js_vmversion = jit_feedback_->StringAt("vmVersion");
2730 if ((js_vmversion == NULL) || 2730 if ((js_vmversion == NULL) ||
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
3763 3763
3764 ASSERT(FLAG_precompiled_mode); 3764 ASSERT(FLAG_precompiled_mode);
3765 const bool optimized = function.IsOptimizable(); // False for natives. 3765 const bool optimized = function.IsOptimizable(); // False for natives.
3766 DartPrecompilationPipeline pipeline(zone, field_type_map); 3766 DartPrecompilationPipeline pipeline(zone, field_type_map);
3767 return PrecompileFunctionHelper(precompiler, &pipeline, function, optimized); 3767 return PrecompileFunctionHelper(precompiler, &pipeline, function, optimized);
3768 } 3768 }
3769 3769
3770 #endif // DART_PRECOMPILER 3770 #endif // DART_PRECOMPILER
3771 3771
3772 } // namespace dart 3772 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698