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

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

Issue 11299020: Make creation of list literal more resilient to changes in the underlying (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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
OLDNEW
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 "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 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after
1753 str_obj.MakeExternal(array, length, peer, cback)); 1753 str_obj.MakeExternal(array, length, peer, cback));
1754 } 1754 }
1755 1755
1756 1756
1757 // --- Lists --- 1757 // --- Lists ---
1758 1758
1759 1759
1760 static RawInstance* GetListInstance(Isolate* isolate, const Object& obj) { 1760 static RawInstance* GetListInstance(Isolate* isolate, const Object& obj) {
1761 if (obj.IsInstance()) { 1761 if (obj.IsInstance()) {
1762 const Instance& instance = Instance::Cast(obj); 1762 const Instance& instance = Instance::Cast(obj);
1763 const Type& type = 1763 const Class& obj_class = Class::Handle(isolate, obj.clazz());
1764 Type::Handle(isolate, isolate->object_store()->list_interface()); 1764 const Class& list_class =
1765 Class::Handle(isolate, isolate->object_store()->list_class());
1765 Error& malformed_type_error = Error::Handle(isolate); 1766 Error& malformed_type_error = Error::Handle(isolate);
1766 if (instance.IsInstanceOf(type, 1767 if (obj_class.IsSubtypeOf(TypeArguments::Handle(isolate),
1768 list_class,
1767 TypeArguments::Handle(isolate), 1769 TypeArguments::Handle(isolate),
1768 &malformed_type_error)) { 1770 &malformed_type_error)) {
1769 ASSERT(malformed_type_error.IsNull()); // Type is a raw List. 1771 ASSERT(malformed_type_error.IsNull()); // Type is a raw List.
1770 return instance.raw(); 1772 return instance.raw();
1771 } 1773 }
1772 } 1774 }
1773 return Instance::null(); 1775 return Instance::null();
1774 } 1776 }
1775 1777
1776 1778
(...skipping 2713 matching lines...) Expand 10 before | Expand all | Expand 10 after
4490 } 4492 }
4491 { 4493 {
4492 NoGCScope no_gc; 4494 NoGCScope no_gc;
4493 RawObject* raw_obj = obj.raw(); 4495 RawObject* raw_obj = obj.raw();
4494 isolate->heap()->SetPeer(raw_obj, peer); 4496 isolate->heap()->SetPeer(raw_obj, peer);
4495 } 4497 }
4496 return Api::Success(isolate); 4498 return Api::Success(isolate);
4497 } 4499 }
4498 4500
4499 } // namespace dart 4501 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698