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 #include "vm/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
6 | 6 |
7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
9 #include "vm/exceptions.h" | 9 #include "vm/exceptions.h" |
10 #include "vm/heap.h" | 10 #include "vm/heap.h" |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 353 |
354 | 354 |
355 DEFINE_NATIVE_ENTRY(Internal_inquireIs64Bit, 0) { | 355 DEFINE_NATIVE_ENTRY(Internal_inquireIs64Bit, 0) { |
356 #if defined(ARCH_IS_64_BIT) | 356 #if defined(ARCH_IS_64_BIT) |
357 return Bool::True().raw(); | 357 return Bool::True().raw(); |
358 #else | 358 #else |
359 return Bool::False().raw(); | 359 return Bool::False().raw(); |
360 #endif // defined(ARCH_IS_64_BIT) | 360 #endif // defined(ARCH_IS_64_BIT) |
361 } | 361 } |
362 | 362 |
| 363 |
| 364 DEFINE_NATIVE_ENTRY(Internal_prependTypeArguments, 3) { |
| 365 const TypeArguments& function_type_arguments = |
| 366 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(0)); |
| 367 const TypeArguments& parent_type_arguments = |
| 368 TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(1)); |
| 369 if (function_type_arguments.IsNull() && parent_type_arguments.IsNull()) { |
| 370 return TypeArguments::null(); |
| 371 } |
| 372 GET_NON_NULL_NATIVE_ARGUMENT(Smi, smi_len, arguments->NativeArgAt(2)); |
| 373 const intptr_t len = smi_len.Value(); |
| 374 const TypeArguments& result = |
| 375 TypeArguments::Handle(zone, TypeArguments::New(len, Heap::kNew)); |
| 376 AbstractType& type = AbstractType::Handle(zone); |
| 377 const intptr_t split = parent_type_arguments.IsNull() |
| 378 ? len - function_type_arguments.Length() |
| 379 : parent_type_arguments.Length(); |
| 380 for (intptr_t i = 0; i < split; i++) { |
| 381 type = parent_type_arguments.IsNull() ? Type::DynamicType() |
| 382 : parent_type_arguments.TypeAt(i); |
| 383 result.SetTypeAt(i, type); |
| 384 } |
| 385 for (intptr_t i = split; i < len; i++) { |
| 386 type = function_type_arguments.IsNull() |
| 387 ? Type::DynamicType() |
| 388 : function_type_arguments.TypeAt(i - split); |
| 389 result.SetTypeAt(i, type); |
| 390 } |
| 391 return result.Canonicalize(); |
| 392 } |
| 393 |
363 } // namespace dart | 394 } // namespace dart |
OLD | NEW |