| 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 4935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4946 | 4946 |
| 4947 | 4947 |
| 4948 void Function::ClearCode() const { | 4948 void Function::ClearCode() const { |
| 4949 StorePointer(&raw_ptr()->code_, StubCode::LazyCompile_entry()->code()); | 4949 StorePointer(&raw_ptr()->code_, StubCode::LazyCompile_entry()->code()); |
| 4950 StorePointer(&raw_ptr()->unoptimized_code_, Code::null()); | 4950 StorePointer(&raw_ptr()->unoptimized_code_, Code::null()); |
| 4951 } | 4951 } |
| 4952 | 4952 |
| 4953 | 4953 |
| 4954 void Function::SwitchToUnoptimizedCode() const { | 4954 void Function::SwitchToUnoptimizedCode() const { |
| 4955 ASSERT(HasOptimizedCode()); | 4955 ASSERT(HasOptimizedCode()); |
| 4956 | |
| 4957 const Code& current_code = Code::Handle(CurrentCode()); | 4956 const Code& current_code = Code::Handle(CurrentCode()); |
| 4958 | 4957 |
| 4959 // Optimized code object might have been actually fully produced by the | |
| 4960 // intrinsifier in this case nothing has to be done. In fact an attempt to | |
| 4961 // patch such code will cause crash. | |
| 4962 // TODO(vegorov): if intrisifier can fully intrinsify the function then we | |
| 4963 // should not later try to optimize it. | |
| 4964 if (PcDescriptors::Handle(current_code.pc_descriptors()).Length() == 0) { | |
| 4965 return; | |
| 4966 } | |
| 4967 | |
| 4968 if (FLAG_trace_disabling_optimized_code) { | 4958 if (FLAG_trace_disabling_optimized_code) { |
| 4969 OS::Print("Disabling optimized code: '%s' entry: %#" Px "\n", | 4959 OS::Print("Disabling optimized code: '%s' entry: %#" Px "\n", |
| 4970 ToFullyQualifiedCString(), | 4960 ToFullyQualifiedCString(), |
| 4971 current_code.EntryPoint()); | 4961 current_code.EntryPoint()); |
| 4972 } | 4962 } |
| 4973 // Patch entry of the optimized code. | 4963 // Patch entry of the optimized code. |
| 4974 CodePatcher::PatchEntry(current_code); | 4964 CodePatcher::PatchEntry(current_code); |
| 4975 // Use previously compiled unoptimized code. | 4965 // Use previously compiled unoptimized code. |
| 4976 AttachCode(Code::Handle(unoptimized_code())); | 4966 AttachCode(Code::Handle(unoptimized_code())); |
| 4977 CodePatcher::RestoreEntry(Code::Handle(unoptimized_code())); | 4967 CodePatcher::RestoreEntry(Code::Handle(unoptimized_code())); |
| (...skipping 13932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18910 return tag_label.ToCString(); | 18900 return tag_label.ToCString(); |
| 18911 } | 18901 } |
| 18912 | 18902 |
| 18913 | 18903 |
| 18914 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 18904 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 18915 Instance::PrintJSONImpl(stream, ref); | 18905 Instance::PrintJSONImpl(stream, ref); |
| 18916 } | 18906 } |
| 18917 | 18907 |
| 18918 | 18908 |
| 18919 } // namespace dart | 18909 } // namespace dart |
| OLD | NEW |