| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 null_handle_ = Api::InitNewHandle(isolate, Object::null()); | 257 null_handle_ = Api::InitNewHandle(isolate, Object::null()); |
| 258 } | 258 } |
| 259 | 259 |
| 260 | 260 |
| 261 bool Api::StringGetPeerHelper(Dart_NativeArguments args, | 261 bool Api::StringGetPeerHelper(Dart_NativeArguments args, |
| 262 int arg_index, | 262 int arg_index, |
| 263 void** peer) { | 263 void** peer) { |
| 264 NoGCScope no_gc_scope; | 264 NoGCScope no_gc_scope; |
| 265 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); | 265 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); |
| 266 RawObject* raw_obj = arguments->NativeArgAt(arg_index); | 266 RawObject* raw_obj = arguments->NativeArgAt(arg_index); |
| 267 if (!raw_obj->IsHeapObject()) { |
| 268 return false; |
| 269 } |
| 267 intptr_t cid = raw_obj->GetClassId(); | 270 intptr_t cid = raw_obj->GetClassId(); |
| 268 if (cid == kExternalOneByteStringCid) { | 271 if (cid == kExternalOneByteStringCid) { |
| 269 RawExternalOneByteString* raw_string = | 272 RawExternalOneByteString* raw_string = |
| 270 reinterpret_cast<RawExternalOneByteString*>(raw_obj)->ptr(); | 273 reinterpret_cast<RawExternalOneByteString*>(raw_obj)->ptr(); |
| 271 ExternalStringData<uint8_t>* data = raw_string->external_data_; | 274 ExternalStringData<uint8_t>* data = raw_string->external_data_; |
| 272 *peer = data->peer(); | 275 *peer = data->peer(); |
| 273 return true; | 276 return true; |
| 274 } | 277 } |
| 275 if (cid == kOneByteStringCid || cid == kTwoByteStringCid) { | 278 if (cid == kOneByteStringCid || cid == kTwoByteStringCid) { |
| 276 Isolate* isolate = arguments->isolate(); | 279 Isolate* isolate = arguments->isolate(); |
| (...skipping 4125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4402 } | 4405 } |
| 4403 { | 4406 { |
| 4404 NoGCScope no_gc; | 4407 NoGCScope no_gc; |
| 4405 RawObject* raw_obj = obj.raw(); | 4408 RawObject* raw_obj = obj.raw(); |
| 4406 isolate->heap()->SetPeer(raw_obj, peer); | 4409 isolate->heap()->SetPeer(raw_obj, peer); |
| 4407 } | 4410 } |
| 4408 return Api::Success(); | 4411 return Api::Success(); |
| 4409 } | 4412 } |
| 4410 | 4413 |
| 4411 } // namespace dart | 4414 } // namespace dart |
| OLD | NEW |