| OLD | NEW |
| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 Isolate* isolate = CcTest::i_isolate(); \ | 64 Isolate* isolate = CcTest::i_isolate(); \ |
| 65 HandleScope scope(isolate); \ | 65 HandleScope scope(isolate); \ |
| 66 byte* buf = static_cast<byte*>(malloc(INSTR_SIZE)); \ | 66 byte* buf = static_cast<byte*>(malloc(INSTR_SIZE)); \ |
| 67 uint32_t encoding = 0; \ | 67 uint32_t encoding = 0; \ |
| 68 Assembler* assm = new Assembler(isolate, buf, INSTR_SIZE); \ | 68 Assembler* assm = new Assembler(isolate, buf, INSTR_SIZE); \ |
| 69 Decoder<DispatchingDecoderVisitor>* decoder = \ | 69 Decoder<DispatchingDecoderVisitor>* decoder = \ |
| 70 new Decoder<DispatchingDecoderVisitor>(); \ | 70 new Decoder<DispatchingDecoderVisitor>(); \ |
| 71 DisassemblingDecoder* disasm = new DisassemblingDecoder(); \ | 71 DisassemblingDecoder* disasm = new DisassemblingDecoder(); \ |
| 72 decoder->AppendVisitor(disasm) | 72 decoder->AppendVisitor(disasm) |
| 73 | 73 |
| 74 #define COMPARE(ASM, EXP) \ | 74 #define COMPARE(ASM, EXP) \ |
| 75 assm->Reset(); \ | 75 assm->Reset(); \ |
| 76 assm->ASM; \ | 76 assm->ASM; \ |
| 77 assm->GetCode(NULL); \ | 77 assm->GetCode(isolate, NULL); \ |
| 78 decoder->Decode(reinterpret_cast<Instruction*>(buf)); \ | 78 decoder->Decode(reinterpret_cast<Instruction*>(buf)); \ |
| 79 encoding = *reinterpret_cast<uint32_t*>(buf); \ | 79 encoding = *reinterpret_cast<uint32_t*>(buf); \ |
| 80 if (strcmp(disasm->GetOutput(), EXP) != 0) { \ | 80 if (strcmp(disasm->GetOutput(), EXP) != 0) { \ |
| 81 printf("%u : Encoding: %08" PRIx32 "\nExpected: %s\nFound: %s\n", \ | 81 printf("%u : Encoding: %08" PRIx32 "\nExpected: %s\nFound: %s\n", \ |
| 82 __LINE__, encoding, EXP, disasm->GetOutput()); \ | 82 __LINE__, encoding, EXP, disasm->GetOutput()); \ |
| 83 abort(); \ | 83 abort(); \ |
| 84 } | 84 } |
| 85 | 85 |
| 86 #define COMPARE_PREFIX(ASM, EXP) \ | 86 #define COMPARE_PREFIX(ASM, EXP) \ |
| 87 assm->Reset(); \ | 87 assm->Reset(); \ |
| 88 assm->ASM; \ | 88 assm->ASM; \ |
| 89 assm->GetCode(NULL); \ | 89 assm->GetCode(isolate, NULL); \ |
| 90 decoder->Decode(reinterpret_cast<Instruction*>(buf)); \ | 90 decoder->Decode(reinterpret_cast<Instruction*>(buf)); \ |
| 91 encoding = *reinterpret_cast<uint32_t*>(buf); \ | 91 encoding = *reinterpret_cast<uint32_t*>(buf); \ |
| 92 if (strncmp(disasm->GetOutput(), EXP, strlen(EXP)) != 0) { \ | 92 if (strncmp(disasm->GetOutput(), EXP, strlen(EXP)) != 0) { \ |
| 93 printf("%u : Encoding: %08" PRIx32 "\nExpected: %s\nFound: %s\n", \ | 93 printf("%u : Encoding: %08" PRIx32 "\nExpected: %s\nFound: %s\n", \ |
| 94 __LINE__, encoding, EXP, disasm->GetOutput()); \ | 94 __LINE__, encoding, EXP, disasm->GetOutput()); \ |
| 95 abort(); \ | 95 abort(); \ |
| 96 } | 96 } |
| 97 | 97 |
| 98 #define CLEANUP() \ | 98 #define CLEANUP() \ |
| 99 delete disasm; \ | 99 delete disasm; \ |
| 100 delete decoder; \ | 100 delete decoder; \ |
| 101 delete assm; \ | 101 delete assm; \ |
| 102 free(buf) | 102 free(buf) |
| 103 | 103 |
| 104 | 104 |
| 105 static bool vm_initialized = false; | 105 static bool vm_initialized = false; |
| (...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1784 COMPARE(Dsb(FullSystem, BarrierOther), "dsb sy (0b1100)"); | 1784 COMPARE(Dsb(FullSystem, BarrierOther), "dsb sy (0b1100)"); |
| 1785 COMPARE(Dsb(InnerShareable, BarrierOther), "dsb sy (0b1000)"); | 1785 COMPARE(Dsb(InnerShareable, BarrierOther), "dsb sy (0b1000)"); |
| 1786 COMPARE(Dsb(NonShareable, BarrierOther), "dsb sy (0b0100)"); | 1786 COMPARE(Dsb(NonShareable, BarrierOther), "dsb sy (0b0100)"); |
| 1787 COMPARE(Dsb(OuterShareable, BarrierOther), "dsb sy (0b0000)"); | 1787 COMPARE(Dsb(OuterShareable, BarrierOther), "dsb sy (0b0000)"); |
| 1788 | 1788 |
| 1789 // ISB | 1789 // ISB |
| 1790 COMPARE(Isb(), "isb"); | 1790 COMPARE(Isb(), "isb"); |
| 1791 | 1791 |
| 1792 CLEANUP(); | 1792 CLEANUP(); |
| 1793 } | 1793 } |
| OLD | NEW |