diff options
author | paulgazz@chromium.org <paulgazz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-06 00:11:54 +0000 |
---|---|---|
committer | paulgazz@chromium.org <paulgazz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-06 00:11:54 +0000 |
commit | 9dc8e30aa56830051d4c3a940aa3c5a59bc59f94 (patch) | |
tree | 0294f5f07f19d9976d04cc9f1a09bac580e9053b /courgette/patch_generator_x86_32.h | |
parent | 3ecbf2da233bfef0b92eadbbeac11ff1af6a1ce1 (diff) | |
download | chromium_src-9dc8e30aa56830051d4c3a940aa3c5a59bc59f94.zip chromium_src-9dc8e30aa56830051d4c3a940aa3c5a59bc59f94.tar.gz chromium_src-9dc8e30aa56830051d4c3a940aa3c5a59bc59f94.tar.bz2 |
ARM binaries seen by Courgette have three ISAs, ARM, thumb, and thumb-2. Courgette currently identified branch instructions from these ISAs heuristically, which leads to false positives. This patch improves on the heuristic by ignoring branches to addresses that aren't used very much in the binary.
Currently, the lower threshold for the number of times an address is used is 5, which was found empirically. ARM versions of chrome OS from daisy_3701.98.0 to daisy_4206.0.0 double the bytes saved by Courgette.
BUG=266019
Review URL: https://chromiumcodereview.appspot.com/21428006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215737 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'courgette/patch_generator_x86_32.h')
-rw-r--r-- | courgette/patch_generator_x86_32.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/courgette/patch_generator_x86_32.h b/courgette/patch_generator_x86_32.h index f68185e..084bdc3 100644 --- a/courgette/patch_generator_x86_32.h +++ b/courgette/patch_generator_x86_32.h @@ -81,6 +81,19 @@ class PatchGeneratorX86_32 : public TransformationPatchGenerator { return new_parse_status; } + // Trim labels below a certain threshold + Status trim_old_status = TrimLabels(old_program); + if (trim_old_status != C_OK) { + DeleteAssemblyProgram(old_program); + return trim_old_status; + } + + Status trim_new_status = TrimLabels(new_program); + if (trim_new_status != C_OK) { + DeleteAssemblyProgram(new_program); + return trim_new_status; + } + EncodedProgram* old_encoded = NULL; Status old_encode_status = Encode(old_program, &old_encoded); if (old_encode_status != C_OK) { |