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 "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
(...skipping 8920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8931 raw_ptr()->context_ = value.raw(); | 8931 raw_ptr()->context_ = value.raw(); |
8932 } | 8932 } |
8933 | 8933 |
8934 | 8934 |
8935 void Closure::set_function(const Function& value) const { | 8935 void Closure::set_function(const Function& value) const { |
8936 raw_ptr()->function_ = value.raw(); | 8936 raw_ptr()->function_ = value.raw(); |
8937 } | 8937 } |
8938 | 8938 |
8939 | 8939 |
8940 const char* Closure::ToCString() const { | 8940 const char* Closure::ToCString() const { |
8941 return "Closure"; | 8941 const Function& fun = Function::Handle(function()); |
| 8942 const bool is_implicit_closure = fun.IsImplicitClosureFunction(); |
| 8943 const char* fun_sig = String::Handle(fun.Signature()).ToCString(); |
| 8944 const char* from = is_implicit_closure ? " from " : ""; |
| 8945 const char* fun_desc = is_implicit_closure ? fun.ToCString() : ""; |
| 8946 const char* format = "Closure: %s%s%s"; |
| 8947 intptr_t len = OS::SNPrint(NULL, 0, format, fun_sig, from, fun_desc) + 1; |
| 8948 char* chars = reinterpret_cast<char*>( |
| 8949 Isolate::Current()->current_zone()->Allocate(len)); |
| 8950 OS::SNPrint(chars, len, format, fun_sig, from, fun_desc); |
| 8951 return chars; |
8942 } | 8952 } |
8943 | 8953 |
8944 | 8954 |
8945 intptr_t Stacktrace::Length() const { | 8955 intptr_t Stacktrace::Length() const { |
8946 const Array& code_array = Array::Handle(raw_ptr()->code_array_); | 8956 const Array& code_array = Array::Handle(raw_ptr()->code_array_); |
8947 return code_array.Length(); | 8957 return code_array.Length(); |
8948 } | 8958 } |
8949 | 8959 |
8950 | 8960 |
8951 RawFunction* Stacktrace::FunctionAtFrame(intptr_t frame_index) const { | 8961 RawFunction* Stacktrace::FunctionAtFrame(intptr_t frame_index) const { |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9210 const String& str = String::Handle(pattern()); | 9220 const String& str = String::Handle(pattern()); |
9211 const char* format = "JSRegExp: pattern=%s flags=%s"; | 9221 const char* format = "JSRegExp: pattern=%s flags=%s"; |
9212 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 9222 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
9213 char* chars = reinterpret_cast<char*>( | 9223 char* chars = reinterpret_cast<char*>( |
9214 Isolate::Current()->current_zone()->Allocate(len + 1)); | 9224 Isolate::Current()->current_zone()->Allocate(len + 1)); |
9215 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 9225 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
9216 return chars; | 9226 return chars; |
9217 } | 9227 } |
9218 | 9228 |
9219 } // namespace dart | 9229 } // namespace dart |
OLD | NEW |