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. |
| 1481 void DetachCode() const; |
| 1482 |
1480 // Disables optimized code and switches to unoptimized code. | 1483 // Disables optimized code and switches to unoptimized code. |
1481 void SwitchToUnoptimizedCode() const; | 1484 void SwitchToUnoptimizedCode() const; |
1482 | 1485 |
1483 // Return the most recently compiled and installed code for this function. | 1486 // Return the most recently compiled and installed code for this function. |
1484 // It is not the only Code object that points to this function. | 1487 // It is not the only Code object that points to this function. |
1485 RawCode* CurrentCode() const { return raw_ptr()->code_; } | 1488 RawCode* CurrentCode() const { return raw_ptr()->code_; } |
1486 | 1489 |
1487 RawCode* unoptimized_code() const { return raw_ptr()->unoptimized_code_; } | 1490 RawCode* unoptimized_code() const { return raw_ptr()->unoptimized_code_; } |
1488 void set_unoptimized_code(const Code& value) const; | 1491 void set_unoptimized_code(const Code& value) const; |
1489 static intptr_t code_offset() { return OFFSET_OF(RawFunction, code_); } | 1492 static intptr_t code_offset() { return OFFSET_OF(RawFunction, code_); } |
| 1493 static intptr_t unoptimized_code_offset() { |
| 1494 return OFFSET_OF(RawFunction, unoptimized_code_); |
| 1495 } |
1490 inline bool HasCode() const; | 1496 inline bool HasCode() const; |
1491 | 1497 |
1492 // Returns true if there is at least one debugger breakpoint | 1498 // Returns true if there is at least one debugger breakpoint |
1493 // set in this function. | 1499 // set in this function. |
1494 bool HasBreakpoint() const; | 1500 bool HasBreakpoint() const; |
1495 | 1501 |
1496 RawContextScope* context_scope() const; | 1502 RawContextScope* context_scope() const; |
1497 void set_context_scope(const ContextScope& value) const; | 1503 void set_context_scope(const ContextScope& value) const; |
1498 | 1504 |
1499 // Enclosing function of this local function. | 1505 // Enclosing function of this local function. |
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2654 | 2660 |
2655 FINAL_HEAP_OBJECT_IMPLEMENTATION(Namespace, Object); | 2661 FINAL_HEAP_OBJECT_IMPLEMENTATION(Namespace, Object); |
2656 friend class Class; | 2662 friend class Class; |
2657 }; | 2663 }; |
2658 | 2664 |
2659 | 2665 |
2660 class Instructions : public Object { | 2666 class Instructions : public Object { |
2661 public: | 2667 public: |
2662 intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize(). | 2668 intptr_t size() const { return raw_ptr()->size_; } // Excludes HeaderSize(). |
2663 RawCode* code() const { return raw_ptr()->code_; } | 2669 RawCode* code() const { return raw_ptr()->code_; } |
| 2670 static intptr_t code_offset() { |
| 2671 return OFFSET_OF(RawInstructions, code_); |
| 2672 } |
2664 RawArray* object_pool() const { return raw_ptr()->object_pool_; } | 2673 RawArray* object_pool() const { return raw_ptr()->object_pool_; } |
2665 static intptr_t object_pool_offset() { | 2674 static intptr_t object_pool_offset() { |
2666 return OFFSET_OF(RawInstructions, object_pool_); | 2675 return OFFSET_OF(RawInstructions, object_pool_); |
2667 } | 2676 } |
2668 | 2677 |
2669 uword EntryPoint() const { | 2678 uword EntryPoint() const { |
2670 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize(); | 2679 return reinterpret_cast<uword>(raw_ptr()) + HeaderSize(); |
2671 } | 2680 } |
2672 | 2681 |
2673 static const intptr_t kMaxElements = (kIntptrMax - | 2682 static const intptr_t kMaxElements = (kIntptrMax - |
(...skipping 3606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6280 | 6289 |
6281 | 6290 |
6282 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6291 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
6283 intptr_t index) { | 6292 intptr_t index) { |
6284 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6293 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
6285 } | 6294 } |
6286 | 6295 |
6287 } // namespace dart | 6296 } // namespace dart |
6288 | 6297 |
6289 #endif // VM_OBJECT_H_ | 6298 #endif // VM_OBJECT_H_ |
OLD | NEW |