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

Side by Side Diff: lib/string.cc

Issue 10783035: Create frequently used symbols in the vm isolate (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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 | « lib/math.cc ('k') | vm/class_finalizer.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 11
11 namespace dart { 12 namespace dart {
12 13
13 DEFINE_NATIVE_ENTRY(StringBase_createFromCodePoints, 1) { 14 DEFINE_NATIVE_ENTRY(StringBase_createFromCodePoints, 1) {
14 GET_NATIVE_ARGUMENT(Array, a, arguments->At(0)); 15 GET_NATIVE_ARGUMENT(Array, a, arguments->At(0));
15 // TODO(srdjan): Check that parameterized type is an int. 16 // TODO(srdjan): Check that parameterized type is an int.
16 Zone* zone = Isolate::Current()->current_zone(); 17 Zone* zone = Isolate::Current()->current_zone();
17 intptr_t len = a.Length(); 18 intptr_t len = a.Length();
18 19
19 // Unbox the array and determine the maximum element width. 20 // Unbox the array and determine the maximum element width.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 return 0; 90 return 0;
90 } 91 }
91 } 92 }
92 93
93 94
94 DEFINE_NATIVE_ENTRY(String_charAt, 2) { 95 DEFINE_NATIVE_ENTRY(String_charAt, 2) {
95 const String& receiver = String::CheckedHandle(arguments->At(0)); 96 const String& receiver = String::CheckedHandle(arguments->At(0));
96 GET_NATIVE_ARGUMENT(Integer, index, arguments->At(1)); 97 GET_NATIVE_ARGUMENT(Integer, index, arguments->At(1));
97 uint32_t value = StringValueAt(receiver, index); 98 uint32_t value = StringValueAt(receiver, index);
98 ASSERT(value <= 0x10FFFF); 99 ASSERT(value <= 0x10FFFF);
99 arguments->SetReturn(String::Handle(String::NewSymbol(&value, 1))); 100 arguments->SetReturn(String::Handle(Symbols::New(&value, 1)));
100 } 101 }
101 102
102 DEFINE_NATIVE_ENTRY(String_charCodeAt, 2) { 103 DEFINE_NATIVE_ENTRY(String_charCodeAt, 2) {
103 const String& receiver = String::CheckedHandle(arguments->At(0)); 104 const String& receiver = String::CheckedHandle(arguments->At(0));
104 GET_NATIVE_ARGUMENT(Integer, index, arguments->At(1)); 105 GET_NATIVE_ARGUMENT(Integer, index, arguments->At(1));
105 int32_t value = StringValueAt(receiver, index); 106 int32_t value = StringValueAt(receiver, index);
106 ASSERT(value >= 0); 107 ASSERT(value >= 0);
107 ASSERT(value <= 0x10FFFF); 108 ASSERT(value <= 0x10FFFF);
108 arguments->SetReturn(Smi::Handle(Smi::New(value))); 109 arguments->SetReturn(Smi::Handle(Smi::New(value)));
109 } 110 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 GrowableArray<const Object*> args; 149 GrowableArray<const Object*> args;
149 args.Add(&elem); 150 args.Add(&elem);
150 Exceptions::ThrowByType(Exceptions::kIllegalArgument, args); 151 Exceptions::ThrowByType(Exceptions::kIllegalArgument, args);
151 } 152 }
152 } 153 }
153 const String& result = String::Handle(String::ConcatAll(strings)); 154 const String& result = String::Handle(String::ConcatAll(strings));
154 arguments->SetReturn(result); 155 arguments->SetReturn(result);
155 } 156 }
156 157
157 } // namespace dart 158 } // namespace dart
OLDNEW
« no previous file with comments | « lib/math.cc ('k') | vm/class_finalizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698