| 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 #include "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 | 6 |
| 7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
| 8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1583 CURRENT_FUNC); | 1583 CURRENT_FUNC); |
| 1584 } | 1584 } |
| 1585 return Api::NewHandle(isolate, String::New(str)); | 1585 return Api::NewHandle(isolate, String::New(str)); |
| 1586 } | 1586 } |
| 1587 | 1587 |
| 1588 | 1588 |
| 1589 DART_EXPORT Dart_Handle Dart_NewString8(const uint8_t* codepoints, | 1589 DART_EXPORT Dart_Handle Dart_NewString8(const uint8_t* codepoints, |
| 1590 intptr_t length) { | 1590 intptr_t length) { |
| 1591 Isolate* isolate = Isolate::Current(); | 1591 Isolate* isolate = Isolate::Current(); |
| 1592 DARTSCOPE(isolate); | 1592 DARTSCOPE(isolate); |
| 1593 if (codepoints == NULL) { | 1593 if (codepoints == NULL && length != 0) { |
| 1594 RETURN_NULL_ERROR(codepoints); | 1594 RETURN_NULL_ERROR(codepoints); |
| 1595 } | 1595 } |
| 1596 CHECK_LENGTH(length, String::kMaxElements); | 1596 CHECK_LENGTH(length, String::kMaxElements); |
| 1597 return Api::NewHandle(isolate, String::New(codepoints, length)); | 1597 return Api::NewHandle(isolate, String::New(codepoints, length)); |
| 1598 } | 1598 } |
| 1599 | 1599 |
| 1600 | 1600 |
| 1601 DART_EXPORT Dart_Handle Dart_NewString16(const uint16_t* codepoints, | 1601 DART_EXPORT Dart_Handle Dart_NewString16(const uint16_t* codepoints, |
| 1602 intptr_t length) { | 1602 intptr_t length) { |
| 1603 Isolate* isolate = Isolate::Current(); | 1603 Isolate* isolate = Isolate::Current(); |
| 1604 DARTSCOPE(isolate); | 1604 DARTSCOPE(isolate); |
| 1605 if (codepoints == NULL) { | 1605 if (codepoints == NULL && length != 0) { |
| 1606 RETURN_NULL_ERROR(codepoints); | 1606 RETURN_NULL_ERROR(codepoints); |
| 1607 } | 1607 } |
| 1608 CHECK_LENGTH(length, String::kMaxElements); | 1608 CHECK_LENGTH(length, String::kMaxElements); |
| 1609 return Api::NewHandle(isolate, String::New(codepoints, length)); | 1609 return Api::NewHandle(isolate, String::New(codepoints, length)); |
| 1610 } | 1610 } |
| 1611 | 1611 |
| 1612 | 1612 |
| 1613 DART_EXPORT Dart_Handle Dart_NewString32(const uint32_t* codepoints, | 1613 DART_EXPORT Dart_Handle Dart_NewString32(const uint32_t* codepoints, |
| 1614 intptr_t length) { | 1614 intptr_t length) { |
| 1615 Isolate* isolate = Isolate::Current(); | 1615 Isolate* isolate = Isolate::Current(); |
| 1616 DARTSCOPE(isolate); | 1616 DARTSCOPE(isolate); |
| 1617 if (codepoints == NULL) { | 1617 if (codepoints == NULL && length != 0) { |
| 1618 RETURN_NULL_ERROR(codepoints); | 1618 RETURN_NULL_ERROR(codepoints); |
| 1619 } | 1619 } |
| 1620 CHECK_LENGTH(length, String::kMaxElements); | 1620 CHECK_LENGTH(length, String::kMaxElements); |
| 1621 return Api::NewHandle(isolate, String::New(codepoints, length)); | 1621 return Api::NewHandle(isolate, String::New(codepoints, length)); |
| 1622 } | 1622 } |
| 1623 | 1623 |
| 1624 | 1624 |
| 1625 DART_EXPORT bool Dart_IsExternalString(Dart_Handle object) { | 1625 DART_EXPORT bool Dart_IsExternalString(Dart_Handle object) { |
| 1626 return RawObject::IsExternalStringClassId(Api::ClassId(object)); | 1626 return RawObject::IsExternalStringClassId(Api::ClassId(object)); |
| 1627 } | 1627 } |
| (...skipping 2573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4201 DART_EXPORT void Dart_InitPerfEventsSupport(Dart_FileWriterFunction function) { | 4201 DART_EXPORT void Dart_InitPerfEventsSupport(Dart_FileWriterFunction function) { |
| 4202 Dart::set_perf_events_writer(function); | 4202 Dart::set_perf_events_writer(function); |
| 4203 } | 4203 } |
| 4204 | 4204 |
| 4205 | 4205 |
| 4206 DART_EXPORT void Dart_InitFlowGraphPrinting(Dart_FileWriterFunction function) { | 4206 DART_EXPORT void Dart_InitFlowGraphPrinting(Dart_FileWriterFunction function) { |
| 4207 Dart::set_flow_graph_writer(function); | 4207 Dart::set_flow_graph_writer(function); |
| 4208 } | 4208 } |
| 4209 | 4209 |
| 4210 } // namespace dart | 4210 } // namespace dart |
| OLD | NEW |