OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #include "include/dart_api.h" | 5 #include "include/dart_api.h" |
6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
8 | 8 |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "vm/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 zone = scope->zone(); | 1165 zone = scope->zone(); |
1166 } | 1166 } |
1167 return reinterpret_cast<uint8_t*>(zone->AllocUnsafe(size)); | 1167 return reinterpret_cast<uint8_t*>(zone->AllocUnsafe(size)); |
1168 } | 1168 } |
1169 | 1169 |
1170 | 1170 |
1171 // --- Objects ---- | 1171 // --- Objects ---- |
1172 | 1172 |
1173 DART_EXPORT Dart_Handle Dart_Null() { | 1173 DART_EXPORT Dart_Handle Dart_Null() { |
1174 Isolate* isolate = Isolate::Current(); | 1174 Isolate* isolate = Isolate::Current(); |
1175 CHECK_ISOLATE_SCOPE(isolate); | 1175 CHECK_ISOLATE(isolate); |
1176 return Api::Null(); | 1176 return Api::Null(); |
1177 } | 1177 } |
1178 | 1178 |
1179 | 1179 |
1180 DART_EXPORT bool Dart_IsNull(Dart_Handle object) { | 1180 DART_EXPORT bool Dart_IsNull(Dart_Handle object) { |
1181 return Api::UnwrapHandle(object) == Object::null(); | 1181 return Api::UnwrapHandle(object) == Object::null(); |
1182 } | 1182 } |
1183 | 1183 |
1184 | 1184 |
1185 DART_EXPORT Dart_Handle Dart_ObjectEquals(Dart_Handle obj1, Dart_Handle obj2, | 1185 DART_EXPORT Dart_Handle Dart_ObjectEquals(Dart_Handle obj1, Dart_Handle obj2, |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1544 } | 1544 } |
1545 *value = obj.value(); | 1545 *value = obj.value(); |
1546 return Api::Success(); | 1546 return Api::Success(); |
1547 } | 1547 } |
1548 | 1548 |
1549 | 1549 |
1550 // --- Booleans ---- | 1550 // --- Booleans ---- |
1551 | 1551 |
1552 DART_EXPORT Dart_Handle Dart_True() { | 1552 DART_EXPORT Dart_Handle Dart_True() { |
1553 Isolate* isolate = Isolate::Current(); | 1553 Isolate* isolate = Isolate::Current(); |
1554 CHECK_ISOLATE_SCOPE(isolate); | 1554 CHECK_ISOLATE(isolate); |
1555 return Api::True(); | 1555 return Api::True(); |
1556 } | 1556 } |
1557 | 1557 |
1558 | 1558 |
1559 DART_EXPORT Dart_Handle Dart_False() { | 1559 DART_EXPORT Dart_Handle Dart_False() { |
1560 Isolate* isolate = Isolate::Current(); | 1560 Isolate* isolate = Isolate::Current(); |
1561 CHECK_ISOLATE_SCOPE(isolate); | 1561 CHECK_ISOLATE(isolate); |
1562 return Api::False(); | 1562 return Api::False(); |
1563 } | 1563 } |
1564 | 1564 |
1565 | 1565 |
1566 DART_EXPORT Dart_Handle Dart_NewBoolean(bool value) { | 1566 DART_EXPORT Dart_Handle Dart_NewBoolean(bool value) { |
1567 Isolate* isolate = Isolate::Current(); | 1567 Isolate* isolate = Isolate::Current(); |
1568 CHECK_ISOLATE_SCOPE(isolate); | 1568 CHECK_ISOLATE(isolate); |
1569 return value ? Api::True() : Api::False(); | 1569 return value ? Api::True() : Api::False(); |
1570 } | 1570 } |
1571 | 1571 |
1572 | 1572 |
1573 DART_EXPORT Dart_Handle Dart_BooleanValue(Dart_Handle boolean_obj, | 1573 DART_EXPORT Dart_Handle Dart_BooleanValue(Dart_Handle boolean_obj, |
1574 bool* value) { | 1574 bool* value) { |
1575 Isolate* isolate = Isolate::Current(); | 1575 Isolate* isolate = Isolate::Current(); |
1576 DARTSCOPE(isolate); | 1576 DARTSCOPE(isolate); |
1577 const Bool& obj = Api::UnwrapBoolHandle(isolate, boolean_obj); | 1577 const Bool& obj = Api::UnwrapBoolHandle(isolate, boolean_obj); |
1578 if (obj.IsNull()) { | 1578 if (obj.IsNull()) { |
(...skipping 2875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4454 } | 4454 } |
4455 { | 4455 { |
4456 NoGCScope no_gc; | 4456 NoGCScope no_gc; |
4457 RawObject* raw_obj = obj.raw(); | 4457 RawObject* raw_obj = obj.raw(); |
4458 isolate->heap()->SetPeer(raw_obj, peer); | 4458 isolate->heap()->SetPeer(raw_obj, peer); |
4459 } | 4459 } |
4460 return Api::Success(); | 4460 return Api::Success(); |
4461 } | 4461 } |
4462 | 4462 |
4463 } // namespace dart | 4463 } // namespace dart |
OLD | NEW |