| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 140 } |
| 141 dest_frame_ = NULL; | 141 dest_frame_ = NULL; |
| 142 | 142 |
| 143 // Delete all deferred objects. | 143 // Delete all deferred objects. |
| 144 for (intptr_t i = 0; i < deferred_objects_count_; i++) { | 144 for (intptr_t i = 0; i < deferred_objects_count_; i++) { |
| 145 delete deferred_objects_[i]; | 145 delete deferred_objects_[i]; |
| 146 } | 146 } |
| 147 delete[] deferred_objects_; | 147 delete[] deferred_objects_; |
| 148 deferred_objects_ = NULL; | 148 deferred_objects_ = NULL; |
| 149 deferred_objects_count_ = 0; | 149 deferred_objects_count_ = 0; |
| 150 #ifndef PRODUCT |
| 150 if (FLAG_support_timeline && (deopt_start_micros_ != 0)) { | 151 if (FLAG_support_timeline && (deopt_start_micros_ != 0)) { |
| 151 TimelineStream* compiler_stream = Timeline::GetCompilerStream(); | 152 TimelineStream* compiler_stream = Timeline::GetCompilerStream(); |
| 152 ASSERT(compiler_stream != NULL); | 153 ASSERT(compiler_stream != NULL); |
| 153 if (compiler_stream->enabled()) { | 154 if (compiler_stream->enabled()) { |
| 154 // Allocate all Dart objects needed before calling StartEvent, | 155 // Allocate all Dart objects needed before calling StartEvent, |
| 155 // which blocks safe points until Complete is called. | 156 // which blocks safe points until Complete is called. |
| 156 const Code& code = Code::Handle(zone(), code_); | 157 const Code& code = Code::Handle(zone(), code_); |
| 157 const Function& function = Function::Handle(zone(), code.function()); | 158 const Function& function = Function::Handle(zone(), code.function()); |
| 158 const String& function_name = | 159 const String& function_name = |
| 159 String::Handle(zone(), function.QualifiedScrubbedName()); | 160 String::Handle(zone(), function.QualifiedScrubbedName()); |
| 160 const char* reason = DeoptReasonToCString(deopt_reason()); | 161 const char* reason = DeoptReasonToCString(deopt_reason()); |
| 161 const int counter = function.deoptimization_counter(); | 162 const int counter = function.deoptimization_counter(); |
| 162 TimelineEvent* timeline_event = compiler_stream->StartEvent(); | 163 TimelineEvent* timeline_event = compiler_stream->StartEvent(); |
| 163 if (timeline_event != NULL) { | 164 if (timeline_event != NULL) { |
| 164 timeline_event->Duration("Deoptimize", | 165 timeline_event->Duration("Deoptimize", |
| 165 deopt_start_micros_, | 166 deopt_start_micros_, |
| 166 OS::GetCurrentMonotonicMicros()); | 167 OS::GetCurrentMonotonicMicros()); |
| 167 timeline_event->SetNumArguments(3); | 168 timeline_event->SetNumArguments(3); |
| 168 timeline_event->CopyArgument(0, "function", function_name.ToCString()); | 169 timeline_event->CopyArgument(0, "function", function_name.ToCString()); |
| 169 timeline_event->CopyArgument(1, "reason", reason); | 170 timeline_event->CopyArgument(1, "reason", reason); |
| 170 timeline_event->FormatArgument(2, "deoptimizationCount", "%d", counter); | 171 timeline_event->FormatArgument(2, "deoptimizationCount", "%d", counter); |
| 171 timeline_event->Complete(); | 172 timeline_event->Complete(); |
| 172 } | 173 } |
| 173 } | 174 } |
| 174 } | 175 } |
| 176 #endif // !PRODUCT |
| 175 } | 177 } |
| 176 | 178 |
| 177 | 179 |
| 178 void DeoptContext::VisitObjectPointers(ObjectPointerVisitor* visitor) { | 180 void DeoptContext::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
| 179 visitor->VisitPointer(reinterpret_cast<RawObject**>(&object_pool_)); | 181 visitor->VisitPointer(reinterpret_cast<RawObject**>(&object_pool_)); |
| 180 visitor->VisitPointer(reinterpret_cast<RawObject**>(&deopt_info_)); | 182 visitor->VisitPointer(reinterpret_cast<RawObject**>(&deopt_info_)); |
| 181 | 183 |
| 182 // Visit any object pointers on the destination stack. | 184 // Visit any object pointers on the destination stack. |
| 183 if (dest_frame_is_allocated_) { | 185 if (dest_frame_is_allocated_) { |
| 184 for (intptr_t i = 0; i < dest_frame_size_; i++) { | 186 for (intptr_t i = 0; i < dest_frame_size_; i++) { |
| (...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 Smi* offset, | 1342 Smi* offset, |
| 1341 TypedData* info, | 1343 TypedData* info, |
| 1342 Smi* reason) { | 1344 Smi* reason) { |
| 1343 intptr_t i = index * kEntrySize; | 1345 intptr_t i = index * kEntrySize; |
| 1344 *offset ^= table.At(i); | 1346 *offset ^= table.At(i); |
| 1345 *info ^= table.At(i + 1); | 1347 *info ^= table.At(i + 1); |
| 1346 *reason ^= table.At(i + 2); | 1348 *reason ^= table.At(i + 2); |
| 1347 } | 1349 } |
| 1348 | 1350 |
| 1349 } // namespace dart | 1351 } // namespace dart |
| OLD | NEW |