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

Side by Side Diff: courgette/ensemble_create.cc

Issue 7920004: Start refactoring to reduce executable type knowledge. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
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 // The main idea in Courgette is to do patching *under a tranformation*. The 5 // The main idea in Courgette is to do patching *under a tranformation*. The
6 // input is transformed into a new representation, patching occurs in the new 6 // input is transformed into a new representation, patching occurs in the new
7 // repesentation, and then the tranform is reversed to get the patched data. 7 // repesentation, and then the tranform is reversed to get the patched data.
8 // 8 //
9 // The idea is applied to pieces (or 'elements') of the whole (or 'ensemble'). 9 // The idea is applied to pieces (or 'elements') of the whole (or 'ensemble').
10 // Each of the elements has to go through the same set of steps in lock-step. 10 // Each of the elements has to go through the same set of steps in lock-step.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 Status TransformationPatchGenerator::Reform( 58 Status TransformationPatchGenerator::Reform(
59 SourceStreamSet* transformed_element, 59 SourceStreamSet* transformed_element,
60 SinkStream* reformed_element) { 60 SinkStream* reformed_element) {
61 return patcher_->Reform(transformed_element, reformed_element); 61 return patcher_->Reform(transformed_element, reformed_element);
62 } 62 }
63 63
64 // Makes a TransformationPatchGenerator of the appropriate variety for the 64 // Makes a TransformationPatchGenerator of the appropriate variety for the
65 // Element kind. 65 // Element kind.
66 TransformationPatchGenerator* MakeGenerator(Element* old_element, 66 TransformationPatchGenerator* MakeGenerator(Element* old_element,
67 Element* new_element) { 67 Element* new_element) {
68 if (new_element->kind() == Element::WIN32_X86_WITH_CODE) { 68 switch (new_element->kind()) {
69 CourgetteWin32X86PatchGenerator* generator = 69 case UNKNOWN:
70 new CourgetteWin32X86PatchGenerator( 70 LOG(WARNING) << "Unexpected Element::Kind " << old_element->kind();
71 old_element, 71 return NULL;
72 new_element, 72 case WIN32_X86: {
73 new CourgetteWin32X86Patcher(old_element->region())); 73 TransformationPatchGenerator* generator =
74 return generator; 74 new CourgetteWin32X86PatchGenerator(
75 } else { 75 old_element,
76 LOG(WARNING) << "Unexpected Element::Kind " << old_element->kind(); 76 new_element,
77 return NULL; 77 new CourgetteWin32X86Patcher(old_element->region()));
78 return generator;
79 }
78 } 80 }
79 } 81 }
80 82
81 // Checks to see if the proposed comparison is 'unsafe'. Sometimes one element 83 // Checks to see if the proposed comparison is 'unsafe'. Sometimes one element
82 // from 'old' is matched as the closest element to multiple elements from 'new'. 84 // from 'old' is matched as the closest element to multiple elements from 'new'.
83 // Each time this happens, the old element is transformed and serialized. This 85 // Each time this happens, the old element is transformed and serialized. This
84 // is a problem when the old element is huge compared with the new element 86 // is a problem when the old element is huge compared with the new element
85 // because the mutliple serialized copies can be much bigger than the size of 87 // because the mutliple serialized copies can be much bigger than the size of
86 // either ensemble. 88 // either ensemble.
87 // 89 //
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 return C_STREAM_ERROR; 417 return C_STREAM_ERROR;
416 } 418 }
417 419
418 VLOG(1) << "done GenerateEnsemblePatch " 420 VLOG(1) << "done GenerateEnsemblePatch "
419 << (base::Time::Now() - start_time).InSecondsF() << "s"; 421 << (base::Time::Now() - start_time).InSecondsF() << "s";
420 422
421 return C_OK; 423 return C_OK;
422 } 424 }
423 425
424 } // namespace 426 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698