| 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/stack_frame.h" | 10 #include "vm/stack_frame.h" |
| 11 #include "vm/symbols.h" | 11 #include "vm/symbols.h" |
| 12 | 12 |
| 13 namespace dart { | 13 namespace dart { |
| 14 | 14 |
| 15 DECLARE_FLAG(bool, enable_type_checks); | 15 DECLARE_FLAG(bool, enable_type_checks); |
| 16 | 16 |
| 17 | 17 |
| 18 DEFINE_NATIVE_ENTRY(Object_cid, 1) { | 18 DEFINE_NATIVE_ENTRY(Object_cid, 1) { |
| 19 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); | 19 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); |
| 20 const Class& cls = Class::Handle(instance.clazz()); | 20 return Smi::New(instance.GetClassId()); |
| 21 return Smi::New(cls.id()); | |
| 22 } | 21 } |
| 23 | 22 |
| 24 | 23 |
| 25 DEFINE_NATIVE_ENTRY(Object_toString, 1) { | 24 DEFINE_NATIVE_ENTRY(Object_toString, 1) { |
| 26 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); | 25 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); |
| 27 const char* c_str = instance.ToCString(); | 26 const char* c_str = instance.ToCString(); |
| 28 return String::New(c_str); | 27 return String::New(c_str); |
| 29 } | 28 } |
| 30 | 29 |
| 31 | 30 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 172 } |
| 174 | 173 |
| 175 | 174 |
| 176 DEFINE_NATIVE_ENTRY(AbstractType_toString, 1) { | 175 DEFINE_NATIVE_ENTRY(AbstractType_toString, 1) { |
| 177 const AbstractType& type = | 176 const AbstractType& type = |
| 178 AbstractType::CheckedHandle(arguments->NativeArgAt(0)); | 177 AbstractType::CheckedHandle(arguments->NativeArgAt(0)); |
| 179 return type.UserVisibleName(); | 178 return type.UserVisibleName(); |
| 180 } | 179 } |
| 181 | 180 |
| 182 } // namespace dart | 181 } // namespace dart |
| OLD | NEW |