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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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() == 2); | 203 DCHECK(args.length() == 3); |
204 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_array, 0); | 204 CONVERT_ARG_HANDLE_CHECKED(JSArray, old_shared_array, 0); |
205 CONVERT_BOOLEAN_ARG_CHECKED(do_drop, 1); | 205 CONVERT_ARG_HANDLE_CHECKED(JSArray, new_shared_array, 1); |
206 RUNTIME_ASSERT(shared_array->length()->IsSmi()); | 206 CONVERT_BOOLEAN_ARG_CHECKED(do_drop, 2); |
207 RUNTIME_ASSERT(shared_array->HasFastElements()) | 207 USE(new_shared_array); |
208 int array_length = Smi::cast(shared_array->length())->value(); | 208 RUNTIME_ASSERT(old_shared_array->length()->IsSmi()); |
| 209 RUNTIME_ASSERT(new_shared_array->length() == old_shared_array->length()); |
| 210 RUNTIME_ASSERT(old_shared_array->HasFastElements()) |
| 211 RUNTIME_ASSERT(new_shared_array->HasFastElements()) |
| 212 int array_length = Smi::cast(old_shared_array->length())->value(); |
209 for (int i = 0; i < array_length; i++) { | 213 for (int i = 0; i < array_length; i++) { |
210 Handle<Object> element; | 214 Handle<Object> old_element; |
| 215 Handle<Object> new_element; |
211 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 216 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
212 isolate, element, Object::GetElement(isolate, shared_array, i)); | 217 isolate, old_element, Object::GetElement(isolate, old_shared_array, i)); |
213 RUNTIME_ASSERT( | 218 RUNTIME_ASSERT( |
214 element->IsJSValue() && | 219 old_element->IsJSValue() && |
215 Handle<JSValue>::cast(element)->value()->IsSharedFunctionInfo()); | 220 Handle<JSValue>::cast(old_element)->value()->IsSharedFunctionInfo()); |
| 221 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 222 isolate, new_element, Object::GetElement(isolate, new_shared_array, i)); |
| 223 RUNTIME_ASSERT( |
| 224 new_element->IsUndefined() || |
| 225 (new_element->IsJSValue() && |
| 226 Handle<JSValue>::cast(new_element)->value()->IsSharedFunctionInfo())); |
216 } | 227 } |
217 | 228 |
218 return *LiveEdit::CheckAndDropActivations(shared_array, do_drop); | 229 return *LiveEdit::CheckAndDropActivations(old_shared_array, new_shared_array, |
| 230 do_drop); |
219 } | 231 } |
220 | 232 |
221 | 233 |
222 // Compares 2 strings line-by-line, then token-wise and returns diff in form | 234 // Compares 2 strings line-by-line, then token-wise and returns diff in form |
223 // of JSArray of triplets (pos1, pos1_end, pos2_end) describing list | 235 // of JSArray of triplets (pos1, pos1_end, pos2_end) describing list |
224 // of diff chunks. | 236 // of diff chunks. |
225 RUNTIME_FUNCTION(Runtime_LiveEditCompareStrings) { | 237 RUNTIME_FUNCTION(Runtime_LiveEditCompareStrings) { |
226 HandleScope scope(isolate); | 238 HandleScope scope(isolate); |
227 CHECK(isolate->debug()->live_edit_enabled()); | 239 CHECK(isolate->debug()->live_edit_enabled()); |
228 DCHECK(args.length() == 2); | 240 DCHECK(args.length() == 2); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 // 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 |
267 // throwing away the entire frame anyways. | 279 // throwing away the entire frame anyways. |
268 const char* error_message = LiveEdit::RestartFrame(it.frame()); | 280 const char* error_message = LiveEdit::RestartFrame(it.frame()); |
269 if (error_message) { | 281 if (error_message) { |
270 return *(isolate->factory()->InternalizeUtf8String(error_message)); | 282 return *(isolate->factory()->InternalizeUtf8String(error_message)); |
271 } | 283 } |
272 return heap->true_value(); | 284 return heap->true_value(); |
273 } | 285 } |
274 } // namespace internal | 286 } // namespace internal |
275 } // namespace v8 | 287 } // namespace v8 |
OLD | NEW |