OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_DART_ENTRY_H_ | 5 #ifndef VM_DART_ENTRY_H_ |
6 #define VM_DART_ENTRY_H_ | 6 #define VM_DART_ENTRY_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 kNamedEntrySize, | 79 kNamedEntrySize, |
80 }; | 80 }; |
81 | 81 |
82 static intptr_t LengthFor(intptr_t count) { | 82 static intptr_t LengthFor(intptr_t count) { |
83 // Add 1 for the terminating null. | 83 // Add 1 for the terminating null. |
84 return kFirstNamedEntryIndex + (kNamedEntrySize * count) + 1; | 84 return kFirstNamedEntryIndex + (kNamedEntrySize * count) + 1; |
85 } | 85 } |
86 | 86 |
87 static RawArray* NewNonCached(intptr_t count, bool canonicalize = true); | 87 static RawArray* NewNonCached(intptr_t count, bool canonicalize = true); |
88 | 88 |
| 89 // Used by Simulator to parse argument descriptors. |
| 90 static intptr_t name_index(intptr_t index) { |
| 91 return kFirstNamedEntryIndex + |
| 92 (index * kNamedEntrySize) + |
| 93 kNameOffset; |
| 94 } |
| 95 |
| 96 static intptr_t position_index(intptr_t index) { |
| 97 return kFirstNamedEntryIndex + |
| 98 (index * kNamedEntrySize) + |
| 99 kPositionOffset; |
| 100 } |
| 101 |
89 const Array& array_; | 102 const Array& array_; |
90 | 103 |
91 // A cache of VM heap allocated arguments descriptors. | 104 // A cache of VM heap allocated arguments descriptors. |
92 static RawArray* cached_args_descriptors_[kCachedDescriptorCount]; | 105 static RawArray* cached_args_descriptors_[kCachedDescriptorCount]; |
93 | 106 |
94 friend class SnapshotReader; | 107 friend class SnapshotReader; |
95 friend class SnapshotWriter; | 108 friend class SnapshotWriter; |
| 109 friend class Simulator; |
96 DISALLOW_COPY_AND_ASSIGN(ArgumentsDescriptor); | 110 DISALLOW_COPY_AND_ASSIGN(ArgumentsDescriptor); |
97 }; | 111 }; |
98 | 112 |
99 | 113 |
100 // DartEntry abstracts functionality needed to resolve dart functions | 114 // DartEntry abstracts functionality needed to resolve dart functions |
101 // and invoke them from C++. | 115 // and invoke them from C++. |
102 class DartEntry : public AllStatic { | 116 class DartEntry : public AllStatic { |
103 public: | 117 public: |
104 // On success, returns a RawInstance. On failure, a RawError. | 118 // On success, returns a RawInstance. On failure, a RawError. |
105 typedef RawObject* (*invokestub)(const Code& target_code, | 119 typedef RawObject* (*invokestub)(const Code& target_code, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // | 186 // |
173 // Returns null on success, a RawError on failure. | 187 // Returns null on success, a RawError on failure. |
174 static RawObject* MapSetAt(const Instance& map, | 188 static RawObject* MapSetAt(const Instance& map, |
175 const Instance& key, | 189 const Instance& key, |
176 const Instance& value); | 190 const Instance& value); |
177 }; | 191 }; |
178 | 192 |
179 } // namespace dart | 193 } // namespace dart |
180 | 194 |
181 #endif // VM_DART_ENTRY_H_ | 195 #endif // VM_DART_ENTRY_H_ |
OLD | NEW |