| 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 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1507 void set_parameter_types(const Array& value) const; | 1507 void set_parameter_types(const Array& value) const; |
| 1508 | 1508 |
| 1509 // Parameter names are valid for all valid parameter indices, and are not | 1509 // Parameter names are valid for all valid parameter indices, and are not |
| 1510 // limited to named optional parameters. | 1510 // limited to named optional parameters. |
| 1511 RawString* ParameterNameAt(intptr_t index) const; | 1511 RawString* ParameterNameAt(intptr_t index) const; |
| 1512 void SetParameterNameAt(intptr_t index, const String& value) const; | 1512 void SetParameterNameAt(intptr_t index, const String& value) const; |
| 1513 RawArray* parameter_names() const { return raw_ptr()->parameter_names_; } | 1513 RawArray* parameter_names() const { return raw_ptr()->parameter_names_; } |
| 1514 void set_parameter_names(const Array& value) const; | 1514 void set_parameter_names(const Array& value) const; |
| 1515 | 1515 |
| 1516 // Sets function's code and code's function. | 1516 // Sets function's code and code's function. |
| 1517 void SetCode(const Code& value) const; | 1517 void AttachCode(const Code& value) const; |
| 1518 void ClearCode() const; | 1518 void set_code(const Code& value) const; |
| 1519 void ClearCode() const; |
| 1519 | 1520 |
| 1520 // Disables optimized code and switches to unoptimized code. | 1521 // Disables optimized code and switches to unoptimized code. |
| 1521 void SwitchToUnoptimizedCode() const; | 1522 void SwitchToUnoptimizedCode() const; |
| 1522 | 1523 |
| 1523 // Return the most recently compiled and installed code for this function. | 1524 // Return the most recently compiled and installed code for this function. |
| 1524 // It is not the only Code object that points to this function. | 1525 // It is not the only Code object that points to this function. |
| 1525 RawCode* CurrentCode() const { return raw_ptr()->code_; } | 1526 RawCode* CurrentCode() const { return raw_ptr()->code_; } |
| 1526 | 1527 |
| 1527 RawCode* unoptimized_code() const { return raw_ptr()->unoptimized_code_; } | 1528 RawCode* unoptimized_code() const { return raw_ptr()->unoptimized_code_; } |
| 1528 void set_unoptimized_code(const Code& value) const; | 1529 void set_unoptimized_code(const Code& value) const; |
| 1529 static intptr_t code_offset() { return OFFSET_OF(RawFunction, code_); } | 1530 static intptr_t code_offset() { return OFFSET_OF(RawFunction, code_); } |
| 1530 static intptr_t unoptimized_code_offset() { | 1531 static intptr_t unoptimized_code_offset() { |
| 1531 return OFFSET_OF(RawFunction, unoptimized_code_); | 1532 return OFFSET_OF(RawFunction, unoptimized_code_); |
| 1532 } | 1533 } |
| 1533 inline bool HasCode() const; | 1534 bool HasCode() const; |
| 1534 | 1535 |
| 1535 // Returns true if there is at least one debugger breakpoint | 1536 // Returns true if there is at least one debugger breakpoint |
| 1536 // set in this function. | 1537 // set in this function. |
| 1537 bool HasBreakpoint() const; | 1538 bool HasBreakpoint() const; |
| 1538 | 1539 |
| 1539 RawContextScope* context_scope() const; | 1540 RawContextScope* context_scope() const; |
| 1540 void set_context_scope(const ContextScope& value) const; | 1541 void set_context_scope(const ContextScope& value) const; |
| 1541 | 1542 |
| 1542 // Enclosing function of this local function. | 1543 // Enclosing function of this local function. |
| 1543 RawFunction* parent_function() const; | 1544 RawFunction* parent_function() const; |
| (...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2963 class Stackmap : public Object { | 2964 class Stackmap : public Object { |
| 2964 public: | 2965 public: |
| 2965 static const intptr_t kNoMaximum = -1; | 2966 static const intptr_t kNoMaximum = -1; |
| 2966 static const intptr_t kNoMinimum = -1; | 2967 static const intptr_t kNoMinimum = -1; |
| 2967 | 2968 |
| 2968 bool IsObject(intptr_t index) const { | 2969 bool IsObject(intptr_t index) const { |
| 2969 ASSERT(InRange(index)); | 2970 ASSERT(InRange(index)); |
| 2970 return GetBit(index); | 2971 return GetBit(index); |
| 2971 } | 2972 } |
| 2972 | 2973 |
| 2973 RawCode* Code() const { return raw_ptr()->code_; } | |
| 2974 void SetCode(const dart::Code& code) const; | |
| 2975 | |
| 2976 intptr_t Length() const { return raw_ptr()->length_; } | 2974 intptr_t Length() const { return raw_ptr()->length_; } |
| 2977 | 2975 |
| 2978 uword PC() const { return raw_ptr()->pc_; } | 2976 uword PC() const { return raw_ptr()->pc_; } |
| 2979 void SetPC(uword value) const { raw_ptr()->pc_ = value; } | 2977 void SetPC(uword value) const { raw_ptr()->pc_ = value; } |
| 2980 | 2978 |
| 2981 intptr_t RegisterBitCount() const { return raw_ptr()->register_bit_count_; } | 2979 intptr_t RegisterBitCount() const { return raw_ptr()->register_bit_count_; } |
| 2982 void SetRegisterBitCount(intptr_t register_bit_count) const { | 2980 void SetRegisterBitCount(intptr_t register_bit_count) const { |
| 2983 raw_ptr()->register_bit_count_ = register_bit_count; | 2981 raw_ptr()->register_bit_count_ = register_bit_count; |
| 2984 } | 2982 } |
| 2985 | 2983 |
| (...skipping 3690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6676 Isolate* isolate = Isolate::Current(); | 6674 Isolate* isolate = Isolate::Current(); |
| 6677 Heap* isolate_heap = isolate->heap(); | 6675 Heap* isolate_heap = isolate->heap(); |
| 6678 Heap* vm_isolate_heap = Dart::vm_isolate()->heap(); | 6676 Heap* vm_isolate_heap = Dart::vm_isolate()->heap(); |
| 6679 ASSERT(isolate_heap->Contains(RawObject::ToAddr(raw_)) || | 6677 ASSERT(isolate_heap->Contains(RawObject::ToAddr(raw_)) || |
| 6680 vm_isolate_heap->Contains(RawObject::ToAddr(raw_))); | 6678 vm_isolate_heap->Contains(RawObject::ToAddr(raw_))); |
| 6681 } | 6679 } |
| 6682 #endif | 6680 #endif |
| 6683 } | 6681 } |
| 6684 | 6682 |
| 6685 | 6683 |
| 6686 bool Function::HasCode() const { | |
| 6687 return raw_ptr()->code_ != Code::null(); | |
| 6688 } | |
| 6689 | |
| 6690 | |
| 6691 intptr_t Field::Offset() const { | 6684 intptr_t Field::Offset() const { |
| 6692 ASSERT(!is_static()); // Offset is valid only for instance fields. | 6685 ASSERT(!is_static()); // Offset is valid only for instance fields. |
| 6693 intptr_t value = Smi::Value(reinterpret_cast<RawSmi*>(raw_ptr()->value_)); | 6686 intptr_t value = Smi::Value(reinterpret_cast<RawSmi*>(raw_ptr()->value_)); |
| 6694 return (value * kWordSize); | 6687 return (value * kWordSize); |
| 6695 } | 6688 } |
| 6696 | 6689 |
| 6697 | 6690 |
| 6698 void Field::SetOffset(intptr_t value_in_bytes) const { | 6691 void Field::SetOffset(intptr_t value_in_bytes) const { |
| 6699 ASSERT(!is_static()); // SetOffset is valid only for instance fields. | 6692 ASSERT(!is_static()); // SetOffset is valid only for instance fields. |
| 6700 ASSERT(kWordSize != 0); | 6693 ASSERT(kWordSize != 0); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6783 | 6776 |
| 6784 | 6777 |
| 6785 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6778 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6786 intptr_t index) { | 6779 intptr_t index) { |
| 6787 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6780 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6788 } | 6781 } |
| 6789 | 6782 |
| 6790 } // namespace dart | 6783 } // namespace dart |
| 6791 | 6784 |
| 6792 #endif // VM_OBJECT_H_ | 6785 #endif // VM_OBJECT_H_ |
| OLD | NEW |