OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project 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 #ifndef V8_DEBUG_LIVEEDIT_H_ | 5 #ifndef V8_DEBUG_LIVEEDIT_H_ |
6 #define V8_DEBUG_LIVEEDIT_H_ | 6 #define V8_DEBUG_LIVEEDIT_H_ |
7 | 7 |
8 | 8 |
9 // Live Edit feature implementation. | 9 // Live Edit feature implementation. |
10 // User should be able to change script on already running VM. This feature | 10 // User should be able to change script on already running VM. This feature |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 static void SetFunctionScript(Handle<JSValue> function_wrapper, | 89 static void SetFunctionScript(Handle<JSValue> function_wrapper, |
90 Handle<Object> script_handle); | 90 Handle<Object> script_handle); |
91 | 91 |
92 static void PatchFunctionPositions(Handle<JSArray> shared_info_array, | 92 static void PatchFunctionPositions(Handle<JSArray> shared_info_array, |
93 Handle<JSArray> position_change_array); | 93 Handle<JSArray> position_change_array); |
94 | 94 |
95 // For a script updates its source field. If old_script_name is provided | 95 // For a script updates its source field. If old_script_name is provided |
96 // (i.e. is a String), also creates a copy of the script with its original | 96 // (i.e. is a String), also creates a copy of the script with its original |
97 // source and sends notification to debugger. | 97 // source and sends notification to debugger. |
98 static Handle<Object> ChangeScriptSource(Handle<Script> original_script, | 98 static Handle<Object> ChangeScriptSource(Handle<Script> original_script, |
| 99 int max_function_literal_id, |
99 Handle<String> new_source, | 100 Handle<String> new_source, |
100 Handle<Object> old_script_name); | 101 Handle<Object> old_script_name); |
101 | 102 |
102 // In a code of a parent function replaces original function as embedded | 103 // In a code of a parent function replaces original function as embedded |
103 // object with a substitution one. | 104 // object with a substitution one. |
104 static void ReplaceRefToNestedFunction(Handle<JSValue> parent_function_shared, | 105 static void ReplaceRefToNestedFunction(Handle<JSValue> parent_function_shared, |
105 Handle<JSValue> orig_function_shared, | 106 Handle<JSValue> orig_function_shared, |
106 Handle<JSValue> subst_function_shared); | 107 Handle<JSValue> subst_function_shared); |
107 | 108 |
108 // Find open generator activations, and set corresponding "result" elements to | 109 // Find open generator activations, and set corresponding "result" elements to |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // from JavaScript. It contains Code object, which is kept wrapped | 272 // from JavaScript. It contains Code object, which is kept wrapped |
272 // into a BlindReference for sanitizing reasons. | 273 // into a BlindReference for sanitizing reasons. |
273 class FunctionInfoWrapper : public JSArrayBasedStruct<FunctionInfoWrapper> { | 274 class FunctionInfoWrapper : public JSArrayBasedStruct<FunctionInfoWrapper> { |
274 public: | 275 public: |
275 explicit FunctionInfoWrapper(Handle<JSArray> array) | 276 explicit FunctionInfoWrapper(Handle<JSArray> array) |
276 : JSArrayBasedStruct<FunctionInfoWrapper>(array) { | 277 : JSArrayBasedStruct<FunctionInfoWrapper>(array) { |
277 } | 278 } |
278 | 279 |
279 void SetInitialProperties(Handle<String> name, int start_position, | 280 void SetInitialProperties(Handle<String> name, int start_position, |
280 int end_position, int param_num, int literal_count, | 281 int end_position, int param_num, int literal_count, |
281 int parent_index); | 282 int parent_index, int function_literal_id); |
282 | 283 |
283 void SetFunctionScopeInfo(Handle<Object> scope_info_array) { | 284 void SetFunctionScopeInfo(Handle<Object> scope_info_array) { |
284 this->SetField(kFunctionScopeInfoOffset_, scope_info_array); | 285 this->SetField(kFunctionScopeInfoOffset_, scope_info_array); |
285 } | 286 } |
286 | 287 |
287 void SetSharedFunctionInfo(Handle<SharedFunctionInfo> info); | 288 void SetSharedFunctionInfo(Handle<SharedFunctionInfo> info); |
288 | 289 |
289 Handle<SharedFunctionInfo> GetSharedFunctionInfo(); | 290 Handle<SharedFunctionInfo> GetSharedFunctionInfo(); |
290 | 291 |
291 int GetLiteralCount() { | 292 int GetLiteralCount() { |
(...skipping 12 matching lines...) Expand all Loading... |
304 | 305 |
305 private: | 306 private: |
306 static const int kFunctionNameOffset_ = 0; | 307 static const int kFunctionNameOffset_ = 0; |
307 static const int kStartPositionOffset_ = 1; | 308 static const int kStartPositionOffset_ = 1; |
308 static const int kEndPositionOffset_ = 2; | 309 static const int kEndPositionOffset_ = 2; |
309 static const int kParamNumOffset_ = 3; | 310 static const int kParamNumOffset_ = 3; |
310 static const int kFunctionScopeInfoOffset_ = 4; | 311 static const int kFunctionScopeInfoOffset_ = 4; |
311 static const int kParentIndexOffset_ = 5; | 312 static const int kParentIndexOffset_ = 5; |
312 static const int kSharedFunctionInfoOffset_ = 6; | 313 static const int kSharedFunctionInfoOffset_ = 6; |
313 static const int kLiteralNumOffset_ = 7; | 314 static const int kLiteralNumOffset_ = 7; |
314 static const int kSize_ = 8; | 315 static const int kFunctionLiteralIdOffset_ = 8; |
| 316 static const int kSize_ = 9; |
315 | 317 |
316 friend class JSArrayBasedStruct<FunctionInfoWrapper>; | 318 friend class JSArrayBasedStruct<FunctionInfoWrapper>; |
317 }; | 319 }; |
318 | 320 |
319 | 321 |
320 // Wraps SharedFunctionInfo along with some of its fields for passing it | 322 // Wraps SharedFunctionInfo along with some of its fields for passing it |
321 // back to JavaScript. SharedFunctionInfo object itself is additionally | 323 // back to JavaScript. SharedFunctionInfo object itself is additionally |
322 // wrapped into BlindReference for sanitizing reasons. | 324 // wrapped into BlindReference for sanitizing reasons. |
323 class SharedInfoWrapper : public JSArrayBasedStruct<SharedInfoWrapper> { | 325 class SharedInfoWrapper : public JSArrayBasedStruct<SharedInfoWrapper> { |
324 public: | 326 public: |
(...skipping 24 matching lines...) Expand all Loading... |
349 static const int kSharedInfoOffset_ = 3; | 351 static const int kSharedInfoOffset_ = 3; |
350 static const int kSize_ = 4; | 352 static const int kSize_ = 4; |
351 | 353 |
352 friend class JSArrayBasedStruct<SharedInfoWrapper>; | 354 friend class JSArrayBasedStruct<SharedInfoWrapper>; |
353 }; | 355 }; |
354 | 356 |
355 } // namespace internal | 357 } // namespace internal |
356 } // namespace v8 | 358 } // namespace v8 |
357 | 359 |
358 #endif /* V8_DEBUG_LIVEEDIT_H_ */ | 360 #endif /* V8_DEBUG_LIVEEDIT_H_ */ |
OLD | NEW |