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

Side by Side Diff: courgette/assembly_program.cc

Issue 22728002: Collapsed Courgette instructions that copy file data to the patch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved len calculation Created 7 years, 4 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
« no previous file with comments | « no previous file | courgette/disassembler_elf_32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "courgette/assembly_program.h" 5 #include "courgette/assembly_program.h"
6 6
7 #include <memory.h> 7 #include <memory.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 case DEFBYTE: { 415 case DEFBYTE: {
416 uint8 b = static_cast<ByteInstruction*>(instruction)->byte_value(); 416 uint8 b = static_cast<ByteInstruction*>(instruction)->byte_value();
417 if (!encoded->AddCopy(1, &b)) 417 if (!encoded->AddCopy(1, &b))
418 return NULL; 418 return NULL;
419 break; 419 break;
420 } 420 }
421 case DEFBYTES: { 421 case DEFBYTES: {
422 const uint8* byte_values = 422 const uint8* byte_values =
423 static_cast<BytesInstruction*>(instruction)->byte_values(); 423 static_cast<BytesInstruction*>(instruction)->byte_values();
424 uint32 len = static_cast<BytesInstruction*>(instruction)->len(); 424 uint32 len = static_cast<BytesInstruction*>(instruction)->len();
425
425 if (!encoded->AddCopy(len, byte_values)) 426 if (!encoded->AddCopy(len, byte_values))
426 return NULL; 427 return NULL;
427 break; 428 break;
428 } 429 }
429 case REL32: { 430 case REL32: {
430 Label* label = static_cast<InstructionWithLabel*>(instruction)->label(); 431 Label* label = static_cast<InstructionWithLabel*>(instruction)->label();
431 if (!encoded->AddRel32(label->index_)) 432 if (!encoded->AddRel32(label->index_))
432 return NULL; 433 return NULL;
433 break; 434 break;
434 } 435 }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 EncodedProgram *encoded = program->Encode(); 574 EncodedProgram *encoded = program->Encode();
574 if (encoded) { 575 if (encoded) {
575 *output = encoded; 576 *output = encoded;
576 return C_OK; 577 return C_OK;
577 } else { 578 } else {
578 return C_GENERAL_ERROR; 579 return C_GENERAL_ERROR;
579 } 580 }
580 } 581 }
581 582
582 } // namespace courgette 583 } // namespace courgette
OLDNEW
« no previous file with comments | « no previous file | courgette/disassembler_elf_32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698