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

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

Issue 566853005: Fix to allocation stub invalidation: we cannot just remove it as it will be collected even though c… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | 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 3624 matching lines...) Expand 10 before | Expand all | Expand 10 after
3635 if ((idx < 0) || (idx >= Array::Cast(types).Length())) { 3635 if ((idx < 0) || (idx >= Array::Cast(types).Length())) {
3636 return Type::null(); 3636 return Type::null();
3637 } 3637 }
3638 type ^= Array::Cast(types).At(idx); 3638 type ^= Array::Cast(types).At(idx);
3639 ASSERT(!type.IsNull()); 3639 ASSERT(!type.IsNull());
3640 return type.raw(); 3640 return type.raw();
3641 } 3641 }
3642 3642
3643 3643
3644 void Class::set_allocation_stub(const Code& value) const { 3644 void Class::set_allocation_stub(const Code& value) const {
3645 // Never clear the stub as it may still be a target, but will be GC-d if
3646 // not referenced.
3645 ASSERT(!value.IsNull()); 3647 ASSERT(!value.IsNull());
3646 ASSERT(raw_ptr()->allocation_stub_ == Code::null()); 3648 ASSERT(raw_ptr()->allocation_stub_ == Code::null());
3647 StorePointer(&raw_ptr()->allocation_stub_, value.raw()); 3649 StorePointer(&raw_ptr()->allocation_stub_, value.raw());
3648 } 3650 }
3649 3651
3650 3652
3651 void Class::DisableAllocationStub() const { 3653 void Class::SwitchAllocationStub() const {
3652 const Code& alloc_stub = Code::Handle(allocation_stub()); 3654 const Code& alloc_stub = Code::Handle(allocation_stub());
3653 if (!alloc_stub.IsNull()) { 3655 if (!alloc_stub.IsNull()) {
3654 CodePatcher::PatchEntry(alloc_stub); 3656 CodePatcher::PatchEntry(alloc_stub);
3655 StorePointer(&raw_ptr()->allocation_stub_, Code::null()); 3657 const Code& spare_alloc_stub = Code::Handle(spare_allocation_stub());
3658 if (spare_alloc_stub.IsNull()) {
3659 StorePointer(&raw_ptr()->allocation_stub_, Code::null());
3660 } else {
3661 ASSERT(CodePatcher::IsEntryPatched(spare_alloc_stub));
3662 CodePatcher::RestoreEntry(spare_alloc_stub);
3663 StorePointer(&raw_ptr()->allocation_stub_, spare_alloc_stub.raw());
3664 }
3665 StorePointer(&raw_ptr()->spare_allocation_stub_, alloc_stub.raw());
3656 } 3666 }
3657 } 3667 }
3658 3668
3659 3669
3660 bool Class::IsFunctionClass() const { 3670 bool Class::IsFunctionClass() const {
3661 return raw() == Type::Handle(Type::Function()).type_class(); 3671 return raw() == Type::Handle(Type::Function()).type_class();
3662 } 3672 }
3663 3673
3664 3674
3665 bool Class::IsCanonicalSignatureClass() const { 3675 bool Class::IsCanonicalSignatureClass() const {
(...skipping 16685 matching lines...) Expand 10 before | Expand all | Expand 10 after
20351 return tag_label.ToCString(); 20361 return tag_label.ToCString();
20352 } 20362 }
20353 20363
20354 20364
20355 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 20365 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
20356 Instance::PrintJSONImpl(stream, ref); 20366 Instance::PrintJSONImpl(stream, ref);
20357 } 20367 }
20358 20368
20359 20369
20360 } // namespace dart 20370 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698