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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // to script source change. Text change is described in second parameter as | 179 // to script source change. Text change is described in second parameter as |
180 // array of groups of 3 numbers: | 180 // array of groups of 3 numbers: |
181 // (change_begin, change_end, change_end_new_position). | 181 // (change_begin, change_end, change_end_new_position). |
182 // Each group describes a change in text; groups are sorted by change_begin. | 182 // Each group describes a change in text; groups are sorted by change_begin. |
183 RUNTIME_FUNCTION(Runtime_LiveEditPatchFunctionPositions) { | 183 RUNTIME_FUNCTION(Runtime_LiveEditPatchFunctionPositions) { |
184 HandleScope scope(isolate); | 184 HandleScope scope(isolate); |
185 CHECK(isolate->debug()->live_edit_enabled()); | 185 CHECK(isolate->debug()->live_edit_enabled()); |
186 DCHECK(args.length() == 2); | 186 DCHECK(args.length() == 2); |
187 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_array, 0); | 187 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_array, 0); |
188 CONVERT_ARG_HANDLE_CHECKED(JSArray, position_change_array, 1); | 188 CONVERT_ARG_HANDLE_CHECKED(JSArray, position_change_array, 1); |
189 RUNTIME_ASSERT(SharedInfoWrapper::IsInstance(shared_array)) | 189 RUNTIME_ASSERT(SharedInfoWrapper::IsInstance(shared_array)); |
190 | 190 |
191 LiveEdit::PatchFunctionPositions(shared_array, position_change_array); | 191 LiveEdit::PatchFunctionPositions(shared_array, position_change_array); |
192 return isolate->heap()->undefined_value(); | 192 return isolate->heap()->undefined_value(); |
193 } | 193 } |
194 | 194 |
195 | 195 |
196 // For array of SharedFunctionInfo's (each wrapped in JSValue) | 196 // For array of SharedFunctionInfo's (each wrapped in JSValue) |
197 // checks that none of them have activations on stacks (of any thread). | 197 // checks that none of them have activations on stacks (of any thread). |
198 // Returns array of the same length with corresponding results of | 198 // Returns array of the same length with corresponding results of |
199 // LiveEdit::FunctionPatchabilityStatus type. | 199 // LiveEdit::FunctionPatchabilityStatus type. |
200 RUNTIME_FUNCTION(Runtime_LiveEditCheckAndDropActivations) { | 200 RUNTIME_FUNCTION(Runtime_LiveEditCheckAndDropActivations) { |
201 HandleScope scope(isolate); | 201 HandleScope scope(isolate); |
202 CHECK(isolate->debug()->live_edit_enabled()); | 202 CHECK(isolate->debug()->live_edit_enabled()); |
203 DCHECK(args.length() == 3); | 203 DCHECK(args.length() == 3); |
204 CONVERT_ARG_HANDLE_CHECKED(JSArray, old_shared_array, 0); | 204 CONVERT_ARG_HANDLE_CHECKED(JSArray, old_shared_array, 0); |
205 CONVERT_ARG_HANDLE_CHECKED(JSArray, new_shared_array, 1); | 205 CONVERT_ARG_HANDLE_CHECKED(JSArray, new_shared_array, 1); |
206 CONVERT_BOOLEAN_ARG_CHECKED(do_drop, 2); | 206 CONVERT_BOOLEAN_ARG_CHECKED(do_drop, 2); |
207 USE(new_shared_array); | 207 USE(new_shared_array); |
208 RUNTIME_ASSERT(old_shared_array->length()->IsSmi()); | 208 RUNTIME_ASSERT(old_shared_array->length()->IsSmi()); |
209 RUNTIME_ASSERT(new_shared_array->length() == old_shared_array->length()); | 209 RUNTIME_ASSERT(new_shared_array->length() == old_shared_array->length()); |
210 RUNTIME_ASSERT(old_shared_array->HasFastElements()) | 210 RUNTIME_ASSERT(old_shared_array->HasFastElements()); |
211 RUNTIME_ASSERT(new_shared_array->HasFastElements()) | 211 RUNTIME_ASSERT(new_shared_array->HasFastElements()); |
212 int array_length = Smi::cast(old_shared_array->length())->value(); | 212 int array_length = Smi::cast(old_shared_array->length())->value(); |
213 for (int i = 0; i < array_length; i++) { | 213 for (int i = 0; i < array_length; i++) { |
214 Handle<Object> old_element; | 214 Handle<Object> old_element; |
215 Handle<Object> new_element; | 215 Handle<Object> new_element; |
216 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 216 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
217 isolate, old_element, Object::GetElement(isolate, old_shared_array, i)); | 217 isolate, old_element, Object::GetElement(isolate, old_shared_array, i)); |
218 RUNTIME_ASSERT( | 218 RUNTIME_ASSERT( |
219 old_element->IsJSValue() && | 219 old_element->IsJSValue() && |
220 Handle<JSValue>::cast(old_element)->value()->IsSharedFunctionInfo()); | 220 Handle<JSValue>::cast(old_element)->value()->IsSharedFunctionInfo()); |
221 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 221 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 // We don't really care what the inlined frame index is, since we are | 278 // We don't really care what the inlined frame index is, since we are |
279 // throwing away the entire frame anyways. | 279 // throwing away the entire frame anyways. |
280 const char* error_message = LiveEdit::RestartFrame(it.frame()); | 280 const char* error_message = LiveEdit::RestartFrame(it.frame()); |
281 if (error_message) { | 281 if (error_message) { |
282 return *(isolate->factory()->InternalizeUtf8String(error_message)); | 282 return *(isolate->factory()->InternalizeUtf8String(error_message)); |
283 } | 283 } |
284 return heap->true_value(); | 284 return heap->true_value(); |
285 } | 285 } |
286 } // namespace internal | 286 } // namespace internal |
287 } // namespace v8 | 287 } // namespace v8 |
OLD | NEW |