OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/deopt_instructions.h" | 5 #include "vm/deopt_instructions.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/intermediate_language.h" | 10 #include "vm/intermediate_language.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 delete deferred_objects_[i]; | 136 delete deferred_objects_[i]; |
137 } | 137 } |
138 delete[] deferred_objects_; | 138 delete[] deferred_objects_; |
139 deferred_objects_ = NULL; | 139 deferred_objects_ = NULL; |
140 deferred_objects_count_ = 0; | 140 deferred_objects_count_ = 0; |
141 if (FLAG_support_timeline && (deopt_start_micros_ != 0)) { | 141 if (FLAG_support_timeline && (deopt_start_micros_ != 0)) { |
142 Isolate* isolate = Isolate::Current(); | 142 Isolate* isolate = Isolate::Current(); |
143 TimelineStream* compiler_stream = isolate->GetCompilerStream(); | 143 TimelineStream* compiler_stream = isolate->GetCompilerStream(); |
144 ASSERT(compiler_stream != NULL); | 144 ASSERT(compiler_stream != NULL); |
145 if (compiler_stream->Enabled()) { | 145 if (compiler_stream->Enabled()) { |
| 146 // Allocate all Dart objects needed before calling StartEvent, |
| 147 // which blocks safe points until Complete is called. |
146 const Code& code = Code::Handle(zone(), code_); | 148 const Code& code = Code::Handle(zone(), code_); |
147 const Function& function = Function::Handle(zone(), code.function()); | 149 const Function& function = Function::Handle(zone(), code.function()); |
148 const char* function_name = function.QualifiedUserVisibleNameCString(); | 150 const String& function_name = |
| 151 String::Handle(zone(), function.QualifiedScrubbedName()); |
149 const char* reason = DeoptReasonToCString(deopt_reason()); | 152 const char* reason = DeoptReasonToCString(deopt_reason()); |
150 int counter = function.deoptimization_counter(); | 153 const int counter = function.deoptimization_counter(); |
151 TimelineEvent* timeline_event = compiler_stream->StartEvent(); | 154 TimelineEvent* timeline_event = compiler_stream->StartEvent(); |
152 if (timeline_event != NULL) { | 155 if (timeline_event != NULL) { |
153 timeline_event->Duration("Deoptimize", | 156 timeline_event->Duration("Deoptimize", |
154 deopt_start_micros_, | 157 deopt_start_micros_, |
155 OS::GetCurrentMonotonicMicros()); | 158 OS::GetCurrentMonotonicMicros()); |
156 timeline_event->SetNumArguments(3); | 159 timeline_event->SetNumArguments(3); |
157 timeline_event->CopyArgument(0, "function", function_name); | 160 timeline_event->CopyArgument(0, "function", function_name.ToCString()); |
158 timeline_event->CopyArgument(1, "reason", reason); | 161 timeline_event->CopyArgument(1, "reason", reason); |
159 timeline_event->FormatArgument(2, "deoptimizationCount", "%d", counter); | 162 timeline_event->FormatArgument(2, "deoptimizationCount", "%d", counter); |
160 timeline_event->Complete(); | 163 timeline_event->Complete(); |
161 } | 164 } |
162 } | 165 } |
163 } | 166 } |
164 } | 167 } |
165 | 168 |
166 | 169 |
167 void DeoptContext::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 170 void DeoptContext::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1307 Smi* offset, | 1310 Smi* offset, |
1308 TypedData* info, | 1311 TypedData* info, |
1309 Smi* reason) { | 1312 Smi* reason) { |
1310 intptr_t i = index * kEntrySize; | 1313 intptr_t i = index * kEntrySize; |
1311 *offset ^= table.At(i); | 1314 *offset ^= table.At(i); |
1312 *info ^= table.At(i + 1); | 1315 *info ^= table.At(i + 1); |
1313 *reason ^= table.At(i + 2); | 1316 *reason ^= table.At(i + 2); |
1314 } | 1317 } |
1315 | 1318 |
1316 } // namespace dart | 1319 } // namespace dart |
OLD | NEW |