| 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 "bin/dartutils.h" | 5 #include "bin/dartutils.h" |
| 6 | 6 |
| 7 #include "bin/file.h" | 7 #include "bin/file.h" |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/globals.h" | 10 #include "platform/globals.h" |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 } | 315 } |
| 316 | 316 |
| 317 | 317 |
| 318 Dart_CObject* CObject::NewInt64(int64_t value) { | 318 Dart_CObject* CObject::NewInt64(int64_t value) { |
| 319 Dart_CObject* cobject = New(Dart_CObject::kInt64); | 319 Dart_CObject* cobject = New(Dart_CObject::kInt64); |
| 320 cobject->value.as_int64 = value; | 320 cobject->value.as_int64 = value; |
| 321 return cobject; | 321 return cobject; |
| 322 } | 322 } |
| 323 | 323 |
| 324 | 324 |
| 325 Dart_CObject* CObject::NewIntptr(intptr_t value) { |
| 326 // Pointer values passed as intptr_t are always send as int64_t. |
| 327 Dart_CObject* cobject = New(Dart_CObject::kInt64); |
| 328 cobject->value.as_int64 = value; |
| 329 return cobject; |
| 330 } |
| 331 |
| 332 |
| 325 Dart_CObject* CObject::NewDouble(double value) { | 333 Dart_CObject* CObject::NewDouble(double value) { |
| 326 Dart_CObject* cobject = New(Dart_CObject::kDouble); | 334 Dart_CObject* cobject = New(Dart_CObject::kDouble); |
| 327 cobject->value.as_double = value; | 335 cobject->value.as_double = value; |
| 328 return cobject; | 336 return cobject; |
| 329 } | 337 } |
| 330 | 338 |
| 331 | 339 |
| 332 Dart_CObject* CObject::NewString(int length) { | 340 Dart_CObject* CObject::NewString(int length) { |
| 333 Dart_CObject* cobject = New(Dart_CObject::kString, length + 1); | 341 Dart_CObject* cobject = New(Dart_CObject::kString, length + 1); |
| 334 cobject->value.as_string = reinterpret_cast<char*>(cobject + 1); | 342 cobject->value.as_string = reinterpret_cast<char*>(cobject + 1); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 345 | 353 |
| 346 | 354 |
| 347 Dart_CObject* CObject::NewArray(int length) { | 355 Dart_CObject* CObject::NewArray(int length) { |
| 348 Dart_CObject* cobject = | 356 Dart_CObject* cobject = |
| 349 New(Dart_CObject::kArray, length * sizeof(Dart_CObject*)); // NOLINT | 357 New(Dart_CObject::kArray, length * sizeof(Dart_CObject*)); // NOLINT |
| 350 cobject->value.as_array.length = length; | 358 cobject->value.as_array.length = length; |
| 351 cobject->value.as_array.values = | 359 cobject->value.as_array.values = |
| 352 reinterpret_cast<Dart_CObject**>(cobject + 1); | 360 reinterpret_cast<Dart_CObject**>(cobject + 1); |
| 353 return cobject; | 361 return cobject; |
| 354 } | 362 } |
| 363 |
| 364 |
| 365 Dart_CObject* CObject::NewByteArray(int length) { |
| 366 Dart_CObject* cobject = New(Dart_CObject::kByteArray, length); |
| 367 cobject->value.as_byte_array.length = length; |
| 368 cobject->value.as_byte_array.values = reinterpret_cast<uint8_t*>(cobject + 1); |
| 369 return cobject; |
| 370 } |
| OLD | NEW |