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

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

Issue 1016073002: [arm64] Assembler support for internal references. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « src/arm64/instructions-arm64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 11205 matching lines...) Expand 10 before | Expand all | Expand 10 after
11216 if (RelocInfo::IsVeneerPool(info->rmode())) { 11216 if (RelocInfo::IsVeneerPool(info->rmode())) {
11217 DCHECK(info->data() == veneer_pool_size); 11217 DCHECK(info->data() == veneer_pool_size);
11218 ++pool_count; 11218 ++pool_count;
11219 } 11219 }
11220 } 11220 }
11221 11221
11222 DCHECK(pool_count == 2); 11222 DCHECK(pool_count == 2);
11223 11223
11224 TEARDOWN(); 11224 TEARDOWN();
11225 } 11225 }
11226
11227
11228 TEST(jump_tables_forward) {
11229 // Test jump tables with forward jumps.
11230 const int kNumCases = 512;
11231
11232 INIT_V8();
11233 SETUP_SIZE(kNumCases * 5 * kInstructionSize + 8192);
11234 START();
11235
11236 int32_t values[kNumCases];
11237 isolate->random_number_generator()->NextBytes(values, sizeof(values));
11238 int32_t results[kNumCases];
11239 memset(results, 0, sizeof(results));
11240 uintptr_t results_ptr = reinterpret_cast<uintptr_t>(results);
11241
11242 Label loop;
11243 Label labels[kNumCases];
11244 Label done;
11245
11246 const Register& index = x0;
11247 STATIC_ASSERT(sizeof(results[0]) == 4);
11248 const Register& value = w1;
11249 const Register& target = x2;
11250
11251 __ Mov(index, 0);
11252 __ Mov(target, results_ptr);
11253 __ Bind(&loop);
11254
11255 {
11256 Assembler::BlockPoolsScope block_pools(&masm);
11257 Label base;
11258
11259 __ Adr(x10, &base);
11260 __ Ldr(x11, MemOperand(x10, index, LSL, kPointerSizeLog2));
11261 __ Br(x11);
11262 __ Bind(&base);
11263 for (int i = 0; i < kNumCases; ++i) {
11264 __ dcptr(&labels[i]);
11265 }
11266 }
11267
11268 for (int i = 0; i < kNumCases; ++i) {
11269 __ Bind(&labels[i]);
11270 __ Mov(value, values[i]);
11271 __ B(&done);
11272 }
11273
11274 __ Bind(&done);
11275 __ Str(value, MemOperand(target, 4, PostIndex));
11276 __ Add(index, index, 1);
11277 __ Cmp(index, kNumCases);
11278 __ B(ne, &loop);
11279
11280 END();
11281
11282 RUN();
11283
11284 for (int i = 0; i < kNumCases; ++i) {
11285 CHECK_EQ(values[i], results[i]);
11286 }
11287
11288 TEARDOWN();
11289 }
11290
11291
11292 TEST(jump_tables_backward) {
11293 // Test jump tables with backward jumps.
11294 const int kNumCases = 512;
11295
11296 INIT_V8();
11297 SETUP_SIZE(kNumCases * 5 * kInstructionSize + 8192);
11298 START();
11299
11300 int32_t values[kNumCases];
11301 isolate->random_number_generator()->NextBytes(values, sizeof(values));
11302 int32_t results[kNumCases];
11303 memset(results, 0, sizeof(results));
11304 uintptr_t results_ptr = reinterpret_cast<uintptr_t>(results);
11305
11306 Label loop;
11307 Label labels[kNumCases];
11308 Label done;
11309
11310 const Register& index = x0;
11311 STATIC_ASSERT(sizeof(results[0]) == 4);
11312 const Register& value = w1;
11313 const Register& target = x2;
11314
11315 __ Mov(index, 0);
11316 __ Mov(target, results_ptr);
11317 __ B(&loop);
11318
11319 for (int i = 0; i < kNumCases; ++i) {
11320 __ Bind(&labels[i]);
11321 __ Mov(value, values[i]);
11322 __ B(&done);
11323 }
11324
11325 __ Bind(&loop);
11326 {
11327 Assembler::BlockPoolsScope block_pools(&masm);
11328 Label base;
11329
11330 __ Adr(x10, &base);
11331 __ Ldr(x11, MemOperand(x10, index, LSL, kPointerSizeLog2));
11332 __ Br(x11);
11333 __ Bind(&base);
11334 for (int i = 0; i < kNumCases; ++i) {
11335 __ dcptr(&labels[i]);
11336 }
11337 }
11338
11339 __ Bind(&done);
11340 __ Str(value, MemOperand(target, 4, PostIndex));
11341 __ Add(index, index, 1);
11342 __ Cmp(index, kNumCases);
11343 __ B(ne, &loop);
11344
11345 END();
11346
11347 RUN();
11348
11349 for (int i = 0; i < kNumCases; ++i) {
11350 CHECK_EQ(values[i], results[i]);
11351 }
11352
11353 TEARDOWN();
11354 }
11355
11356
11357 TEST(internal_reference_linked) {
11358 // Test internal reference when they are linked in a label chain.
11359
11360 INIT_V8();
11361 SETUP();
11362 START();
11363
11364 Label done;
11365
11366 __ Mov(x0, 0);
11367 __ Cbnz(x0, &done);
11368
11369 {
11370 Assembler::BlockPoolsScope block_pools(&masm);
11371 Label base;
11372
11373 __ Adr(x10, &base);
11374 __ Ldr(x11, MemOperand(x10));
11375 __ Br(x11);
11376 __ Bind(&base);
11377 __ dcptr(&done);
11378 }
11379
11380 // Dead code, just to extend the label chain.
11381 __ B(&done);
11382 __ dcptr(&done);
11383 __ Tbz(x0, 1, &done);
11384
11385 __ Bind(&done);
11386 __ Mov(x0, 1);
11387
11388 END();
11389
11390 RUN();
11391
11392 CHECK_EQUAL_64(0x1, x0);
11393
11394 TEARDOWN();
11395 }
OLDNEW
« no previous file with comments | « src/arm64/instructions-arm64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698