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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 LiveEdit::GatherCompileInfo(script_handle, source)); | 74 LiveEdit::GatherCompileInfo(script_handle, source)); |
75 } | 75 } |
76 | 76 |
77 | 77 |
78 // Changes the source of the script to a new_source. | 78 // Changes the source of the script to a new_source. |
79 // If old_script_name is provided (i.e. is a String), also creates a copy of | 79 // If old_script_name is provided (i.e. is a String), also creates a copy of |
80 // the script with its original source and sends notification to debugger. | 80 // the script with its original source and sends notification to debugger. |
81 RUNTIME_FUNCTION(Runtime_LiveEditReplaceScript) { | 81 RUNTIME_FUNCTION(Runtime_LiveEditReplaceScript) { |
82 HandleScope scope(isolate); | 82 HandleScope scope(isolate); |
83 CHECK(isolate->debug()->live_edit_enabled()); | 83 CHECK(isolate->debug()->live_edit_enabled()); |
84 DCHECK(args.length() == 3); | 84 DCHECK(args.length() == 4); |
85 CONVERT_ARG_CHECKED(JSValue, original_script_value, 0); | 85 CONVERT_ARG_CHECKED(JSValue, original_script_value, 0); |
86 CONVERT_ARG_HANDLE_CHECKED(String, new_source, 1); | 86 CONVERT_NUMBER_CHECKED(int, max_function_literal_id, Int32, args[1]); |
87 CONVERT_ARG_HANDLE_CHECKED(Object, old_script_name, 2); | 87 CONVERT_ARG_HANDLE_CHECKED(String, new_source, 2); |
| 88 CONVERT_ARG_HANDLE_CHECKED(Object, old_script_name, 3); |
88 | 89 |
89 CHECK(original_script_value->value()->IsScript()); | 90 CHECK(original_script_value->value()->IsScript()); |
90 Handle<Script> original_script(Script::cast(original_script_value->value())); | 91 Handle<Script> original_script(Script::cast(original_script_value->value())); |
91 | 92 |
92 Handle<Object> old_script = LiveEdit::ChangeScriptSource( | 93 Handle<Object> old_script = LiveEdit::ChangeScriptSource( |
93 original_script, new_source, old_script_name); | 94 original_script, max_function_literal_id, new_source, old_script_name); |
94 | 95 |
95 if (old_script->IsScript()) { | 96 if (old_script->IsScript()) { |
96 Handle<Script> script_handle = Handle<Script>::cast(old_script); | 97 Handle<Script> script_handle = Handle<Script>::cast(old_script); |
97 return *Script::GetWrapper(script_handle); | 98 return *Script::GetWrapper(script_handle); |
98 } else { | 99 } else { |
99 return isolate->heap()->null_value(); | 100 return isolate->heap()->null_value(); |
100 } | 101 } |
101 } | 102 } |
102 | 103 |
103 | 104 |
(...skipping 176 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 | 281 // We don't really care what the inlined frame index is, since we are |
281 // throwing away the entire frame anyways. | 282 // throwing away the entire frame anyways. |
282 const char* error_message = LiveEdit::RestartFrame(it.javascript_frame()); | 283 const char* error_message = LiveEdit::RestartFrame(it.javascript_frame()); |
283 if (error_message) { | 284 if (error_message) { |
284 return *(isolate->factory()->InternalizeUtf8String(error_message)); | 285 return *(isolate->factory()->InternalizeUtf8String(error_message)); |
285 } | 286 } |
286 return heap->true_value(); | 287 return heap->true_value(); |
287 } | 288 } |
288 } // namespace internal | 289 } // namespace internal |
289 } // namespace v8 | 290 } // namespace v8 |
OLD | NEW |