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

Side by Side Diff: runtime/vm/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 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/megamorphic_cache_table.cc ('k') | runtime/vm/object.cc » ('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 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 1490 matching lines...) Expand 10 before | Expand all | Expand 10 after
1501 // Parameter names are valid for all valid parameter indices, and are not 1501 // Parameter names are valid for all valid parameter indices, and are not
1502 // limited to named optional parameters. 1502 // limited to named optional parameters.
1503 RawString* ParameterNameAt(intptr_t index) const; 1503 RawString* ParameterNameAt(intptr_t index) const;
1504 void SetParameterNameAt(intptr_t index, const String& value) const; 1504 void SetParameterNameAt(intptr_t index, const String& value) const;
1505 RawArray* parameter_names() const { return raw_ptr()->parameter_names_; } 1505 RawArray* parameter_names() const { return raw_ptr()->parameter_names_; }
1506 void set_parameter_names(const Array& value) const; 1506 void set_parameter_names(const Array& value) const;
1507 1507
1508 // Sets function's code and code's function. 1508 // Sets function's code and code's function.
1509 void SetCode(const Code& value) const; 1509 void SetCode(const Code& value) const;
1510 1510
1511 // Detaches code from the function by setting the code to null, and patches
1512 // the code to be non-entrant.
1513 void DetachCode() const;
1514
1515 // Reattaches code to the function, and patches the code to be entrant.
1516 void ReattachCode(const Code& code) const;
1517
1518 // Disables optimized code and switches to unoptimized code. 1511 // Disables optimized code and switches to unoptimized code.
1519 void SwitchToUnoptimizedCode() const; 1512 void SwitchToUnoptimizedCode() const;
1520 1513
1521 // Return the most recently compiled and installed code for this function. 1514 // Return the most recently compiled and installed code for this function.
1522 // It is not the only Code object that points to this function. 1515 // It is not the only Code object that points to this function.
1523 RawCode* CurrentCode() const { return raw_ptr()->code_; } 1516 RawCode* CurrentCode() const { return raw_ptr()->code_; }
1524 1517
1525 RawCode* unoptimized_code() const { return raw_ptr()->unoptimized_code_; } 1518 RawCode* unoptimized_code() const { return raw_ptr()->unoptimized_code_; }
1526 void set_unoptimized_code(const Code& value) const; 1519 void set_unoptimized_code(const Code& value) const;
1527 static intptr_t code_offset() { return OFFSET_OF(RawFunction, code_); } 1520 static intptr_t code_offset() { return OFFSET_OF(RawFunction, code_); }
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 bool TestParameterType(TypeTestKind test_kind, 1988 bool TestParameterType(TypeTestKind test_kind,
1996 intptr_t parameter_position, 1989 intptr_t parameter_position,
1997 intptr_t other_parameter_position, 1990 intptr_t other_parameter_position,
1998 const AbstractTypeArguments& type_arguments, 1991 const AbstractTypeArguments& type_arguments,
1999 const Function& other, 1992 const Function& other,
2000 const AbstractTypeArguments& other_type_arguments, 1993 const AbstractTypeArguments& other_type_arguments,
2001 Error* bound_error) const; 1994 Error* bound_error) const;
2002 1995
2003 FINAL_HEAP_OBJECT_IMPLEMENTATION(Function, Object); 1996 FINAL_HEAP_OBJECT_IMPLEMENTATION(Function, Object);
2004 friend class Class; 1997 friend class Class;
1998 // RawFunction::VisitFunctionPointers accesses the private constructor of
1999 // Function.
2000 friend class RawFunction;
2005 }; 2001 };
2006 2002
2007 2003
2008 class ClosureData: public Object { 2004 class ClosureData: public Object {
2009 public: 2005 public:
2010 static intptr_t InstanceSize() { 2006 static intptr_t InstanceSize() {
2011 return RoundedAllocationSize(sizeof(RawClosureData)); 2007 return RoundedAllocationSize(sizeof(RawClosureData));
2012 } 2008 }
2013 2009
2014 private: 2010 private:
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after
3353 intptr_t BinarySearchInSCallTable(uword pc) const; 3349 intptr_t BinarySearchInSCallTable(uword pc) const;
3354 3350
3355 // New is a private method as RawInstruction and RawCode objects should 3351 // New is a private method as RawInstruction and RawCode objects should
3356 // only be created using the Code::FinalizeCode method. This method creates 3352 // only be created using the Code::FinalizeCode method. This method creates
3357 // the RawInstruction and RawCode objects, sets up the pointer offsets 3353 // the RawInstruction and RawCode objects, sets up the pointer offsets
3358 // and links the two in a GC safe manner. 3354 // and links the two in a GC safe manner.
3359 static RawCode* New(intptr_t pointer_offsets_length); 3355 static RawCode* New(intptr_t pointer_offsets_length);
3360 3356
3361 FINAL_HEAP_OBJECT_IMPLEMENTATION(Code, Object); 3357 FINAL_HEAP_OBJECT_IMPLEMENTATION(Code, Object);
3362 friend class Class; 3358 friend class Class;
3359
3360 // So that the RawFunction pointer visitor can determine whether code the
3361 // function points to is optimized.
3362 friend class RawFunction;
3363 }; 3363 };
3364 3364
3365 3365
3366 class Context : public Object { 3366 class Context : public Object {
3367 public: 3367 public:
3368 RawContext* parent() const { return raw_ptr()->parent_; } 3368 RawContext* parent() const { return raw_ptr()->parent_; }
3369 void set_parent(const Context& parent) const { 3369 void set_parent(const Context& parent) const {
3370 ASSERT(parent.IsNull() || parent.isolate() == Isolate::Current()); 3370 ASSERT(parent.IsNull() || parent.isolate() == Isolate::Current());
3371 StorePointer(&raw_ptr()->parent_, parent.raw()); 3371 StorePointer(&raw_ptr()->parent_, parent.raw());
3372 } 3372 }
(...skipping 1640 matching lines...) Expand 10 before | Expand all | Expand 10 after
5013 Snapshot::Kind kind); 5013 Snapshot::Kind kind);
5014 5014
5015 FINAL_HEAP_OBJECT_IMPLEMENTATION(String, Instance); 5015 FINAL_HEAP_OBJECT_IMPLEMENTATION(String, Instance);
5016 5016
5017 friend class Class; 5017 friend class Class;
5018 friend class Symbols; 5018 friend class Symbols;
5019 friend class OneByteString; 5019 friend class OneByteString;
5020 friend class TwoByteString; 5020 friend class TwoByteString;
5021 friend class ExternalOneByteString; 5021 friend class ExternalOneByteString;
5022 friend class ExternalTwoByteString; 5022 friend class ExternalTwoByteString;
5023 // So that the MarkingVisitor can print a debug string from a NoHandleScope.
5024 friend class MarkingVisitor;
5023 }; 5025 };
5024 5026
5025 5027
5026 class OneByteString : public AllStatic { 5028 class OneByteString : public AllStatic {
5027 public: 5029 public:
5028 static int32_t CharAt(const String& str, intptr_t index) { 5030 static int32_t CharAt(const String& str, intptr_t index) {
5029 return *CharAddr(str, index); 5031 return *CharAddr(str, index);
5030 } 5032 }
5031 5033
5032 static void SetCharAt(const String& str, intptr_t index, uint8_t code_point) { 5034 static void SetCharAt(const String& str, intptr_t index, uint8_t code_point) {
(...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after
6429 6431
6430 6432
6431 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6433 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6432 intptr_t index) { 6434 intptr_t index) {
6433 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6435 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6434 } 6436 }
6435 6437
6436 } // namespace dart 6438 } // namespace dart
6437 6439
6438 #endif // VM_OBJECT_H_ 6440 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/megamorphic_cache_table.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698