Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: runtime/vm/simulator_dbc.cc

Issue 2015113002: DBC: Collect type feedback for fastpath smi ops (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Add comment Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/object_dbc_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
758 #define SMI_FASTPATH_ICDATA_INC \
759 do { \
760 ASSERT(Bytecode::IsCallOpcode(*pc)); \
761 const uint16_t kidx = Bytecode::DecodeD(*pc); \
762 const RawICData* icdata = RAW_CAST(ICData, LOAD_CONSTANT(kidx)); \
763 RawObject** data = icdata->ptr()->ic_data_->ptr()->data(); \
764 const intptr_t count_offset = ICData::CountIndexFor(2); \
765 const intptr_t raw_smi_old = \
766 reinterpret_cast<intptr_t>(data[count_offset]); \
767 const intptr_t raw_smi_new = raw_smi_old + Smi::RawValue(1); \
768 *reinterpret_cast<intptr_t*>(&data[count_offset]) = raw_smi_new; \
769 } while (0); \
770
757 // Declare bytecode handler for a smi operation (e.g. AddTOS) with the 771 // Declare bytecode handler for a smi operation (e.g. AddTOS) with the
758 // given result type and the given behavior specified as a function 772 // given result type and the given behavior specified as a function
759 // that takes left and right operands and result slot and returns 773 // that takes left and right operands and result slot and returns
760 // true if fast-path succeeds. 774 // true if fast-path succeeds.
761 #define SMI_FASTPATH_TOS(ResultT, Func) \ 775 #define SMI_FASTPATH_TOS(ResultT, Func) \
762 { \ 776 { \
763 const intptr_t lhs = reinterpret_cast<intptr_t>(SP[-1]); \ 777 const intptr_t lhs = reinterpret_cast<intptr_t>(SP[-1]); \
764 const intptr_t rhs = reinterpret_cast<intptr_t>(SP[-0]); \ 778 const intptr_t rhs = reinterpret_cast<intptr_t>(SP[-0]); \
765 ResultT* slot = reinterpret_cast<ResultT*>(SP - 1); \ 779 ResultT* slot = reinterpret_cast<ResultT*>(SP - 1); \
766 if (LIKELY(AreBothSmis(lhs, rhs) && !Func(lhs, rhs, slot))) { \ 780 if (LIKELY(AreBothSmis(lhs, rhs) && !Func(lhs, rhs, slot))) { \
781 SMI_FASTPATH_ICDATA_INC; \
767 /* Fast path succeeded. Skip the generic call that follows. */ \ 782 /* Fast path succeeded. Skip the generic call that follows. */ \
768 pc++; \ 783 pc++; \
769 /* We dropped 2 arguments and push result */ \ 784 /* We dropped 2 arguments and push result */ \
770 SP--; \ 785 SP--; \
771 } \ 786 } \
772 } 787 }
773 788
774 // Exception handling helper. Gets handler FP and PC from the Simulator where 789 // 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. 790 // 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 791 // 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
2107 special_[kExceptionSpecialIndex] = raw_exception; 2122 special_[kExceptionSpecialIndex] = raw_exception;
2108 special_[kStacktraceSpecialIndex] = raw_stacktrace; 2123 special_[kStacktraceSpecialIndex] = raw_stacktrace;
2109 buf->Longjmp(); 2124 buf->Longjmp();
2110 UNREACHABLE(); 2125 UNREACHABLE();
2111 } 2126 }
2112 2127
2113 } // namespace dart 2128 } // namespace dart
2114 2129
2115 2130
2116 #endif // defined TARGET_ARCH_DBC 2131 #endif // defined TARGET_ARCH_DBC
OLDNEW
« no previous file with comments | « runtime/vm/object_dbc_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698