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

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

Issue 1190973003: Fix crash with --noopt and no_snapshot: initialize megamorphic cache table before first code is run. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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/dart.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) 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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 13338 matching lines...) Expand 10 before | Expand all | Expand 10 after
13349 RawMegamorphicCache* MegamorphicCache::New() { 13349 RawMegamorphicCache* MegamorphicCache::New() {
13350 MegamorphicCache& result = MegamorphicCache::Handle(); 13350 MegamorphicCache& result = MegamorphicCache::Handle();
13351 { RawObject* raw = Object::Allocate(MegamorphicCache::kClassId, 13351 { RawObject* raw = Object::Allocate(MegamorphicCache::kClassId,
13352 MegamorphicCache::InstanceSize(), 13352 MegamorphicCache::InstanceSize(),
13353 Heap::kOld); 13353 Heap::kOld);
13354 NoSafepointScope no_safepoint; 13354 NoSafepointScope no_safepoint;
13355 result ^= raw; 13355 result ^= raw;
13356 } 13356 }
13357 const intptr_t capacity = kInitialCapacity; 13357 const intptr_t capacity = kInitialCapacity;
13358 const Array& buckets = Array::Handle(Array::New(kEntryLength * capacity)); 13358 const Array& buckets = Array::Handle(Array::New(kEntryLength * capacity));
13359 ASSERT(Isolate::Current()->megamorphic_cache_table()->miss_handler() != NULL);
13359 const Function& handler = Function::Handle( 13360 const Function& handler = Function::Handle(
13360 Isolate::Current()->megamorphic_cache_table()->miss_handler()); 13361 Isolate::Current()->megamorphic_cache_table()->miss_handler());
13361 for (intptr_t i = 0; i < capacity; ++i) { 13362 for (intptr_t i = 0; i < capacity; ++i) {
13362 SetEntry(buckets, i, smi_illegal_cid(), handler); 13363 SetEntry(buckets, i, smi_illegal_cid(), handler);
13363 } 13364 }
13364 result.set_buckets(buckets); 13365 result.set_buckets(buckets);
13365 result.set_mask(capacity - 1); 13366 result.set_mask(capacity - 1);
13366 result.set_filled_entry_count(0); 13367 result.set_filled_entry_count(0);
13367 return result.raw(); 13368 return result.raw();
13368 } 13369 }
(...skipping 7605 matching lines...) Expand 10 before | Expand all | Expand 10 after
20974 return tag_label.ToCString(); 20975 return tag_label.ToCString();
20975 } 20976 }
20976 20977
20977 20978
20978 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 20979 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
20979 Instance::PrintJSONImpl(stream, ref); 20980 Instance::PrintJSONImpl(stream, ref);
20980 } 20981 }
20981 20982
20982 20983
20983 } // namespace dart 20984 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698