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 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1470 // Parameter names are valid for all valid parameter indices, and are not | 1470 // Parameter names are valid for all valid parameter indices, and are not |
1471 // limited to named optional parameters. | 1471 // limited to named optional parameters. |
1472 RawString* ParameterNameAt(intptr_t index) const; | 1472 RawString* ParameterNameAt(intptr_t index) const; |
1473 void SetParameterNameAt(intptr_t index, const String& value) const; | 1473 void SetParameterNameAt(intptr_t index, const String& value) const; |
1474 RawArray* parameter_names() const { return raw_ptr()->parameter_names_; } | 1474 RawArray* parameter_names() const { return raw_ptr()->parameter_names_; } |
1475 void set_parameter_names(const Array& value) const; | 1475 void set_parameter_names(const Array& value) const; |
1476 | 1476 |
1477 // Sets function's code and code's function. | 1477 // Sets function's code and code's function. |
1478 void SetCode(const Code& value) const; | 1478 void SetCode(const Code& value) const; |
1479 | 1479 |
| 1480 // Detaches code from the function by setting the code to null, and patches |
| 1481 // the code to be non-entrant. |
| 1482 void DetachCode() const; |
| 1483 |
| 1484 // Reattaches code to the function, and patches the code to be entrant. |
| 1485 void ReattachCode(const Code& code) const; |
| 1486 |
1480 // Disables optimized code and switches to unoptimized code. | 1487 // Disables optimized code and switches to unoptimized code. |
1481 void SwitchToUnoptimizedCode() const; | 1488 void SwitchToUnoptimizedCode() const; |
1482 | 1489 |
1483 // Return the most recently compiled and installed code for this function. | 1490 // Return the most recently compiled and installed code for this function. |
1484 // It is not the only Code object that points to this function. | 1491 // It is not the only Code object that points to this function. |
1485 RawCode* CurrentCode() const { return raw_ptr()->code_; } | 1492 RawCode* CurrentCode() const { return raw_ptr()->code_; } |
1486 | 1493 |
1487 RawCode* unoptimized_code() const { return raw_ptr()->unoptimized_code_; } | 1494 RawCode* unoptimized_code() const { return raw_ptr()->unoptimized_code_; } |
1488 void set_unoptimized_code(const Code& value) const; | 1495 void set_unoptimized_code(const Code& value) const; |
1489 static intptr_t code_offset() { return OFFSET_OF(RawFunction, code_); } | 1496 static intptr_t code_offset() { return OFFSET_OF(RawFunction, code_); } |
| 1497 static intptr_t unoptimized_code_offset() { |
| 1498 return OFFSET_OF(RawFunction, unoptimized_code_); |
| 1499 } |
1490 inline bool HasCode() const; | 1500 inline bool HasCode() const; |
1491 | 1501 |
1492 // Returns true if there is at least one debugger breakpoint | 1502 // Returns true if there is at least one debugger breakpoint |
1493 // set in this function. | 1503 // set in this function. |
1494 bool HasBreakpoint() const; | 1504 bool HasBreakpoint() const; |
1495 | 1505 |
1496 RawContextScope* context_scope() const; | 1506 RawContextScope* context_scope() const; |
1497 void set_context_scope(const ContextScope& value) const; | 1507 void set_context_scope(const ContextScope& value) const; |
1498 | 1508 |
1499 // Enclosing function of this local function. | 1509 // Enclosing function of this local function. |
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2654 | 2664 |
2655 FINAL_HEAP_OBJECT_IMPLEMENTATION(Namespace, Object); | 2665 FINAL_HEAP_OBJECT_IMPLEMENTATION(Namespace, Object); |
2656 friend class Class; | 2666 friend class Class; |
2657 }; | 2667 }; |
2658 | 2668 |
2659 | 2669 |
2660 class Instructions : public Object { | 2670 class Instructions : public Object { |
2661 public: | 2671 public: |
2662 intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize(). | 2672 intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize(). |
2663 RawCode* code() const { return raw_ptr()->code_; } | 2673 RawCode* code() const { return raw_ptr()->code_; } |
| 2674 static intptr_t code_offset() { |
| 2675 return OFFSET_OF(RawInstructions, code_); |
| 2676 } |
2664 RawArray* object_pool() const { return raw_ptr()->object_pool_; } | 2677 RawArray* object_pool() const { return raw_ptr()->object_pool_; } |
2665 static intptr_t object_pool_offset() { | 2678 static intptr_t object_pool_offset() { |
2666 return OFFSET_OF(RawInstructions, object_pool_); | 2679 return OFFSET_OF(RawInstructions, object_pool_); |
2667 } | 2680 } |
2668 | 2681 |
2669 uword EntryPoint() const { | 2682 uword EntryPoint() const { |
2670 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize(); | 2683 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize(); |
2671 } | 2684 } |
2672 | 2685 |
2673 static const intptr_t kMaxElements = (kIntptrMax - | 2686 static const intptr_t kMaxElements = (kIntptrMax - |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3116 | 3129 |
3117 void set_static_calls_target_table(const Array& value) const; | 3130 void set_static_calls_target_table(const Array& value) const; |
3118 RawArray* static_calls_target_table() const { | 3131 RawArray* static_calls_target_table() const { |
3119 return raw_ptr()->static_calls_target_table_; | 3132 return raw_ptr()->static_calls_target_table_; |
3120 } | 3133 } |
3121 | 3134 |
3122 RawDeoptInfo* GetDeoptInfoAtPc(uword pc, intptr_t* deopt_reason) const; | 3135 RawDeoptInfo* GetDeoptInfoAtPc(uword pc, intptr_t* deopt_reason) const; |
3123 | 3136 |
3124 // Returns null if there is no static call at 'pc'. | 3137 // Returns null if there is no static call at 'pc'. |
3125 RawFunction* GetStaticCallTargetFunctionAt(uword pc) const; | 3138 RawFunction* GetStaticCallTargetFunctionAt(uword pc) const; |
| 3139 // Returns null if there is no static call at 'pc'. |
| 3140 RawCode* GetStaticCallTargetCodeAt(uword pc) const; |
3126 // Aborts if there is no static call at 'pc'. | 3141 // Aborts if there is no static call at 'pc'. |
3127 void SetStaticCallTargetCodeAt(uword pc, const Code& code) const; | 3142 void SetStaticCallTargetCodeAt(uword pc, const Code& code) const; |
3128 | 3143 |
3129 void Disassemble() const; | 3144 void Disassemble() const; |
3130 | 3145 |
3131 class Comments : public ZoneAllocated { | 3146 class Comments : public ZoneAllocated { |
3132 public: | 3147 public: |
3133 static Comments& New(intptr_t count); | 3148 static Comments& New(intptr_t count); |
3134 | 3149 |
3135 intptr_t Length() const; | 3150 intptr_t Length() const; |
(...skipping 3144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6280 | 6295 |
6281 | 6296 |
6282 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6297 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
6283 intptr_t index) { | 6298 intptr_t index) { |
6284 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6299 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
6285 } | 6300 } |
6286 | 6301 |
6287 } // namespace dart | 6302 } // namespace dart |
6288 | 6303 |
6289 #endif // VM_OBJECT_H_ | 6304 #endif // VM_OBJECT_H_ |
OLD | NEW |