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

Side by Side Diff: test/cctest/test-assembler-arm.cc

Issue 553843002: Replace our home-grown BitCast with bit_cast from Chrome/Google3. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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
« no previous file with comments | « src/x87/macro-assembler-x87.cc ('k') | test/cctest/test-code-stubs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 1175
1176 CodeDesc desc; 1176 CodeDesc desc;
1177 assm.GetCode(&desc); 1177 assm.GetCode(&desc);
1178 Handle<Code> code = isolate->factory()->NewCode( 1178 Handle<Code> code = isolate->factory()->NewCode(
1179 desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); 1179 desc, Code::ComputeFlags(Code::STUB), Handle<Code>());
1180 #ifdef DEBUG 1180 #ifdef DEBUG
1181 OFStream os(stdout); 1181 OFStream os(stdout);
1182 code->Print(os); 1182 code->Print(os);
1183 #endif 1183 #endif
1184 F3 f = FUNCTION_CAST<F3>(code->entry()); 1184 F3 f = FUNCTION_CAST<F3>(code->entry());
1185 t.left = BitCast<double>(kHoleNanInt64); 1185 t.left = bit_cast<double>(kHoleNanInt64);
1186 t.right = 1; 1186 t.right = 1;
1187 t.add_result = 0; 1187 t.add_result = 0;
1188 t.sub_result = 0; 1188 t.sub_result = 0;
1189 t.mul_result = 0; 1189 t.mul_result = 0;
1190 t.div_result = 0; 1190 t.div_result = 0;
1191 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0); 1191 Object* dummy = CALL_GENERATED_CODE(f, &t, 0, 0, 0, 0);
1192 USE(dummy); 1192 USE(dummy);
1193 const uint32_t kArmNanUpper32 = 0x7ff80000; 1193 const uint32_t kArmNanUpper32 = 0x7ff80000;
1194 const uint32_t kArmNanLower32 = 0x00000000; 1194 const uint32_t kArmNanLower32 = 0x00000000;
1195 #ifdef DEBUG 1195 #ifdef DEBUG
1196 const uint64_t kArmNanInt64 = 1196 const uint64_t kArmNanInt64 =
1197 (static_cast<uint64_t>(kArmNanUpper32) << 32) | kArmNanLower32; 1197 (static_cast<uint64_t>(kArmNanUpper32) << 32) | kArmNanLower32;
1198 DCHECK(kArmNanInt64 != kHoleNanInt64); 1198 DCHECK(kArmNanInt64 != kHoleNanInt64);
1199 #endif 1199 #endif
1200 // With VFP2 the sign of the canonicalized Nan is undefined. So 1200 // With VFP2 the sign of the canonicalized Nan is undefined. So
1201 // we remove the sign bit for the upper tests. 1201 // we remove the sign bit for the upper tests.
1202 CHECK_EQ(kArmNanUpper32, (BitCast<int64_t>(t.add_result) >> 32) & 0x7fffffff); 1202 CHECK_EQ(kArmNanUpper32,
1203 CHECK_EQ(kArmNanLower32, BitCast<int64_t>(t.add_result) & 0xffffffffu); 1203 (bit_cast<int64_t>(t.add_result) >> 32) & 0x7fffffff);
1204 CHECK_EQ(kArmNanUpper32, (BitCast<int64_t>(t.sub_result) >> 32) & 0x7fffffff); 1204 CHECK_EQ(kArmNanLower32, bit_cast<int64_t>(t.add_result) & 0xffffffffu);
1205 CHECK_EQ(kArmNanLower32, BitCast<int64_t>(t.sub_result) & 0xffffffffu); 1205 CHECK_EQ(kArmNanUpper32,
1206 CHECK_EQ(kArmNanUpper32, (BitCast<int64_t>(t.mul_result) >> 32) & 0x7fffffff); 1206 (bit_cast<int64_t>(t.sub_result) >> 32) & 0x7fffffff);
1207 CHECK_EQ(kArmNanLower32, BitCast<int64_t>(t.mul_result) & 0xffffffffu); 1207 CHECK_EQ(kArmNanLower32, bit_cast<int64_t>(t.sub_result) & 0xffffffffu);
1208 CHECK_EQ(kArmNanUpper32, (BitCast<int64_t>(t.div_result) >> 32) & 0x7fffffff); 1208 CHECK_EQ(kArmNanUpper32,
1209 CHECK_EQ(kArmNanLower32, BitCast<int64_t>(t.div_result) & 0xffffffffu); 1209 (bit_cast<int64_t>(t.mul_result) >> 32) & 0x7fffffff);
1210 CHECK_EQ(kArmNanLower32, bit_cast<int64_t>(t.mul_result) & 0xffffffffu);
1211 CHECK_EQ(kArmNanUpper32,
1212 (bit_cast<int64_t>(t.div_result) >> 32) & 0x7fffffff);
1213 CHECK_EQ(kArmNanLower32, bit_cast<int64_t>(t.div_result) & 0xffffffffu);
1210 } 1214 }
1211 1215
1212 1216
1213 TEST(15) { 1217 TEST(15) {
1214 // Test the Neon instructions. 1218 // Test the Neon instructions.
1215 CcTest::InitializeVM(); 1219 CcTest::InitializeVM();
1216 Isolate* isolate = CcTest::i_isolate(); 1220 Isolate* isolate = CcTest::i_isolate();
1217 HandleScope scope(isolate); 1221 HandleScope scope(isolate);
1218 1222
1219 typedef struct { 1223 typedef struct {
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 assm.GetCode(&desc); 1559 assm.GetCode(&desc);
1556 Handle<Code> code = isolate->factory()->NewCode( 1560 Handle<Code> code = isolate->factory()->NewCode(
1557 desc, Code::ComputeFlags(Code::STUB), code_object); 1561 desc, Code::ComputeFlags(Code::STUB), code_object);
1558 F1 f = FUNCTION_CAST<F1>(code->entry()); 1562 F1 f = FUNCTION_CAST<F1>(code->entry());
1559 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 21, 0, 0, 0, 0)); 1563 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 21, 0, 0, 0, 0));
1560 ::printf("f() = %d\n", res); 1564 ::printf("f() = %d\n", res);
1561 CHECK_EQ(42, res); 1565 CHECK_EQ(42, res);
1562 } 1566 }
1563 1567
1564 #undef __ 1568 #undef __
OLDNEW
« no previous file with comments | « src/x87/macro-assembler-x87.cc ('k') | test/cctest/test-code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698