Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1496 // Parameter names are valid for all valid parameter indices, and are not | 1496 // Parameter names are valid for all valid parameter indices, and are not |
| 1497 // limited to named optional parameters. | 1497 // limited to named optional parameters. |
| 1498 RawString* ParameterNameAt(intptr_t index) const; | 1498 RawString* ParameterNameAt(intptr_t index) const; |
| 1499 void SetParameterNameAt(intptr_t index, const String& value) const; | 1499 void SetParameterNameAt(intptr_t index, const String& value) const; |
| 1500 RawArray* parameter_names() const { return raw_ptr()->parameter_names_; } | 1500 RawArray* parameter_names() const { return raw_ptr()->parameter_names_; } |
| 1501 void set_parameter_names(const Array& value) const; | 1501 void set_parameter_names(const Array& value) const; |
| 1502 | 1502 |
| 1503 // Sets function's code and code's function. | 1503 // Sets function's code and code's function. |
| 1504 void SetCode(const Code& value) const; | 1504 void SetCode(const Code& value) const; |
| 1505 | 1505 |
| 1506 // Detaches code from the function by setting the code to null, and patches | |
| 1507 // the code to be non-entrant. | |
| 1508 void DetachCode() const; | |
| 1509 | |
| 1510 // Reattaches code to the function, and patches the code to be entrant. | |
| 1511 void ReattachCode(const Code& code) const; | |
| 1512 | |
| 1513 // Disables optimized code and switches to unoptimized code. | 1506 // Disables optimized code and switches to unoptimized code. |
| 1514 void SwitchToUnoptimizedCode() const; | 1507 void SwitchToUnoptimizedCode() const; |
| 1515 | 1508 |
| 1516 // Return the most recently compiled and installed code for this function. | 1509 // Return the most recently compiled and installed code for this function. |
| 1517 // It is not the only Code object that points to this function. | 1510 // It is not the only Code object that points to this function. |
| 1518 RawCode* CurrentCode() const { return raw_ptr()->code_; } | 1511 RawCode* CurrentCode() const { return raw_ptr()->code_; } |
| 1519 | 1512 |
| 1520 RawCode* unoptimized_code() const { return raw_ptr()->unoptimized_code_; } | 1513 RawCode* unoptimized_code() const { return raw_ptr()->unoptimized_code_; } |
| 1521 void set_unoptimized_code(const Code& value) const; | 1514 void set_unoptimized_code(const Code& value) const; |
| 1522 static intptr_t code_offset() { return OFFSET_OF(RawFunction, code_); } | 1515 static intptr_t code_offset() { return OFFSET_OF(RawFunction, code_); } |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1990 bool TestParameterType(TypeTestKind test_kind, | 1983 bool TestParameterType(TypeTestKind test_kind, |
| 1991 intptr_t parameter_position, | 1984 intptr_t parameter_position, |
| 1992 intptr_t other_parameter_position, | 1985 intptr_t other_parameter_position, |
| 1993 const AbstractTypeArguments& type_arguments, | 1986 const AbstractTypeArguments& type_arguments, |
| 1994 const Function& other, | 1987 const Function& other, |
| 1995 const AbstractTypeArguments& other_type_arguments, | 1988 const AbstractTypeArguments& other_type_arguments, |
| 1996 Error* bound_error) const; | 1989 Error* bound_error) const; |
| 1997 | 1990 |
| 1998 FINAL_HEAP_OBJECT_IMPLEMENTATION(Function, Object); | 1991 FINAL_HEAP_OBJECT_IMPLEMENTATION(Function, Object); |
| 1999 friend class Class; | 1992 friend class Class; |
| 1993 friend class RawFunction; | |
|
Ivan Posva
2013/11/19 19:24:48
What is this needed for?
zra
2013/11/22 17:18:54
RawFunction::VisitFunctionPointers needs to access
| |
| 2000 }; | 1994 }; |
| 2001 | 1995 |
| 2002 | 1996 |
| 2003 class ClosureData: public Object { | 1997 class ClosureData: public Object { |
| 2004 public: | 1998 public: |
| 2005 static intptr_t InstanceSize() { | 1999 static intptr_t InstanceSize() { |
| 2006 return RoundedAllocationSize(sizeof(RawClosureData)); | 2000 return RoundedAllocationSize(sizeof(RawClosureData)); |
| 2007 } | 2001 } |
| 2008 | 2002 |
| 2009 private: | 2003 private: |
| (...skipping 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3347 intptr_t BinarySearchInSCallTable(uword pc) const; | 3341 intptr_t BinarySearchInSCallTable(uword pc) const; |
| 3348 | 3342 |
| 3349 // New is a private method as RawInstruction and RawCode objects should | 3343 // New is a private method as RawInstruction and RawCode objects should |
| 3350 // only be created using the Code::FinalizeCode method. This method creates | 3344 // only be created using the Code::FinalizeCode method. This method creates |
| 3351 // the RawInstruction and RawCode objects, sets up the pointer offsets | 3345 // the RawInstruction and RawCode objects, sets up the pointer offsets |
| 3352 // and links the two in a GC safe manner. | 3346 // and links the two in a GC safe manner. |
| 3353 static RawCode* New(intptr_t pointer_offsets_length); | 3347 static RawCode* New(intptr_t pointer_offsets_length); |
| 3354 | 3348 |
| 3355 FINAL_HEAP_OBJECT_IMPLEMENTATION(Code, Object); | 3349 FINAL_HEAP_OBJECT_IMPLEMENTATION(Code, Object); |
| 3356 friend class Class; | 3350 friend class Class; |
| 3351 | |
| 3352 // So that the RawFunction pointer visitor can determine whether code the | |
| 3353 // function points to is optimized. | |
| 3354 friend class RawFunction; | |
| 3357 }; | 3355 }; |
| 3358 | 3356 |
| 3359 | 3357 |
| 3360 class Context : public Object { | 3358 class Context : public Object { |
| 3361 public: | 3359 public: |
| 3362 RawContext* parent() const { return raw_ptr()->parent_; } | 3360 RawContext* parent() const { return raw_ptr()->parent_; } |
| 3363 void set_parent(const Context& parent) const { | 3361 void set_parent(const Context& parent) const { |
| 3364 ASSERT(parent.IsNull() || parent.isolate() == Isolate::Current()); | 3362 ASSERT(parent.IsNull() || parent.isolate() == Isolate::Current()); |
| 3365 StorePointer(&raw_ptr()->parent_, parent.raw()); | 3363 StorePointer(&raw_ptr()->parent_, parent.raw()); |
| 3366 } | 3364 } |
| (...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4972 Snapshot::Kind kind); | 4970 Snapshot::Kind kind); |
| 4973 | 4971 |
| 4974 FINAL_HEAP_OBJECT_IMPLEMENTATION(String, Instance); | 4972 FINAL_HEAP_OBJECT_IMPLEMENTATION(String, Instance); |
| 4975 | 4973 |
| 4976 friend class Class; | 4974 friend class Class; |
| 4977 friend class Symbols; | 4975 friend class Symbols; |
| 4978 friend class OneByteString; | 4976 friend class OneByteString; |
| 4979 friend class TwoByteString; | 4977 friend class TwoByteString; |
| 4980 friend class ExternalOneByteString; | 4978 friend class ExternalOneByteString; |
| 4981 friend class ExternalTwoByteString; | 4979 friend class ExternalTwoByteString; |
| 4980 // So that the MarkingVisitor can print a debug string from a NoHandleScope. | |
| 4981 friend class MarkingVisitor; | |
| 4982 }; | 4982 }; |
| 4983 | 4983 |
| 4984 | 4984 |
| 4985 class OneByteString : public AllStatic { | 4985 class OneByteString : public AllStatic { |
| 4986 public: | 4986 public: |
| 4987 static int32_t CharAt(const String& str, intptr_t index) { | 4987 static int32_t CharAt(const String& str, intptr_t index) { |
| 4988 return *CharAddr(str, index); | 4988 return *CharAddr(str, index); |
| 4989 } | 4989 } |
| 4990 | 4990 |
| 4991 static void SetCharAt(const String& str, intptr_t index, uint8_t code_point) { | 4991 static void SetCharAt(const String& str, intptr_t index, uint8_t code_point) { |
| (...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6387 | 6387 |
| 6388 | 6388 |
| 6389 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6389 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6390 intptr_t index) { | 6390 intptr_t index) { |
| 6391 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6391 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6392 } | 6392 } |
| 6393 | 6393 |
| 6394 } // namespace dart | 6394 } // namespace dart |
| 6395 | 6395 |
| 6396 #endif // VM_OBJECT_H_ | 6396 #endif // VM_OBJECT_H_ |
| OLD | NEW |