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

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

Issue 2463083002: Remove default monomorphic check code from functions and stubs that do not need it. (Closed)
Patch Set: address comment Created 4 years, 1 month 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
OLDNEW
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/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/os.h" 9 #include "vm/os.h"
10 #include "vm/unit_test.h" 10 #include "vm/unit_test.h"
(...skipping 3095 matching lines...) Expand 10 before | Expand all | Expand 10 after
3106 } 3106 }
3107 3107
3108 3108
3109 ASSEMBLER_TEST_RUN(TestObjectCompare, test) { 3109 ASSEMBLER_TEST_RUN(TestObjectCompare, test) {
3110 bool res = test->InvokeWithCodeAndThread<bool>(); 3110 bool res = test->InvokeWithCodeAndThread<bool>();
3111 EXPECT_EQ(true, res); 3111 EXPECT_EQ(true, res);
3112 } 3112 }
3113 3113
3114 3114
3115 ASSEMBLER_TEST_GENERATE(TestNop, assembler) { 3115 ASSEMBLER_TEST_GENERATE(TestNop, assembler) {
3116 __ RawEntry();
3117
3118 __ nop(1); 3116 __ nop(1);
3119 __ nop(2); 3117 __ nop(2);
3120 __ nop(3); 3118 __ nop(3);
3121 __ nop(4); 3119 __ nop(4);
3122 __ nop(5); 3120 __ nop(5);
3123 __ nop(6); 3121 __ nop(6);
3124 __ nop(7); 3122 __ nop(7);
3125 __ nop(8); 3123 __ nop(8);
3126 __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size. 3124 __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size.
3127 __ ret(); 3125 __ ret();
3128 } 3126 }
3129 3127
3130 3128
3131 ASSEMBLER_TEST_RUN(TestNop, test) { 3129 ASSEMBLER_TEST_RUN(TestNop, test) {
3132 typedef int (*TestNop)(); 3130 typedef int (*TestNop)();
3133 int res = reinterpret_cast<TestNop>(test->payload_start())(); 3131 int res = reinterpret_cast<TestNop>(test->payload_start())();
3134 EXPECT_EQ(36, res); // 36 nop bytes emitted. 3132 EXPECT_EQ(36, res); // 36 nop bytes emitted.
3135 } 3133 }
3136 3134
3137 3135
3138 ASSEMBLER_TEST_GENERATE(TestAlign0, assembler) { 3136 ASSEMBLER_TEST_GENERATE(TestAlign0, assembler) {
3139 __ RawEntry();
3140
3141 __ Align(4, 0); 3137 __ Align(4, 0);
3142 __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size. 3138 __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size.
3143 __ ret(); 3139 __ ret();
3144 } 3140 }
3145 3141
3146 3142
3147 ASSEMBLER_TEST_RUN(TestAlign0, test) { 3143 ASSEMBLER_TEST_RUN(TestAlign0, test) {
3148 typedef int (*TestAlign0)(); 3144 typedef int (*TestAlign0)();
3149 int res = reinterpret_cast<TestAlign0>(test->payload_start())(); 3145 int res = reinterpret_cast<TestAlign0>(test->payload_start())();
3150 EXPECT_EQ(0, res); // 0 bytes emitted. 3146 EXPECT_EQ(0, res); // 0 bytes emitted.
3151 } 3147 }
3152 3148
3153 3149
3154 ASSEMBLER_TEST_GENERATE(TestAlign1, assembler) { 3150 ASSEMBLER_TEST_GENERATE(TestAlign1, assembler) {
3155 __ RawEntry();
3156
3157 __ nop(1); 3151 __ nop(1);
3158 __ Align(4, 0); 3152 __ Align(4, 0);
3159 __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size. 3153 __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size.
3160 __ ret(); 3154 __ ret();
3161 } 3155 }
3162 3156
3163 3157
3164 ASSEMBLER_TEST_RUN(TestAlign1, test) { 3158 ASSEMBLER_TEST_RUN(TestAlign1, test) {
3165 typedef int (*TestAlign1)(); 3159 typedef int (*TestAlign1)();
3166 int res = reinterpret_cast<TestAlign1>(test->payload_start())(); 3160 int res = reinterpret_cast<TestAlign1>(test->payload_start())();
3167 EXPECT_EQ(4, res); // 4 bytes emitted. 3161 EXPECT_EQ(4, res); // 4 bytes emitted.
3168 } 3162 }
3169 3163
3170 3164
3171 ASSEMBLER_TEST_GENERATE(TestAlign1Offset1, assembler) { 3165 ASSEMBLER_TEST_GENERATE(TestAlign1Offset1, assembler) {
3172 __ RawEntry();
3173
3174 __ nop(1); 3166 __ nop(1);
3175 __ Align(4, 1); 3167 __ Align(4, 1);
3176 __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size. 3168 __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size.
3177 __ ret(); 3169 __ ret();
3178 } 3170 }
3179 3171
3180 3172
3181 ASSEMBLER_TEST_RUN(TestAlign1Offset1, test) { 3173 ASSEMBLER_TEST_RUN(TestAlign1Offset1, test) {
3182 typedef int (*TestAlign1Offset1)(); 3174 typedef int (*TestAlign1Offset1)();
3183 int res = reinterpret_cast<TestAlign1Offset1>(test->payload_start())(); 3175 int res = reinterpret_cast<TestAlign1Offset1>(test->payload_start())();
3184 EXPECT_EQ(3, res); // 3 bytes emitted. 3176 EXPECT_EQ(3, res); // 3 bytes emitted.
3185 } 3177 }
3186 3178
3187 3179
3188 ASSEMBLER_TEST_GENERATE(TestAlignLarge, assembler) { 3180 ASSEMBLER_TEST_GENERATE(TestAlignLarge, assembler) {
3189 __ RawEntry();
3190
3191 __ nop(1); 3181 __ nop(1);
3192 __ Align(16, 0); 3182 __ Align(16, 0);
3193 __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size. 3183 __ movq(RAX, Immediate(assembler->CodeSize())); // Return code size.
3194 __ ret(); 3184 __ ret();
3195 } 3185 }
3196 3186
3197 3187
3198 ASSEMBLER_TEST_RUN(TestAlignLarge, test) { 3188 ASSEMBLER_TEST_RUN(TestAlignLarge, test) {
3199 typedef int (*TestAlignLarge)(); 3189 typedef int (*TestAlignLarge)();
3200 int res = reinterpret_cast<TestAlignLarge>(test->payload_start())(); 3190 int res = reinterpret_cast<TestAlignLarge>(test->payload_start())();
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
3595 int res = reinterpret_cast<ConditionalMovesNoOverflowCode>( 3585 int res = reinterpret_cast<ConditionalMovesNoOverflowCode>(
3596 test->entry())(0x7fffffffffffffff, 2); 3586 test->entry())(0x7fffffffffffffff, 2);
3597 EXPECT_EQ(1, res); 3587 EXPECT_EQ(1, res);
3598 res = reinterpret_cast<ConditionalMovesNoOverflowCode>(test->entry())(1, 1); 3588 res = reinterpret_cast<ConditionalMovesNoOverflowCode>(test->entry())(1, 1);
3599 EXPECT_EQ(0, res); 3589 EXPECT_EQ(0, res);
3600 } 3590 }
3601 3591
3602 } // namespace dart 3592 } // namespace dart
3603 3593
3604 #endif // defined TARGET_ARCH_X64 3594 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698