Commit c4781e34 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[runtime] Deprecate RUNTIME_ASSERT from debugger methods.

This removes explicit uses of the RUNTIME_ASSERT macro from some runtime
methods. The implicit ones in CONVERT_FOO_ARG_CHECKED will be addressed
in a separate CL for all runtime modules at once.

R=yangguo@chromium.org
BUG=v8:5066

Review-Url: https://codereview.chromium.org/2053573004
Cr-Commit-Position: refs/heads/master@{#37545}
parent 45a81674
...@@ -79,8 +79,8 @@ RUNTIME_FUNCTION(Runtime_HandleDebuggerStatement) { ...@@ -79,8 +79,8 @@ RUNTIME_FUNCTION(Runtime_HandleDebuggerStatement) {
RUNTIME_FUNCTION(Runtime_SetDebugEventListener) { RUNTIME_FUNCTION(Runtime_SetDebugEventListener) {
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
DCHECK(args.length() == 2); DCHECK(args.length() == 2);
RUNTIME_ASSERT(args[0]->IsJSFunction() || args[0]->IsUndefined(isolate) || CHECK(args[0]->IsJSFunction() || args[0]->IsUndefined(isolate) ||
args[0]->IsNull(isolate)); args[0]->IsNull(isolate));
CONVERT_ARG_HANDLE_CHECKED(Object, callback, 0); CONVERT_ARG_HANDLE_CHECKED(Object, callback, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, data, 1); CONVERT_ARG_HANDLE_CHECKED(Object, data, 1);
isolate->debug()->SetEventListener(callback, data); isolate->debug()->SetEventListener(callback, data);
...@@ -437,7 +437,7 @@ RUNTIME_FUNCTION(Runtime_CheckExecutionState) { ...@@ -437,7 +437,7 @@ RUNTIME_FUNCTION(Runtime_CheckExecutionState) {
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
DCHECK(args.length() == 1); DCHECK(args.length() == 1);
CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id)); CHECK(isolate->debug()->CheckExecutionState(break_id));
return isolate->heap()->true_value(); return isolate->heap()->true_value();
} }
...@@ -446,7 +446,7 @@ RUNTIME_FUNCTION(Runtime_GetFrameCount) { ...@@ -446,7 +446,7 @@ RUNTIME_FUNCTION(Runtime_GetFrameCount) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK(args.length() == 1); DCHECK(args.length() == 1);
CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id)); CHECK(isolate->debug()->CheckExecutionState(break_id));
// Count all frames which are relevant to debugging stack trace. // Count all frames which are relevant to debugging stack trace.
int n = 0; int n = 0;
...@@ -506,7 +506,7 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) { ...@@ -506,7 +506,7 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK(args.length() == 2); DCHECK(args.length() == 2);
CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id)); CHECK(isolate->debug()->CheckExecutionState(break_id));
CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]);
Heap* heap = isolate->heap(); Heap* heap = isolate->heap();
...@@ -597,7 +597,7 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) { ...@@ -597,7 +597,7 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
// Get scope info and read from it for local variable information. // Get scope info and read from it for local variable information.
Handle<JSFunction> function = Handle<JSFunction> function =
Handle<JSFunction>::cast(frame_inspector.GetFunction()); Handle<JSFunction>::cast(frame_inspector.GetFunction());
RUNTIME_ASSERT(function->shared()->IsSubjectToDebugging()); CHECK(function->shared()->IsSubjectToDebugging());
Handle<SharedFunctionInfo> shared(function->shared()); Handle<SharedFunctionInfo> shared(function->shared());
Handle<ScopeInfo> scope_info(shared->scope_info()); Handle<ScopeInfo> scope_info(shared->scope_info());
DCHECK(*scope_info != ScopeInfo::Empty(isolate)); DCHECK(*scope_info != ScopeInfo::Empty(isolate));
...@@ -777,7 +777,7 @@ RUNTIME_FUNCTION(Runtime_GetScopeCount) { ...@@ -777,7 +777,7 @@ RUNTIME_FUNCTION(Runtime_GetScopeCount) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK(args.length() == 2); DCHECK(args.length() == 2);
CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id)); CHECK(isolate->debug()->CheckExecutionState(break_id));
CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); CONVERT_SMI_ARG_CHECKED(wrapped_id, 1);
...@@ -810,7 +810,7 @@ RUNTIME_FUNCTION(Runtime_GetScopeDetails) { ...@@ -810,7 +810,7 @@ RUNTIME_FUNCTION(Runtime_GetScopeDetails) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK(args.length() == 4); DCHECK(args.length() == 4);
CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id)); CHECK(isolate->debug()->CheckExecutionState(break_id));
CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); CONVERT_SMI_ARG_CHECKED(wrapped_id, 1);
CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]);
...@@ -848,7 +848,7 @@ RUNTIME_FUNCTION(Runtime_GetAllScopesDetails) { ...@@ -848,7 +848,7 @@ RUNTIME_FUNCTION(Runtime_GetAllScopesDetails) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK(args.length() == 3 || args.length() == 4); DCHECK(args.length() == 3 || args.length() == 4);
CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id)); CHECK(isolate->debug()->CheckExecutionState(break_id));
CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); CONVERT_SMI_ARG_CHECKED(wrapped_id, 1);
CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]);
...@@ -958,7 +958,7 @@ RUNTIME_FUNCTION(Runtime_SetScopeVariableValue) { ...@@ -958,7 +958,7 @@ RUNTIME_FUNCTION(Runtime_SetScopeVariableValue) {
bool res; bool res;
if (args[0]->IsNumber()) { if (args[0]->IsNumber()) {
CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id)); CHECK(isolate->debug()->CheckExecutionState(break_id));
CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); CONVERT_SMI_ARG_CHECKED(wrapped_id, 1);
CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]);
...@@ -1018,7 +1018,7 @@ static bool IsPositionAlignmentCodeCorrect(int alignment) { ...@@ -1018,7 +1018,7 @@ static bool IsPositionAlignmentCodeCorrect(int alignment) {
RUNTIME_FUNCTION(Runtime_GetBreakLocations) { RUNTIME_FUNCTION(Runtime_GetBreakLocations) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK(args.length() == 2); DCHECK(args.length() == 2);
RUNTIME_ASSERT(isolate->debug()->is_active()); CHECK(isolate->debug()->is_active());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
CONVERT_NUMBER_CHECKED(int32_t, statement_aligned_code, Int32, args[1]); CONVERT_NUMBER_CHECKED(int32_t, statement_aligned_code, Int32, args[1]);
...@@ -1048,16 +1048,16 @@ RUNTIME_FUNCTION(Runtime_GetBreakLocations) { ...@@ -1048,16 +1048,16 @@ RUNTIME_FUNCTION(Runtime_GetBreakLocations) {
RUNTIME_FUNCTION(Runtime_SetFunctionBreakPoint) { RUNTIME_FUNCTION(Runtime_SetFunctionBreakPoint) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK(args.length() == 3); DCHECK(args.length() == 3);
RUNTIME_ASSERT(isolate->debug()->is_active()); CHECK(isolate->debug()->is_active());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]);
RUNTIME_ASSERT(source_position >= function->shared()->start_position() && CHECK(source_position >= function->shared()->start_position() &&
source_position <= function->shared()->end_position()); source_position <= function->shared()->end_position());
CONVERT_ARG_HANDLE_CHECKED(Object, break_point_object_arg, 2); CONVERT_ARG_HANDLE_CHECKED(Object, break_point_object_arg, 2);
// Set break point. // Set break point.
RUNTIME_ASSERT(isolate->debug()->SetBreakPoint( CHECK(isolate->debug()->SetBreakPoint(function, break_point_object_arg,
function, break_point_object_arg, &source_position)); &source_position));
return Smi::FromInt(source_position); return Smi::FromInt(source_position);
} }
...@@ -1073,10 +1073,10 @@ RUNTIME_FUNCTION(Runtime_SetFunctionBreakPoint) { ...@@ -1073,10 +1073,10 @@ RUNTIME_FUNCTION(Runtime_SetFunctionBreakPoint) {
RUNTIME_FUNCTION(Runtime_SetScriptBreakPoint) { RUNTIME_FUNCTION(Runtime_SetScriptBreakPoint) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK(args.length() == 4); DCHECK(args.length() == 4);
RUNTIME_ASSERT(isolate->debug()->is_active()); CHECK(isolate->debug()->is_active());
CONVERT_ARG_HANDLE_CHECKED(JSValue, wrapper, 0); CONVERT_ARG_HANDLE_CHECKED(JSValue, wrapper, 0);
CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]); CONVERT_NUMBER_CHECKED(int32_t, source_position, Int32, args[1]);
RUNTIME_ASSERT(source_position >= 0); CHECK(source_position >= 0);
CONVERT_NUMBER_CHECKED(int32_t, statement_aligned_code, Int32, args[2]); CONVERT_NUMBER_CHECKED(int32_t, statement_aligned_code, Int32, args[2]);
CONVERT_ARG_HANDLE_CHECKED(Object, break_point_object_arg, 3); CONVERT_ARG_HANDLE_CHECKED(Object, break_point_object_arg, 3);
...@@ -1087,7 +1087,7 @@ RUNTIME_FUNCTION(Runtime_SetScriptBreakPoint) { ...@@ -1087,7 +1087,7 @@ RUNTIME_FUNCTION(Runtime_SetScriptBreakPoint) {
static_cast<BreakPositionAlignment>(statement_aligned_code); static_cast<BreakPositionAlignment>(statement_aligned_code);
// Get the script from the script wrapper. // Get the script from the script wrapper.
RUNTIME_ASSERT(wrapper->value()->IsScript()); CHECK(wrapper->value()->IsScript());
Handle<Script> script(Script::cast(wrapper->value())); Handle<Script> script(Script::cast(wrapper->value()));
// Set break point. // Set break point.
...@@ -1105,7 +1105,7 @@ RUNTIME_FUNCTION(Runtime_SetScriptBreakPoint) { ...@@ -1105,7 +1105,7 @@ RUNTIME_FUNCTION(Runtime_SetScriptBreakPoint) {
RUNTIME_FUNCTION(Runtime_ClearBreakPoint) { RUNTIME_FUNCTION(Runtime_ClearBreakPoint) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK(args.length() == 1); DCHECK(args.length() == 1);
RUNTIME_ASSERT(isolate->debug()->is_active()); CHECK(isolate->debug()->is_active());
CONVERT_ARG_HANDLE_CHECKED(Object, break_point_object_arg, 0); CONVERT_ARG_HANDLE_CHECKED(Object, break_point_object_arg, 0);
// Clear break point. // Clear break point.
...@@ -1155,7 +1155,7 @@ RUNTIME_FUNCTION(Runtime_PrepareStep) { ...@@ -1155,7 +1155,7 @@ RUNTIME_FUNCTION(Runtime_PrepareStep) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK(args.length() == 2); DCHECK(args.length() == 2);
CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id)); CHECK(isolate->debug()->CheckExecutionState(break_id));
if (!args[1]->IsNumber()) { if (!args[1]->IsNumber()) {
return isolate->Throw(isolate->heap()->illegal_argument_string()); return isolate->Throw(isolate->heap()->illegal_argument_string());
...@@ -1181,7 +1181,7 @@ RUNTIME_FUNCTION(Runtime_PrepareStep) { ...@@ -1181,7 +1181,7 @@ RUNTIME_FUNCTION(Runtime_PrepareStep) {
RUNTIME_FUNCTION(Runtime_ClearStepping) { RUNTIME_FUNCTION(Runtime_ClearStepping) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK(args.length() == 0); DCHECK(args.length() == 0);
RUNTIME_ASSERT(isolate->debug()->is_active()); CHECK(isolate->debug()->is_active());
isolate->debug()->ClearStepping(); isolate->debug()->ClearStepping();
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
} }
...@@ -1194,7 +1194,7 @@ RUNTIME_FUNCTION(Runtime_DebugEvaluate) { ...@@ -1194,7 +1194,7 @@ RUNTIME_FUNCTION(Runtime_DebugEvaluate) {
// evaluated. // evaluated.
DCHECK(args.length() == 6); DCHECK(args.length() == 6);
CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id)); CHECK(isolate->debug()->CheckExecutionState(break_id));
CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); CONVERT_SMI_ARG_CHECKED(wrapped_id, 1);
CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]);
...@@ -1217,7 +1217,7 @@ RUNTIME_FUNCTION(Runtime_DebugEvaluateGlobal) { ...@@ -1217,7 +1217,7 @@ RUNTIME_FUNCTION(Runtime_DebugEvaluateGlobal) {
// evaluated. // evaluated.
DCHECK(args.length() == 4); DCHECK(args.length() == 4);
CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id)); CHECK(isolate->debug()->CheckExecutionState(break_id));
CONVERT_ARG_HANDLE_CHECKED(String, source, 1); CONVERT_ARG_HANDLE_CHECKED(String, source, 1);
CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 2); CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 2);
...@@ -1232,7 +1232,10 @@ RUNTIME_FUNCTION(Runtime_DebugEvaluateGlobal) { ...@@ -1232,7 +1232,10 @@ RUNTIME_FUNCTION(Runtime_DebugEvaluateGlobal) {
RUNTIME_FUNCTION(Runtime_DebugGetLoadedScripts) { RUNTIME_FUNCTION(Runtime_DebugGetLoadedScripts) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK(args.length() == 0); DCHECK(args.length() == 0);
RUNTIME_ASSERT(isolate->debug()->is_active());
// This runtime function is used by the debugger to determine whether the
// debugger is active or not. Hence we fail gracefully here and don't crash.
if (!isolate->debug()->is_active()) return isolate->ThrowIllegalOperation();
Handle<FixedArray> instances; Handle<FixedArray> instances;
{ {
...@@ -1282,9 +1285,9 @@ RUNTIME_FUNCTION(Runtime_DebugReferencedBy) { ...@@ -1282,9 +1285,9 @@ RUNTIME_FUNCTION(Runtime_DebugReferencedBy) {
DCHECK(args.length() == 3); DCHECK(args.length() == 3);
CONVERT_ARG_HANDLE_CHECKED(JSObject, target, 0); CONVERT_ARG_HANDLE_CHECKED(JSObject, target, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, filter, 1); CONVERT_ARG_HANDLE_CHECKED(Object, filter, 1);
RUNTIME_ASSERT(filter->IsUndefined(isolate) || filter->IsJSObject()); CHECK(filter->IsUndefined(isolate) || filter->IsJSObject());
CONVERT_NUMBER_CHECKED(int32_t, max_references, Int32, args[2]); CONVERT_NUMBER_CHECKED(int32_t, max_references, Int32, args[2]);
RUNTIME_ASSERT(max_references >= 0); CHECK(max_references >= 0);
List<Handle<JSObject> > instances; List<Handle<JSObject> > instances;
Heap* heap = isolate->heap(); Heap* heap = isolate->heap();
...@@ -1339,7 +1342,7 @@ RUNTIME_FUNCTION(Runtime_DebugConstructedBy) { ...@@ -1339,7 +1342,7 @@ RUNTIME_FUNCTION(Runtime_DebugConstructedBy) {
DCHECK(args.length() == 2); DCHECK(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, 0);
CONVERT_NUMBER_CHECKED(int32_t, max_references, Int32, args[1]); CONVERT_NUMBER_CHECKED(int32_t, max_references, Int32, args[1]);
RUNTIME_ASSERT(max_references >= 0); CHECK(max_references >= 0);
List<Handle<JSObject> > instances; List<Handle<JSObject> > instances;
Heap* heap = isolate->heap(); Heap* heap = isolate->heap();
...@@ -1385,11 +1388,15 @@ RUNTIME_FUNCTION(Runtime_DebugSetScriptSource) { ...@@ -1385,11 +1388,15 @@ RUNTIME_FUNCTION(Runtime_DebugSetScriptSource) {
CONVERT_ARG_HANDLE_CHECKED(JSValue, script_wrapper, 0); CONVERT_ARG_HANDLE_CHECKED(JSValue, script_wrapper, 0);
CONVERT_ARG_HANDLE_CHECKED(String, source, 1); CONVERT_ARG_HANDLE_CHECKED(String, source, 1);
RUNTIME_ASSERT(script_wrapper->value()->IsScript()); CHECK(script_wrapper->value()->IsScript());
Handle<Script> script(Script::cast(script_wrapper->value())); Handle<Script> script(Script::cast(script_wrapper->value()));
int compilation_state = script->compilation_state(); // The following condition is not guaranteed to hold and a failure is also
RUNTIME_ASSERT(compilation_state == Script::COMPILATION_STATE_INITIAL); // propagated to callers. Hence we fail gracefully here and don't crash.
if (script->compilation_state() != Script::COMPILATION_STATE_INITIAL) {
return isolate->ThrowIllegalOperation();
}
script->set_source(*source); script->set_source(*source);
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
...@@ -1518,7 +1525,7 @@ RUNTIME_FUNCTION(Runtime_ScriptLineCount) { ...@@ -1518,7 +1525,7 @@ RUNTIME_FUNCTION(Runtime_ScriptLineCount) {
DCHECK(args.length() == 1); DCHECK(args.length() == 1);
CONVERT_ARG_CHECKED(JSValue, script, 0); CONVERT_ARG_CHECKED(JSValue, script, 0);
RUNTIME_ASSERT(script->value()->IsScript()); CHECK(script->value()->IsScript());
Handle<Script> script_handle = Handle<Script>(Script::cast(script->value())); Handle<Script> script_handle = Handle<Script>(Script::cast(script->value()));
Script::InitLineEnds(script_handle); Script::InitLineEnds(script_handle);
...@@ -1533,7 +1540,7 @@ RUNTIME_FUNCTION(Runtime_ScriptLineStartPosition) { ...@@ -1533,7 +1540,7 @@ RUNTIME_FUNCTION(Runtime_ScriptLineStartPosition) {
CONVERT_ARG_CHECKED(JSValue, script, 0); CONVERT_ARG_CHECKED(JSValue, script, 0);
CONVERT_NUMBER_CHECKED(int32_t, line, Int32, args[1]); CONVERT_NUMBER_CHECKED(int32_t, line, Int32, args[1]);
RUNTIME_ASSERT(script->value()->IsScript()); CHECK(script->value()->IsScript());
Handle<Script> script_handle = Handle<Script>(Script::cast(script->value())); Handle<Script> script_handle = Handle<Script>(Script::cast(script->value()));
Script::InitLineEnds(script_handle); Script::InitLineEnds(script_handle);
...@@ -1559,7 +1566,7 @@ RUNTIME_FUNCTION(Runtime_ScriptLineEndPosition) { ...@@ -1559,7 +1566,7 @@ RUNTIME_FUNCTION(Runtime_ScriptLineEndPosition) {
CONVERT_ARG_CHECKED(JSValue, script, 0); CONVERT_ARG_CHECKED(JSValue, script, 0);
CONVERT_NUMBER_CHECKED(int32_t, line, Int32, args[1]); CONVERT_NUMBER_CHECKED(int32_t, line, Int32, args[1]);
RUNTIME_ASSERT(script->value()->IsScript()); CHECK(script->value()->IsScript());
Handle<Script> script_handle = Handle<Script>(Script::cast(script->value())); Handle<Script> script_handle = Handle<Script>(Script::cast(script->value()));
Script::InitLineEnds(script_handle); Script::InitLineEnds(script_handle);
...@@ -1618,7 +1625,7 @@ RUNTIME_FUNCTION(Runtime_ScriptLocationFromLine) { ...@@ -1618,7 +1625,7 @@ RUNTIME_FUNCTION(Runtime_ScriptLocationFromLine) {
DCHECK(args.length() == 4); DCHECK(args.length() == 4);
CONVERT_ARG_CHECKED(JSValue, script, 0); CONVERT_ARG_CHECKED(JSValue, script, 0);
RUNTIME_ASSERT(script->value()->IsScript()); CHECK(script->value()->IsScript());
Handle<Script> script_handle = Handle<Script>(Script::cast(script->value())); Handle<Script> script_handle = Handle<Script>(Script::cast(script->value()));
// Line and column are possibly undefined and we need to handle these cases, // Line and column are possibly undefined and we need to handle these cases,
...@@ -1628,7 +1635,7 @@ RUNTIME_FUNCTION(Runtime_ScriptLocationFromLine) { ...@@ -1628,7 +1635,7 @@ RUNTIME_FUNCTION(Runtime_ScriptLocationFromLine) {
if (args[1]->IsNull(isolate) || args[1]->IsUndefined(isolate)) { if (args[1]->IsNull(isolate) || args[1]->IsUndefined(isolate)) {
line = 0; line = 0;
} else { } else {
RUNTIME_ASSERT(args[1]->IsNumber()); CHECK(args[1]->IsNumber());
line = NumberToInt32(args[1]) - script_handle->line_offset(); line = NumberToInt32(args[1]) - script_handle->line_offset();
} }
...@@ -1636,7 +1643,7 @@ RUNTIME_FUNCTION(Runtime_ScriptLocationFromLine) { ...@@ -1636,7 +1643,7 @@ RUNTIME_FUNCTION(Runtime_ScriptLocationFromLine) {
if (args[2]->IsNull(isolate) || args[2]->IsUndefined(isolate)) { if (args[2]->IsNull(isolate) || args[2]->IsUndefined(isolate)) {
column = 0; column = 0;
} else { } else {
RUNTIME_ASSERT(args[2]->IsNumber()); CHECK(args[2]->IsNumber());
column = NumberToInt32(args[2]); column = NumberToInt32(args[2]);
if (line == 0) column -= script_handle->column_offset(); if (line == 0) column -= script_handle->column_offset();
} }
...@@ -1682,7 +1689,7 @@ RUNTIME_FUNCTION(Runtime_ScriptPositionInfo) { ...@@ -1682,7 +1689,7 @@ RUNTIME_FUNCTION(Runtime_ScriptPositionInfo) {
CONVERT_NUMBER_CHECKED(int32_t, position, Int32, args[1]); CONVERT_NUMBER_CHECKED(int32_t, position, Int32, args[1]);
CONVERT_BOOLEAN_ARG_CHECKED(with_offset, 2); CONVERT_BOOLEAN_ARG_CHECKED(with_offset, 2);
RUNTIME_ASSERT(script->value()->IsScript()); CHECK(script->value()->IsScript());
Handle<Script> script_handle = Handle<Script>(Script::cast(script->value())); Handle<Script> script_handle = Handle<Script>(Script::cast(script->value()));
const Script::OffsetFlag offset_flag = const Script::OffsetFlag offset_flag =
...@@ -1698,7 +1705,7 @@ RUNTIME_FUNCTION(Runtime_ScriptSourceLine) { ...@@ -1698,7 +1705,7 @@ RUNTIME_FUNCTION(Runtime_ScriptSourceLine) {
CONVERT_ARG_CHECKED(JSValue, script, 0); CONVERT_ARG_CHECKED(JSValue, script, 0);
CONVERT_NUMBER_CHECKED(int32_t, line, Int32, args[1]); CONVERT_NUMBER_CHECKED(int32_t, line, Int32, args[1]);
RUNTIME_ASSERT(script->value()->IsScript()); CHECK(script->value()->IsScript());
Handle<Script> script_handle = Handle<Script>(Script::cast(script->value())); Handle<Script> script_handle = Handle<Script>(Script::cast(script->value()));
Script::InitLineEnds(script_handle); Script::InitLineEnds(script_handle);
...@@ -1793,7 +1800,7 @@ RUNTIME_FUNCTION(Runtime_GetWasmFunctionOffsetTable) { ...@@ -1793,7 +1800,7 @@ RUNTIME_FUNCTION(Runtime_GetWasmFunctionOffsetTable) {
HandleScope scope(isolate); HandleScope scope(isolate);
CONVERT_ARG_CHECKED(JSValue, script_val, 0); CONVERT_ARG_CHECKED(JSValue, script_val, 0);
RUNTIME_ASSERT(script_val->value()->IsScript()); CHECK(script_val->value()->IsScript());
Handle<Script> script = Handle<Script>(Script::cast(script_val->value())); Handle<Script> script = Handle<Script>(Script::cast(script_val->value()));
Handle<wasm::WasmDebugInfo> debug_info( Handle<wasm::WasmDebugInfo> debug_info(
...@@ -1808,7 +1815,7 @@ RUNTIME_FUNCTION(Runtime_DisassembleWasmFunction) { ...@@ -1808,7 +1815,7 @@ RUNTIME_FUNCTION(Runtime_DisassembleWasmFunction) {
HandleScope scope(isolate); HandleScope scope(isolate);
CONVERT_ARG_CHECKED(JSValue, script_val, 0); CONVERT_ARG_CHECKED(JSValue, script_val, 0);
RUNTIME_ASSERT(script_val->value()->IsScript()); CHECK(script_val->value()->IsScript());
Handle<Script> script = Handle<Script>(Script::cast(script_val->value())); Handle<Script> script = Handle<Script>(Script::cast(script_val->value()));
Handle<wasm::WasmDebugInfo> debug_info( Handle<wasm::WasmDebugInfo> debug_info(
......
...@@ -24,7 +24,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditFindSharedFunctionInfosForScript) { ...@@ -24,7 +24,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditFindSharedFunctionInfosForScript) {
DCHECK(args.length() == 1); DCHECK(args.length() == 1);
CONVERT_ARG_CHECKED(JSValue, script_value, 0); CONVERT_ARG_CHECKED(JSValue, script_value, 0);
RUNTIME_ASSERT(script_value->value()->IsScript()); CHECK(script_value->value()->IsScript());
Handle<Script> script = Handle<Script>(Script::cast(script_value->value())); Handle<Script> script = Handle<Script>(Script::cast(script_value->value()));
List<Handle<SharedFunctionInfo> > found; List<Handle<SharedFunctionInfo> > found;
...@@ -67,7 +67,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditGatherCompileInfo) { ...@@ -67,7 +67,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditGatherCompileInfo) {
CONVERT_ARG_CHECKED(JSValue, script, 0); CONVERT_ARG_CHECKED(JSValue, script, 0);
CONVERT_ARG_HANDLE_CHECKED(String, source, 1); CONVERT_ARG_HANDLE_CHECKED(String, source, 1);
RUNTIME_ASSERT(script->value()->IsScript()); CHECK(script->value()->IsScript());
Handle<Script> script_handle = Handle<Script>(Script::cast(script->value())); Handle<Script> script_handle = Handle<Script>(Script::cast(script->value()));
RETURN_RESULT_OR_FAILURE(isolate, RETURN_RESULT_OR_FAILURE(isolate,
...@@ -86,7 +86,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditReplaceScript) { ...@@ -86,7 +86,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditReplaceScript) {
CONVERT_ARG_HANDLE_CHECKED(String, new_source, 1); CONVERT_ARG_HANDLE_CHECKED(String, new_source, 1);
CONVERT_ARG_HANDLE_CHECKED(Object, old_script_name, 2); CONVERT_ARG_HANDLE_CHECKED(Object, old_script_name, 2);
RUNTIME_ASSERT(original_script_value->value()->IsScript()); CHECK(original_script_value->value()->IsScript());
Handle<Script> original_script(Script::cast(original_script_value->value())); Handle<Script> original_script(Script::cast(original_script_value->value()));
Handle<Object> old_script = LiveEdit::ChangeScriptSource( Handle<Object> old_script = LiveEdit::ChangeScriptSource(
...@@ -106,7 +106,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditFunctionSourceUpdated) { ...@@ -106,7 +106,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditFunctionSourceUpdated) {
CHECK(isolate->debug()->live_edit_enabled()); CHECK(isolate->debug()->live_edit_enabled());
DCHECK(args.length() == 1); DCHECK(args.length() == 1);
CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_info, 0); CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_info, 0);
RUNTIME_ASSERT(SharedInfoWrapper::IsInstance(shared_info)); CHECK(SharedInfoWrapper::IsInstance(shared_info));
LiveEdit::FunctionSourceUpdated(shared_info); LiveEdit::FunctionSourceUpdated(shared_info);
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
...@@ -120,7 +120,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditReplaceFunctionCode) { ...@@ -120,7 +120,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditReplaceFunctionCode) {
DCHECK(args.length() == 2); DCHECK(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(JSArray, new_compile_info, 0); CONVERT_ARG_HANDLE_CHECKED(JSArray, new_compile_info, 0);
CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_info, 1); CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_info, 1);
RUNTIME_ASSERT(SharedInfoWrapper::IsInstance(shared_info)); CHECK(SharedInfoWrapper::IsInstance(shared_info));
LiveEdit::ReplaceFunctionCode(new_compile_info, shared_info); LiveEdit::ReplaceFunctionCode(new_compile_info, shared_info);
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
...@@ -138,11 +138,11 @@ RUNTIME_FUNCTION(Runtime_LiveEditFunctionSetScript) { ...@@ -138,11 +138,11 @@ RUNTIME_FUNCTION(Runtime_LiveEditFunctionSetScript) {
if (function_object->IsJSValue()) { if (function_object->IsJSValue()) {
Handle<JSValue> function_wrapper = Handle<JSValue>::cast(function_object); Handle<JSValue> function_wrapper = Handle<JSValue>::cast(function_object);
if (script_object->IsJSValue()) { if (script_object->IsJSValue()) {
RUNTIME_ASSERT(JSValue::cast(*script_object)->value()->IsScript()); CHECK(JSValue::cast(*script_object)->value()->IsScript());
Script* script = Script::cast(JSValue::cast(*script_object)->value()); Script* script = Script::cast(JSValue::cast(*script_object)->value());
script_object = Handle<Object>(script, isolate); script_object = Handle<Object>(script, isolate);
} }
RUNTIME_ASSERT(function_wrapper->value()->IsSharedFunctionInfo()); CHECK(function_wrapper->value()->IsSharedFunctionInfo());
LiveEdit::SetFunctionScript(function_wrapper, script_object); LiveEdit::SetFunctionScript(function_wrapper, script_object);
} else { } else {
// Just ignore this. We may not have a SharedFunctionInfo for some functions // Just ignore this. We may not have a SharedFunctionInfo for some functions
...@@ -163,9 +163,9 @@ RUNTIME_FUNCTION(Runtime_LiveEditReplaceRefToNestedFunction) { ...@@ -163,9 +163,9 @@ RUNTIME_FUNCTION(Runtime_LiveEditReplaceRefToNestedFunction) {
CONVERT_ARG_HANDLE_CHECKED(JSValue, parent_wrapper, 0); CONVERT_ARG_HANDLE_CHECKED(JSValue, parent_wrapper, 0);
CONVERT_ARG_HANDLE_CHECKED(JSValue, orig_wrapper, 1); CONVERT_ARG_HANDLE_CHECKED(JSValue, orig_wrapper, 1);
CONVERT_ARG_HANDLE_CHECKED(JSValue, subst_wrapper, 2); CONVERT_ARG_HANDLE_CHECKED(JSValue, subst_wrapper, 2);
RUNTIME_ASSERT(parent_wrapper->value()->IsSharedFunctionInfo()); CHECK(parent_wrapper->value()->IsSharedFunctionInfo());
RUNTIME_ASSERT(orig_wrapper->value()->IsSharedFunctionInfo()); CHECK(orig_wrapper->value()->IsSharedFunctionInfo());
RUNTIME_ASSERT(subst_wrapper->value()->IsSharedFunctionInfo()); CHECK(subst_wrapper->value()->IsSharedFunctionInfo());
LiveEdit::ReplaceRefToNestedFunction(parent_wrapper, orig_wrapper, LiveEdit::ReplaceRefToNestedFunction(parent_wrapper, orig_wrapper,
subst_wrapper); subst_wrapper);
...@@ -184,7 +184,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditPatchFunctionPositions) { ...@@ -184,7 +184,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditPatchFunctionPositions) {
DCHECK(args.length() == 2); DCHECK(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_array, 0); CONVERT_ARG_HANDLE_CHECKED(JSArray, shared_array, 0);
CONVERT_ARG_HANDLE_CHECKED(JSArray, position_change_array, 1); CONVERT_ARG_HANDLE_CHECKED(JSArray, position_change_array, 1);
RUNTIME_ASSERT(SharedInfoWrapper::IsInstance(shared_array)); CHECK(SharedInfoWrapper::IsInstance(shared_array));
LiveEdit::PatchFunctionPositions(shared_array, position_change_array); LiveEdit::PatchFunctionPositions(shared_array, position_change_array);
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
...@@ -203,10 +203,10 @@ RUNTIME_FUNCTION(Runtime_LiveEditCheckAndDropActivations) { ...@@ -203,10 +203,10 @@ RUNTIME_FUNCTION(Runtime_LiveEditCheckAndDropActivations) {
CONVERT_ARG_HANDLE_CHECKED(JSArray, new_shared_array, 1); CONVERT_ARG_HANDLE_CHECKED(JSArray, new_shared_array, 1);
CONVERT_BOOLEAN_ARG_CHECKED(do_drop, 2); CONVERT_BOOLEAN_ARG_CHECKED(do_drop, 2);
USE(new_shared_array); USE(new_shared_array);
RUNTIME_ASSERT(old_shared_array->length()->IsSmi()); CHECK(old_shared_array->length()->IsSmi());
RUNTIME_ASSERT(new_shared_array->length() == old_shared_array->length()); CHECK(new_shared_array->length() == old_shared_array->length());
RUNTIME_ASSERT(old_shared_array->HasFastElements()); CHECK(old_shared_array->HasFastElements());
RUNTIME_ASSERT(new_shared_array->HasFastElements()); CHECK(new_shared_array->HasFastElements());
int array_length = Smi::cast(old_shared_array->length())->value(); int array_length = Smi::cast(old_shared_array->length())->value();
for (int i = 0; i < array_length; i++) { for (int i = 0; i < array_length; i++) {
Handle<Object> old_element; Handle<Object> old_element;
...@@ -214,13 +214,12 @@ RUNTIME_FUNCTION(Runtime_LiveEditCheckAndDropActivations) { ...@@ -214,13 +214,12 @@ RUNTIME_FUNCTION(Runtime_LiveEditCheckAndDropActivations) {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, old_element, isolate, old_element,
JSReceiver::GetElement(isolate, old_shared_array, i)); JSReceiver::GetElement(isolate, old_shared_array, i));
RUNTIME_ASSERT( CHECK(old_element->IsJSValue() &&
old_element->IsJSValue() && Handle<JSValue>::cast(old_element)->value()->IsSharedFunctionInfo());
Handle<JSValue>::cast(old_element)->value()->IsSharedFunctionInfo());
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, new_element, isolate, new_element,
JSReceiver::GetElement(isolate, new_shared_array, i)); JSReceiver::GetElement(isolate, new_shared_array, i));
RUNTIME_ASSERT( CHECK(
new_element->IsUndefined(isolate) || new_element->IsUndefined(isolate) ||
(new_element->IsJSValue() && (new_element->IsJSValue() &&
Handle<JSValue>::cast(new_element)->value()->IsSharedFunctionInfo())); Handle<JSValue>::cast(new_element)->value()->IsSharedFunctionInfo()));
...@@ -259,7 +258,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditRestartFrame) { ...@@ -259,7 +258,7 @@ RUNTIME_FUNCTION(Runtime_LiveEditRestartFrame) {
CHECK(isolate->debug()->live_edit_enabled()); CHECK(isolate->debug()->live_edit_enabled());
DCHECK(args.length() == 2); DCHECK(args.length() == 2);
CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
RUNTIME_ASSERT(isolate->debug()->CheckExecutionState(break_id)); CHECK(isolate->debug()->CheckExecutionState(break_id));
CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]); CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]);
Heap* heap = isolate->heap(); Heap* heap = isolate->heap();
......
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
var a = new Array();
var b = new Array();
Object.freeze(a);
assertThrows(function() { %LiveEditCheckAndDropActivations(a, b, true); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment