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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 GET_NATIVE_ARGUMENT(String, receiver, arguments->At(0)); | 55 GET_NATIVE_ARGUMENT(String, receiver, arguments->At(0)); |
56 GET_NATIVE_ARGUMENT(Smi, start_obj, arguments->At(1)); | 56 GET_NATIVE_ARGUMENT(Smi, start_obj, arguments->At(1)); |
57 GET_NATIVE_ARGUMENT(Smi, end_obj, arguments->At(2)); | 57 GET_NATIVE_ARGUMENT(Smi, end_obj, arguments->At(2)); |
58 | 58 |
59 intptr_t start = start_obj.Value(); | 59 intptr_t start = start_obj.Value(); |
60 intptr_t end = end_obj.Value(); | 60 intptr_t end = end_obj.Value(); |
61 return String::SubString(receiver, start, (end - start)); | 61 return String::SubString(receiver, start, (end - start)); |
62 } | 62 } |
63 | 63 |
64 | 64 |
65 DEFINE_NATIVE_ENTRY(String_hashCode, 1) { | 65 DEFINE_NATIVE_ENTRY(String_getHashCode, 1) { |
66 const String& receiver = String::CheckedHandle(arguments->At(0)); | 66 const String& receiver = String::CheckedHandle(arguments->At(0)); |
67 intptr_t hash_val = receiver.Hash(); | 67 intptr_t hash_val = receiver.Hash(); |
68 ASSERT(hash_val > 0); | 68 ASSERT(hash_val > 0); |
69 ASSERT(Smi::IsValid(hash_val)); | 69 ASSERT(Smi::IsValid(hash_val)); |
70 return Smi::New(hash_val); | 70 return Smi::New(hash_val); |
71 } | 71 } |
72 | 72 |
73 | 73 |
74 DEFINE_NATIVE_ENTRY(String_getLength, 1) { | 74 DEFINE_NATIVE_ENTRY(String_getLength, 1) { |
75 const String& receiver = String::CheckedHandle(arguments->At(0)); | 75 const String& receiver = String::CheckedHandle(arguments->At(0)); |
(...skipping 75 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 |