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

Side by Side Diff: runtime/lib/growable_array.cc

Issue 14307007: Fix crashes in debug mode with optimizations turned off. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/lib/array.cc ('k') | no next file » | 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) 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 "platform/assert.h" 5 #include "platform/assert.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/bootstrap_natives.h" 8 #include "vm/bootstrap_natives.h"
9 #include "vm/exceptions.h" 9 #include "vm/exceptions.h"
10 #include "vm/native_entry.h" 10 #include "vm/native_entry.h"
11 #include "vm/object.h" 11 #include "vm/object.h"
12 12
13 namespace dart { 13 namespace dart {
14 14
15 DEFINE_NATIVE_ENTRY(GrowableObjectArray_allocate, 2) { 15 DEFINE_NATIVE_ENTRY(GrowableObjectArray_allocate, 2) {
16 const AbstractTypeArguments& type_arguments = 16 const AbstractTypeArguments& type_arguments =
17 AbstractTypeArguments::CheckedHandle(arguments->NativeArgAt(0)); 17 AbstractTypeArguments::CheckedHandle(arguments->NativeArgAt(0));
18 ASSERT(type_arguments.IsNull() ||
19 (type_arguments.IsInstantiated() && (type_arguments.Length() == 1)));
20 GET_NON_NULL_NATIVE_ARGUMENT(Array, data, arguments->NativeArgAt(1)); 18 GET_NON_NULL_NATIVE_ARGUMENT(Array, data, arguments->NativeArgAt(1));
21 if ((data.Length() <= 0)) { 19 if ((data.Length() <= 0)) {
22 const Integer& index = Integer::Handle(Integer::New(data.Length())); 20 const Integer& index = Integer::Handle(Integer::New(data.Length()));
23 const Array& args = Array::Handle(Array::New(1)); 21 const Array& args = Array::Handle(Array::New(1));
24 args.SetAt(0, index); 22 args.SetAt(0, index);
25 Exceptions::ThrowByType(Exceptions::kRange, args); 23 Exceptions::ThrowByType(Exceptions::kRange, args);
26 } 24 }
27 const GrowableObjectArray& new_array = 25 const GrowableObjectArray& new_array =
28 GrowableObjectArray::Handle(GrowableObjectArray::New(data)); 26 GrowableObjectArray::Handle(GrowableObjectArray::New(data));
29 new_array.SetTypeArguments(type_arguments); 27 new_array.SetTypeArguments(type_arguments);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 DEFINE_NATIVE_ENTRY(GrowableObjectArray_setData, 2) { 89 DEFINE_NATIVE_ENTRY(GrowableObjectArray_setData, 2) {
92 const GrowableObjectArray& array = 90 const GrowableObjectArray& array =
93 GrowableObjectArray::CheckedHandle(arguments->NativeArgAt(0)); 91 GrowableObjectArray::CheckedHandle(arguments->NativeArgAt(0));
94 GET_NON_NULL_NATIVE_ARGUMENT(Array, data, arguments->NativeArgAt(1)); 92 GET_NON_NULL_NATIVE_ARGUMENT(Array, data, arguments->NativeArgAt(1));
95 ASSERT(data.Length() > 0); 93 ASSERT(data.Length() > 0);
96 array.SetData(data); 94 array.SetData(data);
97 return Object::null(); 95 return Object::null();
98 } 96 }
99 97
100 } // namespace dart 98 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/array.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698