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

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 8678031: Optimize type checks of list and map literals. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/code_generator_ia32.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 } 750 }
751 const Object& obj = Object::Handle(Api::UnwrapHandle(object)); 751 const Object& obj = Object::Handle(Api::UnwrapHandle(object));
752 Instance& instance = Instance::Handle(); 752 Instance& instance = Instance::Handle();
753 instance ^= obj.raw(); 753 instance ^= obj.raw();
754 // Finalize all classes. 754 // Finalize all classes.
755 const char* msg = CheckIsolateState(isolate); 755 const char* msg = CheckIsolateState(isolate);
756 if (msg != NULL) { 756 if (msg != NULL) {
757 return Api::Error(msg); 757 return Api::Error(msg);
758 } 758 }
759 const Type& type = Type::Handle(Type::NewNonParameterizedType(cls)); 759 const Type& type = Type::Handle(Type::NewNonParameterizedType(cls));
760 *value = instance.Is(type); 760 *value = instance.IsInstanceOf(type, TypeArguments::Handle());
761 return Api::Success(); 761 return Api::Success();
762 } 762 }
763 763
764 764
765 // --- Numbers ---- 765 // --- Numbers ----
766 766
767 767
768 // TODO(iposva): The argument should be an instance. 768 // TODO(iposva): The argument should be an instance.
769 DART_EXPORT bool Dart_IsNumber(Dart_Handle object) { 769 DART_EXPORT bool Dart_IsNumber(Dart_Handle object) {
770 DARTSCOPE(Isolate::Current()); 770 DARTSCOPE(Isolate::Current());
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 1122
1123 1123
1124 // --- Lists --- 1124 // --- Lists ---
1125 1125
1126 1126
1127 static RawInstance* GetListInstance(Isolate* isolate, const Object& obj) { 1127 static RawInstance* GetListInstance(Isolate* isolate, const Object& obj) {
1128 if (obj.IsInstance()) { 1128 if (obj.IsInstance()) {
1129 Instance& instance = Instance::Handle(); 1129 Instance& instance = Instance::Handle();
1130 instance ^= obj.raw(); 1130 instance ^= obj.raw();
1131 const Type& type = Type::Handle(isolate->object_store()->list_interface()); 1131 const Type& type = Type::Handle(isolate->object_store()->list_interface());
1132 return instance.Is(type) ? instance.raw() : Instance::null(); 1132 if (instance.IsInstanceOf(type, TypeArguments::Handle())) {
1133 return instance.raw();
1134 }
1133 } 1135 }
1134 return Instance::null(); 1136 return Instance::null();
1135 } 1137 }
1136 1138
1137 1139
1138 DART_EXPORT bool Dart_IsList(Dart_Handle object) { 1140 DART_EXPORT bool Dart_IsList(Dart_Handle object) {
1139 Isolate* isolate = Isolate::Current(); 1141 Isolate* isolate = Isolate::Current();
1140 DARTSCOPE(isolate); 1142 DARTSCOPE(isolate);
1141 const Object& obj = Object::Handle(Api::UnwrapHandle(object)); 1143 const Object& obj = Object::Handle(Api::UnwrapHandle(object));
1142 // TODO(5526318): Make access to GrowableObjectArray more efficient. 1144 // TODO(5526318): Make access to GrowableObjectArray more efficient.
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
2295 } 2297 }
2296 delete debug_region; 2298 delete debug_region;
2297 } else { 2299 } else {
2298 *buffer = NULL; 2300 *buffer = NULL;
2299 *buffer_size = 0; 2301 *buffer_size = 0;
2300 } 2302 }
2301 } 2303 }
2302 2304
2303 2305
2304 } // namespace dart 2306 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/code_generator_ia32.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698