OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/become.h" | 10 #include "vm/become.h" |
(...skipping 15160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15171 | 15171 |
15172 RawApiError* ApiError::New() { | 15172 RawApiError* ApiError::New() { |
15173 ASSERT(Object::api_error_class() != Class::null()); | 15173 ASSERT(Object::api_error_class() != Class::null()); |
15174 RawObject* raw = Object::Allocate(ApiError::kClassId, | 15174 RawObject* raw = Object::Allocate(ApiError::kClassId, |
15175 ApiError::InstanceSize(), Heap::kOld); | 15175 ApiError::InstanceSize(), Heap::kOld); |
15176 return reinterpret_cast<RawApiError*>(raw); | 15176 return reinterpret_cast<RawApiError*>(raw); |
15177 } | 15177 } |
15178 | 15178 |
15179 | 15179 |
15180 RawApiError* ApiError::New(const String& message, Heap::Space space) { | 15180 RawApiError* ApiError::New(const String& message, Heap::Space space) { |
| 15181 #ifndef PRODUCT |
| 15182 if (FLAG_print_stacktrace_at_api_error) { |
| 15183 OS::PrintErr("ApiError: %s\n", message.ToCString()); |
| 15184 Profiler::DumpStackTrace(false /* for_crash */); |
| 15185 } |
| 15186 #endif // !PRODUCT |
| 15187 |
15181 ASSERT(Object::api_error_class() != Class::null()); | 15188 ASSERT(Object::api_error_class() != Class::null()); |
15182 ApiError& result = ApiError::Handle(); | 15189 ApiError& result = ApiError::Handle(); |
15183 { | 15190 { |
15184 RawObject* raw = | 15191 RawObject* raw = |
15185 Object::Allocate(ApiError::kClassId, ApiError::InstanceSize(), space); | 15192 Object::Allocate(ApiError::kClassId, ApiError::InstanceSize(), space); |
15186 NoSafepointScope no_safepoint; | 15193 NoSafepointScope no_safepoint; |
15187 result ^= raw; | 15194 result ^= raw; |
15188 } | 15195 } |
15189 result.set_message(message); | 15196 result.set_message(message); |
15190 return result.raw(); | 15197 return result.raw(); |
(...skipping 7949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
23140 return UserTag::null(); | 23147 return UserTag::null(); |
23141 } | 23148 } |
23142 | 23149 |
23143 | 23150 |
23144 const char* UserTag::ToCString() const { | 23151 const char* UserTag::ToCString() const { |
23145 const String& tag_label = String::Handle(label()); | 23152 const String& tag_label = String::Handle(label()); |
23146 return tag_label.ToCString(); | 23153 return tag_label.ToCString(); |
23147 } | 23154 } |
23148 | 23155 |
23149 } // namespace dart | 23156 } // namespace dart |
OLD | NEW |