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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 Handle<JSArray> shared_info_array, bool do_drop); | 102 Handle<JSArray> shared_info_array, bool do_drop); |
103 | 103 |
104 // A copy of this is in liveedit-debugger.js. | 104 // A copy of this is in liveedit-debugger.js. |
105 enum FunctionPatchabilityStatus { | 105 enum FunctionPatchabilityStatus { |
106 FUNCTION_AVAILABLE_FOR_PATCH = 1, | 106 FUNCTION_AVAILABLE_FOR_PATCH = 1, |
107 FUNCTION_BLOCKED_ON_ACTIVE_STACK = 2, | 107 FUNCTION_BLOCKED_ON_ACTIVE_STACK = 2, |
108 FUNCTION_BLOCKED_ON_OTHER_STACK = 3, | 108 FUNCTION_BLOCKED_ON_OTHER_STACK = 3, |
109 FUNCTION_BLOCKED_UNDER_NATIVE_CODE = 4, | 109 FUNCTION_BLOCKED_UNDER_NATIVE_CODE = 4, |
110 FUNCTION_REPLACED_ON_ACTIVE_STACK = 5 | 110 FUNCTION_REPLACED_ON_ACTIVE_STACK = 5 |
111 }; | 111 }; |
| 112 |
| 113 // Compares 2 strings line-by-line and returns diff in form of array of |
| 114 // triplets (pos1, len1, len2) describing list of diff chunks. |
| 115 static Handle<JSArray> CompareStringsLinewise(Handle<String> s1, |
| 116 Handle<String> s2); |
| 117 }; |
| 118 |
| 119 |
| 120 // A general-purpose comparator between 2 arrays. |
| 121 class Compare { |
| 122 public: |
| 123 |
| 124 // Holds 2 arrays of some elements allowing to compare any pair of |
| 125 // element from the first array and element from the second array. |
| 126 class Input { |
| 127 public: |
| 128 virtual int getLength1() = 0; |
| 129 virtual int getLength2() = 0; |
| 130 virtual bool equals(int index1, int index2) = 0; |
| 131 |
| 132 protected: |
| 133 virtual ~Input() {} |
| 134 }; |
| 135 |
| 136 // Receives compare result as a series of chunks. |
| 137 class Output { |
| 138 public: |
| 139 // Puts another chunk in result list. Note that technically speaking |
| 140 // only 3 arguments actually needed with 4th being derivable. |
| 141 virtual void AddChunk(int pos1, int pos2, int len1, int len2) = 0; |
| 142 |
| 143 protected: |
| 144 virtual ~Output() {} |
| 145 }; |
| 146 |
| 147 // Finds the difference between 2 arrays of elements. |
| 148 static void CalculateDifference(Input* input, |
| 149 Output* result_writer); |
112 }; | 150 }; |
113 | 151 |
114 #endif // ENABLE_DEBUGGER_SUPPORT | 152 #endif // ENABLE_DEBUGGER_SUPPORT |
115 | 153 |
116 | 154 |
117 } } // namespace v8::internal | 155 } } // namespace v8::internal |
118 | 156 |
119 #endif /* V*_LIVEEDIT_H_ */ | 157 #endif /* V*_LIVEEDIT_H_ */ |
OLD | NEW |