OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <limits> | 6 #include <limits> |
7 | 7 |
8 #include "v8.h" | 8 #include "v8.h" |
9 | 9 |
10 #include "accessors.h" | 10 #include "accessors.h" |
(...skipping 5558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5569 object_array->set(store_index, *value); | 5569 object_array->set(store_index, *value); |
5570 } | 5570 } |
5571 return *object; | 5571 return *object; |
5572 } | 5572 } |
5573 | 5573 |
5574 | 5574 |
5575 // Check whether debugger and is about to step into the callback that is passed | 5575 // Check whether debugger and is about to step into the callback that is passed |
5576 // to a built-in function such as Array.forEach. | 5576 // to a built-in function such as Array.forEach. |
5577 RUNTIME_FUNCTION(Runtime_DebugCallbackSupportsStepping) { | 5577 RUNTIME_FUNCTION(Runtime_DebugCallbackSupportsStepping) { |
5578 ASSERT(args.length() == 1); | 5578 ASSERT(args.length() == 1); |
5579 if (!isolate->debugger()->is_active() || !isolate->debug()->StepInActive()) { | 5579 if (!isolate->debug()->is_active() || !isolate->debug()->StepInActive()) { |
5580 return isolate->heap()->false_value(); | 5580 return isolate->heap()->false_value(); |
5581 } | 5581 } |
5582 CONVERT_ARG_CHECKED(Object, callback, 0); | 5582 CONVERT_ARG_CHECKED(Object, callback, 0); |
5583 // We do not step into the callback if it's a builtin or not even a function. | 5583 // We do not step into the callback if it's a builtin or not even a function. |
5584 return isolate->heap()->ToBoolean( | 5584 return isolate->heap()->ToBoolean( |
5585 callback->IsJSFunction() && !JSFunction::cast(callback)->IsBuiltin()); | 5585 callback->IsJSFunction() && !JSFunction::cast(callback)->IsBuiltin()); |
5586 } | 5586 } |
5587 | 5587 |
5588 | 5588 |
5589 // Set one shot breakpoints for the callback function that is passed to a | 5589 // Set one shot breakpoints for the callback function that is passed to a |
(...skipping 5155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10745 // clearing the event listener function | 10745 // clearing the event listener function |
10746 // args[1]: object supplied during callback | 10746 // args[1]: object supplied during callback |
10747 RUNTIME_FUNCTION(Runtime_SetDebugEventListener) { | 10747 RUNTIME_FUNCTION(Runtime_SetDebugEventListener) { |
10748 SealHandleScope shs(isolate); | 10748 SealHandleScope shs(isolate); |
10749 ASSERT(args.length() == 2); | 10749 ASSERT(args.length() == 2); |
10750 RUNTIME_ASSERT(args[0]->IsJSFunction() || | 10750 RUNTIME_ASSERT(args[0]->IsJSFunction() || |
10751 args[0]->IsUndefined() || | 10751 args[0]->IsUndefined() || |
10752 args[0]->IsNull()); | 10752 args[0]->IsNull()); |
10753 CONVERT_ARG_HANDLE_CHECKED(Object, callback, 0); | 10753 CONVERT_ARG_HANDLE_CHECKED(Object, callback, 0); |
10754 CONVERT_ARG_HANDLE_CHECKED(Object, data, 1); | 10754 CONVERT_ARG_HANDLE_CHECKED(Object, data, 1); |
10755 isolate->debugger()->SetEventListener(callback, data); | 10755 isolate->debug()->SetEventListener(callback, data); |
10756 | 10756 |
10757 return isolate->heap()->undefined_value(); | 10757 return isolate->heap()->undefined_value(); |
10758 } | 10758 } |
10759 | 10759 |
10760 | 10760 |
10761 RUNTIME_FUNCTION(Runtime_Break) { | 10761 RUNTIME_FUNCTION(Runtime_Break) { |
10762 SealHandleScope shs(isolate); | 10762 SealHandleScope shs(isolate); |
10763 ASSERT(args.length() == 0); | 10763 ASSERT(args.length() == 0); |
10764 isolate->stack_guard()->RequestDebugBreak(); | 10764 isolate->stack_guard()->RequestDebugBreak(); |
10765 return isolate->heap()->undefined_value(); | 10765 return isolate->heap()->undefined_value(); |
(...skipping 2546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13312 } | 13312 } |
13313 return counter; | 13313 return counter; |
13314 } | 13314 } |
13315 | 13315 |
13316 | 13316 |
13317 // For a script finds all SharedFunctionInfo's in the heap that points | 13317 // For a script finds all SharedFunctionInfo's in the heap that points |
13318 // to this script. Returns JSArray of SharedFunctionInfo wrapped | 13318 // to this script. Returns JSArray of SharedFunctionInfo wrapped |
13319 // in OpaqueReferences. | 13319 // in OpaqueReferences. |
13320 RUNTIME_FUNCTION(Runtime_LiveEditFindSharedFunctionInfosForScript) { | 13320 RUNTIME_FUNCTION(Runtime_LiveEditFindSharedFunctionInfosForScript) { |
13321 HandleScope scope(isolate); | 13321 HandleScope scope(isolate); |
13322 CHECK(isolate->debugger()->live_edit_enabled()); | 13322 CHECK(isolate->debug()->live_edit_enabled()); |
13323 ASSERT(args.length() == 1); | 13323 ASSERT(args.length() == 1); |
13324 CONVERT_ARG_CHECKED(JSValue, script_value, 0); | 13324 CONVERT_ARG_CHECKED(JSValue, script_value, 0); |
13325 | 13325 |
13326 RUNTIME_ASSERT(script_value->value()->IsScript()); | 13326 RUNTIME_ASSERT(script_value->value()->IsScript()); |
13327 Handle<Script> script = Handle<Script>(Script::cast(script_value->value())); | 13327 Handle<Script> script = Handle<Script>(Script::cast(script_value->value())); |
13328 | 13328 |
13329 const int kBufferSize = 32; | 13329 const int kBufferSize = 32; |
13330 | 13330 |
13331 Handle<FixedArray> array; | 13331 Handle<FixedArray> array; |
13332 array = isolate->factory()->NewFixedArray(kBufferSize); | 13332 array = isolate->factory()->NewFixedArray(kBufferSize); |
(...skipping 24 matching lines...) Expand all Loading... |
13357 | 13357 |
13358 // For a script calculates compilation information about all its functions. | 13358 // For a script calculates compilation information about all its functions. |
13359 // The script source is explicitly specified by the second argument. | 13359 // The script source is explicitly specified by the second argument. |
13360 // The source of the actual script is not used, however it is important that | 13360 // The source of the actual script is not used, however it is important that |
13361 // all generated code keeps references to this particular instance of script. | 13361 // all generated code keeps references to this particular instance of script. |
13362 // Returns a JSArray of compilation infos. The array is ordered so that | 13362 // Returns a JSArray of compilation infos. The array is ordered so that |
13363 // each function with all its descendant is always stored in a continues range | 13363 // each function with all its descendant is always stored in a continues range |
13364 // with the function itself going first. The root function is a script function. | 13364 // with the function itself going first. The root function is a script function. |
13365 RUNTIME_FUNCTION(Runtime_LiveEditGatherCompileInfo) { | 13365 RUNTIME_FUNCTION(Runtime_LiveEditGatherCompileInfo) { |
13366 HandleScope scope(isolate); | 13366 HandleScope scope(isolate); |
13367 CHECK(isolate->debugger()->live_edit_enabled()); | 13367 CHECK(isolate->debug()->live_edit_enabled()); |
13368 ASSERT(args.length() == 2); | 13368 ASSERT(args.length() == 2); |
13369 CONVERT_ARG_CHECKED(JSValue, script, 0); | 13369 CONVERT_ARG_CHECKED(JSValue, script, 0); |
13370 CONVERT_ARG_HANDLE_CHECKED(String, source, 1); | 13370 CONVERT_ARG_HANDLE_CHECKED(String, source, 1); |
13371 | 13371 |
13372 RUNTIME_ASSERT(script->value()->IsScript()); | 13372 RUNTIME_ASSERT(script->value()->IsScript()); |
13373 Handle<Script> script_handle = Handle<Script>(Script::cast(script->value())); | 13373 Handle<Script> script_handle = Handle<Script>(Script::cast(script->value())); |
13374 | 13374 |
13375 Handle<JSArray> result; | 13375 Handle<JSArray> result; |
13376 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 13376 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
13377 isolate, result, LiveEdit::GatherCompileInfo(script_handle, source)); | 13377 isolate, result, LiveEdit::GatherCompileInfo(script_handle, source)); |
13378 return *result; | 13378 return *result; |
13379 } | 13379 } |
13380 | 13380 |
13381 | 13381 |
13382 // Changes the source of the script to a new_source. | 13382 // Changes the source of the script to a new_source. |
13383 // If old_script_name is provided (i.e. is a String), also creates a copy of | 13383 // If old_script_name is provided (i.e. is a String), also creates a copy of |
13384 // the script with its original source and sends notification to debugger. | 13384 // the script with its original source and sends notification to debugger. |
13385 RUNTIME_FUNCTION(Runtime_LiveEditReplaceScript) { | 13385 RUNTIME_FUNCTION(Runtime_LiveEditReplaceScript) { |
13386 HandleScope scope(isolate); | 13386 HandleScope scope(isolate); |
13387 CHECK(isolate->debugger()->live_edit_enabled()); | 13387 CHECK(isolate->debug()->live_edit_enabled()); |
13388 ASSERT(args.length() == 3); | 13388 ASSERT(args.length() == 3); |
13389 CONVERT_ARG_CHECKED(JSValue, original_script_value, 0); | 13389 CONVERT_ARG_CHECKED(JSValue, original_script_value, 0); |
13390 CONVERT_ARG_HANDLE_CHECKED(String, new_source, 1); | 13390 CONVERT_ARG_HANDLE_CHECKED(String, new_source, 1); |
13391 CONVERT_ARG_HANDLE_CHECKED(Object, old_script_name, 2); | 13391 CONVERT_ARG_HANDLE_CHECKED(Object, old_script_name, 2); |
13392 | 13392 |
13393 RUNTIME_ASSERT(original_script_value->value()->IsScript()); | 13393 RUNTIME_ASSERT(original_script_value->value()->IsScript()); |
13394 Handle<Script> original_script(Script::cast(original_script_value->value())); | 13394 Handle<Script> original_script(Script::cast(original_script_value->value())); |
13395 | 13395 |
13396 Handle<Object> old_script = LiveEdit::ChangeScriptSource( | 13396 Handle<Object> old_script = LiveEdit::ChangeScriptSource( |
13397 original_script, new_source, old_script_name); | 13397 original_script, new_source, old_script_name); |
13398 | 13398 |
13399 if (old_script->IsScript()) { | 13399 if (old_script->IsScript()) { |
13400 Handle<Script> script_handle = Handle<Script>::cast(old_script); | 13400 Handle<Script> script_handle = Handle<Script>::cast(old_script); |
13401 return *Script::GetWrapper(script_handle); | 13401 return *Script::GetWrapper(script_handle); |
13402 } else { | 13402 } else { |
13403 return isolate->heap()->null_value(); | 13403 return isolate->heap()->null_value(); |
13404 } | 13404 } |
13405 } | 13405 } |
13406 | 13406 |
13407 | 13407 |
13408 RUNTIME_FUNCTION(Runtime_LiveEditFunctionSourceUpdated) { | 13408 RUNTIME_FUNCTION(Runtime_LiveEditFunctionSourceUpdated) { |
13409 HandleScope scope(isolate); | 13409 HandleScope scope(isolate); |
13410 CHECK(isolate->debugger()->live_edit_enabled()); | 13410 CHECK(isolate->debug()->live_edit_enabled()); |
13411 ASSERT(args.length() == 1); | 13411 ASSERT(args.length() == 1); |
13412 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_info, 0); | 13412 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_info, 0); |
13413 RUNTIME_ASSERT(SharedInfoWrapper::IsInstance(shared_info)); | 13413 RUNTIME_ASSERT(SharedInfoWrapper::IsInstance(shared_info)); |
13414 | 13414 |
13415 LiveEdit::FunctionSourceUpdated(shared_info); | 13415 LiveEdit::FunctionSourceUpdated(shared_info); |
13416 return isolate->heap()->undefined_value(); | 13416 return isolate->heap()->undefined_value(); |
13417 } | 13417 } |
13418 | 13418 |
13419 | 13419 |
13420 // Replaces code of SharedFunctionInfo with a new one. | 13420 // Replaces code of SharedFunctionInfo with a new one. |
13421 RUNTIME_FUNCTION(Runtime_LiveEditReplaceFunctionCode) { | 13421 RUNTIME_FUNCTION(Runtime_LiveEditReplaceFunctionCode) { |
13422 HandleScope scope(isolate); | 13422 HandleScope scope(isolate); |
13423 CHECK(isolate->debugger()->live_edit_enabled()); | 13423 CHECK(isolate->debug()->live_edit_enabled()); |
13424 ASSERT(args.length() == 2); | 13424 ASSERT(args.length() == 2); |
13425 CONVERT_ARG_HANDLE_CHECKED(JSArray, new_compile_info, 0); | 13425 CONVERT_ARG_HANDLE_CHECKED(JSArray, new_compile_info, 0); |
13426 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_info, 1); | 13426 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_info, 1); |
13427 RUNTIME_ASSERT(SharedInfoWrapper::IsInstance(shared_info)); | 13427 RUNTIME_ASSERT(SharedInfoWrapper::IsInstance(shared_info)); |
13428 | 13428 |
13429 LiveEdit::ReplaceFunctionCode(new_compile_info, shared_info); | 13429 LiveEdit::ReplaceFunctionCode(new_compile_info, shared_info); |
13430 return isolate->heap()->undefined_value(); | 13430 return isolate->heap()->undefined_value(); |
13431 } | 13431 } |
13432 | 13432 |
13433 | 13433 |
13434 // Connects SharedFunctionInfo to another script. | 13434 // Connects SharedFunctionInfo to another script. |
13435 RUNTIME_FUNCTION(Runtime_LiveEditFunctionSetScript) { | 13435 RUNTIME_FUNCTION(Runtime_LiveEditFunctionSetScript) { |
13436 HandleScope scope(isolate); | 13436 HandleScope scope(isolate); |
13437 CHECK(isolate->debugger()->live_edit_enabled()); | 13437 CHECK(isolate->debug()->live_edit_enabled()); |
13438 ASSERT(args.length() == 2); | 13438 ASSERT(args.length() == 2); |
13439 CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0); | 13439 CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0); |
13440 CONVERT_ARG_HANDLE_CHECKED(Object, script_object, 1); | 13440 CONVERT_ARG_HANDLE_CHECKED(Object, script_object, 1); |
13441 | 13441 |
13442 if (function_object->IsJSValue()) { | 13442 if (function_object->IsJSValue()) { |
13443 Handle<JSValue> function_wrapper = Handle<JSValue>::cast(function_object); | 13443 Handle<JSValue> function_wrapper = Handle<JSValue>::cast(function_object); |
13444 if (script_object->IsJSValue()) { | 13444 if (script_object->IsJSValue()) { |
13445 RUNTIME_ASSERT(JSValue::cast(*script_object)->value()->IsScript()); | 13445 RUNTIME_ASSERT(JSValue::cast(*script_object)->value()->IsScript()); |
13446 Script* script = Script::cast(JSValue::cast(*script_object)->value()); | 13446 Script* script = Script::cast(JSValue::cast(*script_object)->value()); |
13447 script_object = Handle<Object>(script, isolate); | 13447 script_object = Handle<Object>(script, isolate); |
13448 } | 13448 } |
13449 RUNTIME_ASSERT(function_wrapper->value()->IsSharedFunctionInfo()); | 13449 RUNTIME_ASSERT(function_wrapper->value()->IsSharedFunctionInfo()); |
13450 LiveEdit::SetFunctionScript(function_wrapper, script_object); | 13450 LiveEdit::SetFunctionScript(function_wrapper, script_object); |
13451 } else { | 13451 } else { |
13452 // Just ignore this. We may not have a SharedFunctionInfo for some functions | 13452 // Just ignore this. We may not have a SharedFunctionInfo for some functions |
13453 // and we check it in this function. | 13453 // and we check it in this function. |
13454 } | 13454 } |
13455 | 13455 |
13456 return isolate->heap()->undefined_value(); | 13456 return isolate->heap()->undefined_value(); |
13457 } | 13457 } |
13458 | 13458 |
13459 | 13459 |
13460 // In a code of a parent function replaces original function as embedded object | 13460 // In a code of a parent function replaces original function as embedded object |
13461 // with a substitution one. | 13461 // with a substitution one. |
13462 RUNTIME_FUNCTION(Runtime_LiveEditReplaceRefToNestedFunction) { | 13462 RUNTIME_FUNCTION(Runtime_LiveEditReplaceRefToNestedFunction) { |
13463 HandleScope scope(isolate); | 13463 HandleScope scope(isolate); |
13464 CHECK(isolate->debugger()->live_edit_enabled()); | 13464 CHECK(isolate->debug()->live_edit_enabled()); |
13465 ASSERT(args.length() == 3); | 13465 ASSERT(args.length() == 3); |
13466 | 13466 |
13467 CONVERT_ARG_HANDLE_CHECKED(JSValue, parent_wrapper, 0); | 13467 CONVERT_ARG_HANDLE_CHECKED(JSValue, parent_wrapper, 0); |
13468 CONVERT_ARG_HANDLE_CHECKED(JSValue, orig_wrapper, 1); | 13468 CONVERT_ARG_HANDLE_CHECKED(JSValue, orig_wrapper, 1); |
13469 CONVERT_ARG_HANDLE_CHECKED(JSValue, subst_wrapper, 2); | 13469 CONVERT_ARG_HANDLE_CHECKED(JSValue, subst_wrapper, 2); |
13470 RUNTIME_ASSERT(parent_wrapper->value()->IsSharedFunctionInfo()); | 13470 RUNTIME_ASSERT(parent_wrapper->value()->IsSharedFunctionInfo()); |
13471 RUNTIME_ASSERT(orig_wrapper->value()->IsSharedFunctionInfo()); | 13471 RUNTIME_ASSERT(orig_wrapper->value()->IsSharedFunctionInfo()); |
13472 RUNTIME_ASSERT(subst_wrapper->value()->IsSharedFunctionInfo()); | 13472 RUNTIME_ASSERT(subst_wrapper->value()->IsSharedFunctionInfo()); |
13473 | 13473 |
13474 LiveEdit::ReplaceRefToNestedFunction( | 13474 LiveEdit::ReplaceRefToNestedFunction( |
13475 parent_wrapper, orig_wrapper, subst_wrapper); | 13475 parent_wrapper, orig_wrapper, subst_wrapper); |
13476 return isolate->heap()->undefined_value(); | 13476 return isolate->heap()->undefined_value(); |
13477 } | 13477 } |
13478 | 13478 |
13479 | 13479 |
13480 // Updates positions of a shared function info (first parameter) according | 13480 // Updates positions of a shared function info (first parameter) according |
13481 // to script source change. Text change is described in second parameter as | 13481 // to script source change. Text change is described in second parameter as |
13482 // array of groups of 3 numbers: | 13482 // array of groups of 3 numbers: |
13483 // (change_begin, change_end, change_end_new_position). | 13483 // (change_begin, change_end, change_end_new_position). |
13484 // Each group describes a change in text; groups are sorted by change_begin. | 13484 // Each group describes a change in text; groups are sorted by change_begin. |
13485 RUNTIME_FUNCTION(Runtime_LiveEditPatchFunctionPositions) { | 13485 RUNTIME_FUNCTION(Runtime_LiveEditPatchFunctionPositions) { |
13486 HandleScope scope(isolate); | 13486 HandleScope scope(isolate); |
13487 CHECK(isolate->debugger()->live_edit_enabled()); | 13487 CHECK(isolate->debug()->live_edit_enabled()); |
13488 ASSERT(args.length() == 2); | 13488 ASSERT(args.length() == 2); |
13489 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_array, 0); | 13489 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_array, 0); |
13490 CONVERT_ARG_HANDLE_CHECKED(JSArray, position_change_array, 1); | 13490 CONVERT_ARG_HANDLE_CHECKED(JSArray, position_change_array, 1); |
13491 RUNTIME_ASSERT(SharedInfoWrapper::IsInstance(shared_array)) | 13491 RUNTIME_ASSERT(SharedInfoWrapper::IsInstance(shared_array)) |
13492 | 13492 |
13493 LiveEdit::PatchFunctionPositions(shared_array, position_change_array); | 13493 LiveEdit::PatchFunctionPositions(shared_array, position_change_array); |
13494 return isolate->heap()->undefined_value(); | 13494 return isolate->heap()->undefined_value(); |
13495 } | 13495 } |
13496 | 13496 |
13497 | 13497 |
13498 // For array of SharedFunctionInfo's (each wrapped in JSValue) | 13498 // For array of SharedFunctionInfo's (each wrapped in JSValue) |
13499 // checks that none of them have activations on stacks (of any thread). | 13499 // checks that none of them have activations on stacks (of any thread). |
13500 // Returns array of the same length with corresponding results of | 13500 // Returns array of the same length with corresponding results of |
13501 // LiveEdit::FunctionPatchabilityStatus type. | 13501 // LiveEdit::FunctionPatchabilityStatus type. |
13502 RUNTIME_FUNCTION(Runtime_LiveEditCheckAndDropActivations) { | 13502 RUNTIME_FUNCTION(Runtime_LiveEditCheckAndDropActivations) { |
13503 HandleScope scope(isolate); | 13503 HandleScope scope(isolate); |
13504 CHECK(isolate->debugger()->live_edit_enabled()); | 13504 CHECK(isolate->debug()->live_edit_enabled()); |
13505 ASSERT(args.length() == 2); | 13505 ASSERT(args.length() == 2); |
13506 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_array, 0); | 13506 CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_array, 0); |
13507 CONVERT_BOOLEAN_ARG_CHECKED(do_drop, 1); | 13507 CONVERT_BOOLEAN_ARG_CHECKED(do_drop, 1); |
13508 RUNTIME_ASSERT(shared_array->length()->IsSmi()); | 13508 RUNTIME_ASSERT(shared_array->length()->IsSmi()); |
13509 int array_length = Smi::cast(shared_array->length())->value(); | 13509 int array_length = Smi::cast(shared_array->length())->value(); |
13510 for (int i = 0; i < array_length; i++) { | 13510 for (int i = 0; i < array_length; i++) { |
13511 Handle<Object> element = | 13511 Handle<Object> element = |
13512 Object::GetElement(isolate, shared_array, i).ToHandleChecked(); | 13512 Object::GetElement(isolate, shared_array, i).ToHandleChecked(); |
13513 RUNTIME_ASSERT( | 13513 RUNTIME_ASSERT( |
13514 element->IsJSValue() && | 13514 element->IsJSValue() && |
13515 Handle<JSValue>::cast(element)->value()->IsSharedFunctionInfo()); | 13515 Handle<JSValue>::cast(element)->value()->IsSharedFunctionInfo()); |
13516 } | 13516 } |
13517 | 13517 |
13518 return *LiveEdit::CheckAndDropActivations(shared_array, do_drop); | 13518 return *LiveEdit::CheckAndDropActivations(shared_array, do_drop); |
13519 } | 13519 } |
13520 | 13520 |
13521 | 13521 |
13522 // Compares 2 strings line-by-line, then token-wise and returns diff in form | 13522 // Compares 2 strings line-by-line, then token-wise and returns diff in form |
13523 // of JSArray of triplets (pos1, pos1_end, pos2_end) describing list | 13523 // of JSArray of triplets (pos1, pos1_end, pos2_end) describing list |
13524 // of diff chunks. | 13524 // of diff chunks. |
13525 RUNTIME_FUNCTION(Runtime_LiveEditCompareStrings) { | 13525 RUNTIME_FUNCTION(Runtime_LiveEditCompareStrings) { |
13526 HandleScope scope(isolate); | 13526 HandleScope scope(isolate); |
13527 CHECK(isolate->debugger()->live_edit_enabled()); | 13527 CHECK(isolate->debug()->live_edit_enabled()); |
13528 ASSERT(args.length() == 2); | 13528 ASSERT(args.length() == 2); |
13529 CONVERT_ARG_HANDLE_CHECKED(String, s1, 0); | 13529 CONVERT_ARG_HANDLE_CHECKED(String, s1, 0); |
13530 CONVERT_ARG_HANDLE_CHECKED(String, s2, 1); | 13530 CONVERT_ARG_HANDLE_CHECKED(String, s2, 1); |
13531 | 13531 |
13532 return *LiveEdit::CompareStrings(s1, s2); | 13532 return *LiveEdit::CompareStrings(s1, s2); |
13533 } | 13533 } |
13534 | 13534 |
13535 | 13535 |
13536 // Restarts a call frame and completely drops all frames above. | 13536 // Restarts a call frame and completely drops all frames above. |
13537 // Returns true if successful. Otherwise returns undefined or an error message. | 13537 // Returns true if successful. Otherwise returns undefined or an error message. |
13538 RUNTIME_FUNCTION(Runtime_LiveEditRestartFrame) { | 13538 RUNTIME_FUNCTION(Runtime_LiveEditRestartFrame) { |
13539 HandleScope scope(isolate); | 13539 HandleScope scope(isolate); |
13540 CHECK(isolate->debugger()->live_edit_enabled()); | 13540 CHECK(isolate->debug()->live_edit_enabled()); |
13541 ASSERT(args.length() == 2); | 13541 ASSERT(args.length() == 2); |
13542 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); | 13542 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); |
13543 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id)); | 13543 RUNTIME_ASSERT(CheckExecutionState(isolate, break_id)); |
13544 | 13544 |
13545 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); | 13545 CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); |
13546 Heap* heap = isolate->heap(); | 13546 Heap* heap = isolate->heap(); |
13547 | 13547 |
13548 // Find the relevant frame with the requested index. | 13548 // Find the relevant frame with the requested index. |
13549 StackFrame::Id id = isolate->debug()->break_frame_id(); | 13549 StackFrame::Id id = isolate->debug()->break_frame_id(); |
13550 if (id == StackFrame::NO_ID) { | 13550 if (id == StackFrame::NO_ID) { |
(...skipping 14 matching lines...) Expand all Loading... |
13565 return *(isolate->factory()->InternalizeUtf8String(error_message)); | 13565 return *(isolate->factory()->InternalizeUtf8String(error_message)); |
13566 } | 13566 } |
13567 return heap->true_value(); | 13567 return heap->true_value(); |
13568 } | 13568 } |
13569 | 13569 |
13570 | 13570 |
13571 // A testing entry. Returns statement position which is the closest to | 13571 // A testing entry. Returns statement position which is the closest to |
13572 // source_position. | 13572 // source_position. |
13573 RUNTIME_FUNCTION(Runtime_GetFunctionCodePositionFromSource) { | 13573 RUNTIME_FUNCTION(Runtime_GetFunctionCodePositionFromSource) { |
13574 HandleScope scope(isolate); | 13574 HandleScope scope(isolate); |
13575 CHECK(isolate->debugger()->live_edit_enabled()); | 13575 CHECK(isolate->debug()->live_edit_enabled()); |
13576 ASSERT(args.length() == 2); | 13576 ASSERT(args.length() == 2); |
13577 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); | 13577 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
13578 CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); | 13578 CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); |
13579 | 13579 |
13580 Handle<Code> code(function->code(), isolate); | 13580 Handle<Code> code(function->code(), isolate); |
13581 | 13581 |
13582 if (code->kind() != Code::FUNCTION && | 13582 if (code->kind() != Code::FUNCTION && |
13583 code->kind() != Code::OPTIMIZED_FUNCTION) { | 13583 code->kind() != Code::OPTIMIZED_FUNCTION) { |
13584 return isolate->heap()->undefined_value(); | 13584 return isolate->heap()->undefined_value(); |
13585 } | 13585 } |
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15171 } | 15171 } |
15172 return NULL; | 15172 return NULL; |
15173 } | 15173 } |
15174 | 15174 |
15175 | 15175 |
15176 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15176 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15177 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15177 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15178 } | 15178 } |
15179 | 15179 |
15180 } } // namespace v8::internal | 15180 } } // namespace v8::internal |
OLD | NEW |