| OLD | NEW |
| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 174 |
| 175 | 175 |
| 176 DEFINE_NATIVE_ENTRY(String_charAt, 2) { | 176 DEFINE_NATIVE_ENTRY(String_charAt, 2) { |
| 177 const String& receiver = String::CheckedHandle(arguments->NativeArgAt(0)); | 177 const String& receiver = String::CheckedHandle(arguments->NativeArgAt(0)); |
| 178 GET_NON_NULL_NATIVE_ARGUMENT(Integer, index, arguments->NativeArgAt(1)); | 178 GET_NON_NULL_NATIVE_ARGUMENT(Integer, index, arguments->NativeArgAt(1)); |
| 179 uint32_t value = StringValueAt(receiver, index); | 179 uint32_t value = StringValueAt(receiver, index); |
| 180 ASSERT(value <= 0x10FFFF); | 180 ASSERT(value <= 0x10FFFF); |
| 181 return Symbols::FromCharCode(value); | 181 return Symbols::FromCharCode(value); |
| 182 } | 182 } |
| 183 | 183 |
| 184 |
| 184 DEFINE_NATIVE_ENTRY(String_codeUnitAt, 2) { | 185 DEFINE_NATIVE_ENTRY(String_codeUnitAt, 2) { |
| 185 const String& receiver = String::CheckedHandle(arguments->NativeArgAt(0)); | 186 const String& receiver = String::CheckedHandle(arguments->NativeArgAt(0)); |
| 186 GET_NON_NULL_NATIVE_ARGUMENT(Integer, index, arguments->NativeArgAt(1)); | 187 GET_NON_NULL_NATIVE_ARGUMENT(Integer, index, arguments->NativeArgAt(1)); |
| 187 | 188 |
| 188 int32_t value = StringValueAt(receiver, index); | 189 int32_t value = StringValueAt(receiver, index); |
| 189 ASSERT(value >= 0); | 190 ASSERT(value >= 0); |
| 190 ASSERT(value <= 0xFFFF); | 191 ASSERT(value <= 0xFFFF); |
| 191 return Smi::New(value); | 192 return Smi::New(value); |
| 192 } | 193 } |
| 193 | 194 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 ? String::Handle(OneByteString::New(length_value, Heap::kNew)) | 246 ? String::Handle(OneByteString::New(length_value, Heap::kNew)) |
| 246 : String::Handle(TwoByteString::New(length_value, Heap::kNew)); | 247 : String::Handle(TwoByteString::New(length_value, Heap::kNew)); |
| 247 NoGCScope no_gc; | 248 NoGCScope no_gc; |
| 248 | 249 |
| 249 uint16_t* data_position = reinterpret_cast<uint16_t*>(codeUnits.DataAddr(0)); | 250 uint16_t* data_position = reinterpret_cast<uint16_t*>(codeUnits.DataAddr(0)); |
| 250 String::Copy(result, 0, data_position, length_value); | 251 String::Copy(result, 0, data_position, length_value); |
| 251 return result.raw(); | 252 return result.raw(); |
| 252 } | 253 } |
| 253 | 254 |
| 254 } // namespace dart | 255 } // namespace dart |
| OLD | NEW |