| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 intptr_t start = start_obj.Value(); | 62 intptr_t start = start_obj.Value(); |
| 63 intptr_t end = end_obj.Value(); | 63 intptr_t end = end_obj.Value(); |
| 64 | 64 |
| 65 const String& result = String::Handle( | 65 const String& result = String::Handle( |
| 66 String::SubString(receiver, start, (end - start))); | 66 String::SubString(receiver, start, (end - start))); |
| 67 arguments->SetReturn(result); | 67 arguments->SetReturn(result); |
| 68 } | 68 } |
| 69 | 69 |
| 70 | 70 |
| 71 | |
| 72 DEFINE_NATIVE_ENTRY(String_hashCode, 1) { | 71 DEFINE_NATIVE_ENTRY(String_hashCode, 1) { |
| 73 const String& receiver = String::CheckedHandle(arguments->At(0)); | 72 const String& receiver = String::CheckedHandle(arguments->At(0)); |
| 74 intptr_t hash_val = receiver.Hash(); | 73 intptr_t hash_val = receiver.Hash(); |
| 75 ASSERT(hash_val > 0); | 74 ASSERT(hash_val > 0); |
| 76 ASSERT(Smi::IsValid(hash_val)); | 75 ASSERT(Smi::IsValid(hash_val)); |
| 77 const Smi& hash_smi = Smi::Handle(Smi::New(hash_val)); | 76 const Smi& hash_smi = Smi::Handle(Smi::New(hash_val)); |
| 78 arguments->SetReturn(hash_smi); | 77 arguments->SetReturn(hash_smi); |
| 79 } | 78 } |
| 80 | 79 |
| 81 | 80 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 GrowableArray<const Object*> args; | 162 GrowableArray<const Object*> args; |
| 164 args.Add(&elem); | 163 args.Add(&elem); |
| 165 Exceptions::ThrowByType(Exceptions::kIllegalArgument, args); | 164 Exceptions::ThrowByType(Exceptions::kIllegalArgument, args); |
| 166 } | 165 } |
| 167 } | 166 } |
| 168 const String& result = String::Handle(String::ConcatAll(strings)); | 167 const String& result = String::Handle(String::ConcatAll(strings)); |
| 169 arguments->SetReturn(result); | 168 arguments->SetReturn(result); |
| 170 } | 169 } |
| 171 | 170 |
| 172 } // namespace dart | 171 } // namespace dart |
| OLD | NEW |