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

Side by Side Diff: lib/string.cc

Issue 11648006: Create read only handles for empty_array and sentinel objects (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 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 | « lib/isolate.cc ('k') | vm/ast.cc » ('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 "vm/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 6
7 #include "vm/exceptions.h" 7 #include "vm/exceptions.h"
8 #include "vm/native_entry.h" 8 #include "vm/native_entry.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/symbols.h" 10 #include "vm/symbols.h"
(...skipping 14 matching lines...) Expand all
25 Object& index_object = Object::Handle(isolate); 25 Object& index_object = Object::Handle(isolate);
26 for (intptr_t i = 0; i < array_len; i++) { 26 for (intptr_t i = 0; i < array_len; i++) {
27 index_object = a.At(i); 27 index_object = a.At(i);
28 if (!index_object.IsSmi()) { 28 if (!index_object.IsSmi()) {
29 const Array& args = Array::Handle(Array::New(1)); 29 const Array& args = Array::Handle(Array::New(1));
30 args.SetAt(0, index_object); 30 args.SetAt(0, index_object);
31 Exceptions::ThrowByType(Exceptions::kArgument, args); 31 Exceptions::ThrowByType(Exceptions::kArgument, args);
32 } 32 }
33 intptr_t value = Smi::Cast(index_object).Value(); 33 intptr_t value = Smi::Cast(index_object).Value();
34 if (Utf::IsOutOfRange(value)) { 34 if (Utf::IsOutOfRange(value)) {
35 const Array& args = Array::Handle(Object::empty_array()); 35 Exceptions::ThrowByType(Exceptions::kArgument, Object::empty_array());
36 Exceptions::ThrowByType(Exceptions::kArgument, args);
37 } else { 36 } else {
38 if (!Utf::IsLatin1(value)) { 37 if (!Utf::IsLatin1(value)) {
39 is_one_byte_string = false; 38 is_one_byte_string = false;
40 if (Utf::IsSupplementary(value)) { 39 if (Utf::IsSupplementary(value)) {
41 utf16_len += 1; 40 utf16_len += 1;
42 } 41 }
43 } 42 }
44 } 43 }
45 utf32_array[i] = value; 44 utf32_array[i] = value;
46 } 45 }
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 if (!elem.IsString()) { 192 if (!elem.IsString()) {
194 const Array& args = Array::Handle(Array::New(1)); 193 const Array& args = Array::Handle(Array::New(1));
195 args.SetAt(0, elem); 194 args.SetAt(0, elem);
196 Exceptions::ThrowByType(Exceptions::kArgument, args); 195 Exceptions::ThrowByType(Exceptions::kArgument, args);
197 } 196 }
198 } 197 }
199 return String::ConcatAll(strings); 198 return String::ConcatAll(strings);
200 } 199 }
201 200
202 } // namespace dart 201 } // namespace dart
OLDNEW
« no previous file with comments | « lib/isolate.cc ('k') | vm/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698