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/code_generator.h" | 5 #include "vm/code_generator.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
9 #include "vm/code_patcher.h" | 9 #include "vm/code_patcher.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 1931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1942 // is not a performance issue). | 1942 // is not a performance issue). |
1943 uword lazy_deopt_jump = optimized_code.GetLazyDeoptPc(); | 1943 uword lazy_deopt_jump = optimized_code.GetLazyDeoptPc(); |
1944 #if !defined(TARGET_ARCH_DBC) | 1944 #if !defined(TARGET_ARCH_DBC) |
1945 ASSERT(lazy_deopt_jump != 0); | 1945 ASSERT(lazy_deopt_jump != 0); |
1946 #endif | 1946 #endif |
1947 const Instructions& instrs = | 1947 const Instructions& instrs = |
1948 Instructions::Handle(zone, optimized_code.instructions()); | 1948 Instructions::Handle(zone, optimized_code.instructions()); |
1949 { | 1949 { |
1950 WritableInstructionsScope writable(instrs.PayloadStart(), instrs.size()); | 1950 WritableInstructionsScope writable(instrs.PayloadStart(), instrs.size()); |
1951 CodePatcher::InsertDeoptimizationCallAt(pc, lazy_deopt_jump); | 1951 CodePatcher::InsertDeoptimizationCallAt(pc, lazy_deopt_jump); |
1952 } | 1952 if (FLAG_trace_patching) { |
1953 if (FLAG_trace_patching) { | 1953 const String& name = String::Handle(function.name()); |
1954 const String& name = String::Handle(function.name()); | 1954 OS::PrintErr( |
1955 OS::PrintErr("InsertDeoptimizationCallAt: %" Px " to %" Px " for %s\n", pc, | 1955 "InsertDeoptimizationCallAt: 0x%" Px " to 0x%" Px " for %s\n", |
1956 lazy_deopt_jump, name.ToCString()); | 1956 pc, lazy_deopt_jump, name.ToCString()); |
| 1957 } |
| 1958 const ExceptionHandlers& handlers = |
| 1959 ExceptionHandlers::Handle(zone, optimized_code.exception_handlers()); |
| 1960 RawExceptionHandlers::HandlerInfo info; |
| 1961 for (intptr_t i = 0; i < handlers.num_entries(); ++i) { |
| 1962 handlers.GetHandlerInfo(i, &info); |
| 1963 const uword patch_pc = instrs.PayloadStart() + info.handler_pc_offset; |
| 1964 CodePatcher::InsertDeoptimizationCallAt(patch_pc, lazy_deopt_jump); |
| 1965 if (FLAG_trace_patching) { |
| 1966 OS::PrintErr(" at handler 0x%" Px "\n", patch_pc); |
| 1967 } |
| 1968 } |
1957 } | 1969 } |
1958 // Mark code as dead (do not GC its embedded objects). | 1970 // Mark code as dead (do not GC its embedded objects). |
1959 optimized_code.set_is_alive(false); | 1971 optimized_code.set_is_alive(false); |
1960 } | 1972 } |
1961 | 1973 |
1962 | 1974 |
1963 // Currently checks only that all optimized frames have kDeoptIndex | 1975 // Currently checks only that all optimized frames have kDeoptIndex |
1964 // and unoptimized code has the kDeoptAfter. | 1976 // and unoptimized code has the kDeoptAfter. |
1965 void DeoptimizeFunctionsOnStack() { | 1977 void DeoptimizeFunctionsOnStack() { |
1966 DartFrameIterator iterator; | 1978 DartFrameIterator iterator; |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2216 const intptr_t elm_size = old_data.ElementSizeInBytes(); | 2228 const intptr_t elm_size = old_data.ElementSizeInBytes(); |
2217 const TypedData& new_data = | 2229 const TypedData& new_data = |
2218 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); | 2230 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); |
2219 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); | 2231 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); |
2220 typed_data_cell.SetAt(0, new_data); | 2232 typed_data_cell.SetAt(0, new_data); |
2221 arguments.SetReturn(new_data); | 2233 arguments.SetReturn(new_data); |
2222 } | 2234 } |
2223 | 2235 |
2224 | 2236 |
2225 } // namespace dart | 2237 } // namespace dart |
OLD | NEW |