| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 return 0; | 95 return 0; |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 | 98 |
| 99 | 99 |
| 100 DEFINE_NATIVE_ENTRY(String_charAt, 2) { | 100 DEFINE_NATIVE_ENTRY(String_charAt, 2) { |
| 101 const String& receiver = String::CheckedHandle(arguments->NativeArgAt(0)); | 101 const String& receiver = String::CheckedHandle(arguments->NativeArgAt(0)); |
| 102 GET_NATIVE_ARGUMENT(Integer, index, arguments->NativeArgAt(1)); | 102 GET_NATIVE_ARGUMENT(Integer, index, arguments->NativeArgAt(1)); |
| 103 uint32_t value = StringValueAt(receiver, index); | 103 uint32_t value = StringValueAt(receiver, index); |
| 104 ASSERT(value <= 0x10FFFF); | 104 ASSERT(value <= 0x10FFFF); |
| 105 return Symbols::New(&value, 1); | 105 return Symbols::FromCharCode(value); |
| 106 } | 106 } |
| 107 | 107 |
| 108 DEFINE_NATIVE_ENTRY(String_charCodeAt, 2) { | 108 DEFINE_NATIVE_ENTRY(String_charCodeAt, 2) { |
| 109 const String& receiver = String::CheckedHandle(arguments->NativeArgAt(0)); | 109 const String& receiver = String::CheckedHandle(arguments->NativeArgAt(0)); |
| 110 GET_NATIVE_ARGUMENT(Integer, index, arguments->NativeArgAt(1)); | 110 GET_NATIVE_ARGUMENT(Integer, index, arguments->NativeArgAt(1)); |
| 111 | 111 |
| 112 int32_t value = StringValueAt(receiver, index); | 112 int32_t value = StringValueAt(receiver, index); |
| 113 ASSERT(value >= 0); | 113 ASSERT(value >= 0); |
| 114 ASSERT(value <= 0x10FFFF); | 114 ASSERT(value <= 0x10FFFF); |
| 115 return Smi::New(value); | 115 return Smi::New(value); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 if (!elem.IsString()) { | 151 if (!elem.IsString()) { |
| 152 GrowableArray<const Object*> args; | 152 GrowableArray<const Object*> args; |
| 153 args.Add(&elem); | 153 args.Add(&elem); |
| 154 Exceptions::ThrowByType(Exceptions::kArgument, args); | 154 Exceptions::ThrowByType(Exceptions::kArgument, args); |
| 155 } | 155 } |
| 156 } | 156 } |
| 157 return String::ConcatAll(strings); | 157 return String::ConcatAll(strings); |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace dart | 160 } // namespace dart |
| OLD | NEW |