Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: src/runtime/runtime-debug.cc

Issue 2636913002: [liveedit] reimplement frame restarting. (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/runtime/runtime.h ('k') | src/x64/interface-descriptors-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/compiler.h" 8 #include "src/compiler.h"
9 #include "src/debug/debug-evaluate.h" 9 #include "src/debug/debug-evaluate.h"
10 #include "src/debug/debug-frames.h" 10 #include "src/debug/debug-frames.h"
11 #include "src/debug/debug-scopes.h" 11 #include "src/debug/debug-scopes.h"
12 #include "src/debug/debug.h" 12 #include "src/debug/debug.h"
13 #include "src/debug/liveedit.h" 13 #include "src/debug/liveedit.h"
14 #include "src/frames-inl.h" 14 #include "src/frames-inl.h"
15 #include "src/globals.h" 15 #include "src/globals.h"
16 #include "src/interpreter/bytecodes.h" 16 #include "src/interpreter/bytecodes.h"
17 #include "src/interpreter/interpreter.h" 17 #include "src/interpreter/interpreter.h"
18 #include "src/isolate-inl.h" 18 #include "src/isolate-inl.h"
19 #include "src/runtime/runtime.h" 19 #include "src/runtime/runtime.h"
20 #include "src/wasm/wasm-module.h" 20 #include "src/wasm/wasm-module.h"
21 #include "src/wasm/wasm-objects.h" 21 #include "src/wasm/wasm-objects.h"
22 22
23 namespace v8 { 23 namespace v8 {
24 namespace internal { 24 namespace internal {
25 25
26 RUNTIME_FUNCTION(Runtime_DebugBreak) { 26 RUNTIME_FUNCTION(Runtime_DebugBreak) {
27 SealHandleScope shs(isolate); 27 SealHandleScope shs(isolate);
28 DCHECK_EQ(1, args.length()); 28 DCHECK_EQ(1, args.length());
29 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); 29 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0);
30 isolate->debug()->set_return_value(value); 30 isolate->debug()->set_return_value(*value);
31 31
32 // Get the top-most JavaScript frame. 32 // Get the top-most JavaScript frame.
33 JavaScriptFrameIterator it(isolate); 33 JavaScriptFrameIterator it(isolate);
34 isolate->debug()->Break(it.frame()); 34 isolate->debug()->Break(it.frame());
35 35 return isolate->debug()->return_value();
36 isolate->debug()->SetAfterBreakTarget(it.frame());
37 return *isolate->debug()->return_value();
38 } 36 }
39 37
40 RUNTIME_FUNCTION(Runtime_DebugBreakOnBytecode) { 38 RUNTIME_FUNCTION(Runtime_DebugBreakOnBytecode) {
41 SealHandleScope shs(isolate); 39 SealHandleScope shs(isolate);
42 DCHECK_EQ(1, args.length()); 40 DCHECK_EQ(1, args.length());
43 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); 41 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0);
44 isolate->debug()->set_return_value(value); 42 isolate->debug()->set_return_value(*value);
45 43
46 // Get the top-most JavaScript frame. 44 // Get the top-most JavaScript frame.
47 JavaScriptFrameIterator it(isolate); 45 JavaScriptFrameIterator it(isolate);
48 isolate->debug()->Break(it.frame()); 46 isolate->debug()->Break(it.frame());
49 47
50 // If live-edit has dropped frames, we are not going back to dispatch.
51 if (LiveEdit::SetAfterBreakTarget(isolate->debug())) return Smi::kZero;
52
53 // Return the handler from the original bytecode array. 48 // Return the handler from the original bytecode array.
54 DCHECK(it.frame()->is_interpreted()); 49 DCHECK(it.frame()->is_interpreted());
55 InterpretedFrame* interpreted_frame = 50 InterpretedFrame* interpreted_frame =
56 reinterpret_cast<InterpretedFrame*>(it.frame()); 51 reinterpret_cast<InterpretedFrame*>(it.frame());
57 SharedFunctionInfo* shared = interpreted_frame->function()->shared(); 52 SharedFunctionInfo* shared = interpreted_frame->function()->shared();
58 BytecodeArray* bytecode_array = shared->bytecode_array(); 53 BytecodeArray* bytecode_array = shared->bytecode_array();
59 int bytecode_offset = interpreted_frame->GetBytecodeOffset(); 54 int bytecode_offset = interpreted_frame->GetBytecodeOffset();
60 interpreter::Bytecode bytecode = 55 interpreter::Bytecode bytecode =
61 interpreter::Bytecodes::FromByte(bytecode_array->get(bytecode_offset)); 56 interpreter::Bytecodes::FromByte(bytecode_array->get(bytecode_offset));
62 return isolate->interpreter()->GetBytecodeHandler( 57 return isolate->interpreter()->GetBytecodeHandler(
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 // frame or if the frame is optimized it cannot be at a return. 620 // frame or if the frame is optimized it cannot be at a return.
626 bool at_return = false; 621 bool at_return = false;
627 if (!is_optimized && index == 0) { 622 if (!is_optimized && index == 0) {
628 at_return = isolate->debug()->IsBreakAtReturn(it.javascript_frame()); 623 at_return = isolate->debug()->IsBreakAtReturn(it.javascript_frame());
629 } 624 }
630 625
631 // If positioned just before return find the value to be returned and add it 626 // If positioned just before return find the value to be returned and add it
632 // to the frame information. 627 // to the frame information.
633 Handle<Object> return_value = isolate->factory()->undefined_value(); 628 Handle<Object> return_value = isolate->factory()->undefined_value();
634 if (at_return) { 629 if (at_return) {
635 return_value = isolate->debug()->return_value(); 630 return_value = handle(isolate->debug()->return_value(), isolate);
636 } 631 }
637 632
638 // Now advance to the arguments adapter frame (if any). It contains all 633 // Now advance to the arguments adapter frame (if any). It contains all
639 // the provided parameters whereas the function frame always have the number 634 // the provided parameters whereas the function frame always have the number
640 // of arguments matching the functions parameters. The rest of the 635 // of arguments matching the functions parameters. The rest of the
641 // information (except for what is collected above) is the same. 636 // information (except for what is collected above) is the same.
642 if ((inlined_frame_index == 0) && 637 if ((inlined_frame_index == 0) &&
643 it.javascript_frame()->has_adapted_arguments()) { 638 it.javascript_frame()->has_adapted_arguments()) {
644 it.AdvanceToArgumentsFrame(); 639 it.AdvanceToArgumentsFrame();
645 frame_inspector.SetArgumentsFrame(it.frame()); 640 frame_inspector.SetArgumentsFrame(it.frame());
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 if (function->IsJSBoundFunction()) { 1431 if (function->IsJSBoundFunction()) {
1437 RETURN_RESULT_OR_FAILURE( 1432 RETURN_RESULT_OR_FAILURE(
1438 isolate, JSBoundFunction::GetName( 1433 isolate, JSBoundFunction::GetName(
1439 isolate, Handle<JSBoundFunction>::cast(function))); 1434 isolate, Handle<JSBoundFunction>::cast(function)));
1440 } else { 1435 } else {
1441 return *JSFunction::GetDebugName(Handle<JSFunction>::cast(function)); 1436 return *JSFunction::GetDebugName(Handle<JSFunction>::cast(function));
1442 } 1437 }
1443 } 1438 }
1444 1439
1445 1440
1446 // Calls specified function with or without entering the debugger.
1447 // This is used in unit tests to run code as if debugger is entered or simply
1448 // to have a stack with C++ frame in the middle.
1449 RUNTIME_FUNCTION(Runtime_ExecuteInDebugContext) {
1450 HandleScope scope(isolate);
1451 DCHECK_EQ(1, args.length());
1452 CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
1453
1454 DebugScope debug_scope(isolate->debug());
1455 if (debug_scope.failed()) {
1456 DCHECK(isolate->has_pending_exception());
1457 return isolate->heap()->exception();
1458 }
1459
1460 RETURN_RESULT_OR_FAILURE(
1461 isolate, Execution::Call(isolate, function,
1462 handle(function->global_proxy()), 0, NULL));
1463 }
1464
1465
1466 RUNTIME_FUNCTION(Runtime_GetDebugContext) { 1441 RUNTIME_FUNCTION(Runtime_GetDebugContext) {
1467 HandleScope scope(isolate); 1442 HandleScope scope(isolate);
1468 DCHECK_EQ(0, args.length()); 1443 DCHECK_EQ(0, args.length());
1469 Handle<Context> context; 1444 Handle<Context> context;
1470 { 1445 {
1471 DebugScope debug_scope(isolate->debug()); 1446 DebugScope debug_scope(isolate->debug());
1472 if (debug_scope.failed()) { 1447 if (debug_scope.failed()) {
1473 DCHECK(isolate->has_pending_exception()); 1448 DCHECK(isolate->has_pending_exception());
1474 return isolate->heap()->exception(); 1449 return isolate->heap()->exception();
1475 } 1450 }
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 } 1885 }
1911 1886
1912 1887
1913 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { 1888 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) {
1914 UNIMPLEMENTED(); 1889 UNIMPLEMENTED();
1915 return NULL; 1890 return NULL;
1916 } 1891 }
1917 1892
1918 } // namespace internal 1893 } // namespace internal
1919 } // namespace v8 1894 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | src/x64/interface-descriptors-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698