| 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_API_IMPL_H_ | 5 #ifndef VM_DART_API_IMPL_H_ |
| 6 #define VM_DART_API_IMPL_H_ | 6 #define VM_DART_API_IMPL_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/object.h" | 9 #include "vm/object.h" |
| 10 | 10 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 RawObject* raw = *(reinterpret_cast<RawObject**>(handle)); | 116 RawObject* raw = *(reinterpret_cast<RawObject**>(handle)); |
| 117 return !raw->IsHeapObject(); | 117 return !raw->IsHeapObject(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 // Returns the value of a Smi. | 120 // Returns the value of a Smi. |
| 121 static intptr_t SmiValue(Dart_Handle handle) { | 121 static intptr_t SmiValue(Dart_Handle handle) { |
| 122 uword value = *(reinterpret_cast<uword*>(handle)); | 122 uword value = *(reinterpret_cast<uword*>(handle)); |
| 123 return Smi::ValueFromRaw(value); | 123 return Smi::ValueFromRaw(value); |
| 124 } | 124 } |
| 125 | 125 |
| 126 static intptr_t ClassIndex(Dart_Handle handle) { |
| 127 RawObject* raw = *(reinterpret_cast<RawObject**>(handle)); |
| 128 if (!raw->IsHeapObject()) { |
| 129 return kSmi; |
| 130 } |
| 131 return raw->GetClassIndex(); |
| 132 } |
| 133 |
| 126 // Generates a handle used to designate an error return. | 134 // Generates a handle used to designate an error return. |
| 127 static Dart_Handle NewError(const char* format, ...); | 135 static Dart_Handle NewError(const char* format, ...); |
| 128 | 136 |
| 129 // Gets a handle to Null. | 137 // Gets a handle to Null. |
| 130 static Dart_Handle Null(Isolate* isolate); | 138 static Dart_Handle Null(Isolate* isolate); |
| 131 | 139 |
| 132 // Gets a handle to True. | 140 // Gets a handle to True. |
| 133 static Dart_Handle True(Isolate* isolate); | 141 static Dart_Handle True(Isolate* isolate); |
| 134 | 142 |
| 135 // Gets a handle to False | 143 // Gets a handle to False |
| (...skipping 29 matching lines...) Expand all Loading... |
| 165 } | 173 } |
| 166 private: | 174 private: |
| 167 Isolate* saved_isolate_; | 175 Isolate* saved_isolate_; |
| 168 | 176 |
| 169 DISALLOW_COPY_AND_ASSIGN(IsolateSaver); | 177 DISALLOW_COPY_AND_ASSIGN(IsolateSaver); |
| 170 }; | 178 }; |
| 171 | 179 |
| 172 } // namespace dart. | 180 } // namespace dart. |
| 173 | 181 |
| 174 #endif // VM_DART_API_IMPL_H_ | 182 #endif // VM_DART_API_IMPL_H_ |
| OLD | NEW |