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

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

Issue 2601503002: Add Object::IsNullOrUndefined(Isolate*) helper method (Closed)
Patch Set: fixing merge conflicts Created 3 years, 11 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-array.cc ('k') | src/runtime/runtime-object.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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 73 }
74 74
75 75
76 // Adds a JavaScript function as a debug event listener. 76 // Adds a JavaScript function as a debug event listener.
77 // args[0]: debug event listener function to set or null or undefined for 77 // args[0]: debug event listener function to set or null or undefined for
78 // clearing the event listener function 78 // clearing the event listener function
79 // args[1]: object supplied during callback 79 // args[1]: object supplied during callback
80 RUNTIME_FUNCTION(Runtime_SetDebugEventListener) { 80 RUNTIME_FUNCTION(Runtime_SetDebugEventListener) {
81 SealHandleScope shs(isolate); 81 SealHandleScope shs(isolate);
82 DCHECK_EQ(2, args.length()); 82 DCHECK_EQ(2, args.length());
83 CHECK(args[0]->IsJSFunction() || args[0]->IsUndefined(isolate) || 83 CHECK(args[0]->IsJSFunction() || args[0]->IsNullOrUndefined(isolate));
84 args[0]->IsNull(isolate));
85 CONVERT_ARG_HANDLE_CHECKED(Object, callback, 0); 84 CONVERT_ARG_HANDLE_CHECKED(Object, callback, 0);
86 CONVERT_ARG_HANDLE_CHECKED(Object, data, 1); 85 CONVERT_ARG_HANDLE_CHECKED(Object, data, 1);
87 isolate->debug()->SetEventListener(callback, data); 86 isolate->debug()->SetEventListener(callback, data);
88 87
89 return isolate->heap()->undefined_value(); 88 return isolate->heap()->undefined_value();
90 } 89 }
91 90
92 91
93 RUNTIME_FUNCTION(Runtime_ScheduleBreak) { 92 RUNTIME_FUNCTION(Runtime_ScheduleBreak) {
94 SealHandleScope shs(isolate); 93 SealHandleScope shs(isolate);
(...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after
1695 } 1694 }
1696 1695
1697 Handle<Object> ScriptLocationFromLine(Isolate* isolate, Handle<Script> script, 1696 Handle<Object> ScriptLocationFromLine(Isolate* isolate, Handle<Script> script,
1698 Handle<Object> opt_line, 1697 Handle<Object> opt_line,
1699 Handle<Object> opt_column, 1698 Handle<Object> opt_column,
1700 int32_t offset) { 1699 int32_t offset) {
1701 // Line and column are possibly undefined and we need to handle these cases, 1700 // Line and column are possibly undefined and we need to handle these cases,
1702 // additionally subtracting corresponding offsets. 1701 // additionally subtracting corresponding offsets.
1703 1702
1704 int32_t line = 0; 1703 int32_t line = 0;
1705 if (!opt_line->IsNull(isolate) && !opt_line->IsUndefined(isolate)) { 1704 if (!opt_line->IsNullOrUndefined(isolate)) {
1706 CHECK(opt_line->IsNumber()); 1705 CHECK(opt_line->IsNumber());
1707 line = NumberToInt32(*opt_line) - script->line_offset(); 1706 line = NumberToInt32(*opt_line) - script->line_offset();
1708 } 1707 }
1709 1708
1710 int32_t column = 0; 1709 int32_t column = 0;
1711 if (!opt_column->IsNull(isolate) && !opt_column->IsUndefined(isolate)) { 1710 if (!opt_column->IsNullOrUndefined(isolate)) {
1712 CHECK(opt_column->IsNumber()); 1711 CHECK(opt_column->IsNumber());
1713 column = NumberToInt32(*opt_column); 1712 column = NumberToInt32(*opt_column);
1714 if (line == 0) column -= script->column_offset(); 1713 if (line == 0) column -= script->column_offset();
1715 } 1714 }
1716 1715
1717 int line_position = ScriptLinePositionWithOffset(script, line, offset); 1716 int line_position = ScriptLinePositionWithOffset(script, line, offset);
1718 if (line_position < 0 || column < 0) return isolate->factory()->null_value(); 1717 if (line_position < 0 || column < 0) return isolate->factory()->null_value();
1719 1718
1720 return GetJSPositionInfo(script, line_position + column, Script::NO_OFFSET, 1719 return GetJSPositionInfo(script, line_position + column, Script::NO_OFFSET,
1721 isolate); 1720 isolate);
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1915 } 1914 }
1916 1915
1917 1916
1918 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { 1917 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) {
1919 UNIMPLEMENTED(); 1918 UNIMPLEMENTED();
1920 return NULL; 1919 return NULL;
1921 } 1920 }
1922 1921
1923 } // namespace internal 1922 } // namespace internal
1924 } // namespace v8 1923 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime-array.cc ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698