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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 static bool SetAfterBreakTarget(Debug* debug); | 77 static bool SetAfterBreakTarget(Debug* debug); |
78 | 78 |
79 MUST_USE_RESULT static MaybeHandle<JSArray> GatherCompileInfo( | 79 MUST_USE_RESULT static MaybeHandle<JSArray> GatherCompileInfo( |
80 Handle<Script> script, | 80 Handle<Script> script, |
81 Handle<String> source); | 81 Handle<String> source); |
82 | 82 |
83 static void ReplaceFunctionCode(Handle<JSArray> new_compile_info_array, | 83 static void ReplaceFunctionCode(Handle<JSArray> new_compile_info_array, |
84 Handle<JSArray> shared_info_array); | 84 Handle<JSArray> shared_info_array); |
85 | 85 |
86 static void FunctionSourceUpdated(Handle<JSArray> shared_info_array); | 86 static void FixupScript(Handle<Script> script, int max_function_literal_id); |
| 87 |
| 88 static void FunctionSourceUpdated(Handle<JSArray> shared_info_array, |
| 89 int new_function_literal_id); |
87 | 90 |
88 // Updates script field in FunctionSharedInfo. | 91 // Updates script field in FunctionSharedInfo. |
89 static void SetFunctionScript(Handle<JSValue> function_wrapper, | 92 static void SetFunctionScript(Handle<JSValue> function_wrapper, |
90 Handle<Object> script_handle); | 93 Handle<Object> script_handle); |
91 | 94 |
92 static void PatchFunctionPositions(Handle<JSArray> shared_info_array, | 95 static void PatchFunctionPositions(Handle<JSArray> shared_info_array, |
93 Handle<JSArray> position_change_array); | 96 Handle<JSArray> position_change_array); |
94 | 97 |
95 // For a script updates its source field. If old_script_name is provided | 98 // 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 | 99 // (i.e. is a String), also creates a copy of the script with its original |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // from JavaScript. It contains Code object, which is kept wrapped | 274 // from JavaScript. It contains Code object, which is kept wrapped |
272 // into a BlindReference for sanitizing reasons. | 275 // into a BlindReference for sanitizing reasons. |
273 class FunctionInfoWrapper : public JSArrayBasedStruct<FunctionInfoWrapper> { | 276 class FunctionInfoWrapper : public JSArrayBasedStruct<FunctionInfoWrapper> { |
274 public: | 277 public: |
275 explicit FunctionInfoWrapper(Handle<JSArray> array) | 278 explicit FunctionInfoWrapper(Handle<JSArray> array) |
276 : JSArrayBasedStruct<FunctionInfoWrapper>(array) { | 279 : JSArrayBasedStruct<FunctionInfoWrapper>(array) { |
277 } | 280 } |
278 | 281 |
279 void SetInitialProperties(Handle<String> name, int start_position, | 282 void SetInitialProperties(Handle<String> name, int start_position, |
280 int end_position, int param_num, int literal_count, | 283 int end_position, int param_num, int literal_count, |
281 int parent_index); | 284 int parent_index, int function_literal_id); |
282 | 285 |
283 void SetFunctionScopeInfo(Handle<Object> scope_info_array) { | 286 void SetFunctionScopeInfo(Handle<Object> scope_info_array) { |
284 this->SetField(kFunctionScopeInfoOffset_, scope_info_array); | 287 this->SetField(kFunctionScopeInfoOffset_, scope_info_array); |
285 } | 288 } |
286 | 289 |
287 void SetSharedFunctionInfo(Handle<SharedFunctionInfo> info); | 290 void SetSharedFunctionInfo(Handle<SharedFunctionInfo> info); |
288 | 291 |
289 Handle<SharedFunctionInfo> GetSharedFunctionInfo(); | 292 Handle<SharedFunctionInfo> GetSharedFunctionInfo(); |
290 | 293 |
291 int GetLiteralCount() { | 294 int GetLiteralCount() { |
(...skipping 12 matching lines...) Expand all Loading... |
304 | 307 |
305 private: | 308 private: |
306 static const int kFunctionNameOffset_ = 0; | 309 static const int kFunctionNameOffset_ = 0; |
307 static const int kStartPositionOffset_ = 1; | 310 static const int kStartPositionOffset_ = 1; |
308 static const int kEndPositionOffset_ = 2; | 311 static const int kEndPositionOffset_ = 2; |
309 static const int kParamNumOffset_ = 3; | 312 static const int kParamNumOffset_ = 3; |
310 static const int kFunctionScopeInfoOffset_ = 4; | 313 static const int kFunctionScopeInfoOffset_ = 4; |
311 static const int kParentIndexOffset_ = 5; | 314 static const int kParentIndexOffset_ = 5; |
312 static const int kSharedFunctionInfoOffset_ = 6; | 315 static const int kSharedFunctionInfoOffset_ = 6; |
313 static const int kLiteralNumOffset_ = 7; | 316 static const int kLiteralNumOffset_ = 7; |
314 static const int kSize_ = 8; | 317 static const int kFunctionLiteralIdOffset_ = 8; |
| 318 static const int kSize_ = 9; |
315 | 319 |
316 friend class JSArrayBasedStruct<FunctionInfoWrapper>; | 320 friend class JSArrayBasedStruct<FunctionInfoWrapper>; |
317 }; | 321 }; |
318 | 322 |
319 | 323 |
320 // Wraps SharedFunctionInfo along with some of its fields for passing it | 324 // Wraps SharedFunctionInfo along with some of its fields for passing it |
321 // back to JavaScript. SharedFunctionInfo object itself is additionally | 325 // back to JavaScript. SharedFunctionInfo object itself is additionally |
322 // wrapped into BlindReference for sanitizing reasons. | 326 // wrapped into BlindReference for sanitizing reasons. |
323 class SharedInfoWrapper : public JSArrayBasedStruct<SharedInfoWrapper> { | 327 class SharedInfoWrapper : public JSArrayBasedStruct<SharedInfoWrapper> { |
324 public: | 328 public: |
(...skipping 24 matching lines...) Expand all Loading... |
349 static const int kSharedInfoOffset_ = 3; | 353 static const int kSharedInfoOffset_ = 3; |
350 static const int kSize_ = 4; | 354 static const int kSize_ = 4; |
351 | 355 |
352 friend class JSArrayBasedStruct<SharedInfoWrapper>; | 356 friend class JSArrayBasedStruct<SharedInfoWrapper>; |
353 }; | 357 }; |
354 | 358 |
355 } // namespace internal | 359 } // namespace internal |
356 } // namespace v8 | 360 } // namespace v8 |
357 | 361 |
358 #endif /* V8_DEBUG_LIVEEDIT_H_ */ | 362 #endif /* V8_DEBUG_LIVEEDIT_H_ */ |
OLD | NEW |