| 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 met: | 3 // modification, are permitted provided that the following conditions are met: |
| 4 // | 4 // |
| 5 // * Redistributions of source code must retain the above copyright notice, | 5 // * Redistributions of source code must retain the above copyright notice, |
| 6 // this list of conditions and the following disclaimer. | 6 // this list of conditions and the following disclaimer. |
| 7 // * Redistributions in binary form must reproduce the above copyright notice, | 7 // * Redistributions in binary form must reproduce the above copyright notice, |
| 8 // this list of conditions and the following disclaimer in the documentation | 8 // this list of conditions and the following disclaimer in the documentation |
| 9 // and/or other materials provided with the distribution. | 9 // and/or other materials provided with the distribution. |
| 10 // * Neither the name of ARM Limited nor the names of its contributors may be | 10 // * Neither the name of ARM Limited nor the names of its contributors may be |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 TEST(FUZZ_disasm) { | 53 TEST(FUZZ_disasm) { |
| 54 // Feed noise into the disassembler to check that it doesn't crash. | 54 // Feed noise into the disassembler to check that it doesn't crash. |
| 55 // 9 million = ~0.2% of the instruction space. | 55 // 9 million = ~0.2% of the instruction space. |
| 56 static const int instruction_count = 9 * 1024 * 1024; | 56 static const int instruction_count = 9 * 1024 * 1024; |
| 57 | 57 |
| 58 uint16_t seed[3] = {42, 43, 44}; | 58 uint16_t seed[3] = {42, 43, 44}; |
| 59 seed48(seed); | 59 seed48(seed); |
| 60 | 60 |
| 61 Decoder<DispatchingDecoderVisitor> decoder; | 61 Decoder<DispatchingDecoderVisitor> decoder; |
| 62 Disassembler disasm; | 62 DisassemblingDecoder disasm; |
| 63 Instruction buffer[kInstructionSize]; | 63 Instruction buffer[kInstructionSize]; |
| 64 | 64 |
| 65 decoder.AppendVisitor(&disasm); | 65 decoder.AppendVisitor(&disasm); |
| 66 for (int i = 0; i < instruction_count; i++) { | 66 for (int i = 0; i < instruction_count; i++) { |
| 67 uint32_t instr = static_cast<uint32_t>(mrand48()); | 67 uint32_t instr = static_cast<uint32_t>(mrand48()); |
| 68 buffer->SetInstructionBits(instr); | 68 buffer->SetInstructionBits(instr); |
| 69 decoder.Decode(buffer); | 69 decoder.Decode(buffer); |
| 70 } | 70 } |
| 71 } | 71 } |
| OLD | NEW |