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

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

Issue 2396353002: Revert "Add Smi::Zero and replace all Smi::FromInt(0) calls" (Closed)
Patch Set: Created 4 years, 2 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-compiler.cc ('k') | src/runtime/runtime-i18n.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/debug/debug-evaluate.h" 8 #include "src/debug/debug-evaluate.h"
9 #include "src/debug/debug-frames.h" 9 #include "src/debug/debug-frames.h"
10 #include "src/debug/debug-scopes.h" 10 #include "src/debug/debug-scopes.h"
(...skipping 29 matching lines...) Expand all
40 SealHandleScope shs(isolate); 40 SealHandleScope shs(isolate);
41 DCHECK(args.length() == 1); 41 DCHECK(args.length() == 1);
42 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0); 42 CONVERT_ARG_HANDLE_CHECKED(Object, value, 0);
43 isolate->debug()->set_return_value(value); 43 isolate->debug()->set_return_value(value);
44 44
45 // Get the top-most JavaScript frame. 45 // Get the top-most JavaScript frame.
46 JavaScriptFrameIterator it(isolate); 46 JavaScriptFrameIterator it(isolate);
47 isolate->debug()->Break(it.frame()); 47 isolate->debug()->Break(it.frame());
48 48
49 // If live-edit has dropped frames, we are not going back to dispatch. 49 // If live-edit has dropped frames, we are not going back to dispatch.
50 if (LiveEdit::SetAfterBreakTarget(isolate->debug())) return Smi::kZero; 50 if (LiveEdit::SetAfterBreakTarget(isolate->debug())) return Smi::FromInt(0);
51 51
52 // Return the handler from the original bytecode array. 52 // Return the handler from the original bytecode array.
53 DCHECK(it.frame()->is_interpreted()); 53 DCHECK(it.frame()->is_interpreted());
54 InterpretedFrame* interpreted_frame = 54 InterpretedFrame* interpreted_frame =
55 reinterpret_cast<InterpretedFrame*>(it.frame()); 55 reinterpret_cast<InterpretedFrame*>(it.frame());
56 SharedFunctionInfo* shared = interpreted_frame->function()->shared(); 56 SharedFunctionInfo* shared = interpreted_frame->function()->shared();
57 BytecodeArray* bytecode_array = shared->bytecode_array(); 57 BytecodeArray* bytecode_array = shared->bytecode_array();
58 int bytecode_offset = interpreted_frame->GetBytecodeOffset(); 58 int bytecode_offset = interpreted_frame->GetBytecodeOffset();
59 interpreter::Bytecode bytecode = 59 interpreter::Bytecode bytecode =
60 interpreter::Bytecodes::FromByte(bytecode_array->get(bytecode_offset)); 60 interpreter::Bytecodes::FromByte(bytecode_array->get(bytecode_offset));
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 HandleScope scope(isolate); 450 HandleScope scope(isolate);
451 DCHECK(args.length() == 1); 451 DCHECK(args.length() == 1);
452 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); 452 CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
453 CHECK(isolate->debug()->CheckExecutionState(break_id)); 453 CHECK(isolate->debug()->CheckExecutionState(break_id));
454 454
455 // Count all frames which are relevant to debugging stack trace. 455 // Count all frames which are relevant to debugging stack trace.
456 int n = 0; 456 int n = 0;
457 StackFrame::Id id = isolate->debug()->break_frame_id(); 457 StackFrame::Id id = isolate->debug()->break_frame_id();
458 if (id == StackFrame::NO_ID) { 458 if (id == StackFrame::NO_ID) {
459 // If there is no JavaScript stack frame count is 0. 459 // If there is no JavaScript stack frame count is 0.
460 return Smi::kZero; 460 return Smi::FromInt(0);
461 } 461 }
462 462
463 for (StackTraceFrameIterator it(isolate, id); !it.done(); it.Advance()) { 463 for (StackTraceFrameIterator it(isolate, id); !it.done(); it.Advance()) {
464 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); 464 List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
465 if (it.is_wasm()) { 465 if (it.is_wasm()) {
466 n++; 466 n++;
467 } else { 467 } else {
468 it.javascript_frame()->Summarize(&frames); 468 it.javascript_frame()->Summarize(&frames);
469 for (int i = frames.length() - 1; i >= 0; i--) { 469 for (int i = frames.length() - 1; i >= 0; i--) {
470 // Omit functions from native and extension scripts. 470 // Omit functions from native and extension scripts.
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 Handle<String> func_name = 556 Handle<String> func_name =
557 wasm::GetWasmFunctionName(isolate, wasm_obj, func_index); 557 wasm::GetWasmFunctionName(isolate, wasm_obj, func_index);
558 details->set(kFrameDetailsFunctionIndex, *func_name); 558 details->set(kFrameDetailsFunctionIndex, *func_name);
559 559
560 // Add the script wrapper 560 // Add the script wrapper
561 Handle<Object> script_wrapper = 561 Handle<Object> script_wrapper =
562 Script::GetWrapper(frame_inspector.GetScript()); 562 Script::GetWrapper(frame_inspector.GetScript());
563 details->set(kFrameDetailsScriptIndex, *script_wrapper); 563 details->set(kFrameDetailsScriptIndex, *script_wrapper);
564 564
565 // Add the arguments count. 565 // Add the arguments count.
566 details->set(kFrameDetailsArgumentCountIndex, Smi::kZero); 566 details->set(kFrameDetailsArgumentCountIndex, Smi::FromInt(0));
567 567
568 // Add the locals count 568 // Add the locals count
569 details->set(kFrameDetailsLocalCountIndex, Smi::kZero); 569 details->set(kFrameDetailsLocalCountIndex, Smi::FromInt(0));
570 570
571 // Add the source position. 571 // Add the source position.
572 if (position != kNoSourcePosition) { 572 if (position != kNoSourcePosition) {
573 details->set(kFrameDetailsSourcePositionIndex, Smi::FromInt(position)); 573 details->set(kFrameDetailsSourcePositionIndex, Smi::FromInt(position));
574 } 574 }
575 575
576 // Add the constructor information. 576 // Add the constructor information.
577 details->set(kFrameDetailsConstructCallIndex, heap->ToBoolean(false)); 577 details->set(kFrameDetailsConstructCallIndex, heap->ToBoolean(false));
578 578
579 // Add the at return information. 579 // Add the at return information.
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 return isolate->heap()->undefined_value(); 922 return isolate->heap()->undefined_value();
923 } 923 }
924 924
925 RETURN_RESULT_OR_FAILURE(isolate, it.MaterializeScopeDetails()); 925 RETURN_RESULT_OR_FAILURE(isolate, it.MaterializeScopeDetails());
926 } 926 }
927 927
928 RUNTIME_FUNCTION(Runtime_GetGeneratorScopeCount) { 928 RUNTIME_FUNCTION(Runtime_GetGeneratorScopeCount) {
929 HandleScope scope(isolate); 929 HandleScope scope(isolate);
930 DCHECK_EQ(1, args.length()); 930 DCHECK_EQ(1, args.length());
931 931
932 if (!args[0]->IsJSGeneratorObject()) return Smi::kZero; 932 if (!args[0]->IsJSGeneratorObject()) return Smi::FromInt(0);
933 933
934 // Check arguments. 934 // Check arguments.
935 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, gen, 0); 935 CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, gen, 0);
936 936
937 // Count the visible scopes. 937 // Count the visible scopes.
938 int n = 0; 938 int n = 0;
939 for (ScopeIterator it(isolate, gen); !it.Done(); it.Next()) { 939 for (ScopeIterator it(isolate, gen); !it.Done(); it.Next()) {
940 n++; 940 n++;
941 } 941 }
942 942
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
1594 1594
1595 Script::InitLineEnds(script_handle); 1595 Script::InitLineEnds(script_handle);
1596 1596
1597 FixedArray* line_ends_array = FixedArray::cast(script_handle->line_ends()); 1597 FixedArray* line_ends_array = FixedArray::cast(script_handle->line_ends());
1598 const int line_count = line_ends_array->length(); 1598 const int line_count = line_ends_array->length();
1599 1599
1600 // If line == line_count, we return the first position beyond the last line. 1600 // If line == line_count, we return the first position beyond the last line.
1601 if (line < 0 || line > line_count) { 1601 if (line < 0 || line > line_count) {
1602 return Smi::FromInt(-1); 1602 return Smi::FromInt(-1);
1603 } else if (line == 0) { 1603 } else if (line == 0) {
1604 return Smi::kZero; 1604 return Smi::FromInt(0);
1605 } else { 1605 } else {
1606 DCHECK(0 < line && line <= line_count); 1606 DCHECK(0 < line && line <= line_count);
1607 const int pos = Smi::cast(line_ends_array->get(line - 1))->value() + 1; 1607 const int pos = Smi::cast(line_ends_array->get(line - 1))->value() + 1;
1608 return Smi::FromInt(pos); 1608 return Smi::FromInt(pos);
1609 } 1609 }
1610 } 1610 }
1611 1611
1612 RUNTIME_FUNCTION(Runtime_ScriptLineEndPosition) { 1612 RUNTIME_FUNCTION(Runtime_ScriptLineEndPosition) {
1613 HandleScope scope(isolate); 1613 HandleScope scope(isolate);
1614 DCHECK(args.length() == 2); 1614 DCHECK(args.length() == 2);
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1867 Handle<Script> script = Handle<Script>(Script::cast(script_val->value())); 1867 Handle<Script> script = Handle<Script>(Script::cast(script_val->value()));
1868 1868
1869 Handle<wasm::WasmDebugInfo> debug_info = 1869 Handle<wasm::WasmDebugInfo> debug_info =
1870 wasm::GetDebugInfo(handle(script->wasm_object(), isolate)); 1870 wasm::GetDebugInfo(handle(script->wasm_object(), isolate));
1871 return *wasm::WasmDebugInfo::DisassembleFunction( 1871 return *wasm::WasmDebugInfo::DisassembleFunction(
1872 debug_info, script->wasm_function_index()); 1872 debug_info, script->wasm_function_index());
1873 } 1873 }
1874 1874
1875 } // namespace internal 1875 } // namespace internal
1876 } // namespace v8 1876 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-compiler.cc ('k') | src/runtime/runtime-i18n.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698