Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Unified Diff: runtime/bin/common.cc

Issue 10990083: Reapply change to hide VM-only List implementation classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix dart:io perf regression. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/builtin_natives.cc ('k') | runtime/bin/common.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/common.cc
diff --git a/runtime/bin/common.cc b/runtime/bin/common.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5a98342d8661266784e0a0186a882f5d904e72a0
--- /dev/null
+++ b/runtime/bin/common.cc
@@ -0,0 +1,56 @@
+// 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 "bin/isolate_data.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));
+
+ // Fetch the cached builtin array types for this isolate.
+ IsolateData* isolate_data =
+ reinterpret_cast<IsolateData*>(Dart_CurrentIsolateData());
+ Dart_Handle object_array_class = isolate_data->object_array_class;
+ Dart_Handle growable_object_array_class =
+ isolate_data->growable_object_array_class;
+ Dart_Handle immutable_array_class = isolate_data->immutable_array_class;
+
+ // If we have not cached the class pointers in the isolate data,
+ // look them up and cache them now.
+ if (object_array_class == NULL) {
+ Dart_Handle coreimpl_lib =
+ Dart_LookupLibrary(Dart_NewString("dart:coreimpl"));
+ ASSERT(!Dart_IsError(coreimpl_lib));
+ object_array_class =
+ Dart_GetClass(coreimpl_lib, Dart_NewString("_ObjectArray"));
+ ASSERT(!Dart_IsError(object_array_class));
+ immutable_array_class =
+ Dart_GetClass(coreimpl_lib, Dart_NewString("_ImmutableArray"));
+ ASSERT(!Dart_IsError(immutable_array_class));
+ growable_object_array_class =
+ Dart_GetClass(coreimpl_lib, Dart_NewString("_GrowableObjectArray"));
+ ASSERT(!Dart_IsError(growable_object_array_class));
+ // Update the cache.
+ isolate_data->object_array_class =
+ Dart_NewPersistentHandle(object_array_class);
+ ASSERT(!Dart_IsError(isolate_data->object_array_class));
+ isolate_data->growable_object_array_class =
+ Dart_NewPersistentHandle(growable_object_array_class);
+ ASSERT(!Dart_IsError(isolate_data->growable_object_array_class));
+ isolate_data->immutable_array_class =
+ Dart_NewPersistentHandle(immutable_array_class);
+ ASSERT(!Dart_IsError(isolate_data->immutable_array_class));
+ }
+
+ bool builtin_array =
+ (Dart_IdentityEquals(list_class, growable_object_array_class) ||
+ Dart_IdentityEquals(list_class, object_array_class) ||
+ Dart_IdentityEquals(list_class, immutable_array_class));
+ Dart_SetReturnValue(args, Dart_NewBoolean(builtin_array));
+ Dart_ExitScope();
+}
« no previous file with comments | « runtime/bin/builtin_natives.cc ('k') | runtime/bin/common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698