| 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 2430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2441 for (intptr_t i = 0; i < code_objects.Length(); i++) { | 2441 for (intptr_t i = 0; i < code_objects.Length(); i++) { |
| 2442 weak_property ^= code_objects.At(i); | 2442 weak_property ^= code_objects.At(i); |
| 2443 code ^= weak_property.key(); | 2443 code ^= weak_property.key(); |
| 2444 if (code.IsNull()) { | 2444 if (code.IsNull()) { |
| 2445 // Code was garbage collected already. | 2445 // Code was garbage collected already. |
| 2446 continue; | 2446 continue; |
| 2447 } | 2447 } |
| 2448 | 2448 |
| 2449 function ^= code.function(); | 2449 function ^= code.function(); |
| 2450 // If function uses dependent code switch it to unoptimized. | 2450 // If function uses dependent code switch it to unoptimized. |
| 2451 if (function.CurrentCode() == code.raw()) { | 2451 if (code.is_optimized() && (function.CurrentCode() == code.raw())) { |
| 2452 ReportSwitchingCode(code); | 2452 ReportSwitchingCode(code); |
| 2453 if (code.is_optimized()) { | 2453 function.SwitchToUnoptimizedCode(); |
| 2454 function.SwitchToUnoptimizedCode(); | 2454 } else if (function.unoptimized_code() == code.raw()) { |
| 2455 } else { | 2455 ReportSwitchingCode(code); |
| 2456 function.ClearCode(); | 2456 function.ClearCode(); |
| 2457 } | |
| 2458 } | 2457 } |
| 2459 } | 2458 } |
| 2460 } | 2459 } |
| 2461 | 2460 |
| 2462 private: | 2461 private: |
| 2463 const Array& array_; | 2462 const Array& array_; |
| 2464 DISALLOW_COPY_AND_ASSIGN(WeakCodeReferences); | 2463 DISALLOW_COPY_AND_ASSIGN(WeakCodeReferences); |
| 2465 }; | 2464 }; |
| 2466 | 2465 |
| 2467 | 2466 |
| (...skipping 6812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9280 virtual void ReportDeoptimization(const Code& code) { | 9279 virtual void ReportDeoptimization(const Code& code) { |
| 9281 // This gets called when the code object is on the stack | 9280 // This gets called when the code object is on the stack |
| 9282 // while nuking code that depends on a prefix. We don't expect | 9281 // while nuking code that depends on a prefix. We don't expect |
| 9283 // this to happen, so make sure we die loudly if we find | 9282 // this to happen, so make sure we die loudly if we find |
| 9284 // ourselves here. | 9283 // ourselves here. |
| 9285 UNIMPLEMENTED(); | 9284 UNIMPLEMENTED(); |
| 9286 } | 9285 } |
| 9287 | 9286 |
| 9288 virtual void ReportSwitchingCode(const Code& code) { | 9287 virtual void ReportSwitchingCode(const Code& code) { |
| 9289 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { | 9288 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { |
| 9290 OS::PrintErr("Prefix '%s': deleting code for function '%s'\n", | 9289 OS::PrintErr("Prefix '%s': deleting %s code for function '%s'\n", |
| 9291 String::Handle(prefix_.name()).ToCString(), | 9290 String::Handle(prefix_.name()).ToCString(), |
| 9291 code.is_optimized() ? "optimized" : "unoptimized", |
| 9292 Function::Handle(code.function()).ToCString()); | 9292 Function::Handle(code.function()).ToCString()); |
| 9293 } | 9293 } |
| 9294 } | 9294 } |
| 9295 | 9295 |
| 9296 private: | 9296 private: |
| 9297 const LibraryPrefix& prefix_; | 9297 const LibraryPrefix& prefix_; |
| 9298 DISALLOW_COPY_AND_ASSIGN(PrefixDependentArray); | 9298 DISALLOW_COPY_AND_ASSIGN(PrefixDependentArray); |
| 9299 }; | 9299 }; |
| 9300 | 9300 |
| 9301 | 9301 |
| (...skipping 8915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18217 return "_MirrorReference"; | 18217 return "_MirrorReference"; |
| 18218 } | 18218 } |
| 18219 | 18219 |
| 18220 | 18220 |
| 18221 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 18221 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 18222 Instance::PrintToJSONStream(stream, ref); | 18222 Instance::PrintToJSONStream(stream, ref); |
| 18223 } | 18223 } |
| 18224 | 18224 |
| 18225 | 18225 |
| 18226 } // namespace dart | 18226 } // namespace dart |
| OLD | NEW |