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

Side by Side Diff: runtime/vm/raw_object.h

Issue 70183010: Fixes a couple problems with GC of unoptimized code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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
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 #ifndef VM_RAW_OBJECT_H_ 5 #ifndef VM_RAW_OBJECT_H_
6 #define VM_RAW_OBJECT_H_ 6 #define VM_RAW_OBJECT_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/token.h" 10 #include "vm/token.h"
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 kImplicitSetter, // represents an implicit setter for fields. 603 kImplicitSetter, // represents an implicit setter for fields.
604 kImplicitStaticFinalGetter, // represents an implicit getter for static 604 kImplicitStaticFinalGetter, // represents an implicit getter for static
605 // final fields (incl. static const fields). 605 // final fields (incl. static const fields).
606 kStaticInitializer, // used in implicit static getters. 606 kStaticInitializer, // used in implicit static getters.
607 kMethodExtractor, // converts method into implicit closure on the receiver. 607 kMethodExtractor, // converts method into implicit closure on the receiver.
608 kNoSuchMethodDispatcher, // invokes noSuchMethod. 608 kNoSuchMethodDispatcher, // invokes noSuchMethod.
609 kInvokeFieldDispatcher, // invokes a field as a closure. 609 kInvokeFieldDispatcher, // invokes a field as a closure.
610 }; 610 };
611 611
612 private: 612 private:
613 // So that the MarkingVisitor can inspect the attached code, name, etc..
614 friend class MarkingVisitor;
Ivan Posva 2013/11/19 19:24:48 Why is this needed?
zra 2013/11/22 17:18:54 So that MarkingVisitor::DetachCode can null out th
613 friend class Class; 615 friend class Class;
614 RAW_HEAP_OBJECT_IMPLEMENTATION(Function); 616 RAW_HEAP_OBJECT_IMPLEMENTATION(Function);
617 static bool MayTrySkippingCode(RawFunction* raw_fun);
615 618
616 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); } 619 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); }
617 RawString* name_; 620 RawString* name_;
618 RawObject* owner_; // Class or patch class or mixin class 621 RawObject* owner_; // Class or patch class or mixin class
619 // where this function is defined. 622 // where this function is defined.
620 RawAbstractType* result_type_; 623 RawAbstractType* result_type_;
621 RawArray* parameter_types_; 624 RawArray* parameter_types_;
622 RawArray* parameter_names_; 625 RawArray* parameter_names_;
626 RawObject* data_; // Additional data specific to the function kind.
623 RawCode* code_; // Compiled code for the function. 627 RawCode* code_; // Compiled code for the function.
624 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization. 628 RawCode* unoptimized_code_; // Unoptimized code, keep it after optimization.
625 RawObject* data_; // Additional data specific to the function kind.
626 RawObject** to() { 629 RawObject** to() {
630 return reinterpret_cast<RawObject**>(&ptr()->unoptimized_code_);
631 }
632 RawObject** to_no_code() {
627 return reinterpret_cast<RawObject**>(&ptr()->data_); 633 return reinterpret_cast<RawObject**>(&ptr()->data_);
628 } 634 }
629 635
630 intptr_t token_pos_; 636 intptr_t token_pos_;
631 intptr_t end_token_pos_; 637 intptr_t end_token_pos_;
632 intptr_t usage_counter_; // Incremented while function is running. 638 intptr_t usage_counter_; // Incremented while function is running.
633 int16_t num_fixed_parameters_; 639 int16_t num_fixed_parameters_;
634 int16_t num_optional_parameters_; // > 0: positional; < 0: named. 640 int16_t num_optional_parameters_; // > 0: positional; < 0: named.
635 int16_t deoptimization_counter_; 641 int16_t deoptimization_counter_;
636 uint16_t kind_tag_; // See Function::KindTagBits. 642 uint16_t kind_tag_; // See Function::KindTagBits.
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 // Make sure this is updated when new TypedData types are added. 1726 // Make sure this is updated when new TypedData types are added.
1721 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 13); 1727 ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 13);
1722 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 14); 1728 ASSERT(kExternalTypedDataInt8ArrayCid == kTypedDataInt8ArrayViewCid + 14);
1723 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 13); 1729 ASSERT(kNullCid == kExternalTypedDataInt8ArrayCid + 13);
1724 return (kNullCid - kTypedDataInt8ArrayCid); 1730 return (kNullCid - kTypedDataInt8ArrayCid);
1725 } 1731 }
1726 1732
1727 } // namespace dart 1733 } // namespace dart
1728 1734
1729 #endif // VM_RAW_OBJECT_H_ 1735 #endif // VM_RAW_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698