OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
9 #include "src/debug/debug-frames.h" | 9 #include "src/debug/debug-frames.h" |
10 #include "src/debug/liveedit.h" | 10 #include "src/debug/liveedit.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 original_script, new_source, old_script_name); | 93 original_script, new_source, old_script_name); |
94 | 94 |
95 if (old_script->IsScript()) { | 95 if (old_script->IsScript()) { |
96 Handle<Script> script_handle = Handle<Script>::cast(old_script); | 96 Handle<Script> script_handle = Handle<Script>::cast(old_script); |
97 return *Script::GetWrapper(script_handle); | 97 return *Script::GetWrapper(script_handle); |
98 } else { | 98 } else { |
99 return isolate->heap()->null_value(); | 99 return isolate->heap()->null_value(); |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
| 103 // Recreate the shared function infos array after changing the IDs of all |
| 104 // SharedFunctionInfos. |
| 105 RUNTIME_FUNCTION(Runtime_LiveEditFixupScript) { |
| 106 HandleScope scope(isolate); |
| 107 CHECK(isolate->debug()->live_edit_enabled()); |
| 108 DCHECK_EQ(args.length(), 2); |
| 109 CONVERT_ARG_CHECKED(JSValue, script_value, 0); |
| 110 CONVERT_INT32_ARG_CHECKED(max_function_literal_id, 1); |
| 111 |
| 112 CHECK(script_value->value()->IsScript()); |
| 113 Handle<Script> script(Script::cast(script_value->value())); |
| 114 |
| 115 LiveEdit::FixupScript(script, max_function_literal_id); |
| 116 return isolate->heap()->undefined_value(); |
| 117 } |
103 | 118 |
104 RUNTIME_FUNCTION(Runtime_LiveEditFunctionSourceUpdated) { | 119 RUNTIME_FUNCTION(Runtime_LiveEditFunctionSourceUpdated) { |
105 HandleScope scope(isolate); | 120 HandleScope scope(isolate); |
106 CHECK(isolate->debug()->live_edit_enabled()); | 121 CHECK(isolate->debug()->live_edit_enabled()); |
107 DCHECK(args.length() == 1); | 122 DCHECK_EQ(args.length(), 2); |
108 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_info, 0); | 123 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_info, 0); |
| 124 CONVERT_INT32_ARG_CHECKED(new_function_literal_id, 1); |
109 CHECK(SharedInfoWrapper::IsInstance(shared_info)); | 125 CHECK(SharedInfoWrapper::IsInstance(shared_info)); |
110 | 126 |
111 LiveEdit::FunctionSourceUpdated(shared_info); | 127 LiveEdit::FunctionSourceUpdated(shared_info, new_function_literal_id); |
112 return isolate->heap()->undefined_value(); | 128 return isolate->heap()->undefined_value(); |
113 } | 129 } |
114 | 130 |
115 | 131 |
116 // Replaces code of SharedFunctionInfo with a new one. | 132 // Replaces code of SharedFunctionInfo with a new one. |
117 RUNTIME_FUNCTION(Runtime_LiveEditReplaceFunctionCode) { | 133 RUNTIME_FUNCTION(Runtime_LiveEditReplaceFunctionCode) { |
118 HandleScope scope(isolate); | 134 HandleScope scope(isolate); |
119 CHECK(isolate->debug()->live_edit_enabled()); | 135 CHECK(isolate->debug()->live_edit_enabled()); |
120 DCHECK(args.length() == 2); | 136 DCHECK(args.length() == 2); |
121 CONVERT_ARG_HANDLE_CHECKED(JSArray, new_compile_info, 0); | 137 CONVERT_ARG_HANDLE_CHECKED(JSArray, new_compile_info, 0); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // We don't really care what the inlined frame index is, since we are | 296 // We don't really care what the inlined frame index is, since we are |
281 // throwing away the entire frame anyways. | 297 // throwing away the entire frame anyways. |
282 const char* error_message = LiveEdit::RestartFrame(it.javascript_frame()); | 298 const char* error_message = LiveEdit::RestartFrame(it.javascript_frame()); |
283 if (error_message) { | 299 if (error_message) { |
284 return *(isolate->factory()->InternalizeUtf8String(error_message)); | 300 return *(isolate->factory()->InternalizeUtf8String(error_message)); |
285 } | 301 } |
286 return heap->true_value(); | 302 return heap->true_value(); |
287 } | 303 } |
288 } // namespace internal | 304 } // namespace internal |
289 } // namespace v8 | 305 } // namespace v8 |
OLD | NEW |