mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:17:35 +00:00
Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
This commit is contained in:
parent
b33a6a443e
commit
5d180d1f99
725 changed files with 3448 additions and 3448 deletions
|
@ -145,7 +145,7 @@ CallExpression::ThisAndCallee CallExpression::compute_this_and_callee(Interprete
|
|||
if (is<SuperExpression>(*m_callee)) {
|
||||
// If we are calling super, |this| has not been initialized yet, and would not be meaningful to provide.
|
||||
auto new_target = vm.get_new_target();
|
||||
ASSERT(new_target.is_function());
|
||||
VERIFY(new_target.is_function());
|
||||
return { js_undefined(), new_target };
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ Value CallExpression::execute(Interpreter& interpreter, GlobalObject& global_obj
|
|||
if (vm.exception())
|
||||
return {};
|
||||
|
||||
ASSERT(!callee.is_empty());
|
||||
VERIFY(!callee.is_empty());
|
||||
|
||||
if (!callee.is_function()
|
||||
|| (is<NewExpression>(*this) && (is<NativeFunction>(callee.as_object()) && !static_cast<NativeFunction&>(callee.as_object()).has_constructor()))) {
|
||||
|
@ -301,7 +301,7 @@ Value WithStatement::execute(Interpreter& interpreter, GlobalObject& global_obje
|
|||
if (interpreter.exception())
|
||||
return {};
|
||||
|
||||
ASSERT(object);
|
||||
VERIFY(object);
|
||||
|
||||
auto* with_scope = interpreter.heap().allocate<WithScope>(global_object, *object, interpreter.vm().call_frame().scope);
|
||||
TemporaryChange<ScopeObject*> scope_change(interpreter.vm().call_frame().scope, with_scope);
|
||||
|
@ -456,7 +456,7 @@ static FlyString variable_from_for_declaration(Interpreter& interpreter, GlobalO
|
|||
FlyString variable_name;
|
||||
if (is<VariableDeclaration>(node)) {
|
||||
auto& variable_declaration = static_cast<const VariableDeclaration&>(node);
|
||||
ASSERT(!variable_declaration.declarations().is_empty());
|
||||
VERIFY(!variable_declaration.declarations().is_empty());
|
||||
if (variable_declaration.declaration_kind() != DeclarationKind::Var) {
|
||||
wrapper = create_ast_node<BlockStatement>(node.source_range());
|
||||
interpreter.enter_scope(*wrapper, ScopeType::Block, global_object);
|
||||
|
@ -466,7 +466,7 @@ static FlyString variable_from_for_declaration(Interpreter& interpreter, GlobalO
|
|||
} else if (is<Identifier>(node)) {
|
||||
variable_name = static_cast<const Identifier&>(node).string();
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
return variable_name;
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ Value ForInStatement::execute(Interpreter& interpreter, GlobalObject& global_obj
|
|||
|
||||
if (!is<VariableDeclaration>(*m_lhs) && !is<Identifier>(*m_lhs)) {
|
||||
// FIXME: Implement "for (foo.bar in baz)", "for (foo[0] in bar)"
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
RefPtr<BlockStatement> wrapper;
|
||||
auto variable_name = variable_from_for_declaration(interpreter, global_object, m_lhs, wrapper);
|
||||
|
@ -525,7 +525,7 @@ Value ForOfStatement::execute(Interpreter& interpreter, GlobalObject& global_obj
|
|||
|
||||
if (!is<VariableDeclaration>(*m_lhs) && !is<Identifier>(*m_lhs)) {
|
||||
// FIXME: Implement "for (foo.bar of baz)", "for (foo[0] of bar)"
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
RefPtr<BlockStatement> wrapper;
|
||||
auto variable_name = variable_from_for_declaration(interpreter, global_object, m_lhs, wrapper);
|
||||
|
@ -621,7 +621,7 @@ Value BinaryExpression::execute(Interpreter& interpreter, GlobalObject& global_o
|
|||
return instance_of(global_object, lhs_result, rhs_result);
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Value LogicalExpression::execute(Interpreter& interpreter, GlobalObject& global_object) const
|
||||
|
@ -660,7 +660,7 @@ Value LogicalExpression::execute(Interpreter& interpreter, GlobalObject& global_
|
|||
return lhs_result;
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Reference Expression::to_reference(Interpreter&, GlobalObject&) const
|
||||
|
@ -697,7 +697,7 @@ Value UnaryExpression::execute(Interpreter& interpreter, GlobalObject& global_ob
|
|||
if (reference.is_unresolvable())
|
||||
return Value(true);
|
||||
// FIXME: Support deleting locals
|
||||
ASSERT(!reference.is_local_variable());
|
||||
VERIFY(!reference.is_local_variable());
|
||||
if (reference.is_global_variable())
|
||||
return global_object.delete_property(reference.name());
|
||||
auto* base_object = reference.base().to_object(global_object);
|
||||
|
@ -737,7 +737,7 @@ Value UnaryExpression::execute(Interpreter& interpreter, GlobalObject& global_ob
|
|||
case UnaryOp::Typeof:
|
||||
switch (lhs_result.type()) {
|
||||
case Value::Type::Empty:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
return {};
|
||||
case Value::Type::Undefined:
|
||||
return js_string(vm, "undefined");
|
||||
|
@ -760,15 +760,15 @@ Value UnaryExpression::execute(Interpreter& interpreter, GlobalObject& global_ob
|
|||
case Value::Type::BigInt:
|
||||
return js_string(vm, "bigint");
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
case UnaryOp::Void:
|
||||
return js_undefined();
|
||||
case UnaryOp::Delete:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Value SuperExpression::execute(Interpreter& interpreter, GlobalObject&) const
|
||||
|
@ -777,7 +777,7 @@ Value SuperExpression::execute(Interpreter& interpreter, GlobalObject&) const
|
|||
ScopeGuard exit_node { [&] { interpreter.exit_node(*this); } };
|
||||
|
||||
// The semantics for SuperExpressions are handled in CallExpression::compute_this_and_callee()
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Value ClassMethod::execute(Interpreter& interpreter, GlobalObject& global_object) const
|
||||
|
@ -800,7 +800,7 @@ Value ClassExpression::execute(Interpreter& interpreter, GlobalObject& global_ob
|
|||
|
||||
update_function_name(class_constructor_value, m_name);
|
||||
|
||||
ASSERT(class_constructor_value.is_function() && is<ScriptFunction>(class_constructor_value.as_function()));
|
||||
VERIFY(class_constructor_value.is_function() && is<ScriptFunction>(class_constructor_value.as_function()));
|
||||
ScriptFunction* class_constructor = static_cast<ScriptFunction*>(&class_constructor_value.as_function());
|
||||
class_constructor->set_is_class_constructor();
|
||||
Value super_constructor = js_undefined();
|
||||
|
@ -870,7 +870,7 @@ Value ClassExpression::execute(Interpreter& interpreter, GlobalObject& global_ob
|
|||
case ClassMethod::Kind::Setter:
|
||||
return String::formatted("set {}", get_function_name(global_object, key));
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}();
|
||||
update_function_name(method_value, accessor_name);
|
||||
|
@ -1492,7 +1492,7 @@ Value UpdateExpression::execute(Interpreter& interpreter, GlobalObject& global_o
|
|||
new_value = js_bigint(interpreter.heap(), old_value.as_bigint().big_integer().minus(Crypto::SignedBigInteger { 1 }));
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
reference.put(global_object, new_value);
|
||||
|
@ -1610,7 +1610,7 @@ Value VariableDeclarator::execute(Interpreter& interpreter, GlobalObject&) const
|
|||
ScopeGuard exit_node { [&] { interpreter.exit_node(*this); } };
|
||||
|
||||
// NOTE: VariableDeclarator execution is handled by VariableDeclaration.
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void VariableDeclaration::dump(int indent) const
|
||||
|
@ -1671,7 +1671,7 @@ Value ObjectProperty::execute(Interpreter& interpreter, GlobalObject&) const
|
|||
ScopeGuard exit_node { [&] { interpreter.exit_node(*this); } };
|
||||
|
||||
// NOTE: ObjectProperty execution is handled by ObjectExpression.
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Value ObjectExpression::execute(Interpreter& interpreter, GlobalObject& global_object) const
|
||||
|
@ -1733,7 +1733,7 @@ Value ObjectExpression::execute(Interpreter& interpreter, GlobalObject& global_o
|
|||
update_function_name(value, name);
|
||||
|
||||
if (property.type() == ObjectProperty::Type::Getter || property.type() == ObjectProperty::Type::Setter) {
|
||||
ASSERT(value.is_function());
|
||||
VERIFY(value.is_function());
|
||||
object->define_accessor(PropertyName::from_value(global_object, key), value.as_function(), property.type() == ObjectProperty::Type::Getter, Attribute::Configurable | Attribute::Enumerable);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
|
@ -1757,13 +1757,13 @@ void MemberExpression::dump(int indent) const
|
|||
PropertyName MemberExpression::computed_property_name(Interpreter& interpreter, GlobalObject& global_object) const
|
||||
{
|
||||
if (!is_computed()) {
|
||||
ASSERT(is<Identifier>(*m_property));
|
||||
VERIFY(is<Identifier>(*m_property));
|
||||
return static_cast<const Identifier&>(*m_property).string();
|
||||
}
|
||||
auto value = m_property->execute(interpreter, global_object);
|
||||
if (interpreter.exception())
|
||||
return {};
|
||||
ASSERT(!value.is_empty());
|
||||
VERIFY(!value.is_empty());
|
||||
return PropertyName::from_value(global_object, value);
|
||||
}
|
||||
|
||||
|
@ -1774,7 +1774,7 @@ String MemberExpression::to_string_approximation() const
|
|||
object_string = static_cast<const Identifier&>(*m_object).string();
|
||||
if (is_computed())
|
||||
return String::formatted("{}[<computed>]", object_string);
|
||||
ASSERT(is<Identifier>(*m_property));
|
||||
VERIFY(is<Identifier>(*m_property));
|
||||
return String::formatted("{}.{}", object_string, static_cast<const Identifier&>(*m_property).string());
|
||||
}
|
||||
|
||||
|
@ -1803,7 +1803,7 @@ void MetaProperty::dump(int indent) const
|
|||
else if (m_type == MetaProperty::Type::ImportMeta)
|
||||
name = "import.meta";
|
||||
else
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
print_indent(indent);
|
||||
outln("{} {}", class_name(), name);
|
||||
}
|
||||
|
@ -1817,7 +1817,7 @@ Value MetaProperty::execute(Interpreter& interpreter, GlobalObject&) const
|
|||
return interpreter.vm().get_new_target().value_or(js_undefined());
|
||||
if (m_type == MetaProperty::Type::ImportMeta)
|
||||
TODO();
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Value StringLiteral::execute(Interpreter& interpreter, GlobalObject&) const
|
||||
|
@ -2073,7 +2073,7 @@ Value CatchClause::execute(Interpreter& interpreter, GlobalObject&) const
|
|||
ScopeGuard exit_node { [&] { interpreter.exit_node(*this); } };
|
||||
|
||||
// NOTE: CatchClause execution is handled by TryStatement.
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -2137,7 +2137,7 @@ Value SwitchCase::execute(Interpreter& interpreter, GlobalObject&) const
|
|||
ScopeGuard exit_node { [&] { interpreter.exit_node(*this); } };
|
||||
|
||||
// NOTE: SwitchCase execution is handled by SwitchStatement.
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -971,7 +971,7 @@ public:
|
|||
const Expression& key() const { return m_key; }
|
||||
const Expression& value() const
|
||||
{
|
||||
ASSERT(m_value);
|
||||
VERIFY(m_value);
|
||||
return *m_value;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ Cell* Allocator::allocate_cell(Heap& heap)
|
|||
|
||||
auto& block = *m_usable_blocks.last();
|
||||
auto* cell = block.allocate();
|
||||
ASSERT(cell);
|
||||
VERIFY(cell);
|
||||
if (block.is_full())
|
||||
m_full_blocks.append(*m_usable_blocks.last());
|
||||
return cell;
|
||||
|
@ -62,7 +62,7 @@ void Allocator::block_did_become_empty(Badge<Heap>, HeapBlock& block)
|
|||
|
||||
void Allocator::block_did_become_usable(Badge<Heap>, HeapBlock& block)
|
||||
{
|
||||
ASSERT(!block.is_full());
|
||||
VERIFY(!block.is_full());
|
||||
m_usable_blocks.append(block);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ ALWAYS_INLINE Allocator& Heap::allocator_for_size(size_t cell_size)
|
|||
if (allocator->cell_size() >= cell_size)
|
||||
return *allocator;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Cell* Heap::allocate_cell(size_t size)
|
||||
|
@ -84,7 +84,7 @@ Cell* Heap::allocate_cell(size_t size)
|
|||
|
||||
void Heap::collect_garbage(CollectionType collection_type, bool print_report)
|
||||
{
|
||||
ASSERT(!m_collecting_garbage);
|
||||
VERIFY(!m_collecting_garbage);
|
||||
TemporaryChange change(m_collecting_garbage, true);
|
||||
|
||||
Core::ElapsedTimer collection_measurement_timer;
|
||||
|
@ -288,25 +288,25 @@ void Heap::sweep_dead_cells(bool print_report, const Core::ElapsedTimer& measure
|
|||
|
||||
void Heap::did_create_handle(Badge<HandleImpl>, HandleImpl& impl)
|
||||
{
|
||||
ASSERT(!m_handles.contains(&impl));
|
||||
VERIFY(!m_handles.contains(&impl));
|
||||
m_handles.set(&impl);
|
||||
}
|
||||
|
||||
void Heap::did_destroy_handle(Badge<HandleImpl>, HandleImpl& impl)
|
||||
{
|
||||
ASSERT(m_handles.contains(&impl));
|
||||
VERIFY(m_handles.contains(&impl));
|
||||
m_handles.remove(&impl);
|
||||
}
|
||||
|
||||
void Heap::did_create_marked_value_list(Badge<MarkedValueList>, MarkedValueList& list)
|
||||
{
|
||||
ASSERT(!m_marked_value_lists.contains(&list));
|
||||
VERIFY(!m_marked_value_lists.contains(&list));
|
||||
m_marked_value_lists.set(&list);
|
||||
}
|
||||
|
||||
void Heap::did_destroy_marked_value_list(Badge<MarkedValueList>, MarkedValueList& list)
|
||||
{
|
||||
ASSERT(m_marked_value_lists.contains(&list));
|
||||
VERIFY(m_marked_value_lists.contains(&list));
|
||||
m_marked_value_lists.remove(&list);
|
||||
}
|
||||
|
||||
|
@ -317,7 +317,7 @@ void Heap::defer_gc(Badge<DeferGC>)
|
|||
|
||||
void Heap::undefer_gc(Badge<DeferGC>)
|
||||
{
|
||||
ASSERT(m_gc_deferrals > 0);
|
||||
VERIFY(m_gc_deferrals > 0);
|
||||
--m_gc_deferrals;
|
||||
|
||||
if (!m_gc_deferrals) {
|
||||
|
|
|
@ -42,7 +42,7 @@ NonnullOwnPtr<HeapBlock> HeapBlock::create_with_cell_size(Heap& heap, size_t cel
|
|||
#else
|
||||
auto* block = (HeapBlock*)aligned_alloc(block_size, block_size);
|
||||
#endif
|
||||
ASSERT(block != MAP_FAILED);
|
||||
VERIFY(block != MAP_FAILED);
|
||||
new (block) HeapBlock(heap, cell_size);
|
||||
return NonnullOwnPtr<HeapBlock>(NonnullOwnPtr<HeapBlock>::Adopt, *block);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ void HeapBlock::operator delete(void* ptr)
|
|||
{
|
||||
#ifdef __serenity__
|
||||
int rc = munmap(ptr, block_size);
|
||||
ASSERT(rc == 0);
|
||||
VERIFY(rc == 0);
|
||||
#else
|
||||
free(ptr);
|
||||
#endif
|
||||
|
@ -61,7 +61,7 @@ HeapBlock::HeapBlock(Heap& heap, size_t cell_size)
|
|||
: m_heap(heap)
|
||||
, m_cell_size(cell_size)
|
||||
{
|
||||
ASSERT(cell_size >= sizeof(FreelistEntry));
|
||||
VERIFY(cell_size >= sizeof(FreelistEntry));
|
||||
|
||||
FreelistEntry* next = nullptr;
|
||||
for (ssize_t i = cell_count() - 1; i >= 0; i--) {
|
||||
|
@ -75,10 +75,10 @@ HeapBlock::HeapBlock(Heap& heap, size_t cell_size)
|
|||
|
||||
void HeapBlock::deallocate(Cell* cell)
|
||||
{
|
||||
ASSERT(is_valid_cell_pointer(cell));
|
||||
ASSERT(!m_freelist || is_valid_cell_pointer(m_freelist));
|
||||
ASSERT(cell->is_live());
|
||||
ASSERT(!cell->is_marked());
|
||||
VERIFY(is_valid_cell_pointer(cell));
|
||||
VERIFY(!m_freelist || is_valid_cell_pointer(m_freelist));
|
||||
VERIFY(cell->is_live());
|
||||
VERIFY(!cell->is_marked());
|
||||
cell->~Cell();
|
||||
auto* freelist_entry = new (cell) FreelistEntry();
|
||||
freelist_entry->set_live(false);
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
{
|
||||
if (!m_freelist)
|
||||
return nullptr;
|
||||
ASSERT(is_valid_cell_pointer(m_freelist));
|
||||
VERIFY(is_valid_cell_pointer(m_freelist));
|
||||
return exchange(m_freelist, m_freelist->next);
|
||||
}
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ Interpreter::~Interpreter()
|
|||
Value Interpreter::run(GlobalObject& global_object, const Program& program)
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
ASSERT(!vm.exception());
|
||||
VERIFY(!vm.exception());
|
||||
|
||||
VM::InterpreterExecutionScope scope(*this);
|
||||
|
||||
|
@ -66,10 +66,10 @@ Value Interpreter::run(GlobalObject& global_object, const Program& program)
|
|||
static FlyString global_execution_context_name = "(global execution context)";
|
||||
global_call_frame.function_name = global_execution_context_name;
|
||||
global_call_frame.scope = &global_object;
|
||||
ASSERT(!vm.exception());
|
||||
VERIFY(!vm.exception());
|
||||
global_call_frame.is_strict_mode = program.is_strict_mode();
|
||||
vm.push_call_frame(global_call_frame, global_object);
|
||||
ASSERT(!vm.exception());
|
||||
VERIFY(!vm.exception());
|
||||
auto result = program.execute(*this, global_object);
|
||||
vm.pop_call_frame();
|
||||
return result;
|
||||
|
@ -185,7 +185,7 @@ Value Interpreter::execute_statement(GlobalObject& global_object, const Statemen
|
|||
|
||||
LexicalEnvironment* Interpreter::current_environment()
|
||||
{
|
||||
ASSERT(is<LexicalEnvironment>(vm().call_frame().scope));
|
||||
VERIFY(is<LexicalEnvironment>(vm().call_frame().scope));
|
||||
return static_cast<LexicalEnvironment*>(vm().call_frame().scope);
|
||||
}
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ String MarkupGenerator::style_from_style_type(StyleType type)
|
|||
case StyleType::Identifier:
|
||||
return "color: -libweb-palette-syntax-identifier;";
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ MarkupGenerator::StyleType MarkupGenerator::style_type_for_token(Token token)
|
|||
return StyleType::Identifier;
|
||||
default:
|
||||
dbgln("Unknown style type for token {}", token.name());
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
int p = m_token_precedence[static_cast<size_t>(token)];
|
||||
if (p == 0) {
|
||||
warnln("Internal Error: No precedence for operator {}", Token::name(token));
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -827,7 +827,7 @@ NonnullRefPtr<ObjectExpression> Parser::parse_object_expression()
|
|||
}
|
||||
|
||||
if (match(TokenType::ParenOpen)) {
|
||||
ASSERT(property_name);
|
||||
VERIFY(property_name);
|
||||
u8 parse_options = FunctionNodeParseOptions::AllowSuperPropertyLookup;
|
||||
if (property_type == ObjectProperty::Type::Getter)
|
||||
parse_options |= FunctionNodeParseOptions::IsGetterFunction;
|
||||
|
@ -905,7 +905,7 @@ NonnullRefPtr<StringLiteral> Parser::parse_string_literal(Token token, bool in_t
|
|||
} else if (status == Token::StringValueStatus::UnicodeEscapeOverflow) {
|
||||
message = "Unicode code_point must not be greater than 0x10ffff in escape sequence";
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
if (!message.is_empty())
|
||||
|
@ -1158,7 +1158,7 @@ NonnullRefPtr<Expression> Parser::parse_secondary_expression(NonnullRefPtr<Expre
|
|||
NonnullRefPtr<AssignmentExpression> Parser::parse_assignment_expression(AssignmentOp assignment_op, NonnullRefPtr<Expression> lhs, int min_precedence, Associativity associativity)
|
||||
{
|
||||
auto rule_start = push_start();
|
||||
ASSERT(match(TokenType::Equals)
|
||||
VERIFY(match(TokenType::Equals)
|
||||
|| match(TokenType::PlusEquals)
|
||||
|| match(TokenType::MinusEquals)
|
||||
|| match(TokenType::AsteriskEquals)
|
||||
|
@ -1315,7 +1315,7 @@ template<typename FunctionNodeType>
|
|||
NonnullRefPtr<FunctionNodeType> Parser::parse_function_node(u8 parse_options)
|
||||
{
|
||||
auto rule_start = push_start();
|
||||
ASSERT(!(parse_options & FunctionNodeParseOptions::IsGetterFunction && parse_options & FunctionNodeParseOptions::IsSetterFunction));
|
||||
VERIFY(!(parse_options & FunctionNodeParseOptions::IsGetterFunction && parse_options & FunctionNodeParseOptions::IsSetterFunction));
|
||||
|
||||
TemporaryChange super_property_access_rollback(m_parser_state.m_allow_super_property_lookup, !!(parse_options & FunctionNodeParseOptions::AllowSuperPropertyLookup));
|
||||
TemporaryChange super_constructor_call_rollback(m_parser_state.m_allow_super_constructor_call, !!(parse_options & FunctionNodeParseOptions::AllowSuperConstructorCall));
|
||||
|
@ -1427,7 +1427,7 @@ NonnullRefPtr<VariableDeclaration> Parser::parse_variable_declaration(bool for_l
|
|||
declaration_kind = DeclarationKind::Const;
|
||||
break;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
consume();
|
||||
|
||||
|
@ -2037,7 +2037,7 @@ void Parser::save_state()
|
|||
|
||||
void Parser::load_state()
|
||||
{
|
||||
ASSERT(!m_saved_state.is_empty());
|
||||
VERIFY(!m_saved_state.is_empty());
|
||||
m_parser_state = m_saved_state.take_last();
|
||||
}
|
||||
|
||||
|
|
|
@ -187,8 +187,8 @@ private:
|
|||
~RulePosition()
|
||||
{
|
||||
auto last = m_parser.m_rule_starts.take_last();
|
||||
ASSERT(last.line == m_position.line);
|
||||
ASSERT(last.column == m_position.column);
|
||||
VERIFY(last.line == m_position.line);
|
||||
VERIFY(last.column == m_position.column);
|
||||
}
|
||||
|
||||
const Position& position() const { return m_position; }
|
||||
|
|
|
@ -63,7 +63,7 @@ JS_DEFINE_NATIVE_FUNCTION(ArrayIteratorPrototype::next)
|
|||
auto target_array = iterator.array();
|
||||
if (target_array.is_undefined())
|
||||
return create_iterator_result_object(global_object, js_undefined(), true);
|
||||
ASSERT(target_array.is_object());
|
||||
VERIFY(target_array.is_object());
|
||||
auto& array = target_array.as_object();
|
||||
|
||||
auto index = iterator.index();
|
||||
|
|
|
@ -670,9 +670,9 @@ static void array_merge_sort(VM& vm, GlobalObject& global_object, Function* comp
|
|||
// Because they are called with primitive strings, these abstract_relation calls
|
||||
// should never result in a VM exception.
|
||||
auto x_lt_y_relation = abstract_relation(global_object, true, x_string_value, y_string_value);
|
||||
ASSERT(x_lt_y_relation != TriState::Unknown);
|
||||
VERIFY(x_lt_y_relation != TriState::Unknown);
|
||||
auto y_lt_x_relation = abstract_relation(global_object, true, y_string_value, x_string_value);
|
||||
ASSERT(y_lt_x_relation != TriState::Unknown);
|
||||
VERIFY(y_lt_x_relation != TriState::Unknown);
|
||||
|
||||
if (x_lt_y_relation == TriState::True) {
|
||||
comparison_result = -1;
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace JS {
|
|||
BigInt::BigInt(Crypto::SignedBigInteger big_integer)
|
||||
: m_big_integer(move(big_integer))
|
||||
{
|
||||
ASSERT(!m_big_integer.is_invalid());
|
||||
VERIFY(!m_big_integer.is_invalid());
|
||||
}
|
||||
|
||||
BigInt::~BigInt()
|
||||
|
|
|
@ -108,7 +108,7 @@ static Value parse_simplified_iso8601(const String& iso_8601)
|
|||
}
|
||||
|
||||
// We parsed a valid date simplified ISO 8601 string. Values not present in the string are -1.
|
||||
ASSERT(year != -1); // A valid date string always has at least a year.
|
||||
VERIFY(year != -1); // A valid date string always has at least a year.
|
||||
struct tm tm = {};
|
||||
tm.tm_year = year - 1900;
|
||||
tm.tm_mon = month == -1 ? 0 : month - 1;
|
||||
|
|
|
@ -45,7 +45,7 @@ Exception::Exception(Value value)
|
|||
auto& node_stack = vm().node_stack();
|
||||
for (ssize_t i = node_stack.size() - 1; i >= 0; --i) {
|
||||
auto* node = node_stack[i];
|
||||
ASSERT(node);
|
||||
VERIFY(node);
|
||||
m_source_ranges.append(node->source_range());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,8 +50,8 @@ Optional<ValueAndAttributes> SimpleIndexedPropertyStorage::get(u32 index) const
|
|||
|
||||
void SimpleIndexedPropertyStorage::put(u32 index, Value value, PropertyAttributes attributes)
|
||||
{
|
||||
ASSERT(attributes == default_attributes);
|
||||
ASSERT(index < SPARSE_ARRAY_THRESHOLD);
|
||||
VERIFY(attributes == default_attributes);
|
||||
VERIFY(index < SPARSE_ARRAY_THRESHOLD);
|
||||
|
||||
if (index >= m_array_size) {
|
||||
m_array_size = index + 1;
|
||||
|
@ -69,10 +69,10 @@ void SimpleIndexedPropertyStorage::remove(u32 index)
|
|||
|
||||
void SimpleIndexedPropertyStorage::insert(u32 index, Value value, PropertyAttributes attributes)
|
||||
{
|
||||
ASSERT(attributes == default_attributes);
|
||||
ASSERT(index < SPARSE_ARRAY_THRESHOLD);
|
||||
VERIFY(attributes == default_attributes);
|
||||
VERIFY(index < SPARSE_ARRAY_THRESHOLD);
|
||||
m_array_size++;
|
||||
ASSERT(m_array_size <= SPARSE_ARRAY_THRESHOLD);
|
||||
VERIFY(m_array_size <= SPARSE_ARRAY_THRESHOLD);
|
||||
m_packed_elements.insert(index, value);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ ValueAndAttributes SimpleIndexedPropertyStorage::take_last()
|
|||
|
||||
void SimpleIndexedPropertyStorage::set_array_like_size(size_t new_size)
|
||||
{
|
||||
ASSERT(new_size <= SPARSE_ARRAY_THRESHOLD);
|
||||
VERIFY(new_size <= SPARSE_ARRAY_THRESHOLD);
|
||||
m_array_size = new_size;
|
||||
m_packed_elements.resize(new_size);
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ void GenericIndexedPropertyStorage::insert(u32 index, Value value, PropertyAttri
|
|||
|
||||
ValueAndAttributes GenericIndexedPropertyStorage::take_first()
|
||||
{
|
||||
ASSERT(m_array_size > 0);
|
||||
VERIFY(m_array_size > 0);
|
||||
m_array_size--;
|
||||
|
||||
if (!m_sparse_elements.is_empty()) {
|
||||
|
@ -192,7 +192,7 @@ ValueAndAttributes GenericIndexedPropertyStorage::take_first()
|
|||
|
||||
ValueAndAttributes GenericIndexedPropertyStorage::take_last()
|
||||
{
|
||||
ASSERT(m_array_size > 0);
|
||||
VERIFY(m_array_size > 0);
|
||||
m_array_size--;
|
||||
|
||||
if (m_array_size <= SPARSE_ARRAY_THRESHOLD) {
|
||||
|
@ -202,7 +202,7 @@ ValueAndAttributes GenericIndexedPropertyStorage::take_last()
|
|||
} else {
|
||||
auto result = m_sparse_elements.get(m_array_size);
|
||||
m_sparse_elements.remove(m_array_size);
|
||||
ASSERT(result.has_value());
|
||||
VERIFY(result.has_value());
|
||||
return result.value();
|
||||
}
|
||||
}
|
||||
|
@ -282,7 +282,7 @@ Optional<ValueAndAttributes> IndexedProperties::get(Object* this_object, u32 ind
|
|||
return {};
|
||||
auto& value = result.value();
|
||||
if (value.value.is_accessor()) {
|
||||
ASSERT(this_object);
|
||||
VERIFY(this_object);
|
||||
auto& accessor = value.value.as_accessor();
|
||||
return ValueAndAttributes { accessor.call_getter(this_object), value.attributes };
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ void IndexedProperties::put(Object* this_object, u32 index, Value value, Propert
|
|||
|
||||
auto value_here = m_storage->get(index);
|
||||
if (value_here.has_value() && value_here.value().value.is_accessor()) {
|
||||
ASSERT(this_object);
|
||||
VERIFY(this_object);
|
||||
value_here.value().value.as_accessor().call_setter(this_object, value);
|
||||
} else {
|
||||
m_storage->put(index, value, attributes);
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace JS {
|
|||
Object* get_iterator(GlobalObject& global_object, Value value, String hint, Value method)
|
||||
{
|
||||
auto& vm = global_object.vm();
|
||||
ASSERT(hint == "sync" || hint == "async");
|
||||
VERIFY(hint == "sync" || hint == "async");
|
||||
if (method.is_empty()) {
|
||||
if (hint == "async")
|
||||
TODO();
|
||||
|
@ -128,7 +128,7 @@ void get_iterator_values(GlobalObject& global_object, Value value, AK::Function<
|
|||
auto result = callback(next_value);
|
||||
if (result == IterationDecision::Break)
|
||||
return;
|
||||
ASSERT(result == IterationDecision::Continue);
|
||||
VERIFY(result == IterationDecision::Continue);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -433,7 +433,7 @@ Value JSONObject::parse_json_value(GlobalObject& global_object, const JsonValue&
|
|||
return js_string(global_object.heap(), value.to_string());
|
||||
if (value.is_bool())
|
||||
return Value(static_cast<bool>(value.as_bool()));
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Object* JSONObject::parse_json_object(GlobalObject& global_object, const JsonObject& json_object)
|
||||
|
|
|
@ -89,7 +89,7 @@ bool LexicalEnvironment::has_super_binding() const
|
|||
|
||||
Value LexicalEnvironment::get_super_base()
|
||||
{
|
||||
ASSERT(has_super_binding());
|
||||
VERIFY(has_super_binding());
|
||||
if (m_home_object.is_object())
|
||||
return m_home_object.as_object().prototype();
|
||||
return {};
|
||||
|
@ -107,12 +107,12 @@ bool LexicalEnvironment::has_this_binding() const
|
|||
case EnvironmentRecordType::Module:
|
||||
return true;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Value LexicalEnvironment::get_this_binding(GlobalObject& global_object) const
|
||||
{
|
||||
ASSERT(has_this_binding());
|
||||
VERIFY(has_this_binding());
|
||||
if (this_binding_status() == ThisBindingStatus::Uninitialized) {
|
||||
vm().throw_exception<ReferenceError>(global_object, ErrorType::ThisHasNotBeenInitialized);
|
||||
return {};
|
||||
|
@ -122,7 +122,7 @@ Value LexicalEnvironment::get_this_binding(GlobalObject& global_object) const
|
|||
|
||||
void LexicalEnvironment::bind_this_value(GlobalObject& global_object, Value this_value)
|
||||
{
|
||||
ASSERT(has_this_binding());
|
||||
VERIFY(has_this_binding());
|
||||
if (m_this_binding_status == ThisBindingStatus::Initialized) {
|
||||
vm().throw_exception<ReferenceError>(global_object, ErrorType::ThisIsAlreadyInitialized);
|
||||
return;
|
||||
|
|
|
@ -160,8 +160,8 @@ bool Object::prevent_extensions()
|
|||
|
||||
Value Object::get_own_property(const PropertyName& property_name, Value receiver) const
|
||||
{
|
||||
ASSERT(property_name.is_valid());
|
||||
ASSERT(!receiver.is_empty());
|
||||
VERIFY(property_name.is_valid());
|
||||
VERIFY(!receiver.is_empty());
|
||||
|
||||
Value value_here;
|
||||
|
||||
|
@ -177,7 +177,7 @@ Value Object::get_own_property(const PropertyName& property_name, Value receiver
|
|||
value_here = m_storage[metadata.value().offset].value_or(js_undefined());
|
||||
}
|
||||
|
||||
ASSERT(!value_here.is_empty());
|
||||
VERIFY(!value_here.is_empty());
|
||||
if (value_here.is_accessor())
|
||||
return value_here.as_accessor().call_getter(receiver);
|
||||
if (value_here.is_native_property())
|
||||
|
@ -263,7 +263,7 @@ Value Object::get_own_properties(const Object& this_object, PropertyKind kind, b
|
|||
|
||||
Optional<PropertyDescriptor> Object::get_own_property_descriptor(const PropertyName& property_name) const
|
||||
{
|
||||
ASSERT(property_name.is_valid());
|
||||
VERIFY(property_name.is_valid());
|
||||
|
||||
Value value;
|
||||
PropertyAttributes attributes;
|
||||
|
@ -304,7 +304,7 @@ Optional<PropertyDescriptor> Object::get_own_property_descriptor(const PropertyN
|
|||
|
||||
Value Object::get_own_property_descriptor_object(const PropertyName& property_name) const
|
||||
{
|
||||
ASSERT(property_name.is_valid());
|
||||
VERIFY(property_name.is_valid());
|
||||
|
||||
auto& vm = this->vm();
|
||||
auto descriptor_opt = get_own_property_descriptor(property_name);
|
||||
|
@ -433,7 +433,7 @@ bool Object::define_property_without_transition(const PropertyName& property_nam
|
|||
|
||||
bool Object::define_property(const PropertyName& property_name, Value value, PropertyAttributes attributes, bool throw_exceptions)
|
||||
{
|
||||
ASSERT(property_name.is_valid());
|
||||
VERIFY(property_name.is_valid());
|
||||
|
||||
if (property_name.is_number())
|
||||
return put_own_property_by_index(*this, property_name.as_number(), value, attributes, PutOwnPropertyMode::DefineProperty, throw_exceptions);
|
||||
|
@ -448,7 +448,7 @@ bool Object::define_property(const PropertyName& property_name, Value value, Pro
|
|||
|
||||
bool Object::define_accessor(const PropertyName& property_name, Function& getter_or_setter, bool is_getter, PropertyAttributes attributes, bool throw_exceptions)
|
||||
{
|
||||
ASSERT(property_name.is_valid());
|
||||
VERIFY(property_name.is_valid());
|
||||
|
||||
Accessor* accessor { nullptr };
|
||||
auto property_metadata = shape().lookup(property_name.to_string_or_symbol());
|
||||
|
@ -475,7 +475,7 @@ bool Object::define_accessor(const PropertyName& property_name, Function& getter
|
|||
|
||||
bool Object::put_own_property(Object& this_object, const StringOrSymbol& property_name, Value value, PropertyAttributes attributes, PutOwnPropertyMode mode, bool throw_exceptions)
|
||||
{
|
||||
ASSERT(!(mode == PutOwnPropertyMode::Put && value.is_accessor()));
|
||||
VERIFY(!(mode == PutOwnPropertyMode::Put && value.is_accessor()));
|
||||
|
||||
if (value.is_accessor()) {
|
||||
auto& accessor = value.as_accessor();
|
||||
|
@ -523,7 +523,7 @@ bool Object::put_own_property(Object& this_object, const StringOrSymbol& propert
|
|||
m_storage.resize(m_shape->property_count());
|
||||
}
|
||||
metadata = shape().lookup(property_name);
|
||||
ASSERT(metadata.has_value());
|
||||
VERIFY(metadata.has_value());
|
||||
}
|
||||
|
||||
if (!new_property && mode == PutOwnPropertyMode::DefineProperty && !metadata.value().attributes.is_configurable() && attributes != metadata.value().attributes) {
|
||||
|
@ -569,7 +569,7 @@ bool Object::put_own_property(Object& this_object, const StringOrSymbol& propert
|
|||
|
||||
bool Object::put_own_property_by_index(Object& this_object, u32 property_index, Value value, PropertyAttributes attributes, PutOwnPropertyMode mode, bool throw_exceptions)
|
||||
{
|
||||
ASSERT(!(mode == PutOwnPropertyMode::Put && value.is_accessor()));
|
||||
VERIFY(!(mode == PutOwnPropertyMode::Put && value.is_accessor()));
|
||||
|
||||
auto existing_property = m_indexed_properties.get(nullptr, property_index, false);
|
||||
auto new_property = !existing_property.has_value();
|
||||
|
@ -623,7 +623,7 @@ bool Object::put_own_property_by_index(Object& this_object, u32 property_index,
|
|||
|
||||
Value Object::delete_property(const PropertyName& property_name)
|
||||
{
|
||||
ASSERT(property_name.is_valid());
|
||||
VERIFY(property_name.is_valid());
|
||||
|
||||
if (property_name.is_number())
|
||||
return Value(m_indexed_properties.remove(property_name.as_number()));
|
||||
|
@ -684,7 +684,7 @@ Value Object::get_by_index(u32 property_index) const
|
|||
|
||||
Value Object::get(const PropertyName& property_name, Value receiver) const
|
||||
{
|
||||
ASSERT(property_name.is_valid());
|
||||
VERIFY(property_name.is_valid());
|
||||
|
||||
if (property_name.is_number())
|
||||
return get_by_index(property_name.as_number());
|
||||
|
@ -714,7 +714,7 @@ Value Object::get(const PropertyName& property_name, Value receiver) const
|
|||
|
||||
bool Object::put_by_index(u32 property_index, Value value)
|
||||
{
|
||||
ASSERT(!value.is_empty());
|
||||
VERIFY(!value.is_empty());
|
||||
|
||||
// If there's a setter in the prototype chain, we go to the setter.
|
||||
// Otherwise, it goes in the own property storage.
|
||||
|
@ -743,12 +743,12 @@ bool Object::put_by_index(u32 property_index, Value value)
|
|||
|
||||
bool Object::put(const PropertyName& property_name, Value value, Value receiver)
|
||||
{
|
||||
ASSERT(property_name.is_valid());
|
||||
VERIFY(property_name.is_valid());
|
||||
|
||||
if (property_name.is_number())
|
||||
return put_by_index(property_name.as_number(), value);
|
||||
|
||||
ASSERT(!value.is_empty());
|
||||
VERIFY(!value.is_empty());
|
||||
|
||||
if (property_name.is_string()) {
|
||||
auto& property_string = property_name.as_string();
|
||||
|
@ -837,7 +837,7 @@ bool Object::has_property(const PropertyName& property_name) const
|
|||
|
||||
bool Object::has_own_property(const PropertyName& property_name) const
|
||||
{
|
||||
ASSERT(property_name.is_valid());
|
||||
VERIFY(property_name.is_valid());
|
||||
|
||||
auto has_indexed_property = [&](u32 index) -> bool {
|
||||
if (is<StringObject>(*this))
|
||||
|
@ -859,7 +859,7 @@ bool Object::has_own_property(const PropertyName& property_name) const
|
|||
|
||||
Value Object::ordinary_to_primitive(Value::PreferredType preferred_type) const
|
||||
{
|
||||
ASSERT(preferred_type == Value::PreferredType::String || preferred_type == Value::PreferredType::Number);
|
||||
VERIFY(preferred_type == Value::PreferredType::String || preferred_type == Value::PreferredType::Number);
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
: m_type(Type::Number)
|
||||
, m_number(index)
|
||||
{
|
||||
ASSERT(index >= 0);
|
||||
VERIFY(index >= 0);
|
||||
}
|
||||
|
||||
PropertyName(const char* chars)
|
||||
|
@ -73,21 +73,21 @@ public:
|
|||
: m_type(Type::String)
|
||||
, m_string(FlyString(string))
|
||||
{
|
||||
ASSERT(!string.is_null());
|
||||
VERIFY(!string.is_null());
|
||||
}
|
||||
|
||||
PropertyName(const FlyString& string)
|
||||
: m_type(Type::String)
|
||||
, m_string(string)
|
||||
{
|
||||
ASSERT(!string.is_null());
|
||||
VERIFY(!string.is_null());
|
||||
}
|
||||
|
||||
PropertyName(Symbol* symbol)
|
||||
: m_type(Type::Symbol)
|
||||
, m_symbol(symbol)
|
||||
{
|
||||
ASSERT(symbol);
|
||||
VERIFY(symbol);
|
||||
}
|
||||
|
||||
PropertyName(const StringOrSymbol& string_or_symbol)
|
||||
|
@ -108,26 +108,26 @@ public:
|
|||
|
||||
i32 as_number() const
|
||||
{
|
||||
ASSERT(is_number());
|
||||
VERIFY(is_number());
|
||||
return m_number;
|
||||
}
|
||||
|
||||
const FlyString& as_string() const
|
||||
{
|
||||
ASSERT(is_string());
|
||||
VERIFY(is_string());
|
||||
return m_string;
|
||||
}
|
||||
|
||||
const Symbol* as_symbol() const
|
||||
{
|
||||
ASSERT(is_symbol());
|
||||
VERIFY(is_symbol());
|
||||
return m_symbol;
|
||||
}
|
||||
|
||||
String to_string() const
|
||||
{
|
||||
ASSERT(is_valid());
|
||||
ASSERT(!is_symbol());
|
||||
VERIFY(is_valid());
|
||||
VERIFY(!is_symbol());
|
||||
if (is_string())
|
||||
return as_string();
|
||||
return String::number(as_number());
|
||||
|
@ -135,8 +135,8 @@ public:
|
|||
|
||||
StringOrSymbol to_string_or_symbol() const
|
||||
{
|
||||
ASSERT(is_valid());
|
||||
ASSERT(!is_number());
|
||||
VERIFY(is_valid());
|
||||
VERIFY(!is_number());
|
||||
if (is_string())
|
||||
return StringOrSymbol(as_string());
|
||||
return StringOrSymbol(as_symbol());
|
||||
|
|
|
@ -546,13 +546,13 @@ Value ProxyObject::construct(Function& new_target)
|
|||
|
||||
const FlyString& ProxyObject::name() const
|
||||
{
|
||||
ASSERT(is_function());
|
||||
VERIFY(is_function());
|
||||
return static_cast<Function&>(m_target).name();
|
||||
}
|
||||
|
||||
LexicalEnvironment* ProxyObject::create_environment()
|
||||
{
|
||||
ASSERT(is_function());
|
||||
VERIFY(is_function());
|
||||
return static_cast<Function&>(m_target).create_environment();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace JS {
|
|||
|
||||
Shape* Shape::create_unique_clone() const
|
||||
{
|
||||
ASSERT(m_global_object);
|
||||
VERIFY(m_global_object);
|
||||
auto* new_shape = heap().allocate_without_global_object<Shape>(*m_global_object);
|
||||
new_shape->m_unique = true;
|
||||
new_shape->m_prototype = m_prototype;
|
||||
|
@ -179,7 +179,7 @@ void Shape::ensure_property_table() const
|
|||
m_property_table->set(shape->m_property_name, { next_offset++, shape->m_attributes });
|
||||
} else if (shape->m_transition_type == TransitionType::Configure) {
|
||||
auto it = m_property_table->find(shape->m_property_name);
|
||||
ASSERT(it != m_property_table->end());
|
||||
VERIFY(it != m_property_table->end());
|
||||
it->value.attributes = shape->m_attributes;
|
||||
}
|
||||
}
|
||||
|
@ -187,31 +187,31 @@ void Shape::ensure_property_table() const
|
|||
|
||||
void Shape::add_property_to_unique_shape(const StringOrSymbol& property_name, PropertyAttributes attributes)
|
||||
{
|
||||
ASSERT(is_unique());
|
||||
ASSERT(m_property_table);
|
||||
ASSERT(!m_property_table->contains(property_name));
|
||||
VERIFY(is_unique());
|
||||
VERIFY(m_property_table);
|
||||
VERIFY(!m_property_table->contains(property_name));
|
||||
m_property_table->set(property_name, { m_property_table->size(), attributes });
|
||||
++m_property_count;
|
||||
}
|
||||
|
||||
void Shape::reconfigure_property_in_unique_shape(const StringOrSymbol& property_name, PropertyAttributes attributes)
|
||||
{
|
||||
ASSERT(is_unique());
|
||||
ASSERT(m_property_table);
|
||||
VERIFY(is_unique());
|
||||
VERIFY(m_property_table);
|
||||
auto it = m_property_table->find(property_name);
|
||||
ASSERT(it != m_property_table->end());
|
||||
VERIFY(it != m_property_table->end());
|
||||
it->value.attributes = attributes;
|
||||
m_property_table->set(property_name, it->value);
|
||||
}
|
||||
|
||||
void Shape::remove_property_from_unique_shape(const StringOrSymbol& property_name, size_t offset)
|
||||
{
|
||||
ASSERT(is_unique());
|
||||
ASSERT(m_property_table);
|
||||
VERIFY(is_unique());
|
||||
VERIFY(m_property_table);
|
||||
if (m_property_table->remove(property_name))
|
||||
--m_property_count;
|
||||
for (auto& it : *m_property_table) {
|
||||
ASSERT(it.value.offset != offset);
|
||||
VERIFY(it.value.offset != offset);
|
||||
if (it.value.offset > offset)
|
||||
--it.value.offset;
|
||||
}
|
||||
|
|
|
@ -57,14 +57,14 @@ public:
|
|||
StringOrSymbol(const String& string)
|
||||
: m_ptr(string.impl())
|
||||
{
|
||||
ASSERT(!string.is_null());
|
||||
VERIFY(!string.is_null());
|
||||
as_string_impl().ref();
|
||||
}
|
||||
|
||||
StringOrSymbol(const FlyString& string)
|
||||
: m_ptr(string.impl())
|
||||
{
|
||||
ASSERT(!string.is_null());
|
||||
VERIFY(!string.is_null());
|
||||
as_string_impl().ref();
|
||||
}
|
||||
|
||||
|
@ -98,13 +98,13 @@ public:
|
|||
|
||||
ALWAYS_INLINE String as_string() const
|
||||
{
|
||||
ASSERT(is_string());
|
||||
VERIFY(is_string());
|
||||
return as_string_impl();
|
||||
}
|
||||
|
||||
ALWAYS_INLINE const Symbol* as_symbol() const
|
||||
{
|
||||
ASSERT(is_symbol());
|
||||
VERIFY(is_symbol());
|
||||
return reinterpret_cast<const Symbol*>(bits() & ~1ul);
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ public:
|
|||
return as_string();
|
||||
if (is_symbol())
|
||||
return as_symbol()->to_string();
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Value to_value(VM& vm) const
|
||||
|
@ -178,7 +178,7 @@ private:
|
|||
|
||||
ALWAYS_INLINE const StringImpl& as_string_impl() const
|
||||
{
|
||||
ASSERT(is_string());
|
||||
VERIFY(is_string());
|
||||
return *reinterpret_cast<const StringImpl*>(m_ptr);
|
||||
}
|
||||
|
||||
|
|
|
@ -131,10 +131,10 @@ protected:
|
|||
TypedArray(u32 array_length, Object& prototype)
|
||||
: TypedArrayBase(prototype)
|
||||
{
|
||||
ASSERT(!Checked<u32>::multiplication_would_overflow(array_length, sizeof(T)));
|
||||
VERIFY(!Checked<u32>::multiplication_would_overflow(array_length, sizeof(T)));
|
||||
m_viewed_array_buffer = ArrayBuffer::create(global_object(), array_length * sizeof(T));
|
||||
if (array_length)
|
||||
ASSERT(!data().is_null());
|
||||
VERIFY(!data().is_null());
|
||||
m_array_length = array_length;
|
||||
m_byte_length = m_viewed_array_buffer->byte_length();
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ Uint8ClampedArray::Uint8ClampedArray(u32 length, Object& prototype)
|
|||
|
||||
Uint8ClampedArray::~Uint8ClampedArray()
|
||||
{
|
||||
ASSERT(m_data);
|
||||
VERIFY(m_data);
|
||||
free(m_data);
|
||||
m_data = nullptr;
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ VM::~VM()
|
|||
|
||||
Interpreter& VM::interpreter()
|
||||
{
|
||||
ASSERT(!m_interpreters.is_empty());
|
||||
VERIFY(!m_interpreters.is_empty());
|
||||
return *m_interpreters.last();
|
||||
}
|
||||
|
||||
|
@ -82,9 +82,9 @@ void VM::push_interpreter(Interpreter& interpreter)
|
|||
|
||||
void VM::pop_interpreter(Interpreter& interpreter)
|
||||
{
|
||||
ASSERT(!m_interpreters.is_empty());
|
||||
VERIFY(!m_interpreters.is_empty());
|
||||
auto* popped_interpreter = m_interpreters.take_last();
|
||||
ASSERT(popped_interpreter == &interpreter);
|
||||
VERIFY(popped_interpreter == &interpreter);
|
||||
}
|
||||
|
||||
VM::InterpreterExecutionScope::InterpreterExecutionScope(Interpreter& interpreter)
|
||||
|
@ -256,7 +256,7 @@ Value VM::construct(Function& function, Function& new_target, Optional<MarkedVal
|
|||
// If we are constructing an instance of a derived class,
|
||||
// set the prototype on objects created by constructors that return an object (i.e. NativeFunction subclasses).
|
||||
if (function.constructor_kind() == Function::ConstructorKind::Base && new_target.constructor_kind() == Function::ConstructorKind::Derived && result.is_object()) {
|
||||
ASSERT(is<LexicalEnvironment>(current_scope()));
|
||||
VERIFY(is<LexicalEnvironment>(current_scope()));
|
||||
static_cast<LexicalEnvironment*>(current_scope())->replace_this_binding(result);
|
||||
auto prototype = new_target.get(names.prototype);
|
||||
if (exception())
|
||||
|
@ -319,18 +319,18 @@ const ScopeObject* VM::find_this_scope() const
|
|||
if (scope->has_this_binding())
|
||||
return scope;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Value VM::get_new_target() const
|
||||
{
|
||||
ASSERT(is<LexicalEnvironment>(find_this_scope()));
|
||||
VERIFY(is<LexicalEnvironment>(find_this_scope()));
|
||||
return static_cast<const LexicalEnvironment*>(find_this_scope())->new_target();
|
||||
}
|
||||
|
||||
Value VM::call_internal(Function& function, Value this_value, Optional<MarkedValueList> arguments)
|
||||
{
|
||||
ASSERT(!exception());
|
||||
VERIFY(!exception());
|
||||
|
||||
CallFrame call_frame;
|
||||
call_frame.is_strict_mode = function.is_strict_mode();
|
||||
|
@ -342,7 +342,7 @@ Value VM::call_internal(Function& function, Value this_value, Optional<MarkedVal
|
|||
auto* environment = function.create_environment();
|
||||
call_frame.scope = environment;
|
||||
|
||||
ASSERT(environment->this_binding_status() == LexicalEnvironment::ThisBindingStatus::Uninitialized);
|
||||
VERIFY(environment->this_binding_status() == LexicalEnvironment::ThisBindingStatus::Uninitialized);
|
||||
environment->bind_this_value(function.global_object(), call_frame.this_value);
|
||||
if (exception())
|
||||
return {};
|
||||
|
|
|
@ -109,13 +109,13 @@ public:
|
|||
PrimitiveString& empty_string() { return *m_empty_string; }
|
||||
PrimitiveString& single_ascii_character_string(u8 character)
|
||||
{
|
||||
ASSERT(character < 0x80);
|
||||
VERIFY(character < 0x80);
|
||||
return *m_single_ascii_character_strings[character];
|
||||
}
|
||||
|
||||
void push_call_frame(CallFrame& call_frame, GlobalObject& global_object)
|
||||
{
|
||||
ASSERT(!exception());
|
||||
VERIFY(!exception());
|
||||
// Ensure we got some stack space left, so the next function call doesn't kill us.
|
||||
// This value is merely a guess and might need tweaking at a later point.
|
||||
if (m_stack_info.size_free() < 16 * KiB)
|
||||
|
|
|
@ -213,7 +213,7 @@ bool Value::is_array() const
|
|||
|
||||
Array& Value::as_array()
|
||||
{
|
||||
ASSERT(is_array());
|
||||
VERIFY(is_array());
|
||||
return static_cast<Array&>(*m_value.as_object);
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,7 @@ bool Value::is_function() const
|
|||
|
||||
Function& Value::as_function()
|
||||
{
|
||||
ASSERT(is_function());
|
||||
VERIFY(is_function());
|
||||
return static_cast<Function&>(as_object());
|
||||
}
|
||||
|
||||
|
@ -268,7 +268,7 @@ String Value::to_string_without_side_effects() const
|
|||
case Type::NativeProperty:
|
||||
return "<native-property>";
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -307,7 +307,7 @@ String Value::to_string(GlobalObject& global_object, bool legacy_null_to_empty_s
|
|||
return primitive_value.to_string(global_object);
|
||||
}
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -332,7 +332,7 @@ bool Value::to_boolean() const
|
|||
case Type::Object:
|
||||
return true;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -368,7 +368,7 @@ Object* Value::to_object(GlobalObject& global_object) const
|
|||
return &const_cast<Object&>(as_object());
|
||||
default:
|
||||
dbgln("Dying because I can't to_object() on {}", *this);
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -420,7 +420,7 @@ Value Value::to_number(GlobalObject& global_object) const
|
|||
return primitive.to_number(global_object);
|
||||
}
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -458,7 +458,7 @@ BigInt* Value::to_bigint(GlobalObject& global_object) const
|
|||
vm.throw_exception<TypeError>(global_object, ErrorType::Convert, "symbol", "BigInt");
|
||||
return {};
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -470,13 +470,13 @@ i32 Value::as_i32() const
|
|||
|
||||
u32 Value::as_u32() const
|
||||
{
|
||||
ASSERT(as_double() >= 0);
|
||||
VERIFY(as_double() >= 0);
|
||||
return min((double)as_i32(), MAX_U32);
|
||||
}
|
||||
|
||||
size_t Value::as_size_t() const
|
||||
{
|
||||
ASSERT(as_double() >= 0);
|
||||
VERIFY(as_double() >= 0);
|
||||
return min((double)as_i32(), MAX_ARRAY_LIKE_INDEX);
|
||||
}
|
||||
|
||||
|
@ -552,7 +552,7 @@ size_t Value::to_index(GlobalObject& global_object) const
|
|||
return INVALID;
|
||||
}
|
||||
auto index = Value(integer_index).to_length(global_object);
|
||||
ASSERT(!vm.exception());
|
||||
VERIFY(!vm.exception());
|
||||
if (integer_index != index) {
|
||||
vm.throw_exception<RangeError>(global_object, ErrorType::InvalidIndex);
|
||||
return INVALID;
|
||||
|
@ -1028,8 +1028,8 @@ bool same_value_zero(Value lhs, Value rhs)
|
|||
|
||||
bool same_value_non_numeric(Value lhs, Value rhs)
|
||||
{
|
||||
ASSERT(!lhs.is_number() && !lhs.is_bigint());
|
||||
ASSERT(lhs.type() == rhs.type());
|
||||
VERIFY(!lhs.is_number() && !lhs.is_bigint());
|
||||
VERIFY(lhs.type() == rhs.type());
|
||||
|
||||
switch (lhs.type()) {
|
||||
case Value::Type::Undefined:
|
||||
|
@ -1044,7 +1044,7 @@ bool same_value_non_numeric(Value lhs, Value rhs)
|
|||
case Value::Type::Object:
|
||||
return &lhs.as_object() == &rhs.as_object();
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1160,7 +1160,7 @@ TriState abstract_relation(GlobalObject& global_object, bool left_first, Value l
|
|||
}
|
||||
}
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
if (x_primitive.is_bigint() && y_primitive.is_string()) {
|
||||
|
@ -1213,7 +1213,7 @@ TriState abstract_relation(GlobalObject& global_object, bool left_first, Value l
|
|||
return TriState::False;
|
||||
}
|
||||
|
||||
ASSERT((x_numeric.is_number() && y_numeric.is_bigint()) || (x_numeric.is_bigint() && y_numeric.is_number()));
|
||||
VERIFY((x_numeric.is_number() && y_numeric.is_bigint()) || (x_numeric.is_bigint() && y_numeric.is_number()));
|
||||
|
||||
bool x_lower_than_y;
|
||||
if (x_numeric.is_number()) {
|
||||
|
|
|
@ -169,73 +169,73 @@ public:
|
|||
|
||||
double as_double() const
|
||||
{
|
||||
ASSERT(type() == Type::Number);
|
||||
VERIFY(type() == Type::Number);
|
||||
return m_value.as_double;
|
||||
}
|
||||
|
||||
bool as_bool() const
|
||||
{
|
||||
ASSERT(type() == Type::Boolean);
|
||||
VERIFY(type() == Type::Boolean);
|
||||
return m_value.as_bool;
|
||||
}
|
||||
|
||||
Object& as_object()
|
||||
{
|
||||
ASSERT(type() == Type::Object);
|
||||
VERIFY(type() == Type::Object);
|
||||
return *m_value.as_object;
|
||||
}
|
||||
|
||||
const Object& as_object() const
|
||||
{
|
||||
ASSERT(type() == Type::Object);
|
||||
VERIFY(type() == Type::Object);
|
||||
return *m_value.as_object;
|
||||
}
|
||||
|
||||
PrimitiveString& as_string()
|
||||
{
|
||||
ASSERT(is_string());
|
||||
VERIFY(is_string());
|
||||
return *m_value.as_string;
|
||||
}
|
||||
|
||||
const PrimitiveString& as_string() const
|
||||
{
|
||||
ASSERT(is_string());
|
||||
VERIFY(is_string());
|
||||
return *m_value.as_string;
|
||||
}
|
||||
|
||||
Symbol& as_symbol()
|
||||
{
|
||||
ASSERT(is_symbol());
|
||||
VERIFY(is_symbol());
|
||||
return *m_value.as_symbol;
|
||||
}
|
||||
|
||||
const Symbol& as_symbol() const
|
||||
{
|
||||
ASSERT(is_symbol());
|
||||
VERIFY(is_symbol());
|
||||
return *m_value.as_symbol;
|
||||
}
|
||||
|
||||
Cell* as_cell()
|
||||
{
|
||||
ASSERT(is_cell());
|
||||
VERIFY(is_cell());
|
||||
return m_value.as_cell;
|
||||
}
|
||||
|
||||
Accessor& as_accessor()
|
||||
{
|
||||
ASSERT(is_accessor());
|
||||
VERIFY(is_accessor());
|
||||
return *m_value.as_accessor;
|
||||
}
|
||||
|
||||
BigInt& as_bigint()
|
||||
{
|
||||
ASSERT(is_bigint());
|
||||
VERIFY(is_bigint());
|
||||
return *m_value.as_bigint;
|
||||
}
|
||||
|
||||
NativeProperty& as_native_property()
|
||||
{
|
||||
ASSERT(is_native_property());
|
||||
VERIFY(is_native_property());
|
||||
return *m_value.as_native_property;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ const char* Token::name(TokenType type)
|
|||
ENUMERATE_JS_TOKENS
|
||||
#undef __ENUMERATE_JS_TOKEN
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
return "<Unknown>";
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ TokenCategory Token::category(TokenType type)
|
|||
ENUMERATE_JS_TOKENS
|
||||
#undef __ENUMERATE_JS_TOKEN
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ TokenCategory Token::category() const
|
|||
|
||||
double Token::double_value() const
|
||||
{
|
||||
ASSERT(type() == TokenType::NumericLiteral);
|
||||
VERIFY(type() == TokenType::NumericLiteral);
|
||||
String value_string(m_value);
|
||||
if (value_string[0] == '0' && value_string.length() >= 2) {
|
||||
if (value_string[1] == 'x' || value_string[1] == 'X') {
|
||||
|
@ -95,7 +95,7 @@ double Token::double_value() const
|
|||
|
||||
static u32 hex2int(char x)
|
||||
{
|
||||
ASSERT(isxdigit(x));
|
||||
VERIFY(isxdigit(x));
|
||||
if (x >= '0' && x <= '9')
|
||||
return x - '0';
|
||||
return 10u + (tolower(x) - 'a');
|
||||
|
@ -103,7 +103,7 @@ static u32 hex2int(char x)
|
|||
|
||||
String Token::string_value(StringValueStatus& status) const
|
||||
{
|
||||
ASSERT(type() == TokenType::StringLiteral || type() == TokenType::TemplateLiteralString);
|
||||
VERIFY(type() == TokenType::StringLiteral || type() == TokenType::TemplateLiteralString);
|
||||
|
||||
auto is_template = type() == TokenType::TemplateLiteralString;
|
||||
GenericLexer lexer(is_template ? m_value : m_value.substring_view(1, m_value.length() - 2));
|
||||
|
@ -122,7 +122,7 @@ String Token::string_value(StringValueStatus& status) const
|
|||
}
|
||||
|
||||
lexer.ignore();
|
||||
ASSERT(!lexer.is_eof());
|
||||
VERIFY(!lexer.is_eof());
|
||||
|
||||
// Line continuation
|
||||
if (lexer.next_is('\n') || lexer.next_is('\r')) {
|
||||
|
@ -146,7 +146,7 @@ String Token::string_value(StringValueStatus& status) const
|
|||
if (!isxdigit(lexer.peek()) || !isxdigit(lexer.peek(1)))
|
||||
return encoding_failure(StringValueStatus::MalformedHexEscape);
|
||||
auto code_point = hex2int(lexer.consume()) * 16 + hex2int(lexer.consume());
|
||||
ASSERT(code_point <= 255);
|
||||
VERIFY(code_point <= 255);
|
||||
builder.append_code_point(code_point);
|
||||
continue;
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ String Token::string_value(StringValueStatus& status) const
|
|||
if (!octal_str.is_null()) {
|
||||
status = StringValueStatus::LegacyOctalEscapeSequence;
|
||||
auto code_point = strtoul(octal_str.characters(), nullptr, 8);
|
||||
ASSERT(code_point <= 255);
|
||||
VERIFY(code_point <= 255);
|
||||
builder.append_code_point(code_point);
|
||||
continue;
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ String Token::string_value(StringValueStatus& status) const
|
|||
|
||||
bool Token::bool_value() const
|
||||
{
|
||||
ASSERT(type() == TokenType::BoolLiteral);
|
||||
VERIFY(type() == TokenType::BoolLiteral);
|
||||
return m_value == "true";
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue