OLD | NEW |
---|---|
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 <setjmp.h> // NOLINT | 5 #include <setjmp.h> // NOLINT |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #if defined(TARGET_ARCH_DBC) | 9 #if defined(TARGET_ARCH_DBC) |
10 | 10 |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
747 | 747 |
748 #define DECLARE___D uint32_t rD; USE(rD) | 748 #define DECLARE___D uint32_t rD; USE(rD) |
749 #define DECODE___D rD = (op >> Bytecode::kDShift); | 749 #define DECODE___D rD = (op >> Bytecode::kDShift); |
750 | 750 |
751 #define DECLARE_A_D DECLARE___D | 751 #define DECLARE_A_D DECLARE___D |
752 #define DECODE_A_D DECODE___D | 752 #define DECODE_A_D DECODE___D |
753 | 753 |
754 #define DECLARE_A_X int32_t rD; USE(rD) | 754 #define DECLARE_A_X int32_t rD; USE(rD) |
755 #define DECODE_A_X rD = (static_cast<int32_t>(op) >> Bytecode::kDShift); | 755 #define DECODE_A_X rD = (static_cast<int32_t>(op) >> Bytecode::kDShift); |
756 | 756 |
757 // If the following instruction is a call, extract the icdata from the | |
758 // instruction and increment. | |
759 #define SMI_FASTPATH_ICDATA_INC \ | |
760 if ((FLAG_optimization_counter_threshold >= 0) && \ | |
761 Bytecode::IsCallOpcode(*pc)) { \ | |
Vyacheslav Egorov (Google)
2016/05/31 14:55:44
I think we should mandate that the next bytecode m
zra
2016/05/31 16:33:12
I'll make it mandatory in release builds, but opti
Vyacheslav Egorov (Google)
2016/05/31 16:53:07
I am concerned that we will be unit testing the im
| |
762 const uint16_t kidx = Bytecode::DecodeD(*pc); \ | |
763 const RawICData* icdata = RAW_CAST(ICData, LOAD_CONSTANT(kidx)); \ | |
764 RawObject** data = icdata->ptr()->ic_data_->ptr()->data(); \ | |
765 const intptr_t count_offset = ICData::CountIndexFor(2); \ | |
766 const intptr_t raw_smi_old = \ | |
767 reinterpret_cast<intptr_t>(data[count_offset]); \ | |
768 const intptr_t raw_smi_new = raw_smi_old + Smi::RawValue(1); \ | |
769 *reinterpret_cast<intptr_t*>(&data[count_offset]) = raw_smi_new; \ | |
770 } \ | |
771 | |
757 // Declare bytecode handler for a smi operation (e.g. AddTOS) with the | 772 // Declare bytecode handler for a smi operation (e.g. AddTOS) with the |
758 // given result type and the given behavior specified as a function | 773 // given result type and the given behavior specified as a function |
759 // that takes left and right operands and result slot and returns | 774 // that takes left and right operands and result slot and returns |
760 // true if fast-path succeeds. | 775 // true if fast-path succeeds. |
761 #define SMI_FASTPATH_TOS(ResultT, Func) \ | 776 #define SMI_FASTPATH_TOS(ResultT, Func) \ |
762 { \ | 777 { \ |
763 const intptr_t lhs = reinterpret_cast<intptr_t>(SP[-1]); \ | 778 const intptr_t lhs = reinterpret_cast<intptr_t>(SP[-1]); \ |
764 const intptr_t rhs = reinterpret_cast<intptr_t>(SP[-0]); \ | 779 const intptr_t rhs = reinterpret_cast<intptr_t>(SP[-0]); \ |
765 ResultT* slot = reinterpret_cast<ResultT*>(SP - 1); \ | 780 ResultT* slot = reinterpret_cast<ResultT*>(SP - 1); \ |
766 if (LIKELY(AreBothSmis(lhs, rhs) && !Func(lhs, rhs, slot))) { \ | 781 if (LIKELY(AreBothSmis(lhs, rhs) && !Func(lhs, rhs, slot))) { \ |
782 SMI_FASTPATH_ICDATA_INC; \ | |
767 /* Fast path succeeded. Skip the generic call that follows. */ \ | 783 /* Fast path succeeded. Skip the generic call that follows. */ \ |
768 pc++; \ | 784 pc++; \ |
769 /* We dropped 2 arguments and push result */ \ | 785 /* We dropped 2 arguments and push result */ \ |
770 SP--; \ | 786 SP--; \ |
771 } \ | 787 } \ |
772 } | 788 } |
773 | 789 |
774 // Exception handling helper. Gets handler FP and PC from the Simulator where | 790 // Exception handling helper. Gets handler FP and PC from the Simulator where |
775 // they were stored by Simulator::Longjmp and proceeds to execute the handler. | 791 // they were stored by Simulator::Longjmp and proceeds to execute the handler. |
776 // Corner case: handler PC can be a fake marker that marks entry frame, which | 792 // Corner case: handler PC can be a fake marker that marks entry frame, which |
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2107 special_[kExceptionSpecialIndex] = raw_exception; | 2123 special_[kExceptionSpecialIndex] = raw_exception; |
2108 special_[kStacktraceSpecialIndex] = raw_stacktrace; | 2124 special_[kStacktraceSpecialIndex] = raw_stacktrace; |
2109 buf->Longjmp(); | 2125 buf->Longjmp(); |
2110 UNREACHABLE(); | 2126 UNREACHABLE(); |
2111 } | 2127 } |
2112 | 2128 |
2113 } // namespace dart | 2129 } // namespace dart |
2114 | 2130 |
2115 | 2131 |
2116 #endif // defined TARGET_ARCH_DBC | 2132 #endif // defined TARGET_ARCH_DBC |
OLD | NEW |