| 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/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/os.h" | 10 #include "vm/os.h" |
| (...skipping 3001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3012 | 3012 |
| 3013 ASSEMBLER_TEST_RUN(ConditionalMovesSign, test) { | 3013 ASSEMBLER_TEST_RUN(ConditionalMovesSign, test) { |
| 3014 typedef int (*ConditionalMovesSignCode)(int i); | 3014 typedef int (*ConditionalMovesSignCode)(int i); |
| 3015 int res = reinterpret_cast<ConditionalMovesSignCode>(test->entry())(785); | 3015 int res = reinterpret_cast<ConditionalMovesSignCode>(test->entry())(785); |
| 3016 EXPECT_EQ(1, res); | 3016 EXPECT_EQ(1, res); |
| 3017 res = reinterpret_cast<ConditionalMovesSignCode>(test->entry())(-12); | 3017 res = reinterpret_cast<ConditionalMovesSignCode>(test->entry())(-12); |
| 3018 EXPECT_EQ(-1, res); | 3018 EXPECT_EQ(-1, res); |
| 3019 } | 3019 } |
| 3020 | 3020 |
| 3021 | 3021 |
| 3022 // Return 1 if equal, 0 if not equal. |
| 3023 ASSEMBLER_TEST_GENERATE(ConditionalMovesEqual, assembler) { |
| 3024 __ xorl(EAX, EAX); |
| 3025 __ movl(ECX, Immediate(1)); |
| 3026 __ movl(EDX, Address(ESP, 1 * kWordSize)); |
| 3027 __ cmpl(EDX, Immediate(785)); |
| 3028 __ cmove(EAX, ECX); |
| 3029 __ ret(); |
| 3030 } |
| 3031 |
| 3032 |
| 3033 ASSEMBLER_TEST_RUN(ConditionalMovesEqual, test) { |
| 3034 typedef int (*ConditionalMovesSignCode)(int i); |
| 3035 int res = reinterpret_cast<ConditionalMovesSignCode>(test->entry())(785); |
| 3036 EXPECT_EQ(1, res); |
| 3037 res = reinterpret_cast<ConditionalMovesSignCode>(test->entry())(-12); |
| 3038 EXPECT_EQ(0, res); |
| 3039 } |
| 3040 |
| 3041 |
| 3022 ASSEMBLER_TEST_GENERATE(ConditionalMovesCompare, assembler) { | 3042 ASSEMBLER_TEST_GENERATE(ConditionalMovesCompare, assembler) { |
| 3023 __ movl(EDX, Immediate(1)); // Greater equal. | 3043 __ movl(EDX, Immediate(1)); // Greater equal. |
| 3024 __ movl(ECX, Immediate(-1)); // Less | 3044 __ movl(ECX, Immediate(-1)); // Less |
| 3025 __ movl(EAX, Address(ESP, 1 * kWordSize)); | 3045 __ movl(EAX, Address(ESP, 1 * kWordSize)); |
| 3026 __ cmpl(EAX, Address(ESP, 2 * kWordSize)); | 3046 __ cmpl(EAX, Address(ESP, 2 * kWordSize)); |
| 3027 __ cmovlessl(EAX, ECX); | 3047 __ cmovlessl(EAX, ECX); |
| 3028 __ cmovgel(EAX, EDX); | 3048 __ cmovgel(EAX, EDX); |
| 3029 __ ret(); | 3049 __ ret(); |
| 3030 } | 3050 } |
| 3031 | 3051 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3220 FieldAddress(ECX, GrowableObjectArray::data_offset()), | 3240 FieldAddress(ECX, GrowableObjectArray::data_offset()), |
| 3221 EAX); | 3241 EAX); |
| 3222 __ popl(EAX); | 3242 __ popl(EAX); |
| 3223 __ popl(CTX); | 3243 __ popl(CTX); |
| 3224 __ ret(); | 3244 __ ret(); |
| 3225 } | 3245 } |
| 3226 | 3246 |
| 3227 } // namespace dart | 3247 } // namespace dart |
| 3228 | 3248 |
| 3229 #endif // defined TARGET_ARCH_IA32 | 3249 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |