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 } | |
118 | 103 |
119 RUNTIME_FUNCTION(Runtime_LiveEditFunctionSourceUpdated) { | 104 RUNTIME_FUNCTION(Runtime_LiveEditFunctionSourceUpdated) { |
120 HandleScope scope(isolate); | 105 HandleScope scope(isolate); |
121 CHECK(isolate->debug()->live_edit_enabled()); | 106 CHECK(isolate->debug()->live_edit_enabled()); |
122 DCHECK_EQ(args.length(), 2); | 107 DCHECK(args.length() == 1); |
123 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_info, 0); | 108 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_info, 0); |
124 CONVERT_INT32_ARG_CHECKED(new_function_literal_id, 1); | |
125 CHECK(SharedInfoWrapper::IsInstance(shared_info)); | 109 CHECK(SharedInfoWrapper::IsInstance(shared_info)); |
126 | 110 |
127 LiveEdit::FunctionSourceUpdated(shared_info, new_function_literal_id); | 111 LiveEdit::FunctionSourceUpdated(shared_info); |
128 return isolate->heap()->undefined_value(); | 112 return isolate->heap()->undefined_value(); |
129 } | 113 } |
130 | 114 |
131 | 115 |
132 // Replaces code of SharedFunctionInfo with a new one. | 116 // Replaces code of SharedFunctionInfo with a new one. |
133 RUNTIME_FUNCTION(Runtime_LiveEditReplaceFunctionCode) { | 117 RUNTIME_FUNCTION(Runtime_LiveEditReplaceFunctionCode) { |
134 HandleScope scope(isolate); | 118 HandleScope scope(isolate); |
135 CHECK(isolate->debug()->live_edit_enabled()); | 119 CHECK(isolate->debug()->live_edit_enabled()); |
136 DCHECK(args.length() == 2); | 120 DCHECK(args.length() == 2); |
137 CONVERT_ARG_HANDLE_CHECKED(JSArray, new_compile_info, 0); | 121 CONVERT_ARG_HANDLE_CHECKED(JSArray, new_compile_info, 0); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 // We don't really care what the inlined frame index is, since we are | 280 // We don't really care what the inlined frame index is, since we are |
297 // throwing away the entire frame anyways. | 281 // throwing away the entire frame anyways. |
298 const char* error_message = LiveEdit::RestartFrame(it.javascript_frame()); | 282 const char* error_message = LiveEdit::RestartFrame(it.javascript_frame()); |
299 if (error_message) { | 283 if (error_message) { |
300 return *(isolate->factory()->InternalizeUtf8String(error_message)); | 284 return *(isolate->factory()->InternalizeUtf8String(error_message)); |
301 } | 285 } |
302 return heap->true_value(); | 286 return heap->true_value(); |
303 } | 287 } |
304 } // namespace internal | 288 } // namespace internal |
305 } // namespace v8 | 289 } // namespace v8 |
OLD | NEW |