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/code_generator.h" | 5 #include "vm/code_generator.h" |
6 | 6 |
7 #include "vm/assembler_macros.h" | 7 #include "vm/assembler_macros.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 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1565 } | 1565 } |
1566 Isolate::Current()->SetDeoptFrameCopy(frame_copy, frame_copy_size); | 1566 Isolate::Current()->SetDeoptFrameCopy(frame_copy, frame_copy_size); |
1567 } | 1567 } |
1568 | 1568 |
1569 | 1569 |
1570 // Copies saved registers and caller's frame into temporary buffers. | 1570 // Copies saved registers and caller's frame into temporary buffers. |
1571 // Returns the stack size of unoptimized frame. | 1571 // Returns the stack size of unoptimized frame. |
1572 DEFINE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame, | 1572 DEFINE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame, |
1573 uword saved_registers_address) { | 1573 uword saved_registers_address) { |
1574 Isolate* isolate = Isolate::Current(); | 1574 Isolate* isolate = Isolate::Current(); |
1575 Zone zone(isolate); | 1575 StackZone zone(isolate); |
1576 HANDLESCOPE(isolate); | 1576 HANDLESCOPE(isolate); |
1577 | 1577 |
1578 // All registers have been saved below last-fp. | 1578 // All registers have been saved below last-fp. |
1579 const uword last_fp = saved_registers_address + | 1579 const uword last_fp = saved_registers_address + |
1580 kNumberOfCpuRegisters * kWordSize + kNumberOfXmmRegisters * kDoubleSize; | 1580 kNumberOfCpuRegisters * kWordSize + kNumberOfXmmRegisters * kDoubleSize; |
1581 CopySavedRegisters(saved_registers_address); | 1581 CopySavedRegisters(saved_registers_address); |
1582 | 1582 |
1583 // Get optimized code and frame that need to be deoptimized. | 1583 // Get optimized code and frame that need to be deoptimized. |
1584 DartFrameIterator iterator(last_fp); | 1584 DartFrameIterator iterator(last_fp); |
1585 StackFrame* caller_frame = iterator.NextFrame(); | 1585 StackFrame* caller_frame = iterator.NextFrame(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1656 } | 1656 } |
1657 } | 1657 } |
1658 return deopt_context.GetCallerFp(); | 1658 return deopt_context.GetCallerFp(); |
1659 } | 1659 } |
1660 | 1660 |
1661 | 1661 |
1662 // The stack has been adjusted to fit all values for unoptimized frame. | 1662 // The stack has been adjusted to fit all values for unoptimized frame. |
1663 // Fill the unoptimized frame. | 1663 // Fill the unoptimized frame. |
1664 DEFINE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeFillFrame, uword last_fp) { | 1664 DEFINE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeFillFrame, uword last_fp) { |
1665 Isolate* isolate = Isolate::Current(); | 1665 Isolate* isolate = Isolate::Current(); |
1666 Zone zone(isolate); | 1666 StackZone zone(isolate); |
1667 HANDLESCOPE(isolate); | 1667 HANDLESCOPE(isolate); |
1668 | 1668 |
1669 DartFrameIterator iterator(last_fp); | 1669 DartFrameIterator iterator(last_fp); |
1670 StackFrame* caller_frame = iterator.NextFrame(); | 1670 StackFrame* caller_frame = iterator.NextFrame(); |
1671 ASSERT(caller_frame != NULL); | 1671 ASSERT(caller_frame != NULL); |
1672 const Code& optimized_code = Code::Handle(caller_frame->LookupDartCode()); | 1672 const Code& optimized_code = Code::Handle(caller_frame->LookupDartCode()); |
1673 const Function& function = Function::Handle(optimized_code.function()); | 1673 const Function& function = Function::Handle(optimized_code.function()); |
1674 ASSERT(!function.IsNull()); | 1674 ASSERT(!function.IsNull()); |
1675 const Code& unoptimized_code = Code::Handle(function.unoptimized_code()); | 1675 const Code& unoptimized_code = Code::Handle(function.unoptimized_code()); |
1676 ASSERT(!optimized_code.IsNull() && optimized_code.is_optimized()); | 1676 ASSERT(!optimized_code.IsNull() && optimized_code.is_optimized()); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1752 intptr_t line, column; | 1752 intptr_t line, column; |
1753 script.GetTokenLocation(token_pos, &line, &column); | 1753 script.GetTokenLocation(token_pos, &line, &column); |
1754 String& line_string = String::Handle(script.GetLine(line)); | 1754 String& line_string = String::Handle(script.GetLine(line)); |
1755 OS::Print(" Function: %s\n", top_function.ToFullyQualifiedCString()); | 1755 OS::Print(" Function: %s\n", top_function.ToFullyQualifiedCString()); |
1756 OS::Print(" Line %"Pd": '%s'\n", line, line_string.ToCString()); | 1756 OS::Print(" Line %"Pd": '%s'\n", line, line_string.ToCString()); |
1757 } | 1757 } |
1758 } | 1758 } |
1759 | 1759 |
1760 | 1760 |
1761 } // namespace dart | 1761 } // namespace dart |
OLD | NEW |