Index: runtime/bin/common.cc |
diff --git a/runtime/bin/common.cc b/runtime/bin/common.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..84d4dbabc82937591909321890d795dd6415342d |
--- /dev/null |
+++ b/runtime/bin/common.cc |
@@ -0,0 +1,28 @@ |
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+#include "bin/builtin.h" |
+ |
+#include "include/dart_api.h" |
+ |
+void FUNCTION_NAME(Common_IsBuiltinList)(Dart_NativeArguments args) { |
+ Dart_EnterScope(); |
+ Dart_Handle list = Dart_GetNativeArgument(args, 0); |
+ Dart_Handle list_class = Dart_InstanceGetClass(list); |
+ ASSERT(!Dart_IsError(list_class)); |
+ Dart_Handle coreimpl_lib = |
+ Dart_LookupLibrary(Dart_NewString("dart:coreimpl")); |
Søren Gjesse
2012/09/27 12:18:20
Do we want to keep these strings in persistent han
Mads Ager (google)
2012/09/27 12:34:26
Potentially. We don't do that with any other strin
|
+ ASSERT(!Dart_IsError(coreimpl_lib)); |
+ Dart_Handle object_array_class = |
+ Dart_GetClass(coreimpl_lib, Dart_NewString("_ObjectArray")); |
+ ASSERT(!Dart_IsError(object_array_class)); |
+ Dart_Handle immutable_array_class = |
+ Dart_GetClass(coreimpl_lib, Dart_NewString("_ImmutableArray")); |
+ ASSERT(!Dart_IsError(immutable_array_class)); |
+ // TODO(5474): We should be able to allow _GrowableObjectArrays here as well. |
+ bool builtin_array = (Dart_IdentityEquals(list_class, object_array_class) || |
+ Dart_IdentityEquals(list_class, immutable_array_class)); |
+ Dart_SetReturnValue(args, Dart_NewBoolean(builtin_array)); |
+ Dart_ExitScope(); |
+} |