OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 var root = BuildNode(); | 574 var root = BuildNode(); |
575 Assert(index == code_info_array.length); | 575 Assert(index == code_info_array.length); |
576 return root; | 576 return root; |
577 } | 577 } |
578 | 578 |
579 // Applies a list of the textual diff chunks onto the tree of functions. | 579 // Applies a list of the textual diff chunks onto the tree of functions. |
580 // Determines status of each function (from unchanged to damaged). However | 580 // Determines status of each function (from unchanged to damaged). However |
581 // children of unchanged functions are ignored. | 581 // children of unchanged functions are ignored. |
582 function MarkChangedFunctions(code_info_tree, chunks) { | 582 function MarkChangedFunctions(code_info_tree, chunks) { |
583 | 583 |
584 // A convenient interator over diff chunks that also translates | 584 // A convenient iterator over diff chunks that also translates |
585 // positions from old to new in a current non-changed part of script. | 585 // positions from old to new in a current non-changed part of script. |
586 var chunk_it = new function() { | 586 var chunk_it = new function() { |
587 var chunk_index = 0; | 587 var chunk_index = 0; |
588 var pos_diff = 0; | 588 var pos_diff = 0; |
589 this.current = function() { return chunks[chunk_index]; }; | 589 this.current = function() { return chunks[chunk_index]; }; |
590 this.next = function() { | 590 this.next = function() { |
591 var chunk = chunks[chunk_index]; | 591 var chunk = chunks[chunk_index]; |
592 pos_diff = chunk.pos2 + chunk.len2 - (chunk.pos1 + chunk.len1); | 592 pos_diff = chunk.pos2 + chunk.len2 - (chunk.pos1 + chunk.len1); |
593 chunk_index++; | 593 chunk_index++; |
594 }; | 594 }; |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 } | 1074 } |
1075 | 1075 |
1076 | 1076 |
1077 // Functions are public for tests. | 1077 // Functions are public for tests. |
1078 this.TestApi = { | 1078 this.TestApi = { |
1079 PosTranslator: PosTranslator, | 1079 PosTranslator: PosTranslator, |
1080 CompareStrings: CompareStrings, | 1080 CompareStrings: CompareStrings, |
1081 ApplySingleChunkPatch: ApplySingleChunkPatch | 1081 ApplySingleChunkPatch: ApplySingleChunkPatch |
1082 }; | 1082 }; |
1083 }; | 1083 }; |
OLD | NEW |