| 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/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/assert.h" | 8 #include "vm/assert.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 4945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4956 | 4956 |
| 4957 bool Instance::IsValidFieldOffset(int offset) const { | 4957 bool Instance::IsValidFieldOffset(int offset) const { |
| 4958 const Class& cls = Class::Handle(clazz()); | 4958 const Class& cls = Class::Handle(clazz()); |
| 4959 return (offset >= 0 && offset <= (cls.instance_size() - kWordSize)); | 4959 return (offset >= 0 && offset <= (cls.instance_size() - kWordSize)); |
| 4960 } | 4960 } |
| 4961 | 4961 |
| 4962 | 4962 |
| 4963 const char* Instance::ToCString() const { | 4963 const char* Instance::ToCString() const { |
| 4964 if (IsNull()) { | 4964 if (IsNull()) { |
| 4965 return "null"; | 4965 return "null"; |
| 4966 } else if (Isolate::Current()->no_gc_scope_depth() > 0) { |
| 4967 // Can occur when running disassembler. |
| 4968 return "Instance"; |
| 4966 } else { | 4969 } else { |
| 4967 const char* kFormat = "Instance of '%s'"; | 4970 const char* kFormat = "Instance of '%s'"; |
| 4968 Class& cls = Class::Handle(clazz()); | 4971 Class& cls = Class::Handle(clazz()); |
| 4969 TypeArguments& type_arguments = TypeArguments::Handle(); | 4972 TypeArguments& type_arguments = TypeArguments::Handle(); |
| 4970 const intptr_t num_type_arguments = cls.NumTypeArguments(); | 4973 const intptr_t num_type_arguments = cls.NumTypeArguments(); |
| 4971 if (num_type_arguments > 0) { | 4974 if (num_type_arguments > 0) { |
| 4972 type_arguments = GetTypeArguments(); | 4975 type_arguments = GetTypeArguments(); |
| 4973 } | 4976 } |
| 4974 const Type& type = Type::Handle( | 4977 const Type& type = Type::Handle( |
| 4975 Type::NewParameterizedType(cls, type_arguments)); | 4978 Type::NewParameterizedType(cls, type_arguments)); |
| (...skipping 1965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6941 const String& str = String::Handle(pattern()); | 6944 const String& str = String::Handle(pattern()); |
| 6942 const char* format = "JSRegExp: pattern=%s flags=%s"; | 6945 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 6943 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 6946 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 6944 char* chars = reinterpret_cast<char*>( | 6947 char* chars = reinterpret_cast<char*>( |
| 6945 Isolate::Current()->current_zone()->Allocate(len + 1)); | 6948 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 6946 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 6949 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 6947 return chars; | 6950 return chars; |
| 6948 } | 6951 } |
| 6949 | 6952 |
| 6950 } // namespace dart | 6953 } // namespace dart |
| OLD | NEW |