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

Side by Side Diff: lib/string.cc

Issue 11443024: Restructure Add and SetAt to not create a Handle. (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 | « no previous file | 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 "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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 GrowableObjectArray::New(16, Heap::kNew)); 87 GrowableObjectArray::New(16, Heap::kNew));
88 String& str = String::Handle(isolate); 88 String& str = String::Handle(isolate);
89 intptr_t start = 0; 89 intptr_t start = 0;
90 intptr_t i = 0; 90 intptr_t i = 0;
91 for (; i < len; i++) { 91 for (; i < len; i++) {
92 if (split_code == OneByteString::CharAt(receiver, i)) { 92 if (split_code == OneByteString::CharAt(receiver, i)) {
93 str = OneByteString::SubStringUnchecked(receiver, 93 str = OneByteString::SubStringUnchecked(receiver,
94 start, 94 start,
95 (i - start), 95 (i - start),
96 Heap::kNew); 96 Heap::kNew);
97 result.Add(isolate, str); 97 result.Add(str);
98 start = i + 1; 98 start = i + 1;
99 } 99 }
100 } 100 }
101 str = OneByteString::SubStringUnchecked(receiver, 101 str = OneByteString::SubStringUnchecked(receiver,
102 start, 102 start,
103 (i - start), 103 (i - start),
104 Heap::kNew); 104 Heap::kNew);
105 result.Add(isolate, str); 105 result.Add(str);
106 return result.raw(); 106 return result.raw();
107 } 107 }
108 108
109 109
110 DEFINE_NATIVE_ENTRY(String_getHashCode, 1) { 110 DEFINE_NATIVE_ENTRY(String_getHashCode, 1) {
111 const String& receiver = String::CheckedHandle(arguments->NativeArgAt(0)); 111 const String& receiver = String::CheckedHandle(arguments->NativeArgAt(0));
112 intptr_t hash_val = receiver.Hash(); 112 intptr_t hash_val = receiver.Hash();
113 ASSERT(hash_val > 0); 113 ASSERT(hash_val > 0);
114 ASSERT(Smi::IsValid(hash_val)); 114 ASSERT(Smi::IsValid(hash_val));
115 return Smi::New(hash_val); 115 return Smi::New(hash_val);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 if (!elem.IsString()) { 193 if (!elem.IsString()) {
194 GrowableArray<const Object*> args; 194 GrowableArray<const Object*> args;
195 args.Add(&elem); 195 args.Add(&elem);
196 Exceptions::ThrowByType(Exceptions::kArgument, args); 196 Exceptions::ThrowByType(Exceptions::kArgument, args);
197 } 197 }
198 } 198 }
199 return String::ConcatAll(strings); 199 return String::ConcatAll(strings);
200 } 200 }
201 201
202 } // namespace dart 202 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698