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

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

Issue 388863002: Better sequences for class id loading on ia32. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
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_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 3055 matching lines...) Expand 10 before | Expand all | Expand 10 after
3066 __ xorl(EAX, EAX); 3066 __ xorl(EAX, EAX);
3067 __ movl(ECX, Immediate(1)); 3067 __ movl(ECX, Immediate(1));
3068 __ movl(EDX, Address(ESP, 1 * kWordSize)); 3068 __ movl(EDX, Address(ESP, 1 * kWordSize));
3069 __ cmpl(EDX, Immediate(785)); 3069 __ cmpl(EDX, Immediate(785));
3070 __ cmove(EAX, ECX); 3070 __ cmove(EAX, ECX);
3071 __ ret(); 3071 __ ret();
3072 } 3072 }
3073 3073
3074 3074
3075 ASSEMBLER_TEST_RUN(ConditionalMovesEqual, test) { 3075 ASSEMBLER_TEST_RUN(ConditionalMovesEqual, test) {
3076 typedef int (*ConditionalMovesSignCode)(int i); 3076 typedef int (*ConditionalMovesEqualCode)(int i);
3077 int res = reinterpret_cast<ConditionalMovesSignCode>(test->entry())(785); 3077 int res = reinterpret_cast<ConditionalMovesEqualCode>(test->entry())(785);
3078 EXPECT_EQ(1, res); 3078 EXPECT_EQ(1, res);
3079 res = reinterpret_cast<ConditionalMovesSignCode>(test->entry())(-12); 3079 res = reinterpret_cast<ConditionalMovesEqualCode>(test->entry())(-12);
3080 EXPECT_EQ(0, res); 3080 EXPECT_EQ(0, res);
3081 } 3081 }
3082 3082
3083 3083
3084 // Return 1 if not equal, 0 if equal.
3085 ASSEMBLER_TEST_GENERATE(ConditionalMovesNotEqual, assembler) {
3086 __ xorl(EAX, EAX);
3087 __ movl(ECX, Immediate(1));
3088 __ movl(EDX, Address(ESP, 1 * kWordSize));
3089 __ cmpl(EDX, Immediate(785));
3090 __ cmovne(EAX, ECX);
3091 __ ret();
3092 }
3093
3094
3095 ASSEMBLER_TEST_RUN(ConditionalMovesNotEqual, test) {
3096 typedef int (*ConditionalMovesNotEqualCode)(int i);
3097 int res = reinterpret_cast<ConditionalMovesNotEqualCode>(test->entry())(785);
3098 EXPECT_EQ(0, res);
3099 res = reinterpret_cast<ConditionalMovesNotEqualCode>(test->entry())(-12);
3100 EXPECT_EQ(1, res);
3101 }
3102
3103
3084 ASSEMBLER_TEST_GENERATE(ConditionalMovesCompare, assembler) { 3104 ASSEMBLER_TEST_GENERATE(ConditionalMovesCompare, assembler) {
3085 __ movl(EDX, Immediate(1)); // Greater equal. 3105 __ movl(EDX, Immediate(1)); // Greater equal.
3086 __ movl(ECX, Immediate(-1)); // Less 3106 __ movl(ECX, Immediate(-1)); // Less
3087 __ movl(EAX, Address(ESP, 1 * kWordSize)); 3107 __ movl(EAX, Address(ESP, 1 * kWordSize));
3088 __ cmpl(EAX, Address(ESP, 2 * kWordSize)); 3108 __ cmpl(EAX, Address(ESP, 2 * kWordSize));
3089 __ cmovlessl(EAX, ECX); 3109 __ cmovlessl(EAX, ECX);
3090 __ cmovgel(EAX, EDX); 3110 __ cmovgel(EAX, EDX);
3091 __ ret(); 3111 __ ret();
3092 } 3112 }
3093 3113
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
3302 3322
3303 ASSEMBLER_TEST_RUN(BitTest, test) { 3323 ASSEMBLER_TEST_RUN(BitTest, test) {
3304 typedef int (*BitTest)(); 3324 typedef int (*BitTest)();
3305 EXPECT_EQ(1, reinterpret_cast<BitTest>(test->entry())()); 3325 EXPECT_EQ(1, reinterpret_cast<BitTest>(test->entry())());
3306 } 3326 }
3307 3327
3308 3328
3309 } // namespace dart 3329 } // namespace dart
3310 3330
3311 #endif // defined TARGET_ARCH_IA32 3331 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698