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 "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
9 #include "vm/exceptions.h" | 9 #include "vm/exceptions.h" |
10 #include "vm/heap.h" | 10 #include "vm/heap.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); | 39 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); |
40 GET_NON_NULL_NATIVE_ARGUMENT(Smi, hash, arguments->NativeArgAt(1)); | 40 GET_NON_NULL_NATIVE_ARGUMENT(Smi, hash, arguments->NativeArgAt(1)); |
41 Heap* heap = isolate->heap(); | 41 Heap* heap = isolate->heap(); |
42 heap->SetHash(instance.raw(), hash.Value()); | 42 heap->SetHash(instance.raw(), hash.Value()); |
43 return Object::null(); | 43 return Object::null(); |
44 } | 44 } |
45 | 45 |
46 | 46 |
47 DEFINE_NATIVE_ENTRY(Object_toString, 1) { | 47 DEFINE_NATIVE_ENTRY(Object_toString, 1) { |
48 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); | 48 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); |
| 49 ASSERT(!instance.IsString()); // See issue 20583. |
49 const char* c_str = instance.ToCString(); | 50 const char* c_str = instance.ToCString(); |
50 return String::New(c_str); | 51 return String::New(c_str); |
51 } | 52 } |
52 | 53 |
53 | 54 |
54 DEFINE_NATIVE_ENTRY(Object_noSuchMethod, 6) { | 55 DEFINE_NATIVE_ENTRY(Object_noSuchMethod, 6) { |
55 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); | 56 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); |
56 GET_NON_NULL_NATIVE_ARGUMENT(Bool, is_method, arguments->NativeArgAt(1)); | 57 GET_NON_NULL_NATIVE_ARGUMENT(Bool, is_method, arguments->NativeArgAt(1)); |
57 GET_NON_NULL_NATIVE_ARGUMENT(String, member_name, arguments->NativeArgAt(2)); | 58 GET_NON_NULL_NATIVE_ARGUMENT(String, member_name, arguments->NativeArgAt(2)); |
58 GET_NON_NULL_NATIVE_ARGUMENT(Smi, invocation_type, arguments->NativeArgAt(3)); | 59 GET_NON_NULL_NATIVE_ARGUMENT(Smi, invocation_type, arguments->NativeArgAt(3)); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 // Currently all errors are Dart instances, e.g. I/O errors | 298 // Currently all errors are Dart instances, e.g. I/O errors |
298 // created by deferred loading code. LanguageErrors from | 299 // created by deferred loading code. LanguageErrors from |
299 // failed loading or finalization attempts are propagated and result | 300 // failed loading or finalization attempts are propagated and result |
300 // in the isolate's death. | 301 // in the isolate's death. |
301 const Instance& error = Instance::Handle(prefix.LoadError()); | 302 const Instance& error = Instance::Handle(prefix.LoadError()); |
302 return error.raw(); | 303 return error.raw(); |
303 } | 304 } |
304 | 305 |
305 | 306 |
306 } // namespace dart | 307 } // namespace dart |
OLD | NEW |