Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- NaClBitstreamReader.cpp --------------------------------------------===// | 1 //===- NaClBitstreamReader.cpp --------------------------------------------===// |
| 2 // NaClBitstreamReader implementation | 2 // NaClBitstreamReader implementation |
| 3 // | 3 // |
| 4 // The LLVM Compiler Infrastructure | 4 // The LLVM Compiler Infrastructure |
| 5 // | 5 // |
| 6 // This file is distributed under the University of Illinois Open Source | 6 // This file is distributed under the University of Illinois Open Source |
| 7 // License. See LICENSE.TXT for details. | 7 // License. See LICENSE.TXT for details. |
| 8 // | 8 // |
| 9 //===----------------------------------------------------------------------===// | 9 //===----------------------------------------------------------------------===// |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 // Add the abbrevs specific to this block to the CurAbbrevs list. | 64 // Add the abbrevs specific to this block to the CurAbbrevs list. |
| 65 if (const NaClBitstreamReader::BlockInfo *Info = | 65 if (const NaClBitstreamReader::BlockInfo *Info = |
| 66 BitStream->getBlockInfo(BlockID)) { | 66 BitStream->getBlockInfo(BlockID)) { |
| 67 for (size_t i = 0, e = Info->Abbrevs.size(); i != e; ++i) { | 67 for (size_t i = 0, e = Info->Abbrevs.size(); i != e; ++i) { |
| 68 CurAbbrevs.push_back(Info->Abbrevs[i]); | 68 CurAbbrevs.push_back(Info->Abbrevs[i]); |
| 69 CurAbbrevs.back()->addRef(); | 69 CurAbbrevs.back()->addRef(); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 // Get the codesize of this block. | 73 // Get the codesize of this block. |
| 74 CurCodeSize = ReadVBR(naclbitc::CodeLenWidth); | 74 CurCodeSize = ReadIntVBR(naclbitc::CodeLenWidth); |
|
Karl
2013/05/17 20:52:18
Changed this to:
CurCodeSize.IsFixed = ReadBool
| |
| 75 SkipToFourByteBoundary(); | 75 SkipToFourByteBoundary(); |
| 76 unsigned NumWords = Read(naclbitc::BlockSizeWidth); | 76 unsigned NumWords = Read(naclbitc::BlockSizeWidth); |
| 77 if (NumWordsP) *NumWordsP = NumWords; | 77 if (NumWordsP) *NumWordsP = NumWords; |
| 78 | 78 |
| 79 // Validate that this block is sane. | 79 // Validate that this block is sane. |
| 80 if (CurCodeSize == 0 || AtEndOfStream()) | 80 if (CurCodeSize == 0 || AtEndOfStream()) |
|
Karl
2013/05/17 20:52:18
CurCodeSize -> CurCodeSize.NumBits
| |
| 81 return true; | 81 return true; |
| 82 | 82 |
| 83 return false; | 83 return false; |
| 84 } | 84 } |
| 85 | 85 |
| 86 void NaClBitstreamCursor::readAbbreviatedLiteral( | 86 void NaClBitstreamCursor::readAbbreviatedLiteral( |
| 87 const NaClBitCodeAbbrevOp &Op, | 87 const NaClBitCodeAbbrevOp &Op, |
| 88 SmallVectorImpl<uint64_t> &Vals) { | 88 SmallVectorImpl<uint64_t> &Vals) { |
| 89 assert(Op.isLiteral() && "Not a literal"); | 89 assert(Op.isLiteral() && "Not a literal"); |
| 90 // If the abbrev specifies the literal value to use, use it. | 90 // If the abbrev specifies the literal value to use, use it. |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 std::string Name; | 364 std::string Name; |
| 365 for (unsigned i = 1, e = Record.size(); i != e; ++i) | 365 for (unsigned i = 1, e = Record.size(); i != e; ++i) |
| 366 Name += (char)Record[i]; | 366 Name += (char)Record[i]; |
| 367 CurBlockInfo->RecordNames.push_back(std::make_pair((unsigned)Record[0], | 367 CurBlockInfo->RecordNames.push_back(std::make_pair((unsigned)Record[0], |
| 368 Name)); | 368 Name)); |
| 369 break; | 369 break; |
| 370 } | 370 } |
| 371 } | 371 } |
| 372 } | 372 } |
| 373 } | 373 } |
| OLD | NEW |