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

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

Issue 381803005: Reland r38116: Improve receiver class check in polymorphic inlining. (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_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 2932 matching lines...) Expand 10 before | Expand all | Expand 10 after
2943 typedef int (*ConditionalMovesCompareCode)(int i, int j); 2943 typedef int (*ConditionalMovesCompareCode)(int i, int j);
2944 int res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(10, 5); 2944 int res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(10, 5);
2945 EXPECT_EQ(1, res); // Greater equal. 2945 EXPECT_EQ(1, res); // Greater equal.
2946 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(5, 5); 2946 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(5, 5);
2947 EXPECT_EQ(1, res); // Greater equal. 2947 EXPECT_EQ(1, res); // Greater equal.
2948 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(2, 5); 2948 res = reinterpret_cast<ConditionalMovesCompareCode>(test->entry())(2, 5);
2949 EXPECT_EQ(-1, res); // Less. 2949 EXPECT_EQ(-1, res); // Less.
2950 } 2950 }
2951 2951
2952 2952
2953 ASSEMBLER_TEST_GENERATE(BitTest, assembler) {
2954 __ movq(RAX, Immediate(4));
2955 __ movq(R12, Immediate(2));
2956 __ btq(RAX, R12);
2957 Label ok;
2958 __ j(CARRY, &ok);
2959 __ int3();
2960 __ Bind(&ok);
2961 __ movq(RAX, Immediate(1));
2962 __ ret();
2963 }
2964
2965
2966 ASSEMBLER_TEST_RUN(BitTest, test) {
2967 typedef int (*BitTest)();
2968 EXPECT_EQ(1, reinterpret_cast<BitTest>(test->entry())());
2969 }
2970
2971
2953 // Return 1 if equal, 0 if not equal. 2972 // Return 1 if equal, 0 if not equal.
2954 ASSEMBLER_TEST_GENERATE(ConditionalMovesEqual, assembler) { 2973 ASSEMBLER_TEST_GENERATE(ConditionalMovesEqual, assembler) {
2955 __ movq(RDX, CallingConventions::kArg1Reg); 2974 __ movq(RDX, CallingConventions::kArg1Reg);
2956 __ xorq(RAX, RAX); 2975 __ xorq(RAX, RAX);
2957 __ movq(RCX, Immediate(1)); 2976 __ movq(RCX, Immediate(1));
2958 __ cmpq(RDX, Immediate(785)); 2977 __ cmpq(RDX, Immediate(785));
2959 __ cmoveq(RAX, RCX); 2978 __ cmoveq(RAX, RCX);
2960 __ ret(); 2979 __ ret();
2961 } 2980 }
2962 2981
2963 2982
2964 ASSEMBLER_TEST_RUN(ConditionalMovesEqual, test) { 2983 ASSEMBLER_TEST_RUN(ConditionalMovesEqual, test) {
2965 typedef int (*ConditionalMovesEqualCode)(int i); 2984 typedef int (*ConditionalMovesEqualCode)(int i);
2966 int res = reinterpret_cast<ConditionalMovesEqualCode>(test->entry())(785); 2985 int res = reinterpret_cast<ConditionalMovesEqualCode>(test->entry())(785);
2967 EXPECT_EQ(1, res); 2986 EXPECT_EQ(1, res);
2968 res = reinterpret_cast<ConditionalMovesEqualCode>(test->entry())(-12); 2987 res = reinterpret_cast<ConditionalMovesEqualCode>(test->entry())(-12);
2969 EXPECT_EQ(0, res); 2988 EXPECT_EQ(0, res);
2970 } 2989 }
2971 2990
2972 } // namespace dart 2991 } // namespace dart
2973 2992
2974 #endif // defined TARGET_ARCH_X64 2993 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698