| 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->At(0)); | 101 const String& receiver = String::CheckedHandle(arguments->At(0)); |
| 102 GET_NATIVE_ARGUMENT(Integer, index, arguments->At(1)); | 102 GET_NATIVE_ARGUMENT(Integer, index, arguments->At(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->At(0)); | 109 const String& receiver = String::CheckedHandle(arguments->At(0)); |
| 110 GET_NATIVE_ARGUMENT(Integer, index, arguments->At(1)); | 110 GET_NATIVE_ARGUMENT(Integer, index, arguments->At(1)); |
| 111 int32_t value = StringValueAt(receiver, index); | 111 int32_t value = StringValueAt(receiver, index); |
| 112 ASSERT(value >= 0); | 112 ASSERT(value >= 0); |
| 113 ASSERT(value <= 0x10FFFF); | 113 ASSERT(value <= 0x10FFFF); |
| 114 return Smi::New(value); | 114 return Smi::New(value); |
| 115 } | 115 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 if (!elem.IsString()) { | 150 if (!elem.IsString()) { |
| 151 GrowableArray<const Object*> args; | 151 GrowableArray<const Object*> args; |
| 152 args.Add(&elem); | 152 args.Add(&elem); |
| 153 Exceptions::ThrowByType(Exceptions::kArgument, args); | 153 Exceptions::ThrowByType(Exceptions::kArgument, args); |
| 154 } | 154 } |
| 155 } | 155 } |
| 156 return String::ConcatAll(strings); | 156 return String::ConcatAll(strings); |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // namespace dart | 159 } // namespace dart |
| OLD | NEW |