OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1509 } | 1509 } |
1510 | 1510 |
1511 | 1511 |
1512 void TestSmiIndex(MacroAssembler* masm, Label* exit, int id, int x) { | 1512 void TestSmiIndex(MacroAssembler* masm, Label* exit, int id, int x) { |
1513 __ movl(rax, Immediate(id)); | 1513 __ movl(rax, Immediate(id)); |
1514 | 1514 |
1515 for (int i = 0; i < 8; i++) { | 1515 for (int i = 0; i < 8; i++) { |
1516 __ Move(rcx, Smi::FromInt(x)); | 1516 __ Move(rcx, Smi::FromInt(x)); |
1517 SmiIndex index = masm->SmiToIndex(rdx, rcx, i); | 1517 SmiIndex index = masm->SmiToIndex(rdx, rcx, i); |
1518 ASSERT(index.reg.is(rcx) || index.reg.is(rdx)); | 1518 ASSERT(index.reg.is(rcx) || index.reg.is(rdx)); |
1519 __ shl(index.reg, Immediate(index.scale)); | 1519 __ shlq(index.reg, Immediate(index.scale)); |
1520 __ Set(r8, static_cast<intptr_t>(x) << i); | 1520 __ Set(r8, static_cast<intptr_t>(x) << i); |
1521 __ cmpq(index.reg, r8); | 1521 __ cmpq(index.reg, r8); |
1522 __ j(not_equal, exit); | 1522 __ j(not_equal, exit); |
1523 __ incq(rax); | 1523 __ incq(rax); |
1524 __ Move(rcx, Smi::FromInt(x)); | 1524 __ Move(rcx, Smi::FromInt(x)); |
1525 index = masm->SmiToIndex(rcx, rcx, i); | 1525 index = masm->SmiToIndex(rcx, rcx, i); |
1526 ASSERT(index.reg.is(rcx)); | 1526 ASSERT(index.reg.is(rcx)); |
1527 __ shl(rcx, Immediate(index.scale)); | 1527 __ shlq(rcx, Immediate(index.scale)); |
1528 __ Set(r8, static_cast<intptr_t>(x) << i); | 1528 __ Set(r8, static_cast<intptr_t>(x) << i); |
1529 __ cmpq(rcx, r8); | 1529 __ cmpq(rcx, r8); |
1530 __ j(not_equal, exit); | 1530 __ j(not_equal, exit); |
1531 __ incq(rax); | 1531 __ incq(rax); |
1532 | 1532 |
1533 __ Move(rcx, Smi::FromInt(x)); | 1533 __ Move(rcx, Smi::FromInt(x)); |
1534 index = masm->SmiToNegativeIndex(rdx, rcx, i); | 1534 index = masm->SmiToNegativeIndex(rdx, rcx, i); |
1535 ASSERT(index.reg.is(rcx) || index.reg.is(rdx)); | 1535 ASSERT(index.reg.is(rcx) || index.reg.is(rdx)); |
1536 __ shl(index.reg, Immediate(index.scale)); | 1536 __ shlq(index.reg, Immediate(index.scale)); |
1537 __ Set(r8, static_cast<intptr_t>(-x) << i); | 1537 __ Set(r8, static_cast<intptr_t>(-x) << i); |
1538 __ cmpq(index.reg, r8); | 1538 __ cmpq(index.reg, r8); |
1539 __ j(not_equal, exit); | 1539 __ j(not_equal, exit); |
1540 __ incq(rax); | 1540 __ incq(rax); |
1541 __ Move(rcx, Smi::FromInt(x)); | 1541 __ Move(rcx, Smi::FromInt(x)); |
1542 index = masm->SmiToNegativeIndex(rcx, rcx, i); | 1542 index = masm->SmiToNegativeIndex(rcx, rcx, i); |
1543 ASSERT(index.reg.is(rcx)); | 1543 ASSERT(index.reg.is(rcx)); |
1544 __ shl(rcx, Immediate(index.scale)); | 1544 __ shlq(rcx, Immediate(index.scale)); |
1545 __ Set(r8, static_cast<intptr_t>(-x) << i); | 1545 __ Set(r8, static_cast<intptr_t>(-x) << i); |
1546 __ cmpq(rcx, r8); | 1546 __ cmpq(rcx, r8); |
1547 __ j(not_equal, exit); | 1547 __ j(not_equal, exit); |
1548 __ incq(rax); | 1548 __ incq(rax); |
1549 } | 1549 } |
1550 } | 1550 } |
1551 | 1551 |
1552 | 1552 |
1553 TEST(SmiIndex) { | 1553 TEST(SmiIndex) { |
1554 i::V8::Initialize(NULL); | 1554 i::V8::Initialize(NULL); |
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2804 | 2804 |
2805 CodeDesc desc; | 2805 CodeDesc desc; |
2806 masm->GetCode(&desc); | 2806 masm->GetCode(&desc); |
2807 // Call the function from C++. | 2807 // Call the function from C++. |
2808 int result = FUNCTION_CAST<F0>(buffer)(); | 2808 int result = FUNCTION_CAST<F0>(buffer)(); |
2809 CHECK_EQ(0, result); | 2809 CHECK_EQ(0, result); |
2810 } | 2810 } |
2811 | 2811 |
2812 | 2812 |
2813 #undef __ | 2813 #undef __ |
OLD | NEW |