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

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

Issue 23515007: ARM: remove the regexp specific literal pool. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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/assembler.h ('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 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 1421 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 __ nop(); 1432 __ nop();
1433 } 1433 }
1434 1434
1435 Label target; 1435 Label target;
1436 __ b(eq, &target); 1436 __ b(eq, &target);
1437 __ bind(&target); 1437 __ bind(&target);
1438 __ nop(); 1438 __ nop();
1439 } 1439 }
1440 1440
1441 1441
1442 TEST(code_relative_offset) {
1443 // Test extracting the offset of a label from the beginning of the code
1444 // in a register.
1445 CcTest::InitializeVM();
1446 Isolate* isolate = Isolate::Current();
1447 HandleScope scope(isolate);
1448 // Initialize a code object that will contain the code.
1449 Handle<Object> code_object(isolate->heap()->undefined_value(), isolate);
1450
1451 Assembler assm(isolate, NULL, 0);
1452
1453 Label start, target_away, target_faraway;
1454
1455 __ stm(db_w, sp, r4.bit() | r5.bit() | lr.bit());
1456
1457 // r3 is used as the address zero, the test will crash when we load it.
1458 __ mov(r3, Operand::Zero());
1459
1460 // r5 will be a pointer to the start of the code.
1461 __ mov(r5, Operand(code_object));
1462 __ mov_label_offset(r4, &start);
1463
1464 __ mov_label_offset(r1, &target_faraway);
1465 __ str(r1, MemOperand(sp, kPointerSize, NegPreIndex));
1466
1467 __ mov_label_offset(r1, &target_away);
1468
1469 // Jump straight to 'target_away' the first time and use the relative
1470 // position the second time. This covers the case when extracting the
1471 // position of a label which is linked.
1472 __ mov(r2, Operand::Zero());
1473 __ bind(&start);
1474 __ cmp(r2, Operand::Zero());
1475 __ b(eq, &target_away);
1476 __ add(pc, r5, r1);
1477 // Emit invalid instructions to push the label between 2^8 and 2^16
1478 // instructions away. The test will crash if they are reached.
1479 for (int i = 0; i < (1 << 10); i++) {
1480 __ ldr(r3, MemOperand(r3));
1481 }
1482 __ bind(&target_away);
1483 // This will be hit twice: r0 = r0 + 5 + 5.
1484 __ add(r0, r0, Operand(5));
1485
1486 __ ldr(r1, MemOperand(sp, kPointerSize, PostIndex), ne);
1487 __ add(pc, r5, r4, LeaveCC, ne);
1488
1489 __ mov(r2, Operand(1));
1490 __ b(&start);
1491 // Emit invalid instructions to push the label between 2^16 and 2^24
1492 // instructions away. The test will crash if they are reached.
1493 for (int i = 0; i < (1 << 21); i++) {
1494 __ ldr(r3, MemOperand(r3));
1495 }
1496 __ bind(&target_faraway);
1497 // r0 = r0 + 5 + 5 + 11
1498 __ add(r0, r0, Operand(11));
1499
1500 __ ldm(ia_w, sp, r4.bit() | r5.bit() | pc.bit());
1501
1502 CodeDesc desc;
1503 assm.GetCode(&desc);
1504 Handle<Code> code = isolate->factory()->NewCode(desc,
1505 Code::ComputeFlags(Code::STUB), code_object);
1506 CHECK(code->IsCode());
1507 F1 f = FUNCTION_CAST<F1>(code->entry());
1508 int res = reinterpret_cast<int>(CALL_GENERATED_CODE(f, 21, 0, 0, 0, 0));
1509 ::printf("f() = %d\n", res);
1510 CHECK_EQ(42, res);
1511 }
1512
1442 #undef __ 1513 #undef __
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698