mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:07:34 +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
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue