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/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 "fit into a javascript integer."); | 66 "fit into a javascript integer."); |
67 DEFINE_FLAG(bool, use_field_guards, true, "Guard field cids."); | 67 DEFINE_FLAG(bool, use_field_guards, true, "Guard field cids."); |
68 DEFINE_FLAG(bool, use_lib_cache, true, "Use library name cache"); | 68 DEFINE_FLAG(bool, use_lib_cache, true, "Use library name cache"); |
69 DEFINE_FLAG(bool, trace_field_guards, false, "Trace changes in field's cids."); | 69 DEFINE_FLAG(bool, trace_field_guards, false, "Trace changes in field's cids."); |
70 | 70 |
71 DECLARE_FLAG(bool, enable_type_checks); | 71 DECLARE_FLAG(bool, enable_type_checks); |
72 DECLARE_FLAG(bool, error_on_bad_override); | 72 DECLARE_FLAG(bool, error_on_bad_override); |
73 DECLARE_FLAG(bool, trace_compiler); | 73 DECLARE_FLAG(bool, trace_compiler); |
74 DECLARE_FLAG(bool, trace_deoptimization); | 74 DECLARE_FLAG(bool, trace_deoptimization); |
75 DECLARE_FLAG(bool, trace_deoptimization_verbose); | 75 DECLARE_FLAG(bool, trace_deoptimization_verbose); |
76 DECLARE_FLAG(bool, verbose_stacktrace); | 76 DECLARE_FLAG(bool, show_invisible_frames); |
77 DECLARE_FLAG(charp, coverage_dir); | 77 DECLARE_FLAG(charp, coverage_dir); |
78 DECLARE_FLAG(bool, write_protect_code); | 78 DECLARE_FLAG(bool, write_protect_code); |
79 | 79 |
80 static const char* kGetterPrefix = "get:"; | 80 static const char* kGetterPrefix = "get:"; |
81 static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix); | 81 static const intptr_t kGetterPrefixLength = strlen(kGetterPrefix); |
82 static const char* kSetterPrefix = "set:"; | 82 static const char* kSetterPrefix = "set:"; |
83 static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix); | 83 static const intptr_t kSetterPrefixLength = strlen(kSetterPrefix); |
84 | 84 |
85 cpp_vtable Object::handle_vtable_ = 0; | 85 cpp_vtable Object::handle_vtable_ = 0; |
86 cpp_vtable Object::builtin_vtables_[kNumPredefinedCids] = { 0 }; | 86 cpp_vtable Object::builtin_vtables_[kNumPredefinedCids] = { 0 }; |
(...skipping 2486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2573 } | 2573 } |
2574 | 2574 |
2575 // Named parameters. | 2575 // Named parameters. |
2576 for (; i < desc.Count(); i++) { | 2576 for (; i < desc.Count(); i++) { |
2577 invocation.SetParameterTypeAt(i, Type::Handle(Type::DynamicType())); | 2577 invocation.SetParameterTypeAt(i, Type::Handle(Type::DynamicType())); |
2578 intptr_t index = i - desc.PositionalCount(); | 2578 intptr_t index = i - desc.PositionalCount(); |
2579 invocation.SetParameterNameAt(i, String::Handle(desc.NameAt(index))); | 2579 invocation.SetParameterNameAt(i, String::Handle(desc.NameAt(index))); |
2580 } | 2580 } |
2581 invocation.set_result_type(Type::Handle(Type::DynamicType())); | 2581 invocation.set_result_type(Type::Handle(Type::DynamicType())); |
2582 invocation.set_is_debuggable(false); | 2582 invocation.set_is_debuggable(false); |
2583 invocation.set_is_visible(false); // Not visible in stack trace. | 2583 invocation.set_is_reflectable(false); |
2584 invocation.set_saved_args_desc(args_desc); | 2584 invocation.set_saved_args_desc(args_desc); |
2585 | 2585 |
2586 return invocation.raw(); | 2586 return invocation.raw(); |
2587 } | 2587 } |
2588 | 2588 |
2589 | 2589 |
2590 RawArray* Class::invocation_dispatcher_cache() const { | 2590 RawArray* Class::invocation_dispatcher_cache() const { |
2591 return raw_ptr()->invocation_dispatcher_cache_; | 2591 return raw_ptr()->invocation_dispatcher_cache_; |
2592 } | 2592 } |
2593 | 2593 |
(...skipping 3506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6100 result.set_parameter_names(Object::empty_array()); | 6100 result.set_parameter_names(Object::empty_array()); |
6101 result.set_name(name); | 6101 result.set_name(name); |
6102 result.set_kind(kind); | 6102 result.set_kind(kind); |
6103 result.set_recognized_kind(MethodRecognizer::kUnknown); | 6103 result.set_recognized_kind(MethodRecognizer::kUnknown); |
6104 result.set_modifier(RawFunction::kNoModifier); | 6104 result.set_modifier(RawFunction::kNoModifier); |
6105 result.set_is_static(is_static); | 6105 result.set_is_static(is_static); |
6106 result.set_is_const(is_const); | 6106 result.set_is_const(is_const); |
6107 result.set_is_abstract(is_abstract); | 6107 result.set_is_abstract(is_abstract); |
6108 result.set_is_external(is_external); | 6108 result.set_is_external(is_external); |
6109 result.set_is_native(is_native); | 6109 result.set_is_native(is_native); |
6110 result.set_is_visible(true); // Will be computed later. | 6110 result.set_is_reflectable(true); // Will be computed later. |
6111 result.set_is_debuggable(true); // Will be computed later. | 6111 result.set_is_debuggable(true); // Will be computed later. |
6112 result.set_is_intrinsic(false); | 6112 result.set_is_intrinsic(false); |
6113 result.set_is_redirecting(false); | 6113 result.set_is_redirecting(false); |
6114 result.set_is_async_closure(false); | 6114 result.set_is_async_closure(false); |
6115 result.set_always_inline(false); | 6115 result.set_always_inline(false); |
6116 result.set_is_polymorphic_target(false); | 6116 result.set_is_polymorphic_target(false); |
6117 result.set_owner(owner); | 6117 result.set_owner(owner); |
6118 result.set_token_pos(token_pos); | 6118 result.set_token_pos(token_pos); |
6119 result.set_end_token_pos(token_pos); | 6119 result.set_end_token_pos(token_pos); |
6120 result.set_num_fixed_parameters(0); | 6120 result.set_num_fixed_parameters(0); |
(...skipping 14016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20137 if (function.IsNull()) { | 20137 if (function.IsNull()) { |
20138 // Check if null function object indicates a stack trace overflow. | 20138 // Check if null function object indicates a stack trace overflow. |
20139 if ((i < (Length() - 1)) && | 20139 if ((i < (Length() - 1)) && |
20140 (FunctionAtFrame(i + 1) != Function::null())) { | 20140 (FunctionAtFrame(i + 1) != Function::null())) { |
20141 const char* kTruncated = "...\n...\n"; | 20141 const char* kTruncated = "...\n...\n"; |
20142 intptr_t truncated_len = strlen(kTruncated) + 1; | 20142 intptr_t truncated_len = strlen(kTruncated) + 1; |
20143 char* chars = isolate->current_zone()->Alloc<char>(truncated_len); | 20143 char* chars = isolate->current_zone()->Alloc<char>(truncated_len); |
20144 OS::SNPrint(chars, truncated_len, "%s", kTruncated); | 20144 OS::SNPrint(chars, truncated_len, "%s", kTruncated); |
20145 frame_strings.Add(chars); | 20145 frame_strings.Add(chars); |
20146 } | 20146 } |
20147 } else if (function.is_visible() || FLAG_verbose_stacktrace) { | 20147 } else if (function.is_debuggable() || FLAG_show_invisible_frames) { |
20148 code = CodeAtFrame(i); | 20148 code = CodeAtFrame(i); |
20149 ASSERT(function.raw() == code.function()); | 20149 ASSERT(function.raw() == code.function()); |
20150 uword pc = code.EntryPoint() + Smi::Value(PcOffsetAtFrame(i)); | 20150 uword pc = code.EntryPoint() + Smi::Value(PcOffsetAtFrame(i)); |
20151 if (code.is_optimized() && expand_inlined()) { | 20151 if (code.is_optimized() && expand_inlined()) { |
20152 // Traverse inlined frames. | 20152 // Traverse inlined frames. |
20153 for (InlinedFunctionsIterator it(code, pc); | 20153 for (InlinedFunctionsIterator it(code, pc); |
20154 !it.Done() && (*frame_index < max_frames); it.Advance()) { | 20154 !it.Done() && (*frame_index < max_frames); it.Advance()) { |
20155 function = it.function(); | 20155 function = it.function(); |
20156 if (function.is_visible() || FLAG_verbose_stacktrace) { | 20156 if (function.is_debuggable() || FLAG_show_invisible_frames) { |
20157 code = it.code(); | 20157 code = it.code(); |
20158 ASSERT(function.raw() == code.function()); | 20158 ASSERT(function.raw() == code.function()); |
20159 uword pc = it.pc(); | 20159 uword pc = it.pc(); |
20160 ASSERT(pc != 0); | 20160 ASSERT(pc != 0); |
20161 ASSERT(code.EntryPoint() <= pc); | 20161 ASSERT(code.EntryPoint() <= pc); |
20162 ASSERT(pc < (code.EntryPoint() + code.Size())); | 20162 ASSERT(pc < (code.EntryPoint() + code.Size())); |
20163 total_len += PrintOneStacktrace( | 20163 total_len += PrintOneStacktrace( |
20164 isolate, &frame_strings, pc, function, code, *frame_index); | 20164 isolate, &frame_strings, pc, function, code, *frame_index); |
20165 (*frame_index)++; // To account for inlined frames. | 20165 (*frame_index)++; // To account for inlined frames. |
20166 } | 20166 } |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20526 return tag_label.ToCString(); | 20526 return tag_label.ToCString(); |
20527 } | 20527 } |
20528 | 20528 |
20529 | 20529 |
20530 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20530 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
20531 Instance::PrintJSONImpl(stream, ref); | 20531 Instance::PrintJSONImpl(stream, ref); |
20532 } | 20532 } |
20533 | 20533 |
20534 | 20534 |
20535 } // namespace dart | 20535 } // namespace dart |
OLD | NEW |