[runtime] Clean up runtime function Arguments accesses
Replace all CONVERT_XXX_ARG_XXX() macros from runtime-util.h with direct calls to Arguments or the fully expanded equivalent. - This replaces many of the hard CHECKs with DCHECK (as is common practice in most V8 code) - Instead of relying on verbose comments we now have readable code - Rename Arguments.::xxx_at with Arguments::xxx_value_at since these methods don't return the Object but rather their double/int value - Add Oddball::ToBool helper - Add and use v8::internal::PropertyAttributesFromInt helper - Add stronger DCHECK for PropertyAttributes returned in GetPropertyAttributesWithInterceptorInternal Bug: v8:11263 Change-Id: I8d531857e05d19f3198753b05af28d993a391854 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3497768 Reviewed-by: Igor Sheludko <ishell@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Commit-Queue: Camillo Bruni <cbruni@chromium.org> Cr-Commit-Position: refs/heads/main@{#79418}
This commit is contained in:
parent
9d96ebbb47
commit
cead657371
@ -24,18 +24,20 @@ Arguments<T>::ChangeValueScope::ChangeValueScope(Isolate* isolate,
|
||||
}
|
||||
|
||||
template <ArgumentsType T>
|
||||
int Arguments<T>::smi_at(int index) const {
|
||||
return Smi::ToInt(Object(*address_of_arg_at(index)));
|
||||
int Arguments<T>::smi_value_at(int index) const {
|
||||
Object obj = (*this)[index];
|
||||
int value = Smi::ToInt(obj);
|
||||
DCHECK_IMPLIES(obj.IsTaggedIndex(), value == tagged_index_value_at(index));
|
||||
return value;
|
||||
}
|
||||
|
||||
template <ArgumentsType T>
|
||||
int Arguments<T>::tagged_index_at(int index) const {
|
||||
Address raw = *address_of_arg_at(index);
|
||||
return static_cast<int>(TaggedIndex(raw).value());
|
||||
int Arguments<T>::tagged_index_value_at(int index) const {
|
||||
return static_cast<int>(TaggedIndex::cast((*this)[index]).value());
|
||||
}
|
||||
|
||||
template <ArgumentsType T>
|
||||
double Arguments<T>::number_at(int index) const {
|
||||
double Arguments<T>::number_value_at(int index) const {
|
||||
return (*this)[index].Number();
|
||||
}
|
||||
|
||||
|
@ -51,24 +51,24 @@ class Arguments {
|
||||
DCHECK_GE(length_, 0);
|
||||
}
|
||||
|
||||
Object operator[](int index) const {
|
||||
V8_INLINE Object operator[](int index) const {
|
||||
return Object(*address_of_arg_at(index));
|
||||
}
|
||||
|
||||
template <class S = Object>
|
||||
inline Handle<S> at(int index) const;
|
||||
V8_INLINE Handle<S> at(int index) const;
|
||||
|
||||
inline int smi_at(int index) const;
|
||||
V8_INLINE int smi_value_at(int index) const;
|
||||
|
||||
inline int tagged_index_at(int index) const;
|
||||
V8_INLINE int tagged_index_value_at(int index) const;
|
||||
|
||||
inline double number_at(int index) const;
|
||||
V8_INLINE double number_value_at(int index) const;
|
||||
|
||||
inline FullObjectSlot slot_at(int index) const {
|
||||
V8_INLINE FullObjectSlot slot_at(int index) const {
|
||||
return FullObjectSlot(address_of_arg_at(index));
|
||||
}
|
||||
|
||||
inline Address* address_of_arg_at(int index) const {
|
||||
V8_INLINE Address* address_of_arg_at(int index) const {
|
||||
DCHECK_LE(static_cast<uint32_t>(index), static_cast<uint32_t>(length_));
|
||||
uintptr_t offset = index * kSystemPointerSize;
|
||||
if (arguments_type == ArgumentsType::kJS) {
|
||||
@ -79,7 +79,7 @@ class Arguments {
|
||||
}
|
||||
|
||||
// Get the total number of arguments including the receiver.
|
||||
int length() const { return static_cast<int>(length_); }
|
||||
V8_INLINE int length() const { return static_cast<int>(length_); }
|
||||
|
||||
// Arguments on the stack are in reverse order (compared to an array).
|
||||
FullObjectSlot first_slot() const {
|
||||
|
@ -3264,6 +3264,7 @@ Handle<Object> Factory::NumberToStringCacheGet(Object number, int hash) {
|
||||
|
||||
Handle<String> Factory::NumberToString(Handle<Object> number,
|
||||
NumberCacheMode mode) {
|
||||
SLOW_DCHECK(number->IsNumber());
|
||||
if (number->IsSmi()) return SmiToString(Smi::cast(*number), mode);
|
||||
|
||||
double double_value = Handle<HeapNumber>::cast(number)->value();
|
||||
|
22
src/ic/ic.cc
22
src/ic/ic.cc
@ -2713,7 +2713,7 @@ RUNTIME_FUNCTION(Runtime_LoadNoFeedbackIC_Miss) {
|
||||
// Runtime functions don't follow the IC's calling convention.
|
||||
Handle<Object> receiver = args.at(0);
|
||||
Handle<Name> key = args.at<Name>(1);
|
||||
CONVERT_INT32_ARG_CHECKED(slot_kind, 2);
|
||||
int slot_kind = args.smi_value_at(2);
|
||||
FeedbackSlotKind kind = static_cast<FeedbackSlotKind>(slot_kind);
|
||||
|
||||
Handle<FeedbackVector> vector = Handle<FeedbackVector>();
|
||||
@ -2748,7 +2748,7 @@ RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Miss) {
|
||||
Handle<String> name = args.at<String>(0);
|
||||
Handle<TaggedIndex> slot = args.at<TaggedIndex>(1);
|
||||
Handle<HeapObject> maybe_vector = args.at<HeapObject>(2);
|
||||
CONVERT_INT32_ARG_CHECKED(typeof_value, 3);
|
||||
int typeof_value = args.smi_value_at(3);
|
||||
TypeofMode typeof_mode = static_cast<TypeofMode>(typeof_value);
|
||||
FeedbackSlot vector_slot = FeedbackVector::ToSlot(slot->value());
|
||||
|
||||
@ -2772,7 +2772,7 @@ RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Miss) {
|
||||
RUNTIME_FUNCTION(Runtime_LoadGlobalIC_Slow) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
|
||||
Handle<String> name = args.at<String>(0);
|
||||
|
||||
Handle<TaggedIndex> slot = args.at<TaggedIndex>(1);
|
||||
Handle<FeedbackVector> vector = args.at<FeedbackVector>(2);
|
||||
@ -2942,7 +2942,7 @@ RUNTIME_FUNCTION(Runtime_StoreGlobalIC_Slow) {
|
||||
DCHECK_EQ(5, args.length());
|
||||
// Runtime functions don't follow the IC's calling convention.
|
||||
Handle<Object> value = args.at(0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, name, 4);
|
||||
Handle<String> name = args.at<String>(4);
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
@ -3247,11 +3247,11 @@ static MaybeHandle<JSObject> CloneObjectSlowPath(Isolate* isolate,
|
||||
RUNTIME_FUNCTION(Runtime_CloneObjectIC_Miss) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
Handle<Object> source = args.at<Object>(0);
|
||||
CONVERT_SMI_ARG_CHECKED(flags, 1);
|
||||
Handle<Object> source = args.at(0);
|
||||
int flags = args.smi_value_at(1);
|
||||
|
||||
if (!MigrateDeprecated(isolate, source)) {
|
||||
CONVERT_TAGGED_INDEX_ARG_CHECKED(index, 2);
|
||||
int index = args.tagged_index_value_at(2);
|
||||
FeedbackSlot slot = FeedbackVector::ToSlot(index);
|
||||
Handle<HeapObject> maybe_vector = args.at<HeapObject>(3);
|
||||
if (maybe_vector->IsFeedbackVector()) {
|
||||
@ -3401,8 +3401,8 @@ RUNTIME_FUNCTION(Runtime_LoadElementWithInterceptor) {
|
||||
// TODO(verwaest): This should probably get the holder and receiver as input.
|
||||
HandleScope scope(isolate);
|
||||
Handle<JSObject> receiver = args.at<JSObject>(0);
|
||||
DCHECK_GE(args.smi_at(1), 0);
|
||||
uint32_t index = args.smi_at(1);
|
||||
DCHECK_GE(args.smi_value_at(1), 0);
|
||||
uint32_t index = args.smi_value_at(1);
|
||||
|
||||
Handle<InterceptorInfo> interceptor(receiver->GetIndexedInterceptor(),
|
||||
isolate);
|
||||
@ -3446,8 +3446,8 @@ RUNTIME_FUNCTION(Runtime_KeyedHasIC_Miss) {
|
||||
RUNTIME_FUNCTION(Runtime_HasElementWithInterceptor) {
|
||||
HandleScope scope(isolate);
|
||||
Handle<JSObject> receiver = args.at<JSObject>(0);
|
||||
DCHECK_GE(args.smi_at(1), 0);
|
||||
uint32_t index = args.smi_at(1);
|
||||
DCHECK_GE(args.smi_value_at(1), 0);
|
||||
uint32_t index = args.smi_value_at(1);
|
||||
|
||||
Handle<InterceptorInfo> interceptor(receiver->GetIndexedInterceptor(),
|
||||
isolate);
|
||||
|
@ -2012,8 +2012,8 @@ MaybeHandle<JSObject> SupportedLocales(
|
||||
}
|
||||
|
||||
// 5. Return CreateArrayFromList(supportedLocales).
|
||||
PropertyAttributes attr = static_cast<PropertyAttributes>(NONE);
|
||||
return CreateArrayFromList(isolate, supported_locales, attr);
|
||||
return CreateArrayFromList(isolate, supported_locales,
|
||||
PropertyAttributes::NONE);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@ -2027,8 +2027,8 @@ MaybeHandle<JSArray> Intl::GetCanonicalLocales(Isolate* isolate,
|
||||
MAYBE_RETURN(maybe_ll, MaybeHandle<JSArray>());
|
||||
|
||||
// 2. Return CreateArrayFromList(ll).
|
||||
PropertyAttributes attr = static_cast<PropertyAttributes>(NONE);
|
||||
return CreateArrayFromList(isolate, maybe_ll.FromJust(), attr);
|
||||
return CreateArrayFromList(isolate, maybe_ll.FromJust(),
|
||||
PropertyAttributes::NONE);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
@ -1203,6 +1203,8 @@ Maybe<PropertyAttributes> GetPropertyAttributesWithInterceptorInternal(
|
||||
if (!result.is_null()) {
|
||||
int32_t value;
|
||||
CHECK(result->ToInt32(&value));
|
||||
DCHECK_IMPLIES((value & ~PropertyAttributes::ALL_ATTRIBUTES_MASK) != 0,
|
||||
value == PropertyAttributes::ABSENT);
|
||||
return Just(static_cast<PropertyAttributes>(value));
|
||||
}
|
||||
} else if (!interceptor->getter().IsUndefined(isolate)) {
|
||||
@ -4099,7 +4101,7 @@ void JSObject::ApplyAttributesToDictionary(
|
||||
Object v = dictionary->ValueAt(i);
|
||||
if (v.IsAccessorPair()) attrs &= ~READ_ONLY;
|
||||
}
|
||||
details = details.CopyAddAttributes(static_cast<PropertyAttributes>(attrs));
|
||||
details = details.CopyAddAttributes(PropertyAttributesFromInt(attrs));
|
||||
dictionary->DetailsAtPut(i, details);
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,11 @@ DEF_GETTER(HeapObject, IsBoolean, bool) {
|
||||
((Oddball::cast(*this).kind() & Oddball::kNotBooleanMask) == 0);
|
||||
}
|
||||
|
||||
bool Oddball::ToBool(Isolate* isolate) const {
|
||||
DCHECK(IsBoolean(isolate));
|
||||
return IsTrue(isolate);
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
|
@ -31,6 +31,8 @@ class Oddball : public TorqueGeneratedOddball<Oddball, PrimitiveHeapObject> {
|
||||
V8_WARN_UNUSED_RESULT static inline Handle<Object> ToNumber(
|
||||
Isolate* isolate, Handle<Oddball> input);
|
||||
|
||||
V8_INLINE bool ToBool(Isolate* isolate) const;
|
||||
|
||||
// Initialize the fields.
|
||||
static void Initialize(Isolate* isolate, Handle<Oddball> oddball,
|
||||
const char* to_string, Handle<Object> to_number,
|
||||
|
@ -32,6 +32,11 @@ enum PropertyAttributes {
|
||||
// a non-existent property.
|
||||
};
|
||||
|
||||
V8_INLINE PropertyAttributes PropertyAttributesFromInt(int value) {
|
||||
DCHECK_EQ(value & ~PropertyAttributes::ALL_ATTRIBUTES_MASK, 0);
|
||||
return static_cast<PropertyAttributes>(value);
|
||||
}
|
||||
|
||||
// Number of distinct bits in PropertyAttributes.
|
||||
static const int kPropertyAttributesBitsCount = 3;
|
||||
|
||||
|
@ -25,8 +25,8 @@ namespace internal {
|
||||
RUNTIME_FUNCTION(Runtime_TransitionElementsKind) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Map, to_map, 1);
|
||||
Handle<JSObject> object = args.at<JSObject>(0);
|
||||
Handle<Map> to_map = args.at<Map>(1);
|
||||
ElementsKind to_kind = to_map->elements_kind();
|
||||
if (ElementsAccessor::ForKind(to_kind)
|
||||
->TransitionElementsKind(object, to_map)
|
||||
@ -43,9 +43,8 @@ RUNTIME_FUNCTION(Runtime_TransitionElementsKind) {
|
||||
RUNTIME_FUNCTION(Runtime_TransitionElementsKindWithKind) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Smi, elements_kind_smi, 1);
|
||||
ElementsKind to_kind = static_cast<ElementsKind>(elements_kind_smi->value());
|
||||
Handle<JSObject> object = args.at<JSObject>(0);
|
||||
ElementsKind to_kind = static_cast<ElementsKind>(args.smi_value_at(1));
|
||||
JSObject::TransitionElementsKind(object, to_kind);
|
||||
return *object;
|
||||
}
|
||||
@ -56,9 +55,9 @@ RUNTIME_FUNCTION(Runtime_NewArray) {
|
||||
int const argc = args.length() - 3;
|
||||
// argv points to the arguments constructed by the JavaScript call.
|
||||
JavaScriptArguments argv(argc, args.address_of_arg_at(0));
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, argc);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, new_target, argc + 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(HeapObject, type_info, argc + 2);
|
||||
Handle<JSFunction> constructor = args.at<JSFunction>(argc);
|
||||
Handle<JSReceiver> new_target = args.at<JSReceiver>(argc + 1);
|
||||
Handle<HeapObject> type_info = args.at<HeapObject>(argc + 2);
|
||||
// TODO(bmeurer): Use MaybeHandle to pass around the AllocationSite.
|
||||
Handle<AllocationSite> site = type_info->IsAllocationSite()
|
||||
? Handle<AllocationSite>::cast(type_info)
|
||||
@ -157,7 +156,7 @@ RUNTIME_FUNCTION(Runtime_NewArray) {
|
||||
RUNTIME_FUNCTION(Runtime_NormalizeElements) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, array, 0);
|
||||
Handle<JSObject> array = args.at<JSObject>(0);
|
||||
CHECK(!array->HasTypedArrayElements());
|
||||
CHECK(!array->IsJSGlobalProxy());
|
||||
JSObject::NormalizeElements(array);
|
||||
@ -169,8 +168,8 @@ RUNTIME_FUNCTION(Runtime_NormalizeElements) {
|
||||
RUNTIME_FUNCTION(Runtime_GrowArrayElements) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
|
||||
Handle<JSObject> object = args.at<JSObject>(0);
|
||||
Handle<Object> key = args.at(1);
|
||||
uint32_t index;
|
||||
if (key->IsSmi()) {
|
||||
int value = Smi::ToInt(*key);
|
||||
@ -204,7 +203,7 @@ RUNTIME_FUNCTION(Runtime_GrowArrayElements) {
|
||||
RUNTIME_FUNCTION(Runtime_ArrayIsArray) {
|
||||
HandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
Handle<Object> object = args.at(0);
|
||||
Maybe<bool> result = Object::IsArray(object);
|
||||
MAYBE_RETURN(result, ReadOnlyRoots(isolate).exception());
|
||||
return isolate->heap()->ToBoolean(result.FromJust());
|
||||
@ -213,14 +212,14 @@ RUNTIME_FUNCTION(Runtime_ArrayIsArray) {
|
||||
RUNTIME_FUNCTION(Runtime_IsArray) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(Object, obj, 0);
|
||||
Object obj = args[0];
|
||||
return isolate->heap()->ToBoolean(obj.IsJSArray());
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_ArraySpeciesConstructor) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, original_array, 0);
|
||||
Handle<Object> original_array = args.at(0);
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, Object::ArraySpeciesConstructor(isolate, original_array));
|
||||
}
|
||||
@ -229,8 +228,8 @@ RUNTIME_FUNCTION(Runtime_ArraySpeciesConstructor) {
|
||||
RUNTIME_FUNCTION(Runtime_ArrayIncludes_Slow) {
|
||||
HandleScope shs(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, search_element, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, from_index, 2);
|
||||
Handle<Object> search_element = args.at(1);
|
||||
Handle<Object> from_index = args.at(2);
|
||||
|
||||
// Let O be ? ToObject(this value).
|
||||
Handle<JSReceiver> object;
|
||||
@ -330,8 +329,8 @@ RUNTIME_FUNCTION(Runtime_ArrayIncludes_Slow) {
|
||||
RUNTIME_FUNCTION(Runtime_ArrayIndexOf) {
|
||||
HandleScope hs(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, search_element, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, from_index, 2);
|
||||
Handle<Object> search_element = args.at(1);
|
||||
Handle<Object> from_index = args.at(2);
|
||||
|
||||
// Let O be ? ToObject(this value).
|
||||
Handle<JSReceiver> object;
|
||||
|
@ -396,9 +396,9 @@ Object GetModifySetValueInBuffer(RuntimeArguments args, Isolate* isolate,
|
||||
const char* method_name) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, sta, 0);
|
||||
CONVERT_SIZE_ARG_CHECKED(index, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value_obj, 2);
|
||||
Handle<JSTypedArray> sta = args.at<JSTypedArray>(0);
|
||||
size_t index = NumberToSize(args[1]);
|
||||
Handle<Object> value_obj = args.at(2);
|
||||
|
||||
uint8_t* source = static_cast<uint8_t*>(sta->GetBuffer()->backing_store()) +
|
||||
sta->byte_offset();
|
||||
@ -444,8 +444,8 @@ Object GetModifySetValueInBuffer(RuntimeArguments args, Isolate* isolate,
|
||||
RUNTIME_FUNCTION(Runtime_AtomicsLoad64) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, sta, 0);
|
||||
CONVERT_SIZE_ARG_CHECKED(index, 1);
|
||||
Handle<JSTypedArray> sta = args.at<JSTypedArray>(0);
|
||||
size_t index = NumberToSize(args[1]);
|
||||
|
||||
uint8_t* source = static_cast<uint8_t*>(sta->GetBuffer()->backing_store()) +
|
||||
sta->byte_offset();
|
||||
@ -464,9 +464,9 @@ RUNTIME_FUNCTION(Runtime_AtomicsLoad64) {
|
||||
RUNTIME_FUNCTION(Runtime_AtomicsStore64) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, sta, 0);
|
||||
CONVERT_SIZE_ARG_CHECKED(index, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value_obj, 2);
|
||||
Handle<JSTypedArray> sta = args.at<JSTypedArray>(0);
|
||||
size_t index = NumberToSize(args[1]);
|
||||
Handle<Object> value_obj = args.at(2);
|
||||
|
||||
uint8_t* source = static_cast<uint8_t*>(sta->GetBuffer()->backing_store()) +
|
||||
sta->byte_offset();
|
||||
@ -496,10 +496,10 @@ RUNTIME_FUNCTION(Runtime_AtomicsExchange) {
|
||||
RUNTIME_FUNCTION(Runtime_AtomicsCompareExchange) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, sta, 0);
|
||||
CONVERT_SIZE_ARG_CHECKED(index, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, old_value_obj, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, new_value_obj, 3);
|
||||
Handle<JSTypedArray> sta = args.at<JSTypedArray>(0);
|
||||
size_t index = NumberToSize(args[1]);
|
||||
Handle<Object> old_value_obj = args.at(2);
|
||||
Handle<Object> new_value_obj = args.at(3);
|
||||
CHECK_LT(index, sta->length());
|
||||
|
||||
uint8_t* source = static_cast<uint8_t*>(sta->GetBuffer()->backing_store()) +
|
||||
|
@ -14,10 +14,10 @@ namespace internal {
|
||||
RUNTIME_FUNCTION(Runtime_BigIntCompareToBigInt) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Smi, mode, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(BigInt, lhs, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(BigInt, rhs, 2);
|
||||
bool result = ComparisonResultToBool(static_cast<Operation>(mode->value()),
|
||||
int mode = args.smi_value_at(0);
|
||||
Handle<BigInt> lhs = args.at<BigInt>(1);
|
||||
Handle<BigInt> rhs = args.at<BigInt>(2);
|
||||
bool result = ComparisonResultToBool(static_cast<Operation>(mode),
|
||||
BigInt::CompareToBigInt(lhs, rhs));
|
||||
return *isolate->factory()->ToBoolean(result);
|
||||
}
|
||||
@ -25,10 +25,10 @@ RUNTIME_FUNCTION(Runtime_BigIntCompareToBigInt) {
|
||||
RUNTIME_FUNCTION(Runtime_BigIntCompareToNumber) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Smi, mode, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(BigInt, lhs, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 2);
|
||||
bool result = ComparisonResultToBool(static_cast<Operation>(mode->value()),
|
||||
int mode = args.smi_value_at(0);
|
||||
Handle<BigInt> lhs = args.at<BigInt>(1);
|
||||
Handle<Object> rhs = args.at(2);
|
||||
bool result = ComparisonResultToBool(static_cast<Operation>(mode),
|
||||
BigInt::CompareToNumber(lhs, rhs));
|
||||
return *isolate->factory()->ToBoolean(result);
|
||||
}
|
||||
@ -36,13 +36,13 @@ RUNTIME_FUNCTION(Runtime_BigIntCompareToNumber) {
|
||||
RUNTIME_FUNCTION(Runtime_BigIntCompareToString) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Smi, mode, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(BigInt, lhs, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, rhs, 2);
|
||||
int mode = args.smi_value_at(0);
|
||||
Handle<BigInt> lhs = args.at<BigInt>(1);
|
||||
Handle<String> rhs = args.at<String>(2);
|
||||
Maybe<ComparisonResult> maybe_result =
|
||||
BigInt::CompareToString(isolate, lhs, rhs);
|
||||
MAYBE_RETURN(maybe_result, ReadOnlyRoots(isolate).exception());
|
||||
bool result = ComparisonResultToBool(static_cast<Operation>(mode->value()),
|
||||
bool result = ComparisonResultToBool(static_cast<Operation>(mode),
|
||||
maybe_result.FromJust());
|
||||
return *isolate->factory()->ToBoolean(result);
|
||||
}
|
||||
@ -50,8 +50,8 @@ RUNTIME_FUNCTION(Runtime_BigIntCompareToString) {
|
||||
RUNTIME_FUNCTION(Runtime_BigIntEqualToBigInt) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(BigInt, lhs, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(BigInt, rhs, 1);
|
||||
Handle<BigInt> lhs = args.at<BigInt>(0);
|
||||
Handle<BigInt> rhs = args.at<BigInt>(1);
|
||||
bool result = BigInt::EqualToBigInt(*lhs, *rhs);
|
||||
return *isolate->factory()->ToBoolean(result);
|
||||
}
|
||||
@ -59,8 +59,8 @@ RUNTIME_FUNCTION(Runtime_BigIntEqualToBigInt) {
|
||||
RUNTIME_FUNCTION(Runtime_BigIntEqualToNumber) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(BigInt, lhs, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
|
||||
Handle<BigInt> lhs = args.at<BigInt>(0);
|
||||
Handle<Object> rhs = args.at(1);
|
||||
bool result = BigInt::EqualToNumber(lhs, rhs);
|
||||
return *isolate->factory()->ToBoolean(result);
|
||||
}
|
||||
@ -68,8 +68,8 @@ RUNTIME_FUNCTION(Runtime_BigIntEqualToNumber) {
|
||||
RUNTIME_FUNCTION(Runtime_BigIntEqualToString) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(BigInt, lhs, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, rhs, 1);
|
||||
Handle<BigInt> lhs = args.at<BigInt>(0);
|
||||
Handle<String> rhs = args.at<String>(1);
|
||||
Maybe<bool> maybe_result = BigInt::EqualToString(isolate, lhs, rhs);
|
||||
MAYBE_RETURN(maybe_result, ReadOnlyRoots(isolate).exception());
|
||||
return *isolate->factory()->ToBoolean(maybe_result.FromJust());
|
||||
@ -78,30 +78,30 @@ RUNTIME_FUNCTION(Runtime_BigIntEqualToString) {
|
||||
RUNTIME_FUNCTION(Runtime_BigIntToBoolean) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(BigInt, bigint, 0);
|
||||
Handle<BigInt> bigint = args.at<BigInt>(0);
|
||||
return *isolate->factory()->ToBoolean(bigint->ToBoolean());
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_BigIntToNumber) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(BigInt, x, 0);
|
||||
Handle<BigInt> x = args.at<BigInt>(0);
|
||||
return *BigInt::ToNumber(isolate, x);
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_ToBigInt) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
|
||||
Handle<Object> x = args.at(0);
|
||||
RETURN_RESULT_OR_FAILURE(isolate, BigInt::FromObject(isolate, x));
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_BigIntBinaryOp) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, left_obj, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, right_obj, 1);
|
||||
CONVERT_SMI_ARG_CHECKED(opcode, 2);
|
||||
Handle<Object> left_obj = args.at(0);
|
||||
Handle<Object> right_obj = args.at(1);
|
||||
int opcode = args.smi_value_at(2);
|
||||
Operation op = static_cast<Operation>(opcode);
|
||||
|
||||
if (!left_obj->IsBigInt() || !right_obj->IsBigInt()) {
|
||||
@ -157,8 +157,8 @@ RUNTIME_FUNCTION(Runtime_BigIntBinaryOp) {
|
||||
RUNTIME_FUNCTION(Runtime_BigIntUnaryOp) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(BigInt, x, 0);
|
||||
CONVERT_SMI_ARG_CHECKED(opcode, 1);
|
||||
Handle<BigInt> x = args.at<BigInt>(0);
|
||||
int opcode = args.smi_value_at(1);
|
||||
Operation op = static_cast<Operation>(opcode);
|
||||
|
||||
MaybeHandle<BigInt> result;
|
||||
|
@ -39,7 +39,7 @@ RUNTIME_FUNCTION(Runtime_ThrowUnsupportedSuperError) {
|
||||
RUNTIME_FUNCTION(Runtime_ThrowConstructorNonCallableError) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, 0);
|
||||
Handle<JSFunction> constructor = args.at<JSFunction>(0);
|
||||
Handle<String> name(constructor->shared().Name(), isolate);
|
||||
|
||||
Handle<Context> context = handle(constructor->native_context(), isolate);
|
||||
@ -115,8 +115,8 @@ Object ThrowNotSuperConstructor(Isolate* isolate, Handle<Object> constructor,
|
||||
RUNTIME_FUNCTION(Runtime_ThrowNotSuperConstructor) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, constructor, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 1);
|
||||
Handle<Object> constructor = args.at(0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(1);
|
||||
return ThrowNotSuperConstructor(isolate, constructor, function);
|
||||
}
|
||||
|
||||
@ -425,7 +425,7 @@ bool AddDescriptorsByTemplate(
|
||||
int key_index = ComputedEntryFlags::KeyIndexBits::decode(flags);
|
||||
Smi value = Smi::FromInt(key_index + 1); // Value follows name.
|
||||
|
||||
Handle<Object> key = args.at<Object>(key_index);
|
||||
Handle<Object> key = args.at(key_index);
|
||||
DCHECK(key->IsName());
|
||||
uint32_t element;
|
||||
Handle<Name> name = Handle<Name>::cast(key);
|
||||
@ -664,9 +664,9 @@ MaybeHandle<Object> DefineClass(Isolate* isolate,
|
||||
RUNTIME_FUNCTION(Runtime_DefineClass) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_LE(ClassBoilerplate::kFirstDynamicArgumentIndex, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(ClassBoilerplate, class_boilerplate, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, super_class, 2);
|
||||
Handle<ClassBoilerplate> class_boilerplate = args.at<ClassBoilerplate>(0);
|
||||
Handle<JSFunction> constructor = args.at<JSFunction>(1);
|
||||
Handle<Object> super_class = args.at(2);
|
||||
DCHECK_EQ(class_boilerplate->arguments_count(), args.length());
|
||||
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
@ -718,9 +718,9 @@ MaybeHandle<Object> LoadFromSuper(Isolate* isolate, Handle<Object> receiver,
|
||||
RUNTIME_FUNCTION(Runtime_LoadFromSuper) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Name, name, 2);
|
||||
Handle<Object> receiver = args.at(0);
|
||||
Handle<JSObject> home_object = args.at<JSObject>(1);
|
||||
Handle<Name> name = args.at<Name>(2);
|
||||
|
||||
PropertyKey key(isolate, name);
|
||||
|
||||
@ -732,11 +732,11 @@ RUNTIME_FUNCTION(Runtime_LoadFromSuper) {
|
||||
RUNTIME_FUNCTION(Runtime_LoadKeyedFromSuper) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1);
|
||||
Handle<Object> receiver = args.at(0);
|
||||
Handle<JSObject> home_object = args.at<JSObject>(1);
|
||||
// TODO(ishell): To improve performance, consider performing the to-string
|
||||
// conversion of {key} before calling into the runtime.
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key, 2);
|
||||
Handle<Object> key = args.at(2);
|
||||
|
||||
bool success;
|
||||
PropertyKey lookup_key(isolate, key, &success);
|
||||
@ -767,10 +767,10 @@ MaybeHandle<Object> StoreToSuper(Isolate* isolate, Handle<JSObject> home_object,
|
||||
RUNTIME_FUNCTION(Runtime_StoreToSuper) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Name, name, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 3);
|
||||
Handle<Object> receiver = args.at(0);
|
||||
Handle<JSObject> home_object = args.at<JSObject>(1);
|
||||
Handle<Name> name = args.at<Name>(2);
|
||||
Handle<Object> value = args.at(3);
|
||||
|
||||
PropertyKey key(isolate, name);
|
||||
|
||||
@ -782,12 +782,12 @@ RUNTIME_FUNCTION(Runtime_StoreToSuper) {
|
||||
RUNTIME_FUNCTION(Runtime_StoreKeyedToSuper) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, home_object, 1);
|
||||
Handle<Object> receiver = args.at(0);
|
||||
Handle<JSObject> home_object = args.at<JSObject>(1);
|
||||
// TODO(ishell): To improve performance, consider performing the to-string
|
||||
// conversion of {key} before calling into the runtime.
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 3);
|
||||
Handle<Object> key = args.at(2);
|
||||
Handle<Object> value = args.at(3);
|
||||
|
||||
bool success;
|
||||
PropertyKey lookup_key(isolate, key, &success);
|
||||
|
@ -23,7 +23,7 @@ RUNTIME_FUNCTION(Runtime_TheHole) {
|
||||
RUNTIME_FUNCTION(Runtime_SetGrow) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
|
||||
Handle<JSSet> holder = args.at<JSSet>(0);
|
||||
Handle<OrderedHashSet> table(OrderedHashSet::cast(holder->table()), isolate);
|
||||
MaybeHandle<OrderedHashSet> table_candidate =
|
||||
OrderedHashSet::EnsureGrowable(isolate, table);
|
||||
@ -40,7 +40,7 @@ RUNTIME_FUNCTION(Runtime_SetGrow) {
|
||||
RUNTIME_FUNCTION(Runtime_SetShrink) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSSet, holder, 0);
|
||||
Handle<JSSet> holder = args.at<JSSet>(0);
|
||||
Handle<OrderedHashSet> table(OrderedHashSet::cast(holder->table()), isolate);
|
||||
table = OrderedHashSet::Shrink(isolate, table);
|
||||
holder->set_table(*table);
|
||||
@ -50,7 +50,7 @@ RUNTIME_FUNCTION(Runtime_SetShrink) {
|
||||
RUNTIME_FUNCTION(Runtime_MapShrink) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
|
||||
Handle<JSMap> holder = args.at<JSMap>(0);
|
||||
Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table()), isolate);
|
||||
table = OrderedHashMap::Shrink(isolate, table);
|
||||
holder->set_table(*table);
|
||||
@ -60,7 +60,7 @@ RUNTIME_FUNCTION(Runtime_MapShrink) {
|
||||
RUNTIME_FUNCTION(Runtime_MapGrow) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSMap, holder, 0);
|
||||
Handle<JSMap> holder = args.at<JSMap>(0);
|
||||
Handle<OrderedHashMap> table(OrderedHashMap::cast(holder->table()), isolate);
|
||||
MaybeHandle<OrderedHashMap> table_candidate =
|
||||
OrderedHashMap::EnsureGrowable(isolate, table);
|
||||
@ -77,9 +77,9 @@ RUNTIME_FUNCTION(Runtime_MapGrow) {
|
||||
RUNTIME_FUNCTION(Runtime_WeakCollectionDelete) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
|
||||
CONVERT_SMI_ARG_CHECKED(hash, 2)
|
||||
Handle<JSWeakCollection> weak_collection = args.at<JSWeakCollection>(0);
|
||||
Handle<Object> key = args.at(1);
|
||||
int hash = args.smi_value_at(2);
|
||||
|
||||
#ifdef DEBUG
|
||||
DCHECK(key->IsJSReceiver());
|
||||
@ -99,10 +99,10 @@ RUNTIME_FUNCTION(Runtime_WeakCollectionDelete) {
|
||||
RUNTIME_FUNCTION(Runtime_WeakCollectionSet) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSWeakCollection, weak_collection, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
|
||||
CONVERT_SMI_ARG_CHECKED(hash, 3)
|
||||
Handle<JSWeakCollection> weak_collection = args.at<JSWeakCollection>(0);
|
||||
Handle<Object> key = args.at(1);
|
||||
Handle<Object> value = args.at(2);
|
||||
int hash = args.smi_value_at(3);
|
||||
|
||||
#ifdef DEBUG
|
||||
DCHECK(key->IsJSReceiver());
|
||||
|
@ -51,7 +51,7 @@ Object CompileOptimized(Isolate* isolate, Handle<JSFunction> function,
|
||||
RUNTIME_FUNCTION(Runtime_CompileLazy) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
|
||||
Handle<SharedFunctionInfo> sfi(function->shared(), isolate);
|
||||
|
||||
@ -79,7 +79,7 @@ RUNTIME_FUNCTION(Runtime_CompileLazy) {
|
||||
RUNTIME_FUNCTION(Runtime_InstallBaselineCode) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
Handle<SharedFunctionInfo> sfi(function->shared(), isolate);
|
||||
DCHECK(sfi->HasBaselineCode());
|
||||
IsCompiledScope is_compiled_scope(*sfi, isolate);
|
||||
@ -96,7 +96,7 @@ RUNTIME_FUNCTION(Runtime_InstallBaselineCode) {
|
||||
RUNTIME_FUNCTION(Runtime_CompileMaglev_Concurrent) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
return CompileOptimized(isolate, function, CodeKind::MAGLEV,
|
||||
ConcurrencyMode::kConcurrent);
|
||||
}
|
||||
@ -104,7 +104,7 @@ RUNTIME_FUNCTION(Runtime_CompileMaglev_Concurrent) {
|
||||
RUNTIME_FUNCTION(Runtime_CompileMaglev_NotConcurrent) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
return CompileOptimized(isolate, function, CodeKind::MAGLEV,
|
||||
ConcurrencyMode::kNotConcurrent);
|
||||
}
|
||||
@ -112,7 +112,7 @@ RUNTIME_FUNCTION(Runtime_CompileMaglev_NotConcurrent) {
|
||||
RUNTIME_FUNCTION(Runtime_CompileTurbofan_Concurrent) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
return CompileOptimized(isolate, function, CodeKind::TURBOFAN,
|
||||
ConcurrencyMode::kConcurrent);
|
||||
}
|
||||
@ -120,7 +120,7 @@ RUNTIME_FUNCTION(Runtime_CompileTurbofan_Concurrent) {
|
||||
RUNTIME_FUNCTION(Runtime_CompileTurbofan_NotConcurrent) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
return CompileOptimized(isolate, function, CodeKind::TURBOFAN,
|
||||
ConcurrencyMode::kNotConcurrent);
|
||||
}
|
||||
@ -128,7 +128,7 @@ RUNTIME_FUNCTION(Runtime_CompileTurbofan_NotConcurrent) {
|
||||
RUNTIME_FUNCTION(Runtime_HealOptimizedCodeSlot) {
|
||||
SealHandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
|
||||
DCHECK(function->shared().is_compiled());
|
||||
|
||||
@ -140,7 +140,7 @@ RUNTIME_FUNCTION(Runtime_HealOptimizedCodeSlot) {
|
||||
RUNTIME_FUNCTION(Runtime_InstantiateAsmJs) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(args.length(), 4);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
|
||||
Handle<JSReceiver> stdlib;
|
||||
if (args[1].IsJSReceiver()) {
|
||||
@ -244,7 +244,7 @@ RUNTIME_FUNCTION(Runtime_ObserveNode) {
|
||||
// code compiled by TurboFan.
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0);
|
||||
Handle<Object> obj = args.at(0);
|
||||
return *obj;
|
||||
}
|
||||
|
||||
@ -252,7 +252,7 @@ RUNTIME_FUNCTION(Runtime_VerifyType) {
|
||||
// %VerifyType has no effect in the interpreter.
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0);
|
||||
Handle<Object> obj = args.at(0);
|
||||
return *obj;
|
||||
}
|
||||
|
||||
@ -462,14 +462,13 @@ RUNTIME_FUNCTION(Runtime_ResolvePossiblyDirectEval) {
|
||||
return *callee;
|
||||
}
|
||||
|
||||
DCHECK(args[3].IsSmi());
|
||||
DCHECK(is_valid_language_mode(args.smi_at(3)));
|
||||
LanguageMode language_mode = static_cast<LanguageMode>(args.smi_at(3));
|
||||
DCHECK(args[4].IsSmi());
|
||||
DCHECK(is_valid_language_mode(args.smi_value_at(3)));
|
||||
LanguageMode language_mode = static_cast<LanguageMode>(args.smi_value_at(3));
|
||||
Handle<SharedFunctionInfo> outer_info(args.at<JSFunction>(2)->shared(),
|
||||
isolate);
|
||||
return CompileGlobalEval(isolate, args.at<Object>(1), outer_info,
|
||||
language_mode, args.smi_at(4), args.smi_at(5));
|
||||
language_mode, args.smi_value_at(4),
|
||||
args.smi_value_at(5));
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
@ -47,7 +47,7 @@ RUNTIME_FUNCTION_RETURN_PAIR(Runtime_DebugBreakOnBytecode) {
|
||||
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 0);
|
||||
Handle<Object> value = args.at(0);
|
||||
HandleScope scope(isolate);
|
||||
|
||||
// Return value can be changed by debugger. Last set value will be used as
|
||||
@ -112,7 +112,7 @@ RUNTIME_FUNCTION_RETURN_PAIR(Runtime_DebugBreakOnBytecode) {
|
||||
RUNTIME_FUNCTION(Runtime_DebugBreakAtEntry) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
USE(function);
|
||||
|
||||
DCHECK(function->shared().HasDebugInfo());
|
||||
@ -385,7 +385,7 @@ RUNTIME_FUNCTION(Runtime_GetGeneratorScopeCount) {
|
||||
if (!args[0].IsJSGeneratorObject()) return Smi::zero();
|
||||
|
||||
// Check arguments.
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, gen, 0);
|
||||
Handle<JSGeneratorObject> gen = args.at<JSGeneratorObject>(0);
|
||||
|
||||
// Only inspect suspended generator scopes.
|
||||
if (!gen->is_suspended()) {
|
||||
@ -410,8 +410,8 @@ RUNTIME_FUNCTION(Runtime_GetGeneratorScopeDetails) {
|
||||
}
|
||||
|
||||
// Check arguments.
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, gen, 0);
|
||||
CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]);
|
||||
Handle<JSGeneratorObject> gen = args.at<JSGeneratorObject>(0);
|
||||
int index = NumberToInt32(args[1]);
|
||||
|
||||
// Only inspect suspended generator scopes.
|
||||
if (!gen->is_suspended()) {
|
||||
@ -453,10 +453,10 @@ static bool SetScopeVariableValue(ScopeIterator* it, int index,
|
||||
RUNTIME_FUNCTION(Runtime_SetGeneratorScopeVariableValue) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, gen, 0);
|
||||
CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, variable_name, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, new_value, 3);
|
||||
Handle<JSGeneratorObject> gen = args.at<JSGeneratorObject>(0);
|
||||
int index = NumberToInt32(args[1]);
|
||||
Handle<String> variable_name = args.at<String>(2);
|
||||
Handle<Object> new_value = args.at(3);
|
||||
ScopeIterator it(isolate, gen);
|
||||
bool res = SetScopeVariableValue(&it, index, variable_name, new_value);
|
||||
return isolate->heap()->ToBoolean(res);
|
||||
@ -467,7 +467,7 @@ RUNTIME_FUNCTION(Runtime_GetBreakLocations) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CHECK(isolate->debug()->is_active());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
|
||||
Handle<JSFunction> fun = args.at<JSFunction>(0);
|
||||
|
||||
Handle<SharedFunctionInfo> shared(fun->shared(), isolate);
|
||||
// Find the number of break points
|
||||
@ -487,7 +487,7 @@ RUNTIME_FUNCTION(Runtime_GetBreakLocations) {
|
||||
RUNTIME_FUNCTION(Runtime_IsBreakOnException) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_NUMBER_CHECKED(uint32_t, type_arg, Uint32, args[0]);
|
||||
uint32_t type_arg = NumberToUint32(args[0]);
|
||||
|
||||
ExceptionBreakType type = static_cast<ExceptionBreakType>(type_arg);
|
||||
bool result = isolate->debug()->IsBreakOnException(type);
|
||||
@ -529,7 +529,7 @@ RUNTIME_FUNCTION(Runtime_FunctionGetInferredName) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
|
||||
CONVERT_ARG_CHECKED(Object, f, 0);
|
||||
Object f = args[0];
|
||||
if (f.IsJSFunction()) {
|
||||
return JSFunction::cast(f).shared().inferred_name();
|
||||
}
|
||||
@ -670,10 +670,10 @@ bool GetScriptById(Isolate* isolate, int needle, Handle<Script>* result) {
|
||||
RUNTIME_FUNCTION(Runtime_ScriptLocationFromLine2) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_NUMBER_CHECKED(int32_t, scriptid, Int32, args[0]);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, opt_line, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, opt_column, 2);
|
||||
CONVERT_NUMBER_CHECKED(int32_t, offset, Int32, args[3]);
|
||||
int32_t scriptid = NumberToInt32(args[0]);
|
||||
Handle<Object> opt_line = args.at(1);
|
||||
Handle<Object> opt_column = args.at(2);
|
||||
int32_t offset = NumberToInt32(args[3]);
|
||||
|
||||
Handle<Script> script;
|
||||
CHECK(GetScriptById(isolate, scriptid, &script));
|
||||
@ -686,8 +686,8 @@ RUNTIME_FUNCTION(Runtime_ScriptLocationFromLine2) {
|
||||
RUNTIME_FUNCTION(Runtime_DebugOnFunctionCall) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1);
|
||||
Handle<JSFunction> fun = args.at<JSFunction>(0);
|
||||
Handle<Object> receiver = args.at(1);
|
||||
if (isolate->debug()->needs_check_on_function_call()) {
|
||||
// Ensure that the callee will perform debug check on function call too.
|
||||
Handle<SharedFunctionInfo> shared(fun->shared(), isolate);
|
||||
@ -716,7 +716,7 @@ RUNTIME_FUNCTION(Runtime_DebugPrepareStepInSuspendedGenerator) {
|
||||
RUNTIME_FUNCTION(Runtime_DebugPushPromise) {
|
||||
DCHECK_EQ(1, args.length());
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0);
|
||||
Handle<JSObject> promise = args.at<JSObject>(0);
|
||||
isolate->PushPromise(promise);
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
}
|
||||
@ -800,7 +800,7 @@ RUNTIME_FUNCTION(Runtime_DebugCollectCoverage) {
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_DebugTogglePreciseCoverage) {
|
||||
SealHandleScope shs(isolate);
|
||||
CONVERT_BOOLEAN_ARG_CHECKED(enable, 0);
|
||||
bool enable = Oddball::cast(args[0]).ToBool(isolate);
|
||||
Coverage::SelectMode(isolate, enable ? debug::CoverageMode::kPreciseCount
|
||||
: debug::CoverageMode::kBestEffort);
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
@ -808,7 +808,7 @@ RUNTIME_FUNCTION(Runtime_DebugTogglePreciseCoverage) {
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_DebugToggleBlockCoverage) {
|
||||
SealHandleScope shs(isolate);
|
||||
CONVERT_BOOLEAN_ARG_CHECKED(enable, 0);
|
||||
bool enable = Oddball::cast(args[0]).ToBool(isolate);
|
||||
Coverage::SelectMode(isolate, enable ? debug::CoverageMode::kBlockCount
|
||||
: debug::CoverageMode::kBestEffort);
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
@ -821,11 +821,11 @@ RUNTIME_FUNCTION(Runtime_IncBlockCounter) {
|
||||
RUNTIME_FUNCTION(Runtime_DebugAsyncFunctionSuspended) {
|
||||
DCHECK_EQ(5, args.length());
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSPromise, outer_promise, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, reject_handler, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 3);
|
||||
CONVERT_BOOLEAN_ARG_CHECKED(is_predicted_as_caught, 4);
|
||||
Handle<JSPromise> promise = args.at<JSPromise>(0);
|
||||
Handle<JSPromise> outer_promise = args.at<JSPromise>(1);
|
||||
Handle<JSFunction> reject_handler = args.at<JSFunction>(2);
|
||||
Handle<JSGeneratorObject> generator = args.at<JSGeneratorObject>(3);
|
||||
bool is_predicted_as_caught = Oddball::cast(args[4]).ToBool(isolate);
|
||||
|
||||
// Allocate the throwaway promise and fire the appropriate init
|
||||
// hook for the throwaway promise (passing the {promise} as its
|
||||
@ -867,7 +867,7 @@ RUNTIME_FUNCTION(Runtime_DebugAsyncFunctionSuspended) {
|
||||
RUNTIME_FUNCTION(Runtime_DebugPromiseThen) {
|
||||
DCHECK_EQ(1, args.length());
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, promise, 0);
|
||||
Handle<JSReceiver> promise = args.at<JSReceiver>(0);
|
||||
if (promise->IsJSPromise()) {
|
||||
isolate->OnPromiseThen(Handle<JSPromise>::cast(promise));
|
||||
}
|
||||
@ -877,8 +877,8 @@ RUNTIME_FUNCTION(Runtime_DebugPromiseThen) {
|
||||
RUNTIME_FUNCTION(Runtime_LiveEditPatchScript) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, script_function, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, new_source, 1);
|
||||
Handle<JSFunction> script_function = args.at<JSFunction>(0);
|
||||
Handle<String> new_source = args.at<String>(1);
|
||||
|
||||
Handle<Script> script(Script::cast(script_function->shared().script()),
|
||||
isolate);
|
||||
|
@ -119,7 +119,7 @@ MaybeHandle<Object> HasEnumerableProperty(Isolate* isolate,
|
||||
RUNTIME_FUNCTION(Runtime_ForInEnumerate) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
|
||||
Handle<JSReceiver> receiver = args.at<JSReceiver>(0);
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Enumerate(isolate, receiver));
|
||||
}
|
||||
|
||||
@ -127,8 +127,8 @@ RUNTIME_FUNCTION(Runtime_ForInEnumerate) {
|
||||
RUNTIME_FUNCTION(Runtime_ForInHasProperty) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
|
||||
Handle<JSReceiver> receiver = args.at<JSReceiver>(0);
|
||||
Handle<Object> key = args.at(1);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result, HasEnumerableProperty(isolate, receiver, key));
|
||||
|
@ -17,7 +17,7 @@ namespace internal {
|
||||
RUNTIME_FUNCTION(Runtime_FunctionGetScriptSource) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0);
|
||||
Handle<JSReceiver> function = args.at<JSReceiver>(0);
|
||||
|
||||
if (function->IsJSFunction()) {
|
||||
Handle<Object> script(Handle<JSFunction>::cast(function)->shared().script(),
|
||||
@ -30,7 +30,7 @@ RUNTIME_FUNCTION(Runtime_FunctionGetScriptSource) {
|
||||
RUNTIME_FUNCTION(Runtime_FunctionGetScriptId) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0);
|
||||
Handle<JSReceiver> function = args.at<JSReceiver>(0);
|
||||
|
||||
if (function->IsJSFunction()) {
|
||||
Handle<Object> script(Handle<JSFunction>::cast(function)->shared().script(),
|
||||
@ -45,7 +45,7 @@ RUNTIME_FUNCTION(Runtime_FunctionGetScriptId) {
|
||||
RUNTIME_FUNCTION(Runtime_FunctionGetSourceCode) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, function, 0);
|
||||
Handle<JSReceiver> function = args.at<JSReceiver>(0);
|
||||
if (function->IsJSFunction()) {
|
||||
Handle<SharedFunctionInfo> shared(
|
||||
Handle<JSFunction>::cast(function)->shared(), isolate);
|
||||
@ -59,7 +59,7 @@ RUNTIME_FUNCTION(Runtime_FunctionGetScriptSourcePosition) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
|
||||
CONVERT_ARG_CHECKED(JSFunction, fun, 0);
|
||||
auto fun = JSFunction::cast(args[0]);
|
||||
int pos = fun.shared().StartPosition();
|
||||
return Smi::FromInt(pos);
|
||||
}
|
||||
@ -69,7 +69,7 @@ RUNTIME_FUNCTION(Runtime_FunctionIsAPIFunction) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
|
||||
CONVERT_ARG_CHECKED(JSFunction, f, 0);
|
||||
auto f = JSFunction::cast(args[0]);
|
||||
return isolate->heap()->ToBoolean(f.shared().IsApiFunction());
|
||||
}
|
||||
|
||||
@ -78,8 +78,8 @@ RUNTIME_FUNCTION(Runtime_Call) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_LE(2, args.length());
|
||||
int const argc = args.length() - 2;
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, target, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1);
|
||||
Handle<Object> target = args.at(0);
|
||||
Handle<Object> receiver = args.at(1);
|
||||
base::ScopedVector<Handle<Object>> argv(argc);
|
||||
for (int i = 0; i < argc; ++i) {
|
||||
argv[i] = args.at(2 + i);
|
||||
@ -92,7 +92,7 @@ RUNTIME_FUNCTION(Runtime_Call) {
|
||||
RUNTIME_FUNCTION(Runtime_IsFunction) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(Object, object, 0);
|
||||
Object object = args[0];
|
||||
return isolate->heap()->ToBoolean(object.IsFunction());
|
||||
}
|
||||
|
||||
|
@ -23,8 +23,8 @@ namespace internal {
|
||||
RUNTIME_FUNCTION(Runtime_AtomicsNumWaitersForTesting) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, sta, 0);
|
||||
CONVERT_SIZE_ARG_CHECKED(index, 1);
|
||||
Handle<JSTypedArray> sta = args.at<JSTypedArray>(0);
|
||||
size_t index = NumberToSize(args[1]);
|
||||
CHECK(!sta->WasDetached());
|
||||
CHECK(sta->GetBuffer()->is_shared());
|
||||
CHECK_LT(index, sta->length());
|
||||
@ -44,8 +44,8 @@ RUNTIME_FUNCTION(Runtime_AtomicsNumAsyncWaitersForTesting) {
|
||||
RUNTIME_FUNCTION(Runtime_AtomicsNumUnresolvedAsyncPromisesForTesting) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, sta, 0);
|
||||
CONVERT_SIZE_ARG_CHECKED(index, 1);
|
||||
Handle<JSTypedArray> sta = args.at<JSTypedArray>(0);
|
||||
size_t index = NumberToSize(args[1]);
|
||||
CHECK(!sta->WasDetached());
|
||||
CHECK(sta->GetBuffer()->is_shared());
|
||||
CHECK_LT(index, sta->length());
|
||||
@ -61,7 +61,7 @@ RUNTIME_FUNCTION(Runtime_AtomicsNumUnresolvedAsyncPromisesForTesting) {
|
||||
RUNTIME_FUNCTION(Runtime_SetAllowAtomicsWait) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_BOOLEAN_ARG_CHECKED(set, 0);
|
||||
bool set = Oddball::cast(args[0]).ToBool(isolate);
|
||||
|
||||
isolate->set_allow_atomics_wait(set);
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
|
@ -46,8 +46,8 @@ RUNTIME_FUNCTION(Runtime_AsyncFunctionResolve) {
|
||||
RUNTIME_FUNCTION(Runtime_CreateJSGeneratorObject) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 1);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
Handle<Object> receiver = args.at(1);
|
||||
CHECK_IMPLIES(IsAsyncFunction(function->shared().kind()),
|
||||
IsAsyncGeneratorFunction(function->shared().kind()));
|
||||
CHECK(IsResumableFunction(function->shared().kind()));
|
||||
@ -83,7 +83,7 @@ RUNTIME_FUNCTION(Runtime_GeneratorClose) {
|
||||
RUNTIME_FUNCTION(Runtime_GeneratorGetFunction) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSGeneratorObject, generator, 0);
|
||||
Handle<JSGeneratorObject> generator = args.at<JSGeneratorObject>(0);
|
||||
|
||||
return generator->function();
|
||||
}
|
||||
@ -129,7 +129,7 @@ RUNTIME_FUNCTION(Runtime_GeneratorGetResumeMode) {
|
||||
RUNTIME_FUNCTION(Runtime_AsyncGeneratorHasCatchHandlerForPC) {
|
||||
DisallowGarbageCollection no_gc_scope;
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(JSAsyncGeneratorObject, generator, 0);
|
||||
auto generator = JSAsyncGeneratorObject::cast(args[0]);
|
||||
|
||||
int state = generator.continuation();
|
||||
DCHECK_NE(state, JSAsyncGeneratorObject::kGeneratorExecuting);
|
||||
|
@ -41,7 +41,7 @@ namespace internal {
|
||||
RUNTIME_FUNCTION(Runtime_AccessCheck) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
|
||||
Handle<JSObject> object = args.at<JSObject>(0);
|
||||
if (!isolate->MayAccess(handle(isolate->context(), isolate), object)) {
|
||||
isolate->ReportFailedAccessCheck(object);
|
||||
RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
|
||||
@ -97,7 +97,7 @@ RUNTIME_FUNCTION(Runtime_ThrowSymbolAsyncIteratorInvalid) {
|
||||
#define THROW_ERROR(isolate, args, call) \
|
||||
HandleScope scope(isolate); \
|
||||
DCHECK_LE(1, args.length()); \
|
||||
CONVERT_SMI_ARG_CHECKED(message_id_smi, 0); \
|
||||
int message_id_smi = args.smi_value_at(0); \
|
||||
\
|
||||
Handle<Object> undefined = isolate->factory()->undefined_value(); \
|
||||
Handle<Object> arg0 = (args.length() > 1) ? args.at(1) : undefined; \
|
||||
@ -111,7 +111,7 @@ RUNTIME_FUNCTION(Runtime_ThrowSymbolAsyncIteratorInvalid) {
|
||||
RUNTIME_FUNCTION(Runtime_ThrowRangeError) {
|
||||
if (FLAG_correctness_fuzzer_suppressions) {
|
||||
DCHECK_LE(1, args.length());
|
||||
CONVERT_SMI_ARG_CHECKED(message_id_smi, 0);
|
||||
int message_id_smi = args.smi_value_at(0);
|
||||
|
||||
// If the result of a BigInt computation is truncated to 64 bit, Turbofan
|
||||
// can sometimes truncate intermediate results already, which can prevent
|
||||
@ -163,8 +163,8 @@ const char* ElementsKindToType(ElementsKind fixed_elements_kind) {
|
||||
RUNTIME_FUNCTION(Runtime_ThrowInvalidTypedArrayAlignment) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Map, map, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, problem_string, 1);
|
||||
Handle<Map> map = args.at<Map>(0);
|
||||
Handle<String> problem_string = args.at<String>(1);
|
||||
|
||||
ElementsKind kind = map->elements_kind();
|
||||
|
||||
@ -197,7 +197,7 @@ RUNTIME_FUNCTION(Runtime_PromoteScheduledException) {
|
||||
RUNTIME_FUNCTION(Runtime_ThrowReferenceError) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, name, 0);
|
||||
Handle<Object> name = args.at(0);
|
||||
THROW_NEW_ERROR_RETURN_FAILURE(
|
||||
isolate, NewReferenceError(MessageTemplate::kNotDefined, name));
|
||||
}
|
||||
@ -205,7 +205,7 @@ RUNTIME_FUNCTION(Runtime_ThrowReferenceError) {
|
||||
RUNTIME_FUNCTION(Runtime_ThrowAccessedUninitializedVariable) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, name, 0);
|
||||
Handle<Object> name = args.at(0);
|
||||
THROW_NEW_ERROR_RETURN_FAILURE(
|
||||
isolate,
|
||||
NewReferenceError(MessageTemplate::kAccessedUninitializedVariable, name));
|
||||
@ -214,8 +214,8 @@ RUNTIME_FUNCTION(Runtime_ThrowAccessedUninitializedVariable) {
|
||||
RUNTIME_FUNCTION(Runtime_NewError) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_INT32_ARG_CHECKED(template_index, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 1);
|
||||
int template_index = args.smi_value_at(0);
|
||||
Handle<Object> arg0 = args.at(1);
|
||||
MessageTemplate message_template = MessageTemplateFromInt(template_index);
|
||||
return *isolate->factory()->NewError(message_template, arg0);
|
||||
}
|
||||
@ -230,23 +230,20 @@ RUNTIME_FUNCTION(Runtime_NewTypeError) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_LE(args.length(), 4);
|
||||
DCHECK_GE(args.length(), 1);
|
||||
CONVERT_INT32_ARG_CHECKED(template_index, 0);
|
||||
int template_index = args.smi_value_at(0);
|
||||
MessageTemplate message_template = MessageTemplateFromInt(template_index);
|
||||
|
||||
Handle<Object> arg0;
|
||||
if (args.length() >= 2) {
|
||||
CHECK(args[1].IsObject());
|
||||
arg0 = args.at<Object>(1);
|
||||
}
|
||||
|
||||
Handle<Object> arg1;
|
||||
if (args.length() >= 3) {
|
||||
CHECK(args[2].IsObject());
|
||||
arg1 = args.at<Object>(2);
|
||||
}
|
||||
Handle<Object> arg2;
|
||||
if (args.length() >= 4) {
|
||||
CHECK(args[3].IsObject());
|
||||
arg2 = args.at<Object>(3);
|
||||
}
|
||||
|
||||
@ -256,8 +253,8 @@ RUNTIME_FUNCTION(Runtime_NewTypeError) {
|
||||
RUNTIME_FUNCTION(Runtime_NewReferenceError) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_INT32_ARG_CHECKED(template_index, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 1);
|
||||
int template_index = args.smi_value_at(0);
|
||||
Handle<Object> arg0 = args.at(1);
|
||||
MessageTemplate message_template = MessageTemplateFromInt(template_index);
|
||||
return *isolate->factory()->NewReferenceError(message_template, arg0);
|
||||
}
|
||||
@ -265,8 +262,8 @@ RUNTIME_FUNCTION(Runtime_NewReferenceError) {
|
||||
RUNTIME_FUNCTION(Runtime_NewSyntaxError) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_INT32_ARG_CHECKED(template_index, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, arg0, 1);
|
||||
int template_index = args.smi_value_at(0);
|
||||
Handle<Object> arg0 = args.at(1);
|
||||
MessageTemplate message_template = MessageTemplateFromInt(template_index);
|
||||
return *isolate->factory()->NewSyntaxError(message_template, arg0);
|
||||
}
|
||||
@ -279,7 +276,7 @@ RUNTIME_FUNCTION(Runtime_ThrowInvalidStringLength) {
|
||||
RUNTIME_FUNCTION(Runtime_ThrowIteratorResultNotAnObject) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 0);
|
||||
Handle<Object> value = args.at(0);
|
||||
THROW_NEW_ERROR_RETURN_FAILURE(
|
||||
isolate,
|
||||
NewTypeError(MessageTemplate::kIteratorResultNotAnObject, value));
|
||||
@ -302,7 +299,7 @@ RUNTIME_FUNCTION(Runtime_ThrowSymbolIteratorInvalid) {
|
||||
RUNTIME_FUNCTION(Runtime_ThrowNotConstructor) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
Handle<Object> object = args.at(0);
|
||||
THROW_NEW_ERROR_RETURN_FAILURE(
|
||||
isolate, NewTypeError(MessageTemplate::kNotConstructor, object));
|
||||
}
|
||||
@ -310,7 +307,7 @@ RUNTIME_FUNCTION(Runtime_ThrowNotConstructor) {
|
||||
RUNTIME_FUNCTION(Runtime_ThrowApplyNonFunction) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
Handle<Object> object = args.at(0);
|
||||
Handle<String> type = Object::TypeOf(isolate, object);
|
||||
THROW_NEW_ERROR_RETURN_FAILURE(
|
||||
isolate, NewTypeError(MessageTemplate::kApplyNonFunction, object, type));
|
||||
@ -333,7 +330,8 @@ RUNTIME_FUNCTION(Runtime_StackGuard) {
|
||||
RUNTIME_FUNCTION(Runtime_StackGuardWithGap) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(args.length(), 1);
|
||||
CONVERT_UINT32_ARG_CHECKED(gap, 0);
|
||||
uint32_t gap = 0;
|
||||
CHECK(args[0].ToUint32(&gap));
|
||||
TRACE_EVENT0("v8.execute", "V8.StackGuard");
|
||||
|
||||
// First check if this is a real stack overflow.
|
||||
@ -348,7 +346,7 @@ RUNTIME_FUNCTION(Runtime_StackGuardWithGap) {
|
||||
RUNTIME_FUNCTION(Runtime_BytecodeBudgetInterruptWithStackCheck) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
TRACE_EVENT0("v8.execute", "V8.BytecodeBudgetInterruptWithStackCheck");
|
||||
|
||||
// Check for stack interrupts here so that we can fold the interrupt check
|
||||
@ -374,7 +372,7 @@ RUNTIME_FUNCTION(Runtime_BytecodeBudgetInterruptWithStackCheck) {
|
||||
RUNTIME_FUNCTION(Runtime_BytecodeBudgetInterrupt) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
TRACE_EVENT0("v8.execute", "V8.BytecodeBudgetInterrupt");
|
||||
|
||||
isolate->tiering_manager()->OnInterruptTick(function);
|
||||
@ -412,8 +410,8 @@ class SaveAndClearThreadInWasmFlag {};
|
||||
RUNTIME_FUNCTION(Runtime_AllocateInYoungGeneration) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_SMI_ARG_CHECKED(size, 0);
|
||||
CONVERT_SMI_ARG_CHECKED(flags, 1);
|
||||
int size = args.smi_value_at(0);
|
||||
int flags = args.smi_value_at(1);
|
||||
AllocationAlignment alignment =
|
||||
AllocateDoubleAlignFlag::decode(flags) ? kDoubleAligned : kTaggedAligned;
|
||||
bool allow_large_object_allocation =
|
||||
@ -444,8 +442,8 @@ RUNTIME_FUNCTION(Runtime_AllocateInYoungGeneration) {
|
||||
RUNTIME_FUNCTION(Runtime_AllocateInOldGeneration) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_SMI_ARG_CHECKED(size, 0);
|
||||
CONVERT_SMI_ARG_CHECKED(flags, 1);
|
||||
int size = args.smi_value_at(0);
|
||||
int flags = args.smi_value_at(1);
|
||||
AllocationAlignment alignment =
|
||||
AllocateDoubleAlignFlag::decode(flags) ? kDoubleAligned : kTaggedAligned;
|
||||
bool allow_large_object_allocation =
|
||||
@ -462,7 +460,7 @@ RUNTIME_FUNCTION(Runtime_AllocateInOldGeneration) {
|
||||
RUNTIME_FUNCTION(Runtime_AllocateByteArray) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_SMI_ARG_CHECKED(length, 0);
|
||||
int length = args.smi_value_at(0);
|
||||
DCHECK_LT(0, length);
|
||||
return *isolate->factory()->NewByteArray(length);
|
||||
}
|
||||
@ -470,7 +468,7 @@ RUNTIME_FUNCTION(Runtime_AllocateByteArray) {
|
||||
RUNTIME_FUNCTION(Runtime_AllocateSeqOneByteString) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_SMI_ARG_CHECKED(length, 0);
|
||||
int length = args.smi_value_at(0);
|
||||
if (length == 0) return ReadOnlyRoots(isolate).empty_string();
|
||||
Handle<SeqOneByteString> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
@ -481,7 +479,7 @@ RUNTIME_FUNCTION(Runtime_AllocateSeqOneByteString) {
|
||||
RUNTIME_FUNCTION(Runtime_AllocateSeqTwoByteString) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_SMI_ARG_CHECKED(length, 0);
|
||||
int length = args.smi_value_at(0);
|
||||
if (length == 0) return ReadOnlyRoots(isolate).empty_string();
|
||||
Handle<SeqTwoByteString> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
@ -492,23 +490,23 @@ RUNTIME_FUNCTION(Runtime_AllocateSeqTwoByteString) {
|
||||
RUNTIME_FUNCTION(Runtime_ThrowIteratorError) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
Handle<Object> object = args.at(0);
|
||||
return isolate->Throw(*ErrorUtils::NewIteratorError(isolate, object));
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_ThrowSpreadArgError) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_SMI_ARG_CHECKED(message_id_smi, 0);
|
||||
int message_id_smi = args.smi_value_at(0);
|
||||
MessageTemplate message_id = MessageTemplateFromInt(message_id_smi);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 1);
|
||||
Handle<Object> object = args.at(1);
|
||||
return ErrorUtils::ThrowSpreadArgError(isolate, message_id, object);
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_ThrowCalledNonCallable) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
Handle<Object> object = args.at(0);
|
||||
return isolate->Throw(
|
||||
*ErrorUtils::NewCalledNonCallableError(isolate, object));
|
||||
}
|
||||
@ -516,7 +514,7 @@ RUNTIME_FUNCTION(Runtime_ThrowCalledNonCallable) {
|
||||
RUNTIME_FUNCTION(Runtime_ThrowConstructedNonConstructable) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
Handle<Object> object = args.at(0);
|
||||
return isolate->Throw(
|
||||
*ErrorUtils::NewConstructedNonConstructable(isolate, object));
|
||||
}
|
||||
@ -524,7 +522,7 @@ RUNTIME_FUNCTION(Runtime_ThrowConstructedNonConstructable) {
|
||||
RUNTIME_FUNCTION(Runtime_ThrowPatternAssignmentNonCoercible) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
Handle<Object> object = args.at(0);
|
||||
return ErrorUtils::ThrowLoadFromNullOrUndefined(isolate, object,
|
||||
MaybeHandle<Object>());
|
||||
}
|
||||
@ -542,7 +540,7 @@ RUNTIME_FUNCTION(Runtime_ThrowConstructorReturnedNonObject) {
|
||||
RUNTIME_FUNCTION(Runtime_CreateListFromArrayLike) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
Handle<Object> object = args.at(0);
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::CreateListFromArrayLike(
|
||||
isolate, object, ElementTypes::kAll));
|
||||
}
|
||||
@ -550,7 +548,7 @@ RUNTIME_FUNCTION(Runtime_CreateListFromArrayLike) {
|
||||
RUNTIME_FUNCTION(Runtime_IncrementUseCounter) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_SMI_ARG_CHECKED(counter, 0);
|
||||
int counter = args.smi_value_at(0);
|
||||
isolate->CountUsage(static_cast<v8::Isolate::UseCounterFeature>(counter));
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
}
|
||||
@ -577,18 +575,18 @@ RUNTIME_FUNCTION(Runtime_GetAndResetRuntimeCallStats) {
|
||||
std::FILE* f;
|
||||
if (args[0].IsString()) {
|
||||
// With a string argument, the results are appended to that file.
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, filename, 0);
|
||||
Handle<String> filename = args.at<String>(0);
|
||||
f = std::fopen(filename->ToCString().get(), "a");
|
||||
DCHECK_NOT_NULL(f);
|
||||
} else {
|
||||
// With an integer argument, the results are written to stdout/stderr.
|
||||
CONVERT_SMI_ARG_CHECKED(fd, 0);
|
||||
int fd = args.smi_value_at(0);
|
||||
DCHECK(fd == 1 || fd == 2);
|
||||
f = fd == 1 ? stdout : stderr;
|
||||
}
|
||||
// The second argument (if any) is a message header to be printed.
|
||||
if (args.length() >= 2) {
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, message, 1);
|
||||
Handle<String> message = args.at<String>(1);
|
||||
message->PrintOn(f);
|
||||
std::fputc('\n', f);
|
||||
std::fflush(f);
|
||||
@ -608,8 +606,8 @@ RUNTIME_FUNCTION(Runtime_GetAndResetRuntimeCallStats) {
|
||||
RUNTIME_FUNCTION(Runtime_OrdinaryHasInstance) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, callable, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 1);
|
||||
Handle<Object> callable = args.at(0);
|
||||
Handle<Object> object = args.at(1);
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, Object::OrdinaryHasInstance(isolate, callable, object));
|
||||
}
|
||||
@ -617,14 +615,14 @@ RUNTIME_FUNCTION(Runtime_OrdinaryHasInstance) {
|
||||
RUNTIME_FUNCTION(Runtime_Typeof) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
Handle<Object> object = args.at(0);
|
||||
return *Object::TypeOf(isolate, object);
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_AllowDynamicFunction) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0);
|
||||
Handle<JSFunction> target = args.at<JSFunction>(0);
|
||||
Handle<JSObject> global_proxy(target->global_proxy(), isolate);
|
||||
return *isolate->factory()->ToBoolean(
|
||||
Builtins::AllowDynamicFunction(isolate, target, global_proxy));
|
||||
@ -634,7 +632,7 @@ RUNTIME_FUNCTION(Runtime_CreateAsyncFromSyncIterator) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, sync_iterator, 0);
|
||||
Handle<Object> sync_iterator = args.at(0);
|
||||
|
||||
if (!sync_iterator->IsJSReceiver()) {
|
||||
THROW_NEW_ERROR_RETURN_FAILURE(
|
||||
@ -654,9 +652,10 @@ RUNTIME_FUNCTION(Runtime_CreateAsyncFromSyncIterator) {
|
||||
RUNTIME_FUNCTION(Runtime_GetTemplateObject) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(TemplateObjectDescription, description, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared_info, 1);
|
||||
CONVERT_SMI_ARG_CHECKED(slot_id, 2);
|
||||
Handle<TemplateObjectDescription> description =
|
||||
args.at<TemplateObjectDescription>(0);
|
||||
Handle<SharedFunctionInfo> shared_info = args.at<SharedFunctionInfo>(1);
|
||||
int slot_id = args.smi_value_at(2);
|
||||
|
||||
Handle<NativeContext> native_context(isolate->context().native_context(),
|
||||
isolate);
|
||||
@ -671,7 +670,7 @@ RUNTIME_FUNCTION(Runtime_ReportMessageFromMicrotask) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, exception, 0);
|
||||
Handle<Object> exception = args.at(0);
|
||||
|
||||
DCHECK(!isolate->has_pending_exception());
|
||||
isolate->set_pending_exception(*exception);
|
||||
@ -687,7 +686,7 @@ RUNTIME_FUNCTION(Runtime_GetInitializerFunction) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, constructor, 0);
|
||||
Handle<JSReceiver> constructor = args.at<JSReceiver>(0);
|
||||
Handle<Symbol> key = isolate->factory()->class_fields_symbol();
|
||||
Handle<Object> initializer =
|
||||
JSReceiver::GetDataProperty(isolate, constructor, key);
|
||||
@ -697,8 +696,9 @@ RUNTIME_FUNCTION(Runtime_GetInitializerFunction) {
|
||||
RUNTIME_FUNCTION(Runtime_DoubleToStringWithRadix) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_DOUBLE_ARG_CHECKED(number, 0);
|
||||
CONVERT_INT32_ARG_CHECKED(radix, 1);
|
||||
double number = args.number_value_at(0);
|
||||
int32_t radix = 0;
|
||||
CHECK(args[1].ToInt32(&radix));
|
||||
|
||||
char* const str = DoubleToRadixCString(number, radix);
|
||||
Handle<String> result = isolate->factory()->NewStringFromAsciiChecked(str);
|
||||
@ -709,7 +709,7 @@ RUNTIME_FUNCTION(Runtime_DoubleToStringWithRadix) {
|
||||
RUNTIME_FUNCTION(Runtime_SharedValueBarrierSlow) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(HeapObject, value, 0);
|
||||
Handle<HeapObject> value = args.at<HeapObject>(0);
|
||||
Handle<Object> shared_value;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, shared_value, Object::ShareSlow(isolate, value, kThrowOnError));
|
||||
|
@ -36,8 +36,8 @@ namespace internal {
|
||||
RUNTIME_FUNCTION(Runtime_FormatList) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSListFormat, list_format, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(FixedArray, list, 1);
|
||||
Handle<JSListFormat> list_format = args.at<JSListFormat>(0);
|
||||
Handle<FixedArray> list = args.at<FixedArray>(1);
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, JSListFormat::FormatList(isolate, list_format, list));
|
||||
}
|
||||
@ -46,8 +46,8 @@ RUNTIME_FUNCTION(Runtime_FormatList) {
|
||||
RUNTIME_FUNCTION(Runtime_FormatListToParts) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSListFormat, list_format, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(FixedArray, list, 1);
|
||||
Handle<JSListFormat> list_format = args.at<JSListFormat>(0);
|
||||
Handle<FixedArray> list = args.at<FixedArray>(1);
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, JSListFormat::FormatListToParts(isolate, list_format, list));
|
||||
}
|
||||
@ -55,7 +55,7 @@ RUNTIME_FUNCTION(Runtime_FormatListToParts) {
|
||||
RUNTIME_FUNCTION(Runtime_StringToLowerCaseIntl) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(args.length(), 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, s, 0);
|
||||
Handle<String> s = args.at<String>(0);
|
||||
s = String::Flatten(isolate, s);
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Intl::ConvertToLower(isolate, s));
|
||||
}
|
||||
@ -63,7 +63,7 @@ RUNTIME_FUNCTION(Runtime_StringToLowerCaseIntl) {
|
||||
RUNTIME_FUNCTION(Runtime_StringToUpperCaseIntl) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(args.length(), 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, s, 0);
|
||||
Handle<String> s = args.at<String>(0);
|
||||
s = String::Flatten(isolate, s);
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Intl::ConvertToUpper(isolate, s));
|
||||
}
|
||||
|
@ -584,10 +584,11 @@ MaybeHandle<JSObject> CreateLiteral(Isolate* isolate,
|
||||
RUNTIME_FUNCTION(Runtime_CreateObjectLiteral) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(HeapObject, maybe_vector, 0);
|
||||
CONVERT_TAGGED_INDEX_ARG_CHECKED(literals_index, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(ObjectBoilerplateDescription, description, 2);
|
||||
CONVERT_SMI_ARG_CHECKED(flags, 3);
|
||||
Handle<HeapObject> maybe_vector = args.at<HeapObject>(0);
|
||||
int literals_index = args.tagged_index_value_at(1);
|
||||
Handle<ObjectBoilerplateDescription> description =
|
||||
args.at<ObjectBoilerplateDescription>(2);
|
||||
int flags = args.smi_value_at(3);
|
||||
Handle<FeedbackVector> vector;
|
||||
if (maybe_vector->IsFeedbackVector()) {
|
||||
vector = Handle<FeedbackVector>::cast(maybe_vector);
|
||||
@ -602,8 +603,9 @@ RUNTIME_FUNCTION(Runtime_CreateObjectLiteral) {
|
||||
RUNTIME_FUNCTION(Runtime_CreateObjectLiteralWithoutAllocationSite) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(ObjectBoilerplateDescription, description, 0);
|
||||
CONVERT_SMI_ARG_CHECKED(flags, 1);
|
||||
Handle<ObjectBoilerplateDescription> description =
|
||||
args.at<ObjectBoilerplateDescription>(0);
|
||||
int flags = args.smi_value_at(1);
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, CreateLiteralWithoutAllocationSite<ObjectLiteralHelper>(
|
||||
isolate, description, flags));
|
||||
@ -612,8 +614,9 @@ RUNTIME_FUNCTION(Runtime_CreateObjectLiteralWithoutAllocationSite) {
|
||||
RUNTIME_FUNCTION(Runtime_CreateArrayLiteralWithoutAllocationSite) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(ArrayBoilerplateDescription, description, 0);
|
||||
CONVERT_SMI_ARG_CHECKED(flags, 1);
|
||||
Handle<ArrayBoilerplateDescription> description =
|
||||
args.at<ArrayBoilerplateDescription>(0);
|
||||
int flags = args.smi_value_at(1);
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, CreateLiteralWithoutAllocationSite<ArrayLiteralHelper>(
|
||||
isolate, description, flags));
|
||||
@ -622,10 +625,11 @@ RUNTIME_FUNCTION(Runtime_CreateArrayLiteralWithoutAllocationSite) {
|
||||
RUNTIME_FUNCTION(Runtime_CreateArrayLiteral) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(HeapObject, maybe_vector, 0);
|
||||
CONVERT_TAGGED_INDEX_ARG_CHECKED(literals_index, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(ArrayBoilerplateDescription, elements, 2);
|
||||
CONVERT_SMI_ARG_CHECKED(flags, 3);
|
||||
Handle<HeapObject> maybe_vector = args.at<HeapObject>(0);
|
||||
int literals_index = args.tagged_index_value_at(1);
|
||||
Handle<ArrayBoilerplateDescription> elements =
|
||||
args.at<ArrayBoilerplateDescription>(2);
|
||||
int flags = args.smi_value_at(3);
|
||||
Handle<FeedbackVector> vector;
|
||||
if (maybe_vector->IsFeedbackVector()) {
|
||||
vector = Handle<FeedbackVector>::cast(maybe_vector);
|
||||
@ -640,10 +644,10 @@ RUNTIME_FUNCTION(Runtime_CreateArrayLiteral) {
|
||||
RUNTIME_FUNCTION(Runtime_CreateRegExpLiteral) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(HeapObject, maybe_vector, 0);
|
||||
CONVERT_TAGGED_INDEX_ARG_CHECKED(index, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, pattern, 2);
|
||||
CONVERT_SMI_ARG_CHECKED(flags, 3);
|
||||
Handle<HeapObject> maybe_vector = args.at<HeapObject>(0);
|
||||
int index = args.tagged_index_value_at(1);
|
||||
Handle<String> pattern = args.at<String>(2);
|
||||
int flags = args.smi_value_at(3);
|
||||
|
||||
if (maybe_vector->IsUndefined()) {
|
||||
// We don't have a vector; don't create a boilerplate, simply construct a
|
||||
|
@ -28,12 +28,11 @@ RUNTIME_FUNCTION(Runtime_DynamicImportCall) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_LE(2, args.length());
|
||||
DCHECK_GE(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, specifier, 1);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
Handle<Object> specifier = args.at(1);
|
||||
|
||||
MaybeHandle<Object> import_assertions;
|
||||
if (args.length() == 3) {
|
||||
CHECK(args[2].IsObject());
|
||||
import_assertions = args.at<Object>(2);
|
||||
}
|
||||
|
||||
@ -47,7 +46,7 @@ RUNTIME_FUNCTION(Runtime_DynamicImportCall) {
|
||||
RUNTIME_FUNCTION(Runtime_GetModuleNamespace) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_SMI_ARG_CHECKED(module_request, 0);
|
||||
int module_request = args.smi_value_at(0);
|
||||
Handle<SourceTextModule> module(isolate->context().module(), isolate);
|
||||
return *SourceTextModule::GetModuleNamespace(isolate, module, module_request);
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ namespace internal {
|
||||
RUNTIME_FUNCTION(Runtime_StringToNumber) {
|
||||
HandleScope handle_scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, subject, 0);
|
||||
Handle<String> subject = args.at<String>(0);
|
||||
return *String::ToNumber(isolate, subject);
|
||||
}
|
||||
|
||||
@ -25,8 +25,8 @@ RUNTIME_FUNCTION(Runtime_StringToNumber) {
|
||||
RUNTIME_FUNCTION(Runtime_StringParseInt) {
|
||||
HandleScope handle_scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, string, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, radix, 1);
|
||||
Handle<Object> string = args.at(0);
|
||||
Handle<Object> radix = args.at(1);
|
||||
|
||||
// Convert {string} to a String first, and flatten it.
|
||||
Handle<String> subject;
|
||||
@ -53,7 +53,7 @@ RUNTIME_FUNCTION(Runtime_StringParseInt) {
|
||||
RUNTIME_FUNCTION(Runtime_StringParseFloat) {
|
||||
HandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, subject, 0);
|
||||
Handle<String> subject = args.at<String>(0);
|
||||
|
||||
double value = StringToDouble(isolate, subject, ALLOW_TRAILING_JUNK,
|
||||
std::numeric_limits<double>::quiet_NaN());
|
||||
@ -64,9 +64,8 @@ RUNTIME_FUNCTION(Runtime_StringParseFloat) {
|
||||
RUNTIME_FUNCTION(Runtime_NumberToStringSlow) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_NUMBER_ARG_HANDLE_CHECKED(number, 0);
|
||||
|
||||
return *isolate->factory()->NumberToString(number, NumberCacheMode::kSetOnly);
|
||||
return *isolate->factory()->NumberToString(args.at(0),
|
||||
NumberCacheMode::kSetOnly);
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_MaxSmi) {
|
||||
@ -79,7 +78,7 @@ RUNTIME_FUNCTION(Runtime_MaxSmi) {
|
||||
RUNTIME_FUNCTION(Runtime_IsSmi) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(Object, obj, 0);
|
||||
Object obj = args[0];
|
||||
return isolate->heap()->ToBoolean(obj.IsSmi());
|
||||
}
|
||||
|
||||
|
@ -425,8 +425,8 @@ RUNTIME_FUNCTION(Runtime_ObjectHasOwnProperty) {
|
||||
RUNTIME_FUNCTION(Runtime_HasOwnConstDataProperty) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, property, 1);
|
||||
Handle<Object> object = args.at(0);
|
||||
Handle<Object> property = args.at(1);
|
||||
|
||||
bool success;
|
||||
PropertyKey key(isolate, property, &success);
|
||||
@ -484,10 +484,10 @@ RUNTIME_FUNCTION(Runtime_AddDictionaryProperty) {
|
||||
RUNTIME_FUNCTION(Runtime_AddPrivateBrand) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(args.length(), 4);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Symbol, brand, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Context, context, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Smi, depth_smi, 3);
|
||||
Handle<JSReceiver> receiver = args.at<JSReceiver>(0);
|
||||
Handle<Symbol> brand = args.at<Symbol>(1);
|
||||
Handle<Context> context = args.at<Context>(2);
|
||||
int depth = args.smi_value_at(3);
|
||||
DCHECK(brand->is_private_name());
|
||||
|
||||
LookupIterator it(isolate, receiver, brand, LookupIterator::OWN);
|
||||
@ -505,7 +505,6 @@ RUNTIME_FUNCTION(Runtime_AddPrivateBrand) {
|
||||
// Look for the context in |depth| in the context chain to store it
|
||||
// in the instance with the brand variable as key, which is needed by
|
||||
// the debugger for retrieving names of private methods.
|
||||
int depth = depth_smi->value();
|
||||
DCHECK_GE(depth, 0);
|
||||
for (; depth > 0; depth--) {
|
||||
context =
|
||||
@ -627,8 +626,8 @@ MaybeHandle<Object> Runtime::DefineObjectOwnProperty(
|
||||
RUNTIME_FUNCTION(Runtime_InternalSetPrototype) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1);
|
||||
Handle<JSReceiver> obj = args.at<JSReceiver>(0);
|
||||
Handle<Object> prototype = args.at(1);
|
||||
MAYBE_RETURN(
|
||||
JSReceiver::SetPrototype(isolate, obj, prototype, false, kThrowOnError),
|
||||
ReadOnlyRoots(isolate).exception());
|
||||
@ -638,8 +637,8 @@ RUNTIME_FUNCTION(Runtime_InternalSetPrototype) {
|
||||
RUNTIME_FUNCTION(Runtime_OptimizeObjectForAddingMultipleProperties) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
|
||||
CONVERT_SMI_ARG_CHECKED(properties, 1);
|
||||
Handle<JSObject> object = args.at<JSObject>(0);
|
||||
int properties = args.smi_value_at(1);
|
||||
// Conservative upper limit to prevent fuzz tests from going OOM.
|
||||
if (properties > 100000) return isolate->ThrowIllegalOperation();
|
||||
if (object->HasFastProperties() && !object->IsJSGlobalProxy()) {
|
||||
@ -653,7 +652,7 @@ RUNTIME_FUNCTION(Runtime_ObjectValues) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
|
||||
Handle<JSReceiver> receiver = args.at<JSReceiver>(0);
|
||||
|
||||
Handle<FixedArray> values;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
@ -667,7 +666,7 @@ RUNTIME_FUNCTION(Runtime_ObjectValuesSkipFastPath) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
|
||||
Handle<JSReceiver> receiver = args.at<JSReceiver>(0);
|
||||
|
||||
Handle<FixedArray> value;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
@ -681,7 +680,7 @@ RUNTIME_FUNCTION(Runtime_ObjectEntries) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
|
||||
Handle<JSReceiver> receiver = args.at<JSReceiver>(0);
|
||||
|
||||
Handle<FixedArray> entries;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
@ -695,7 +694,7 @@ RUNTIME_FUNCTION(Runtime_ObjectEntriesSkipFastPath) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
|
||||
Handle<JSReceiver> receiver = args.at<JSReceiver>(0);
|
||||
|
||||
Handle<FixedArray> entries;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
@ -708,7 +707,7 @@ RUNTIME_FUNCTION(Runtime_ObjectEntriesSkipFastPath) {
|
||||
RUNTIME_FUNCTION(Runtime_ObjectIsExtensible) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
Handle<Object> object = args.at(0);
|
||||
|
||||
Maybe<bool> result =
|
||||
object->IsJSReceiver()
|
||||
@ -721,7 +720,7 @@ RUNTIME_FUNCTION(Runtime_ObjectIsExtensible) {
|
||||
RUNTIME_FUNCTION(Runtime_JSReceiverPreventExtensionsThrow) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0);
|
||||
Handle<JSReceiver> object = args.at<JSReceiver>(0);
|
||||
|
||||
MAYBE_RETURN(JSReceiver::PreventExtensions(Handle<JSReceiver>::cast(object),
|
||||
kThrowOnError),
|
||||
@ -732,7 +731,7 @@ RUNTIME_FUNCTION(Runtime_JSReceiverPreventExtensionsThrow) {
|
||||
RUNTIME_FUNCTION(Runtime_JSReceiverPreventExtensionsDontThrow) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0);
|
||||
Handle<JSReceiver> object = args.at<JSReceiver>(0);
|
||||
|
||||
Maybe<bool> result = JSReceiver::PreventExtensions(
|
||||
Handle<JSReceiver>::cast(object), kDontThrow);
|
||||
@ -743,7 +742,7 @@ RUNTIME_FUNCTION(Runtime_JSReceiverPreventExtensionsDontThrow) {
|
||||
RUNTIME_FUNCTION(Runtime_JSReceiverGetPrototypeOf) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
|
||||
Handle<JSReceiver> receiver = args.at<JSReceiver>(0);
|
||||
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
JSReceiver::GetPrototype(isolate, receiver));
|
||||
@ -753,8 +752,8 @@ RUNTIME_FUNCTION(Runtime_JSReceiverSetPrototypeOfThrow) {
|
||||
HandleScope scope(isolate);
|
||||
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, proto, 1);
|
||||
Handle<JSReceiver> object = args.at<JSReceiver>(0);
|
||||
Handle<Object> proto = args.at(1);
|
||||
|
||||
MAYBE_RETURN(
|
||||
JSReceiver::SetPrototype(isolate, object, proto, true, kThrowOnError),
|
||||
@ -767,8 +766,8 @@ RUNTIME_FUNCTION(Runtime_JSReceiverSetPrototypeOfDontThrow) {
|
||||
HandleScope scope(isolate);
|
||||
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, proto, 1);
|
||||
Handle<JSReceiver> object = args.at<JSReceiver>(0);
|
||||
Handle<Object> proto = args.at(1);
|
||||
|
||||
Maybe<bool> result =
|
||||
JSReceiver::SetPrototype(isolate, object, proto, true, kDontThrow);
|
||||
@ -779,11 +778,10 @@ RUNTIME_FUNCTION(Runtime_JSReceiverSetPrototypeOfDontThrow) {
|
||||
RUNTIME_FUNCTION(Runtime_GetProperty) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK(args.length() == 3 || args.length() == 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, lookup_start_obj, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key_obj, 1);
|
||||
Handle<Object> lookup_start_obj = args.at(0);
|
||||
Handle<Object> key_obj = args.at(1);
|
||||
Handle<Object> receiver_obj = lookup_start_obj;
|
||||
if (args.length() == 3) {
|
||||
CHECK(args[2].IsObject());
|
||||
receiver_obj = args.at<Object>(2);
|
||||
}
|
||||
|
||||
@ -887,9 +885,9 @@ RUNTIME_FUNCTION(Runtime_SetKeyedProperty) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
|
||||
Handle<Object> object = args.at(0);
|
||||
Handle<Object> key = args.at(1);
|
||||
Handle<Object> value = args.at(2);
|
||||
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, Runtime::SetObjectProperty(isolate, object, key, value,
|
||||
@ -900,9 +898,9 @@ RUNTIME_FUNCTION(Runtime_DefineObjectOwnProperty) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
|
||||
Handle<Object> object = args.at(0);
|
||||
Handle<Object> key = args.at(1);
|
||||
Handle<Object> value = args.at(2);
|
||||
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, Runtime::DefineObjectOwnProperty(isolate, object, key, value,
|
||||
@ -913,9 +911,9 @@ RUNTIME_FUNCTION(Runtime_SetNamedProperty) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
|
||||
Handle<Object> object = args.at(0);
|
||||
Handle<Object> key = args.at(1);
|
||||
Handle<Object> value = args.at(2);
|
||||
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, Runtime::SetObjectProperty(isolate, object, key, value,
|
||||
@ -932,9 +930,9 @@ RUNTIME_FUNCTION(Runtime_DefineKeyedOwnPropertyInLiteral_Simple) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
|
||||
Handle<JSReceiver> object = args.at<JSReceiver>(0);
|
||||
Handle<Object> key = args.at(1);
|
||||
Handle<Object> value = args.at(2);
|
||||
|
||||
PropertyKey lookup_key(isolate, key);
|
||||
LookupIterator it(isolate, object, lookup_key, LookupIterator::OWN);
|
||||
@ -967,9 +965,9 @@ Object DeleteProperty(Isolate* isolate, Handle<Object> object,
|
||||
RUNTIME_FUNCTION(Runtime_DeleteProperty) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
|
||||
CONVERT_SMI_ARG_CHECKED(language_mode, 2);
|
||||
Handle<Object> object = args.at(0);
|
||||
Handle<Object> key = args.at(1);
|
||||
int language_mode = args.smi_value_at(2);
|
||||
return DeleteProperty(isolate, object, key,
|
||||
static_cast<LanguageMode>(language_mode));
|
||||
}
|
||||
@ -977,7 +975,7 @@ RUNTIME_FUNCTION(Runtime_DeleteProperty) {
|
||||
RUNTIME_FUNCTION(Runtime_ShrinkNameDictionary) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(NameDictionary, dictionary, 0);
|
||||
Handle<NameDictionary> dictionary = args.at<NameDictionary>(0);
|
||||
|
||||
return *NameDictionary::Shrink(isolate, dictionary);
|
||||
}
|
||||
@ -985,7 +983,7 @@ RUNTIME_FUNCTION(Runtime_ShrinkNameDictionary) {
|
||||
RUNTIME_FUNCTION(Runtime_ShrinkSwissNameDictionary) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(SwissNameDictionary, dictionary, 0);
|
||||
Handle<SwissNameDictionary> dictionary = args.at<SwissNameDictionary>(0);
|
||||
|
||||
return *SwissNameDictionary::Shrink(isolate, dictionary);
|
||||
}
|
||||
@ -994,8 +992,8 @@ RUNTIME_FUNCTION(Runtime_ShrinkSwissNameDictionary) {
|
||||
RUNTIME_FUNCTION(Runtime_HasProperty) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
|
||||
Handle<Object> object = args.at(0);
|
||||
Handle<Object> key = args.at(1);
|
||||
|
||||
// Check that {object} is actually a receiver.
|
||||
if (!object->IsJSReceiver()) {
|
||||
@ -1019,8 +1017,8 @@ RUNTIME_FUNCTION(Runtime_HasProperty) {
|
||||
RUNTIME_FUNCTION(Runtime_GetOwnPropertyKeys) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0);
|
||||
CONVERT_SMI_ARG_CHECKED(filter_value, 1);
|
||||
Handle<JSReceiver> object = args.at<JSReceiver>(0);
|
||||
int filter_value = args.smi_value_at(1);
|
||||
PropertyFilter filter = static_cast<PropertyFilter>(filter_value);
|
||||
|
||||
Handle<FixedArray> keys;
|
||||
@ -1035,7 +1033,7 @@ RUNTIME_FUNCTION(Runtime_GetOwnPropertyKeys) {
|
||||
RUNTIME_FUNCTION(Runtime_ToFastProperties) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
Handle<Object> object = args.at(0);
|
||||
if (object->IsJSObject() && !object->IsJSGlobalObject()) {
|
||||
JSObject::MigrateSlowToFast(Handle<JSObject>::cast(object), 0,
|
||||
"RuntimeToFastProperties");
|
||||
@ -1052,8 +1050,8 @@ RUNTIME_FUNCTION(Runtime_AllocateHeapNumber) {
|
||||
RUNTIME_FUNCTION(Runtime_NewObject) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, new_target, 1);
|
||||
Handle<JSFunction> target = args.at<JSFunction>(0);
|
||||
Handle<JSReceiver> new_target = args.at<JSReceiver>(1);
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate,
|
||||
JSObject::New(target, new_target, Handle<AllocationSite>::null()));
|
||||
@ -1062,9 +1060,9 @@ RUNTIME_FUNCTION(Runtime_NewObject) {
|
||||
RUNTIME_FUNCTION(Runtime_GetDerivedMap) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, new_target, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, rab_gsab, 2);
|
||||
Handle<JSFunction> target = args.at<JSFunction>(0);
|
||||
Handle<JSReceiver> new_target = args.at<JSReceiver>(1);
|
||||
Handle<Object> rab_gsab = args.at(2);
|
||||
if (rab_gsab->IsTrue()) {
|
||||
return *JSFunction::GetDerivedRabGsabMap(isolate, target, new_target);
|
||||
} else {
|
||||
@ -1078,7 +1076,7 @@ RUNTIME_FUNCTION(Runtime_CompleteInobjectSlackTrackingForMap) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(Map, initial_map, 0);
|
||||
Handle<Map> initial_map = args.at<Map>(0);
|
||||
MapUpdater::CompleteInobjectSlackTracking(isolate, *initial_map);
|
||||
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
@ -1087,7 +1085,7 @@ RUNTIME_FUNCTION(Runtime_CompleteInobjectSlackTrackingForMap) {
|
||||
RUNTIME_FUNCTION(Runtime_TryMigrateInstance) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, js_object, 0);
|
||||
Handle<JSObject> js_object = args.at<JSObject>(0);
|
||||
// It could have been a DCHECK but we call this function directly from tests.
|
||||
if (!js_object->map().is_deprecated()) return Smi::zero();
|
||||
// This call must not cause lazy deopts, because it's called from deferred
|
||||
@ -1111,14 +1109,14 @@ static bool IsValidAccessor(Isolate* isolate, Handle<Object> obj) {
|
||||
RUNTIME_FUNCTION(Runtime_DefineAccessorPropertyUnchecked) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(5, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
|
||||
Handle<JSObject> obj = args.at<JSObject>(0);
|
||||
CHECK(!obj->IsNull(isolate));
|
||||
CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, getter, 2);
|
||||
Handle<Name> name = args.at<Name>(1);
|
||||
Handle<Object> getter = args.at(2);
|
||||
CHECK(IsValidAccessor(isolate, getter));
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3);
|
||||
Handle<Object> setter = args.at(3);
|
||||
CHECK(IsValidAccessor(isolate, setter));
|
||||
CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 4);
|
||||
auto attrs = PropertyAttributesFromInt(args.smi_value_at(4));
|
||||
|
||||
RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, JSObject::DefineAccessor(obj, name, getter, setter, attrs));
|
||||
@ -1128,12 +1126,12 @@ RUNTIME_FUNCTION(Runtime_DefineAccessorPropertyUnchecked) {
|
||||
RUNTIME_FUNCTION(Runtime_DefineKeyedOwnPropertyInLiteral) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(6, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
|
||||
CONVERT_SMI_ARG_CHECKED(flag, 3);
|
||||
CONVERT_ARG_HANDLE_CHECKED(HeapObject, maybe_vector, 4);
|
||||
CONVERT_TAGGED_INDEX_ARG_CHECKED(index, 5);
|
||||
Handle<JSObject> object = args.at<JSObject>(0);
|
||||
Handle<Name> name = args.at<Name>(1);
|
||||
Handle<Object> value = args.at(2);
|
||||
int flag = args.smi_value_at(3);
|
||||
Handle<HeapObject> maybe_vector = args.at<HeapObject>(4);
|
||||
int index = args.tagged_index_value_at(5);
|
||||
|
||||
if (!maybe_vector->IsUndefined()) {
|
||||
DCHECK(maybe_vector->IsFeedbackVector());
|
||||
@ -1190,14 +1188,14 @@ RUNTIME_FUNCTION(Runtime_DefineKeyedOwnPropertyInLiteral) {
|
||||
RUNTIME_FUNCTION(Runtime_CollectTypeProfile) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Smi, position, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(HeapObject, maybe_vector, 2);
|
||||
int position = args.smi_value_at(0);
|
||||
Handle<Object> value = args.at(1);
|
||||
Handle<HeapObject> maybe_vector = args.at<HeapObject>(2);
|
||||
|
||||
if (maybe_vector->IsUndefined()) {
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
}
|
||||
CONVERT_ARG_HANDLE_CHECKED(FeedbackVector, vector, 2);
|
||||
Handle<FeedbackVector> vector = args.at<FeedbackVector>(2);
|
||||
|
||||
Handle<String> type = Object::TypeOf(isolate, value);
|
||||
if (value->IsJSReceiver()) {
|
||||
@ -1211,7 +1209,7 @@ RUNTIME_FUNCTION(Runtime_CollectTypeProfile) {
|
||||
|
||||
DCHECK(vector->metadata().HasTypeProfileSlot());
|
||||
FeedbackNexus nexus(vector, vector->GetTypeProfileSlot());
|
||||
nexus.Collect(type, position->value());
|
||||
nexus.Collect(type, position);
|
||||
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
}
|
||||
@ -1219,7 +1217,7 @@ RUNTIME_FUNCTION(Runtime_CollectTypeProfile) {
|
||||
RUNTIME_FUNCTION(Runtime_HasFastPackedElements) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(HeapObject, obj, 0);
|
||||
auto obj = HeapObject::cast(args[0]);
|
||||
return isolate->heap()->ToBoolean(
|
||||
IsFastPackedElementsKind(obj.map().elements_kind()));
|
||||
}
|
||||
@ -1227,24 +1225,24 @@ RUNTIME_FUNCTION(Runtime_HasFastPackedElements) {
|
||||
RUNTIME_FUNCTION(Runtime_IsJSReceiver) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(Object, obj, 0);
|
||||
Object obj = args[0];
|
||||
return isolate->heap()->ToBoolean(obj.IsJSReceiver());
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_GetFunctionName) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
return *JSFunction::GetName(isolate, function);
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_DefineGetterPropertyUnchecked) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, getter, 2);
|
||||
CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3);
|
||||
Handle<JSObject> object = args.at<JSObject>(0);
|
||||
Handle<Name> name = args.at<Name>(1);
|
||||
Handle<JSFunction> getter = args.at<JSFunction>(2);
|
||||
auto attrs = PropertyAttributesFromInt(args.smi_value_at(3));
|
||||
|
||||
if (String::cast(getter->shared().Name()).length() == 0) {
|
||||
Handle<Map> getter_map(getter->map(), isolate);
|
||||
@ -1264,8 +1262,8 @@ RUNTIME_FUNCTION(Runtime_DefineGetterPropertyUnchecked) {
|
||||
RUNTIME_FUNCTION(Runtime_SetDataProperties) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, target, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, source, 1);
|
||||
Handle<JSReceiver> target = args.at<JSReceiver>(0);
|
||||
Handle<Object> source = args.at(1);
|
||||
|
||||
// 2. If source is undefined or null, let keys be an empty List.
|
||||
if (source->IsUndefined(isolate) || source->IsNull(isolate)) {
|
||||
@ -1282,8 +1280,8 @@ RUNTIME_FUNCTION(Runtime_SetDataProperties) {
|
||||
RUNTIME_FUNCTION(Runtime_CopyDataProperties) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, target, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, source, 1);
|
||||
Handle<JSObject> target = args.at<JSObject>(0);
|
||||
Handle<Object> source = args.at(1);
|
||||
|
||||
// 2. If source is undefined or null, let keys be an empty List.
|
||||
if (source->IsUndefined(isolate) || source->IsNull(isolate)) {
|
||||
@ -1336,9 +1334,9 @@ void CheckExcludedPropertiesAreOnCallerStack(Isolate* isolate, Address base,
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_CopyDataPropertiesWithExcludedPropertiesOnStack) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_LE(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, source, 0);
|
||||
CONVERT_SMI_ARG_CHECKED(excluded_property_count, 1);
|
||||
DCHECK_LE(3, args.length());
|
||||
Handle<Object> source = args.at(0);
|
||||
int excluded_property_count = args.smi_value_at(1);
|
||||
// The excluded_property_base is passed as a raw stack pointer. This is safe
|
||||
// because the stack pointer is aligned, so it looks like a Smi to the GC.
|
||||
Address* excluded_property_base = reinterpret_cast<Address*>(args[2].ptr());
|
||||
@ -1386,10 +1384,10 @@ RUNTIME_FUNCTION(Runtime_CopyDataPropertiesWithExcludedPropertiesOnStack) {
|
||||
RUNTIME_FUNCTION(Runtime_DefineSetterPropertyUnchecked) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, setter, 2);
|
||||
CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 3);
|
||||
Handle<JSObject> object = args.at<JSObject>(0);
|
||||
Handle<Name> name = args.at<Name>(1);
|
||||
Handle<JSFunction> setter = args.at<JSFunction>(2);
|
||||
auto attrs = PropertyAttributesFromInt(args.smi_value_at(3));
|
||||
|
||||
if (String::cast(setter->shared().Name()).length() == 0) {
|
||||
Handle<Map> setter_map(setter->map(), isolate);
|
||||
@ -1415,43 +1413,43 @@ RUNTIME_FUNCTION(Runtime_ToObject) {
|
||||
RUNTIME_FUNCTION(Runtime_ToNumber) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
|
||||
Handle<Object> input = args.at(0);
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::ToNumber(isolate, input));
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_ToNumeric) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
|
||||
Handle<Object> input = args.at(0);
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::ToNumeric(isolate, input));
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_ToLength) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
|
||||
Handle<Object> input = args.at(0);
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::ToLength(isolate, input));
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_ToString) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
|
||||
Handle<Object> input = args.at(0);
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::ToString(isolate, input));
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_ToName) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, input, 0);
|
||||
Handle<Object> input = args.at(0);
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::ToName(isolate, input));
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_HasInPrototypeChain) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1);
|
||||
Handle<Object> object = args.at(0);
|
||||
Handle<Object> prototype = args.at(1);
|
||||
if (!object->IsJSReceiver()) return ReadOnlyRoots(isolate).false_value();
|
||||
Maybe<bool> result = JSReceiver::HasInPrototypeChain(
|
||||
isolate, Handle<JSReceiver>::cast(object), prototype);
|
||||
@ -1463,8 +1461,8 @@ RUNTIME_FUNCTION(Runtime_HasInPrototypeChain) {
|
||||
RUNTIME_FUNCTION(Runtime_CreateIterResultObject) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, done, 1);
|
||||
Handle<Object> value = args.at(0);
|
||||
Handle<Object> done = args.at(1);
|
||||
return *isolate->factory()->NewJSIteratorResult(value,
|
||||
done->BooleanValue(isolate));
|
||||
}
|
||||
@ -1472,9 +1470,9 @@ RUNTIME_FUNCTION(Runtime_CreateIterResultObject) {
|
||||
RUNTIME_FUNCTION(Runtime_CreateDataProperty) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, o, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
|
||||
Handle<JSReceiver> o = args.at<JSReceiver>(0);
|
||||
Handle<Object> key = args.at(1);
|
||||
Handle<Object> value = args.at(2);
|
||||
bool success;
|
||||
PropertyKey lookup_key(isolate, key, &success);
|
||||
if (!success) return ReadOnlyRoots(isolate).exception();
|
||||
@ -1487,22 +1485,22 @@ RUNTIME_FUNCTION(Runtime_CreateDataProperty) {
|
||||
RUNTIME_FUNCTION(Runtime_SetOwnPropertyIgnoreAttributes) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, o, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, key, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Smi, attributes, 3);
|
||||
Handle<JSObject> o = args.at<JSObject>(0);
|
||||
Handle<String> key = args.at<String>(1);
|
||||
Handle<Object> value = args.at(2);
|
||||
int attributes = args.smi_value_at(3);
|
||||
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, JSObject::SetOwnPropertyIgnoreAttributes(
|
||||
o, key, value, PropertyAttributes(attributes->value())));
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
JSObject::SetOwnPropertyIgnoreAttributes(
|
||||
o, key, value, PropertyAttributes(attributes)));
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_GetOwnPropertyDescriptor) {
|
||||
HandleScope scope(isolate);
|
||||
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
|
||||
Handle<JSReceiver> object = args.at<JSReceiver>(0);
|
||||
Handle<Name> name = args.at<Name>(1);
|
||||
|
||||
PropertyDescriptor desc;
|
||||
Maybe<bool> found =
|
||||
@ -1516,7 +1514,7 @@ RUNTIME_FUNCTION(Runtime_GetOwnPropertyDescriptor) {
|
||||
RUNTIME_FUNCTION(Runtime_LoadPrivateSetter) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(args.length(), 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(AccessorPair, pair, 0);
|
||||
Handle<AccessorPair> pair = args.at<AccessorPair>(0);
|
||||
DCHECK(pair->setter().IsJSFunction());
|
||||
return pair->setter();
|
||||
}
|
||||
@ -1524,7 +1522,7 @@ RUNTIME_FUNCTION(Runtime_LoadPrivateSetter) {
|
||||
RUNTIME_FUNCTION(Runtime_LoadPrivateGetter) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(args.length(), 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(AccessorPair, pair, 0);
|
||||
Handle<AccessorPair> pair = args.at<AccessorPair>(0);
|
||||
DCHECK(pair->getter().IsJSFunction());
|
||||
return pair->getter();
|
||||
}
|
||||
@ -1543,35 +1541,34 @@ RUNTIME_FUNCTION(Runtime_CreatePrivateAccessors) {
|
||||
// SwissNameDictionary is work in progress.
|
||||
RUNTIME_FUNCTION(Runtime_SwissTableAllocate) {
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Smi, at_least_space_for, 0);
|
||||
int at_least_space_for = args.smi_value_at(0);
|
||||
|
||||
return *isolate->factory()->NewSwissNameDictionary(
|
||||
at_least_space_for->value(), AllocationType::kYoung);
|
||||
return *isolate->factory()->NewSwissNameDictionary(at_least_space_for,
|
||||
AllocationType::kYoung);
|
||||
}
|
||||
|
||||
// TODO(v8:11330) This is only here while the CSA/Torque implementaton of
|
||||
// SwissNameDictionary is work in progress.
|
||||
RUNTIME_FUNCTION(Runtime_SwissTableAdd) {
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(SwissNameDictionary, table, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Name, key, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Smi, details_smi, 3);
|
||||
Handle<SwissNameDictionary> table = args.at<SwissNameDictionary>(0);
|
||||
Handle<Name> key = args.at<Name>(1);
|
||||
Handle<Object> value = args.at(2);
|
||||
PropertyDetails details(Smi::cast(args[3]));
|
||||
|
||||
DCHECK(key->IsUniqueName());
|
||||
|
||||
return *SwissNameDictionary::Add(isolate, table, key, value,
|
||||
PropertyDetails{*details_smi});
|
||||
return *SwissNameDictionary::Add(isolate, table, key, value, details);
|
||||
}
|
||||
|
||||
// TODO(v8:11330) This is only here while the CSA/Torque implementaton of
|
||||
// SwissNameDictionary is work in progress.
|
||||
RUNTIME_FUNCTION(Runtime_SwissTableFindEntry) {
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(SwissNameDictionary, table, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Name, key, 1);
|
||||
|
||||
InternalIndex index = table->FindEntry(isolate, *key);
|
||||
DisallowGarbageCollection no_gc;
|
||||
auto table = SwissNameDictionary::cast(args[0]);
|
||||
Name key = Name::cast(args[1]);
|
||||
InternalIndex index = table.FindEntry(isolate, key);
|
||||
return Smi::FromInt(index.is_found()
|
||||
? index.as_int()
|
||||
: SwissNameDictionary::kNotFoundSentinel);
|
||||
@ -1581,15 +1578,14 @@ RUNTIME_FUNCTION(Runtime_SwissTableFindEntry) {
|
||||
// SwissNameDictionary is work in progress.
|
||||
RUNTIME_FUNCTION(Runtime_SwissTableUpdate) {
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(SwissNameDictionary, table, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Smi, index, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Smi, details_smi, 3);
|
||||
DisallowGarbageCollection no_gc;
|
||||
auto table = SwissNameDictionary::cast(args[0]);
|
||||
InternalIndex index(args.smi_value_at(1));
|
||||
Object value = args[2];
|
||||
table.ValueAtPut(index, value);
|
||||
|
||||
InternalIndex i(Smi::ToInt(*index));
|
||||
|
||||
table->ValueAtPut(i, *value);
|
||||
table->DetailsAtPut(i, PropertyDetails{*details_smi});
|
||||
PropertyDetails details(Smi::cast(args[3]));
|
||||
table.DetailsAtPut(index, details);
|
||||
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
}
|
||||
@ -1598,61 +1594,59 @@ RUNTIME_FUNCTION(Runtime_SwissTableUpdate) {
|
||||
// SwissNameDictionary is work in progress.
|
||||
RUNTIME_FUNCTION(Runtime_SwissTableDelete) {
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(SwissNameDictionary, table, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Smi, entry, 1);
|
||||
Handle<SwissNameDictionary> table = args.at<SwissNameDictionary>(0);
|
||||
InternalIndex index(args.smi_value_at(1));
|
||||
|
||||
InternalIndex i(Smi::ToInt(*entry));
|
||||
|
||||
return *SwissNameDictionary::DeleteEntry(isolate, table, i);
|
||||
return *SwissNameDictionary::DeleteEntry(isolate, table, index);
|
||||
}
|
||||
|
||||
// TODO(v8:11330) This is only here while the CSA/Torque implementaton of
|
||||
// SwissNameDictionary is work in progress.
|
||||
RUNTIME_FUNCTION(Runtime_SwissTableEquals) {
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(SwissNameDictionary, table, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(SwissNameDictionary, other, 1);
|
||||
|
||||
return Smi::FromInt(table->EqualsForTesting(*other));
|
||||
DisallowGarbageCollection no_gc;
|
||||
auto table = SwissNameDictionary::cast(args[0]);
|
||||
auto other = SwissNameDictionary::cast(args[0]);
|
||||
return Smi::FromInt(table.EqualsForTesting(other));
|
||||
}
|
||||
|
||||
// TODO(v8:11330) This is only here while the CSA/Torque implementaton of
|
||||
// SwissNameDictionary is work in progress.
|
||||
RUNTIME_FUNCTION(Runtime_SwissTableElementsCount) {
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(SwissNameDictionary, table, 0);
|
||||
|
||||
return Smi::FromInt(table->NumberOfElements());
|
||||
DisallowGarbageCollection no_gc;
|
||||
auto table = SwissNameDictionary::cast(args[0]);
|
||||
return Smi::FromInt(table.NumberOfElements());
|
||||
}
|
||||
|
||||
// TODO(v8:11330) This is only here while the CSA/Torque implementaton of
|
||||
// SwissNameDictionary is work in progress.
|
||||
RUNTIME_FUNCTION(Runtime_SwissTableKeyAt) {
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(SwissNameDictionary, table, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Smi, entry, 1);
|
||||
|
||||
return table->KeyAt(InternalIndex(Smi::ToInt(*entry)));
|
||||
DisallowGarbageCollection no_gc;
|
||||
auto table = SwissNameDictionary::cast(args[0]);
|
||||
InternalIndex index(args.smi_value_at(1));
|
||||
return table.KeyAt(index);
|
||||
}
|
||||
|
||||
// TODO(v8:11330) This is only here while the CSA/Torque implementaton of
|
||||
// SwissNameDictionary is work in progress.
|
||||
RUNTIME_FUNCTION(Runtime_SwissTableValueAt) {
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(SwissNameDictionary, table, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Smi, entry, 1);
|
||||
|
||||
return table->ValueAt(InternalIndex(Smi::ToInt(*entry)));
|
||||
DisallowGarbageCollection no_gc;
|
||||
auto table = SwissNameDictionary::cast(args[0]);
|
||||
InternalIndex index(args.smi_value_at(1));
|
||||
return table.ValueAt(index);
|
||||
}
|
||||
|
||||
// TODO(v8:11330) This is only here while the CSA/Torque implementaton of
|
||||
// SwissNameDictionary is work in progress.
|
||||
RUNTIME_FUNCTION(Runtime_SwissTableDetailsAt) {
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(SwissNameDictionary, table, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Smi, entry, 1);
|
||||
|
||||
PropertyDetails d = table->DetailsAt(InternalIndex(Smi::ToInt(*entry)));
|
||||
DisallowGarbageCollection no_gc;
|
||||
auto table = SwissNameDictionary::cast(args[0]);
|
||||
InternalIndex index(args.smi_value_at(1));
|
||||
PropertyDetails d = table.DetailsAt(index);
|
||||
return d.AsSmi();
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,8 @@ namespace internal {
|
||||
RUNTIME_FUNCTION(Runtime_Add) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, lhs, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, rhs, 1);
|
||||
Handle<Object> lhs = args.at(0);
|
||||
Handle<Object> rhs = args.at(1);
|
||||
RETURN_RESULT_OR_FAILURE(isolate, Object::Add(isolate, lhs, rhs));
|
||||
}
|
||||
|
||||
@ -23,8 +23,8 @@ RUNTIME_FUNCTION(Runtime_Add) {
|
||||
RUNTIME_FUNCTION(Runtime_Equal) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, y, 1);
|
||||
Handle<Object> x = args.at(0);
|
||||
Handle<Object> y = args.at(1);
|
||||
Maybe<bool> result = Object::Equals(isolate, x, y);
|
||||
if (result.IsNothing()) return ReadOnlyRoots(isolate).exception();
|
||||
return isolate->heap()->ToBoolean(result.FromJust());
|
||||
@ -33,8 +33,8 @@ RUNTIME_FUNCTION(Runtime_Equal) {
|
||||
RUNTIME_FUNCTION(Runtime_NotEqual) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, y, 1);
|
||||
Handle<Object> x = args.at(0);
|
||||
Handle<Object> y = args.at(1);
|
||||
Maybe<bool> result = Object::Equals(isolate, x, y);
|
||||
if (result.IsNothing()) return ReadOnlyRoots(isolate).exception();
|
||||
return isolate->heap()->ToBoolean(!result.FromJust());
|
||||
@ -43,32 +43,32 @@ RUNTIME_FUNCTION(Runtime_NotEqual) {
|
||||
RUNTIME_FUNCTION(Runtime_StrictEqual) {
|
||||
SealHandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_CHECKED(Object, x, 0);
|
||||
CONVERT_ARG_CHECKED(Object, y, 1);
|
||||
Object x = args[0];
|
||||
Object y = args[1];
|
||||
return isolate->heap()->ToBoolean(x.StrictEquals(y));
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_StrictNotEqual) {
|
||||
SealHandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_CHECKED(Object, x, 0);
|
||||
CONVERT_ARG_CHECKED(Object, y, 1);
|
||||
Object x = args[0];
|
||||
Object y = args[1];
|
||||
return isolate->heap()->ToBoolean(!x.StrictEquals(y));
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_ReferenceEqual) {
|
||||
SealHandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_CHECKED(Object, x, 0);
|
||||
CONVERT_ARG_CHECKED(Object, y, 1);
|
||||
Object x = args[0];
|
||||
Object y = args[1];
|
||||
return isolate->heap()->ToBoolean(x == y);
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_LessThan) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, y, 1);
|
||||
Handle<Object> x = args.at(0);
|
||||
Handle<Object> y = args.at(1);
|
||||
Maybe<bool> result = Object::LessThan(isolate, x, y);
|
||||
if (result.IsNothing()) return ReadOnlyRoots(isolate).exception();
|
||||
return isolate->heap()->ToBoolean(result.FromJust());
|
||||
@ -77,8 +77,8 @@ RUNTIME_FUNCTION(Runtime_LessThan) {
|
||||
RUNTIME_FUNCTION(Runtime_GreaterThan) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, y, 1);
|
||||
Handle<Object> x = args.at(0);
|
||||
Handle<Object> y = args.at(1);
|
||||
Maybe<bool> result = Object::GreaterThan(isolate, x, y);
|
||||
if (result.IsNothing()) return ReadOnlyRoots(isolate).exception();
|
||||
return isolate->heap()->ToBoolean(result.FromJust());
|
||||
@ -87,8 +87,8 @@ RUNTIME_FUNCTION(Runtime_GreaterThan) {
|
||||
RUNTIME_FUNCTION(Runtime_LessThanOrEqual) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, y, 1);
|
||||
Handle<Object> x = args.at(0);
|
||||
Handle<Object> y = args.at(1);
|
||||
Maybe<bool> result = Object::LessThanOrEqual(isolate, x, y);
|
||||
if (result.IsNothing()) return ReadOnlyRoots(isolate).exception();
|
||||
return isolate->heap()->ToBoolean(result.FromJust());
|
||||
@ -97,8 +97,8 @@ RUNTIME_FUNCTION(Runtime_LessThanOrEqual) {
|
||||
RUNTIME_FUNCTION(Runtime_GreaterThanOrEqual) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, x, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, y, 1);
|
||||
Handle<Object> x = args.at(0);
|
||||
Handle<Object> y = args.at(1);
|
||||
Maybe<bool> result = Object::GreaterThanOrEqual(isolate, x, y);
|
||||
if (result.IsNothing()) return ReadOnlyRoots(isolate).exception();
|
||||
return isolate->heap()->ToBoolean(result.FromJust());
|
||||
|
@ -20,8 +20,8 @@ namespace internal {
|
||||
RUNTIME_FUNCTION(Runtime_PromiseRejectEventFromStack) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
|
||||
Handle<JSPromise> promise = args.at<JSPromise>(0);
|
||||
Handle<Object> value = args.at(1);
|
||||
|
||||
Handle<Object> rejected_promise = promise;
|
||||
if (isolate->debug()->is_active()) {
|
||||
@ -44,8 +44,8 @@ RUNTIME_FUNCTION(Runtime_PromiseRejectEventFromStack) {
|
||||
RUNTIME_FUNCTION(Runtime_PromiseRejectAfterResolved) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, reason, 1);
|
||||
Handle<JSPromise> promise = args.at<JSPromise>(0);
|
||||
Handle<Object> reason = args.at(1);
|
||||
isolate->ReportPromiseReject(promise, reason,
|
||||
v8::kPromiseRejectAfterResolved);
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
@ -54,8 +54,8 @@ RUNTIME_FUNCTION(Runtime_PromiseRejectAfterResolved) {
|
||||
RUNTIME_FUNCTION(Runtime_PromiseResolveAfterResolved) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, resolution, 1);
|
||||
Handle<JSPromise> promise = args.at<JSPromise>(0);
|
||||
Handle<Object> resolution = args.at(1);
|
||||
isolate->ReportPromiseReject(promise, resolution,
|
||||
v8::kPromiseResolveAfterResolved);
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
@ -64,7 +64,7 @@ RUNTIME_FUNCTION(Runtime_PromiseResolveAfterResolved) {
|
||||
RUNTIME_FUNCTION(Runtime_PromiseRevokeReject) {
|
||||
DCHECK_EQ(1, args.length());
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
|
||||
Handle<JSPromise> promise = args.at<JSPromise>(0);
|
||||
// At this point, no revocation has been issued before
|
||||
CHECK(!promise->has_handler());
|
||||
isolate->ReportPromiseReject(promise, Handle<Object>(),
|
||||
@ -75,7 +75,7 @@ RUNTIME_FUNCTION(Runtime_PromiseRevokeReject) {
|
||||
RUNTIME_FUNCTION(Runtime_EnqueueMicrotask) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
|
||||
Handle<CallableTask> microtask = isolate->factory()->NewCallableTask(
|
||||
function, handle(function->native_context(), isolate));
|
||||
@ -95,8 +95,8 @@ RUNTIME_FUNCTION(Runtime_PerformMicrotaskCheckpoint) {
|
||||
RUNTIME_FUNCTION(Runtime_RunMicrotaskCallback) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_CHECKED(Object, microtask_callback, 0);
|
||||
CONVERT_ARG_CHECKED(Object, microtask_data, 1);
|
||||
Object microtask_callback = args[0];
|
||||
Object microtask_data = args[1];
|
||||
MicrotaskCallback callback = ToCData<MicrotaskCallback>(microtask_callback);
|
||||
void* data = ToCData<void*>(microtask_data);
|
||||
callback(data);
|
||||
@ -107,7 +107,7 @@ RUNTIME_FUNCTION(Runtime_RunMicrotaskCallback) {
|
||||
RUNTIME_FUNCTION(Runtime_PromiseStatus) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
|
||||
Handle<JSPromise> promise = args.at<JSPromise>(0);
|
||||
|
||||
return Smi::FromInt(promise->status());
|
||||
}
|
||||
@ -115,8 +115,8 @@ RUNTIME_FUNCTION(Runtime_PromiseStatus) {
|
||||
RUNTIME_FUNCTION(Runtime_PromiseHookInit) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, parent, 1);
|
||||
Handle<JSPromise> promise = args.at<JSPromise>(0);
|
||||
Handle<Object> parent = args.at(1);
|
||||
isolate->RunPromiseHook(PromiseHookType::kInit, promise, parent);
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
}
|
||||
@ -124,7 +124,7 @@ RUNTIME_FUNCTION(Runtime_PromiseHookInit) {
|
||||
RUNTIME_FUNCTION(Runtime_PromiseHookBefore) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, promise, 0);
|
||||
Handle<JSReceiver> promise = args.at<JSReceiver>(0);
|
||||
if (promise->IsJSPromise()) {
|
||||
isolate->OnPromiseBefore(Handle<JSPromise>::cast(promise));
|
||||
}
|
||||
@ -134,7 +134,7 @@ RUNTIME_FUNCTION(Runtime_PromiseHookBefore) {
|
||||
RUNTIME_FUNCTION(Runtime_PromiseHookAfter) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, promise, 0);
|
||||
Handle<JSReceiver> promise = args.at<JSReceiver>(0);
|
||||
if (promise->IsJSPromise()) {
|
||||
isolate->OnPromiseAfter(Handle<JSPromise>::cast(promise));
|
||||
}
|
||||
@ -144,9 +144,9 @@ RUNTIME_FUNCTION(Runtime_PromiseHookAfter) {
|
||||
RUNTIME_FUNCTION(Runtime_RejectPromise) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, reason, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Oddball, debug_event, 2);
|
||||
Handle<JSPromise> promise = args.at<JSPromise>(0);
|
||||
Handle<Object> reason = args.at(1);
|
||||
Handle<Oddball> debug_event = args.at<Oddball>(2);
|
||||
return *JSPromise::Reject(promise, reason,
|
||||
debug_event->BooleanValue(isolate));
|
||||
}
|
||||
@ -154,8 +154,8 @@ RUNTIME_FUNCTION(Runtime_RejectPromise) {
|
||||
RUNTIME_FUNCTION(Runtime_ResolvePromise) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, resolution, 1);
|
||||
Handle<JSPromise> promise = args.at<JSPromise>(0);
|
||||
Handle<Object> resolution = args.at(1);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
|
||||
JSPromise::Resolve(promise, resolution));
|
||||
@ -167,10 +167,10 @@ RUNTIME_FUNCTION(Runtime_ResolvePromise) {
|
||||
RUNTIME_FUNCTION(Runtime_ConstructAggregateErrorHelper) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, target, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, new_target, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, message, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, options, 3);
|
||||
Handle<JSFunction> target = args.at<JSFunction>(0);
|
||||
Handle<Object> new_target = args.at(1);
|
||||
Handle<Object> message = args.at(2);
|
||||
Handle<Object> options = args.at(3);
|
||||
|
||||
DCHECK_EQ(*target, *isolate->aggregate_error_function());
|
||||
|
||||
@ -186,36 +186,32 @@ RUNTIME_FUNCTION(Runtime_ConstructAggregateErrorHelper) {
|
||||
RUNTIME_FUNCTION(Runtime_ConstructInternalAggregateErrorHelper) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_GE(args.length(), 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Smi, message, 0);
|
||||
int message_template_index = args.smi_value_at(0);
|
||||
|
||||
Handle<Object> arg0;
|
||||
if (args.length() >= 2) {
|
||||
DCHECK(args[1].IsObject());
|
||||
arg0 = args.at<Object>(1);
|
||||
}
|
||||
|
||||
Handle<Object> arg1;
|
||||
if (args.length() >= 3) {
|
||||
DCHECK(args[2].IsObject());
|
||||
arg1 = args.at<Object>(2);
|
||||
}
|
||||
|
||||
Handle<Object> arg2;
|
||||
if (args.length() >= 4) {
|
||||
CHECK(args[3].IsObject());
|
||||
arg2 = args.at<Object>(3);
|
||||
}
|
||||
|
||||
Handle<Object> options;
|
||||
if (args.length() >= 5) {
|
||||
CHECK(args[4].IsObject());
|
||||
options = args.at<Object>(4);
|
||||
} else {
|
||||
options = isolate->factory()->undefined_value();
|
||||
}
|
||||
|
||||
Handle<Object> message_string = MessageFormatter::Format(
|
||||
isolate, MessageTemplate(message->value()), arg0, arg1, arg2);
|
||||
isolate, MessageTemplate(message_template_index), arg0, arg1, arg2);
|
||||
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
|
@ -18,21 +18,21 @@ namespace internal {
|
||||
RUNTIME_FUNCTION(Runtime_IsJSProxy) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(Object, obj, 0);
|
||||
Object obj = args[0];
|
||||
return isolate->heap()->ToBoolean(obj.IsJSProxy());
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_JSProxyGetHandler) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(JSProxy, proxy, 0);
|
||||
auto proxy = JSProxy::cast(args[0]);
|
||||
return proxy.handler();
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_JSProxyGetTarget) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(JSProxy, proxy, 0);
|
||||
auto proxy = JSProxy::cast(args[0]);
|
||||
return proxy.target();
|
||||
}
|
||||
|
||||
@ -40,15 +40,15 @@ RUNTIME_FUNCTION(Runtime_GetPropertyWithReceiver) {
|
||||
HandleScope scope(isolate);
|
||||
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, holder, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 2);
|
||||
Handle<JSReceiver> holder = args.at<JSReceiver>(0);
|
||||
Handle<Object> key = args.at(1);
|
||||
Handle<Object> receiver = args.at(2);
|
||||
// TODO(mythria): Remove the on_non_existent parameter to this function. This
|
||||
// should only be called when getting named properties on receiver. This
|
||||
// doesn't handle the global variable loads.
|
||||
#ifdef DEBUG
|
||||
CONVERT_ARG_HANDLE_CHECKED(Smi, on_non_existent, 3);
|
||||
DCHECK_NE(static_cast<OnNonExistent>(on_non_existent->value()),
|
||||
int on_non_existent = args.smi_value_at(3);
|
||||
DCHECK_NE(static_cast<OnNonExistent>(on_non_existent),
|
||||
OnNonExistent::kThrowReferenceError);
|
||||
#endif
|
||||
|
||||
@ -67,10 +67,10 @@ RUNTIME_FUNCTION(Runtime_SetPropertyWithReceiver) {
|
||||
HandleScope scope(isolate);
|
||||
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, holder, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, receiver, 3);
|
||||
Handle<JSReceiver> holder = args.at<JSReceiver>(0);
|
||||
Handle<Object> key = args.at(1);
|
||||
Handle<Object> value = args.at(2);
|
||||
Handle<Object> receiver = args.at(3);
|
||||
|
||||
bool success = false;
|
||||
PropertyKey lookup_key(isolate, key, &success);
|
||||
@ -89,10 +89,10 @@ RUNTIME_FUNCTION(Runtime_CheckProxyGetSetTrapResult) {
|
||||
HandleScope scope(isolate);
|
||||
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Name, name, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, target, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, trap_result, 2);
|
||||
CONVERT_NUMBER_CHECKED(int64_t, access_kind, Int64, args[3]);
|
||||
Handle<Name> name = args.at<Name>(0);
|
||||
Handle<JSReceiver> target = args.at<JSReceiver>(1);
|
||||
Handle<Object> trap_result = args.at(2);
|
||||
int64_t access_kind = NumberToInt64(args[3]);
|
||||
|
||||
RETURN_RESULT_OR_FAILURE(isolate, JSProxy::CheckGetSetTrapResult(
|
||||
isolate, name, target, trap_result,
|
||||
@ -103,8 +103,8 @@ RUNTIME_FUNCTION(Runtime_CheckProxyHasTrapResult) {
|
||||
HandleScope scope(isolate);
|
||||
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Name, name, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, target, 1);
|
||||
Handle<Name> name = args.at<Name>(0);
|
||||
Handle<JSReceiver> target = args.at<JSReceiver>(1);
|
||||
|
||||
Maybe<bool> result = JSProxy::CheckHasTrap(isolate, name, target);
|
||||
if (!result.IsJust()) return ReadOnlyRoots(isolate).exception();
|
||||
@ -115,8 +115,8 @@ RUNTIME_FUNCTION(Runtime_CheckProxyDeleteTrapResult) {
|
||||
HandleScope scope(isolate);
|
||||
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Name, name, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, target, 1);
|
||||
Handle<Name> name = args.at<Name>(0);
|
||||
Handle<JSReceiver> target = args.at<JSReceiver>(1);
|
||||
|
||||
Maybe<bool> result = JSProxy::CheckDeleteTrap(isolate, name, target);
|
||||
if (!result.IsJust()) return ReadOnlyRoots(isolate).exception();
|
||||
|
@ -800,9 +800,9 @@ V8_WARN_UNUSED_RESULT static Object StringReplaceGlobalRegExpWithEmptyString(
|
||||
RUNTIME_FUNCTION(Runtime_StringSplit) {
|
||||
HandleScope handle_scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, subject, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, pattern, 1);
|
||||
CONVERT_NUMBER_CHECKED(uint32_t, limit, Uint32, args[2]);
|
||||
Handle<String> subject = args.at<String>(0);
|
||||
Handle<String> pattern = args.at<String>(1);
|
||||
uint32_t limit = NumberToUint32(args[2]);
|
||||
CHECK_LT(0, limit);
|
||||
|
||||
int subject_length = subject->length();
|
||||
@ -911,10 +911,11 @@ MaybeHandle<Object> ExperimentalOneshotExec(
|
||||
RUNTIME_FUNCTION(Runtime_RegExpExec) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, subject, 1);
|
||||
CONVERT_INT32_ARG_CHECKED(index, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(RegExpMatchInfo, last_match_info, 3);
|
||||
Handle<JSRegExp> regexp = args.at<JSRegExp>(0);
|
||||
Handle<String> subject = args.at<String>(1);
|
||||
int32_t index = 0;
|
||||
CHECK(args[2].ToInt32(&index));
|
||||
Handle<RegExpMatchInfo> last_match_info = args.at<RegExpMatchInfo>(3);
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, RegExpExec(isolate, regexp, subject, index, last_match_info,
|
||||
RegExp::ExecQuirks::kNone));
|
||||
@ -923,10 +924,11 @@ RUNTIME_FUNCTION(Runtime_RegExpExec) {
|
||||
RUNTIME_FUNCTION(Runtime_RegExpExecTreatMatchAtEndAsFailure) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, subject, 1);
|
||||
CONVERT_INT32_ARG_CHECKED(index, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(RegExpMatchInfo, last_match_info, 3);
|
||||
Handle<JSRegExp> regexp = args.at<JSRegExp>(0);
|
||||
Handle<String> subject = args.at<String>(1);
|
||||
int32_t index = 0;
|
||||
CHECK(args[2].ToInt32(&index));
|
||||
Handle<RegExpMatchInfo> last_match_info = args.at<RegExpMatchInfo>(3);
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, RegExpExec(isolate, regexp, subject, index, last_match_info,
|
||||
RegExp::ExecQuirks::kTreatMatchAtEndAsFailure));
|
||||
@ -935,10 +937,11 @@ RUNTIME_FUNCTION(Runtime_RegExpExecTreatMatchAtEndAsFailure) {
|
||||
RUNTIME_FUNCTION(Runtime_RegExpExperimentalOneshotExec) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, subject, 1);
|
||||
CONVERT_INT32_ARG_CHECKED(index, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(RegExpMatchInfo, last_match_info, 3);
|
||||
Handle<JSRegExp> regexp = args.at<JSRegExp>(0);
|
||||
Handle<String> subject = args.at<String>(1);
|
||||
int32_t index = 0;
|
||||
CHECK(args[2].ToInt32(&index));
|
||||
Handle<RegExpMatchInfo> last_match_info = args.at<RegExpMatchInfo>(3);
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate,
|
||||
ExperimentalOneshotExec(isolate, regexp, subject, index, last_match_info,
|
||||
@ -949,10 +952,11 @@ RUNTIME_FUNCTION(
|
||||
Runtime_RegExpExperimentalOneshotExecTreatMatchAtEndAsFailure) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, subject, 1);
|
||||
CONVERT_INT32_ARG_CHECKED(index, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(RegExpMatchInfo, last_match_info, 3);
|
||||
Handle<JSRegExp> regexp = args.at<JSRegExp>(0);
|
||||
Handle<String> subject = args.at<String>(1);
|
||||
int32_t index = 0;
|
||||
CHECK(args[2].ToInt32(&index));
|
||||
Handle<RegExpMatchInfo> last_match_info = args.at<RegExpMatchInfo>(3);
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate,
|
||||
ExperimentalOneshotExec(isolate, regexp, subject, index, last_match_info,
|
||||
@ -962,10 +966,10 @@ RUNTIME_FUNCTION(
|
||||
RUNTIME_FUNCTION(Runtime_RegExpBuildIndices) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(RegExpMatchInfo, match_info, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, maybe_names, 2);
|
||||
Handle<RegExpMatchInfo> match_info = args.at<RegExpMatchInfo>(1);
|
||||
Handle<Object> maybe_names = args.at(2);
|
||||
#ifdef DEBUG
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0);
|
||||
Handle<JSRegExp> regexp = args.at<JSRegExp>(0);
|
||||
DCHECK(regexp->flags() & JSRegExp::kHasIndices);
|
||||
#endif
|
||||
|
||||
@ -1462,10 +1466,10 @@ RUNTIME_FUNCTION(Runtime_RegExpExecMultiple) {
|
||||
HandleScope handles(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, subject, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(RegExpMatchInfo, last_match_info, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSArray, result_array, 3);
|
||||
Handle<JSRegExp> regexp = args.at<JSRegExp>(0);
|
||||
Handle<String> subject = args.at<String>(1);
|
||||
Handle<RegExpMatchInfo> last_match_info = args.at<RegExpMatchInfo>(2);
|
||||
Handle<JSArray> result_array = args.at<JSArray>(3);
|
||||
|
||||
DCHECK(RegExpUtils::IsUnmodifiedRegExp(isolate, regexp));
|
||||
CHECK(result_array->HasObjectElements());
|
||||
@ -1488,9 +1492,9 @@ RUNTIME_FUNCTION(Runtime_RegExpExecMultiple) {
|
||||
RUNTIME_FUNCTION(Runtime_StringReplaceNonGlobalRegExpWithFunction) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, subject, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, replace_obj, 2);
|
||||
Handle<String> subject = args.at<String>(0);
|
||||
Handle<JSRegExp> regexp = args.at<JSRegExp>(1);
|
||||
Handle<JSReceiver> replace_obj = args.at<JSReceiver>(2);
|
||||
|
||||
DCHECK(RegExpUtils::IsUnmodifiedRegExp(isolate, regexp));
|
||||
DCHECK(replace_obj->map().is_callable());
|
||||
@ -1639,9 +1643,9 @@ RUNTIME_FUNCTION(Runtime_RegExpSplit) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, recv, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, string, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, limit_obj, 2);
|
||||
Handle<JSReceiver> recv = args.at<JSReceiver>(0);
|
||||
Handle<String> string = args.at<String>(1);
|
||||
Handle<Object> limit_obj = args.at(2);
|
||||
|
||||
Factory* factory = isolate->factory();
|
||||
|
||||
@ -1793,8 +1797,8 @@ RUNTIME_FUNCTION(Runtime_RegExpReplaceRT) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, recv, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, string, 1);
|
||||
Handle<JSReceiver> recv = args.at<JSReceiver>(0);
|
||||
Handle<String> string = args.at<String>(1);
|
||||
Handle<Object> replace_obj = args.at(2);
|
||||
|
||||
Factory* factory = isolate->factory();
|
||||
@ -1993,9 +1997,9 @@ RUNTIME_FUNCTION(Runtime_RegExpInitializeAndCompile) {
|
||||
// TODO(pwong): To follow the spec more closely and simplify calling code,
|
||||
// this could handle the canonicalization of pattern and flags. See
|
||||
// https://tc39.github.io/ecma262/#sec-regexpinitialize
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, source, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, flags, 2);
|
||||
Handle<JSRegExp> regexp = args.at<JSRegExp>(0);
|
||||
Handle<String> source = args.at<String>(1);
|
||||
Handle<String> flags = args.at<String>(2);
|
||||
|
||||
RETURN_FAILURE_ON_EXCEPTION(isolate,
|
||||
JSRegExp::Initialize(regexp, source, flags));
|
||||
@ -2006,14 +2010,14 @@ RUNTIME_FUNCTION(Runtime_RegExpInitializeAndCompile) {
|
||||
RUNTIME_FUNCTION(Runtime_IsRegExp) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(Object, obj, 0);
|
||||
Object obj = args[0];
|
||||
return isolate->heap()->ToBoolean(obj.IsJSRegExp());
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_RegExpStringFromFlags) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(JSRegExp, regexp, 0);
|
||||
auto regexp = JSRegExp::cast(args[0]);
|
||||
Handle<String> flags = JSRegExp::StringFromFlags(isolate, regexp.flags());
|
||||
return *flags;
|
||||
}
|
||||
|
@ -125,8 +125,8 @@ RUNTIME_FUNCTION(Runtime_DeclareModuleExports) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(FixedArray, declarations, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, closure, 1);
|
||||
Handle<FixedArray> declarations = args.at<FixedArray>(0);
|
||||
Handle<JSFunction> closure = args.at<JSFunction>(1);
|
||||
|
||||
Handle<ClosureFeedbackCellArray> closure_feedback_cell_array =
|
||||
Handle<ClosureFeedbackCellArray>::null();
|
||||
@ -173,8 +173,8 @@ RUNTIME_FUNCTION(Runtime_DeclareGlobals) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(FixedArray, declarations, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, closure, 1);
|
||||
Handle<FixedArray> declarations = args.at<FixedArray>(0);
|
||||
Handle<JSFunction> closure = args.at<JSFunction>(1);
|
||||
|
||||
Handle<JSGlobalObject> global(isolate->global_object());
|
||||
Handle<Context> context(isolate->context(), isolate);
|
||||
@ -324,15 +324,15 @@ Object DeclareEvalHelper(Isolate* isolate, Handle<String> name,
|
||||
RUNTIME_FUNCTION(Runtime_DeclareEvalFunction) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
|
||||
Handle<String> name = args.at<String>(0);
|
||||
Handle<Object> value = args.at(1);
|
||||
return DeclareEvalHelper(isolate, name, value);
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_DeclareEvalVar) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
|
||||
Handle<String> name = args.at<String>(0);
|
||||
return DeclareEvalHelper(isolate, name,
|
||||
isolate->factory()->undefined_value());
|
||||
}
|
||||
@ -493,7 +493,7 @@ class ParameterArguments {
|
||||
RUNTIME_FUNCTION(Runtime_NewSloppyArguments) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0);
|
||||
Handle<JSFunction> callee = args.at<JSFunction>(0);
|
||||
// This generic runtime function can also be used when the caller has been
|
||||
// inlined, we use the slow but accurate {GetCallerArguments}.
|
||||
int argument_count = 0;
|
||||
@ -506,7 +506,7 @@ RUNTIME_FUNCTION(Runtime_NewSloppyArguments) {
|
||||
RUNTIME_FUNCTION(Runtime_NewStrictArguments) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0);
|
||||
Handle<JSFunction> callee = args.at<JSFunction>(0);
|
||||
// This generic runtime function can also be used when the caller has been
|
||||
// inlined, we use the slow but accurate {GetCallerArguments}.
|
||||
int argument_count = 0;
|
||||
@ -531,7 +531,7 @@ RUNTIME_FUNCTION(Runtime_NewStrictArguments) {
|
||||
RUNTIME_FUNCTION(Runtime_NewRestParameter) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0)
|
||||
Handle<JSFunction> callee = args.at<JSFunction>(0);
|
||||
int start_index =
|
||||
callee->shared().internal_formal_parameter_count_without_receiver();
|
||||
// This generic runtime function can also be used when the caller has been
|
||||
@ -557,8 +557,8 @@ RUNTIME_FUNCTION(Runtime_NewRestParameter) {
|
||||
RUNTIME_FUNCTION(Runtime_NewClosure) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(FeedbackCell, feedback_cell, 1);
|
||||
Handle<SharedFunctionInfo> shared = args.at<SharedFunctionInfo>(0);
|
||||
Handle<FeedbackCell> feedback_cell = args.at<FeedbackCell>(1);
|
||||
Handle<Context> context(isolate->context(), isolate);
|
||||
return *Factory::JSFunctionBuilder{isolate, shared, context}
|
||||
.set_feedback_cell(feedback_cell)
|
||||
@ -569,8 +569,8 @@ RUNTIME_FUNCTION(Runtime_NewClosure) {
|
||||
RUNTIME_FUNCTION(Runtime_NewClosure_Tenured) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(SharedFunctionInfo, shared, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(FeedbackCell, feedback_cell, 1);
|
||||
Handle<SharedFunctionInfo> shared = args.at<SharedFunctionInfo>(0);
|
||||
Handle<FeedbackCell> feedback_cell = args.at<FeedbackCell>(1);
|
||||
Handle<Context> context(isolate->context(), isolate);
|
||||
// The caller ensures that we pretenure closures that are assigned
|
||||
// directly to properties.
|
||||
@ -584,7 +584,7 @@ RUNTIME_FUNCTION(Runtime_NewFunctionContext) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(ScopeInfo, scope_info, 0);
|
||||
Handle<ScopeInfo> scope_info = args.at<ScopeInfo>(0);
|
||||
|
||||
Handle<Context> outer(isolate->context(), isolate);
|
||||
return *isolate->factory()->NewFunctionContext(outer, scope_info);
|
||||
@ -594,8 +594,8 @@ RUNTIME_FUNCTION(Runtime_NewFunctionContext) {
|
||||
RUNTIME_FUNCTION(Runtime_PushWithContext) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, extension_object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(ScopeInfo, scope_info, 1);
|
||||
Handle<JSReceiver> extension_object = args.at<JSReceiver>(0);
|
||||
Handle<ScopeInfo> scope_info = args.at<ScopeInfo>(1);
|
||||
Handle<Context> current(isolate->context(), isolate);
|
||||
return *isolate->factory()->NewWithContext(current, scope_info,
|
||||
extension_object);
|
||||
@ -605,8 +605,8 @@ RUNTIME_FUNCTION(Runtime_PushWithContext) {
|
||||
RUNTIME_FUNCTION(Runtime_PushCatchContext) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, thrown_object, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(ScopeInfo, scope_info, 1);
|
||||
Handle<Object> thrown_object = args.at(0);
|
||||
Handle<ScopeInfo> scope_info = args.at<ScopeInfo>(1);
|
||||
Handle<Context> current(isolate->context(), isolate);
|
||||
return *isolate->factory()->NewCatchContext(current, scope_info,
|
||||
thrown_object);
|
||||
@ -616,7 +616,7 @@ RUNTIME_FUNCTION(Runtime_PushCatchContext) {
|
||||
RUNTIME_FUNCTION(Runtime_PushBlockContext) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(ScopeInfo, scope_info, 0);
|
||||
Handle<ScopeInfo> scope_info = args.at<ScopeInfo>(0);
|
||||
Handle<Context> current(isolate->context(), isolate);
|
||||
return *isolate->factory()->NewBlockContext(current, scope_info);
|
||||
}
|
||||
@ -625,7 +625,7 @@ RUNTIME_FUNCTION(Runtime_PushBlockContext) {
|
||||
RUNTIME_FUNCTION(Runtime_DeleteLookupSlot) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
|
||||
Handle<String> name = args.at<String>(0);
|
||||
|
||||
int index;
|
||||
PropertyAttributes attributes;
|
||||
@ -731,7 +731,7 @@ MaybeHandle<Object> LoadLookupSlot(Isolate* isolate, Handle<String> name,
|
||||
RUNTIME_FUNCTION(Runtime_LoadLookupSlot) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
|
||||
Handle<String> name = args.at<String>(0);
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
LoadLookupSlot(isolate, name, kThrowOnError));
|
||||
}
|
||||
@ -740,7 +740,7 @@ RUNTIME_FUNCTION(Runtime_LoadLookupSlot) {
|
||||
RUNTIME_FUNCTION(Runtime_LoadLookupSlotInsideTypeof) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
|
||||
Handle<String> name = args.at<String>(0);
|
||||
RETURN_RESULT_OR_FAILURE(isolate, LoadLookupSlot(isolate, name, kDontThrow));
|
||||
}
|
||||
|
||||
@ -748,7 +748,6 @@ RUNTIME_FUNCTION(Runtime_LoadLookupSlotInsideTypeof) {
|
||||
RUNTIME_FUNCTION_RETURN_PAIR(Runtime_LoadLookupSlotForCall) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
DCHECK(args[0].IsString());
|
||||
Handle<String> name = args.at<String>(0);
|
||||
Handle<Object> value;
|
||||
Handle<Object> receiver;
|
||||
@ -831,8 +830,8 @@ MaybeHandle<Object> StoreLookupSlot(
|
||||
RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Sloppy) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
|
||||
Handle<String> name = args.at<String>(0);
|
||||
Handle<Object> value = args.at(1);
|
||||
Handle<Context> context(isolate->context(), isolate);
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate,
|
||||
@ -842,8 +841,8 @@ RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Sloppy) {
|
||||
RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
|
||||
Handle<String> name = args.at<String>(0);
|
||||
Handle<Object> value = args.at(1);
|
||||
Handle<Context> context(isolate->context(), isolate);
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate,
|
||||
@ -855,8 +854,8 @@ RUNTIME_FUNCTION(Runtime_StoreLookupSlot_Strict) {
|
||||
RUNTIME_FUNCTION(Runtime_StoreLookupSlot_SloppyHoisting) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
|
||||
Handle<String> name = args.at<String>(0);
|
||||
Handle<Object> value = args.at(1);
|
||||
const ContextLookupFlags lookup_flags =
|
||||
static_cast<ContextLookupFlags>(DONT_FOLLOW_CHAINS);
|
||||
Handle<Context> declaration_context(isolate->context().declaration_context(),
|
||||
@ -869,8 +868,8 @@ RUNTIME_FUNCTION(Runtime_StoreLookupSlot_SloppyHoisting) {
|
||||
RUNTIME_FUNCTION(Runtime_StoreGlobalNoHoleCheckForReplLetOrConst) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
|
||||
Handle<String> name = args.at<String>(0);
|
||||
Handle<Object> value = args.at(1);
|
||||
|
||||
Handle<Context> native_context = isolate->native_context();
|
||||
Handle<ScriptContextTable> script_contexts(
|
||||
|
@ -21,11 +21,11 @@ namespace internal {
|
||||
RUNTIME_FUNCTION(Runtime_GetSubstitution) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(5, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, matched, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, subject, 1);
|
||||
CONVERT_SMI_ARG_CHECKED(position, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, replacement, 3);
|
||||
CONVERT_SMI_ARG_CHECKED(start_index, 4);
|
||||
Handle<String> matched = args.at<String>(0);
|
||||
Handle<String> subject = args.at<String>(1);
|
||||
int position = args.smi_value_at(2);
|
||||
Handle<String> replacement = args.at<String>(3);
|
||||
int start_index = args.smi_value_at(4);
|
||||
|
||||
// A simple match without captures.
|
||||
class SimpleMatch : public String::Match {
|
||||
@ -112,9 +112,9 @@ MaybeHandle<String> StringReplaceOneCharWithString(
|
||||
RUNTIME_FUNCTION(Runtime_StringReplaceOneCharWithString) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, subject, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, search, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, replace, 2);
|
||||
Handle<String> subject = args.at<String>(0);
|
||||
Handle<String> search = args.at<String>(1);
|
||||
Handle<String> replace = args.at<String>(2);
|
||||
|
||||
// If the cons string tree is too deep, we simply abort the recursion and
|
||||
// retry with a flattened subject string.
|
||||
@ -148,9 +148,9 @@ RUNTIME_FUNCTION(Runtime_StringLastIndexOf) {
|
||||
RUNTIME_FUNCTION(Runtime_StringSubstring) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, string, 0);
|
||||
CONVERT_INT32_ARG_CHECKED(start, 1);
|
||||
CONVERT_INT32_ARG_CHECKED(end, 2);
|
||||
Handle<String> string = args.at<String>(0);
|
||||
int start = args.smi_value_at(1);
|
||||
int end = args.smi_value_at(2);
|
||||
DCHECK_LE(0, start);
|
||||
DCHECK_LE(start, end);
|
||||
DCHECK_LE(end, string->length());
|
||||
@ -161,8 +161,8 @@ RUNTIME_FUNCTION(Runtime_StringSubstring) {
|
||||
RUNTIME_FUNCTION(Runtime_StringAdd) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, str1, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, str2, 1);
|
||||
Handle<String> str1 = args.at<String>(0);
|
||||
Handle<String> str2 = args.at<String>(1);
|
||||
isolate->counters()->string_add_runtime()->Increment();
|
||||
RETURN_RESULT_OR_FAILURE(isolate,
|
||||
isolate->factory()->NewConsString(str1, str2));
|
||||
@ -172,7 +172,7 @@ RUNTIME_FUNCTION(Runtime_StringAdd) {
|
||||
RUNTIME_FUNCTION(Runtime_InternalizeString) {
|
||||
HandleScope handles(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, string, 0);
|
||||
Handle<String> string = args.at<String>(0);
|
||||
return *isolate->factory()->InternalizeString(string);
|
||||
}
|
||||
|
||||
@ -180,8 +180,8 @@ RUNTIME_FUNCTION(Runtime_StringCharCodeAt) {
|
||||
HandleScope handle_scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, subject, 0);
|
||||
CONVERT_NUMBER_CHECKED(uint32_t, i, Uint32, args[1]);
|
||||
Handle<String> subject = args.at<String>(0);
|
||||
uint32_t i = NumberToUint32(args[1]);
|
||||
|
||||
// Flatten the string. If someone wants to get a char at an index
|
||||
// in a cons string, it is likely that more indices will be
|
||||
@ -198,12 +198,12 @@ RUNTIME_FUNCTION(Runtime_StringCharCodeAt) {
|
||||
RUNTIME_FUNCTION(Runtime_StringBuilderConcat) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0);
|
||||
Handle<JSArray> array = args.at<JSArray>(0);
|
||||
int32_t array_length;
|
||||
if (!args[1].ToInt32(&array_length)) {
|
||||
THROW_NEW_ERROR_RETURN_FAILURE(isolate, NewInvalidStringLengthError());
|
||||
}
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, special, 2);
|
||||
Handle<String> special = args.at<String>(2);
|
||||
|
||||
size_t actual_array_length = 0;
|
||||
CHECK(TryNumberToSize(array->length(), &actual_array_length));
|
||||
@ -304,8 +304,8 @@ static int CopyCachedOneByteCharsToArray(Heap* heap, const uint8_t* chars,
|
||||
RUNTIME_FUNCTION(Runtime_StringToArray) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, s, 0);
|
||||
CONVERT_NUMBER_CHECKED(uint32_t, limit, Uint32, args[1]);
|
||||
Handle<String> s = args.at<String>(0);
|
||||
uint32_t limit = NumberToUint32(args[1]);
|
||||
|
||||
s = String::Flatten(isolate, s);
|
||||
const int length =
|
||||
@ -350,8 +350,8 @@ RUNTIME_FUNCTION(Runtime_StringToArray) {
|
||||
RUNTIME_FUNCTION(Runtime_StringLessThan) {
|
||||
HandleScope handle_scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, x, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, y, 1);
|
||||
Handle<String> x = args.at<String>(0);
|
||||
Handle<String> y = args.at<String>(1);
|
||||
ComparisonResult result = String::Compare(isolate, x, y);
|
||||
DCHECK_NE(result, ComparisonResult::kUndefined);
|
||||
return isolate->heap()->ToBoolean(
|
||||
@ -361,8 +361,8 @@ RUNTIME_FUNCTION(Runtime_StringLessThan) {
|
||||
RUNTIME_FUNCTION(Runtime_StringLessThanOrEqual) {
|
||||
HandleScope handle_scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, x, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, y, 1);
|
||||
Handle<String> x = args.at<String>(0);
|
||||
Handle<String> y = args.at<String>(1);
|
||||
ComparisonResult result = String::Compare(isolate, x, y);
|
||||
DCHECK_NE(result, ComparisonResult::kUndefined);
|
||||
return isolate->heap()->ToBoolean(
|
||||
@ -372,8 +372,8 @@ RUNTIME_FUNCTION(Runtime_StringLessThanOrEqual) {
|
||||
RUNTIME_FUNCTION(Runtime_StringGreaterThan) {
|
||||
HandleScope handle_scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, x, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, y, 1);
|
||||
Handle<String> x = args.at<String>(0);
|
||||
Handle<String> y = args.at<String>(1);
|
||||
ComparisonResult result = String::Compare(isolate, x, y);
|
||||
DCHECK_NE(result, ComparisonResult::kUndefined);
|
||||
return isolate->heap()->ToBoolean(
|
||||
@ -383,8 +383,8 @@ RUNTIME_FUNCTION(Runtime_StringGreaterThan) {
|
||||
RUNTIME_FUNCTION(Runtime_StringGreaterThanOrEqual) {
|
||||
HandleScope handle_scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, x, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, y, 1);
|
||||
Handle<String> x = args.at<String>(0);
|
||||
Handle<String> y = args.at<String>(1);
|
||||
ComparisonResult result = String::Compare(isolate, x, y);
|
||||
DCHECK_NE(result, ComparisonResult::kUndefined);
|
||||
return isolate->heap()->ToBoolean(
|
||||
@ -394,15 +394,15 @@ RUNTIME_FUNCTION(Runtime_StringGreaterThanOrEqual) {
|
||||
RUNTIME_FUNCTION(Runtime_StringEqual) {
|
||||
HandleScope handle_scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, x, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, y, 1);
|
||||
Handle<String> x = args.at<String>(0);
|
||||
Handle<String> y = args.at<String>(1);
|
||||
return isolate->heap()->ToBoolean(String::Equals(isolate, x, y));
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_FlattenString) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, str, 0);
|
||||
Handle<String> str = args.at<String>(0);
|
||||
return *String::Flatten(isolate, str);
|
||||
}
|
||||
|
||||
@ -414,7 +414,7 @@ RUNTIME_FUNCTION(Runtime_StringMaxLength) {
|
||||
RUNTIME_FUNCTION(Runtime_StringEscapeQuotes) {
|
||||
HandleScope handle_scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, string, 0);
|
||||
Handle<String> string = args.at<String>(0);
|
||||
|
||||
// Equivalent to global replacement `string.replace(/"/g, """)`, but this
|
||||
// does not modify any global state (e.g. the regexp match info).
|
||||
|
@ -18,7 +18,7 @@ RUNTIME_FUNCTION(Runtime_CreatePrivateSymbol) {
|
||||
DCHECK_GE(1, args.length());
|
||||
Handle<Symbol> symbol = isolate->factory()->NewPrivateSymbol();
|
||||
if (args.length() == 1) {
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, description, 0);
|
||||
Handle<Object> description = args.at(0);
|
||||
CHECK(description->IsString() || description->IsUndefined(isolate));
|
||||
if (description->IsString())
|
||||
symbol->set_description(String::cast(*description));
|
||||
@ -29,7 +29,7 @@ RUNTIME_FUNCTION(Runtime_CreatePrivateSymbol) {
|
||||
RUNTIME_FUNCTION(Runtime_CreatePrivateBrandSymbol) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
|
||||
Handle<String> name = args.at<String>(0);
|
||||
Handle<Symbol> symbol = isolate->factory()->NewPrivateNameSymbol(name);
|
||||
symbol->set_is_private_brand();
|
||||
return *symbol;
|
||||
@ -38,7 +38,7 @@ RUNTIME_FUNCTION(Runtime_CreatePrivateBrandSymbol) {
|
||||
RUNTIME_FUNCTION(Runtime_CreatePrivateNameSymbol) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
|
||||
Handle<String> name = args.at<String>(0);
|
||||
Handle<Symbol> symbol = isolate->factory()->NewPrivateNameSymbol(name);
|
||||
return *symbol;
|
||||
}
|
||||
@ -46,7 +46,7 @@ RUNTIME_FUNCTION(Runtime_CreatePrivateNameSymbol) {
|
||||
RUNTIME_FUNCTION(Runtime_SymbolDescriptiveString) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Symbol, symbol, 0);
|
||||
Handle<Symbol> symbol = args.at<Symbol>(0);
|
||||
IncrementalStringBuilder builder(isolate);
|
||||
builder.AppendCStringLiteral("Symbol(");
|
||||
if (symbol->description().IsString()) {
|
||||
@ -60,7 +60,7 @@ RUNTIME_FUNCTION(Runtime_SymbolDescriptiveString) {
|
||||
RUNTIME_FUNCTION(Runtime_SymbolIsPrivate) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(Symbol, symbol, 0);
|
||||
auto symbol = Symbol::cast(args[0]);
|
||||
return isolate->heap()->ToBoolean(symbol.is_private());
|
||||
}
|
||||
} // namespace internal
|
||||
|
@ -101,12 +101,12 @@ RUNTIME_FUNCTION(Runtime_SetWasmCompileControls) {
|
||||
HandleScope scope(isolate);
|
||||
v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
|
||||
CHECK_EQ(args.length(), 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Smi, block_size, 0);
|
||||
CONVERT_BOOLEAN_ARG_CHECKED(allow_async, 1);
|
||||
int block_size = args.smi_value_at(0);
|
||||
bool allow_async = Oddball::cast(args[1]).ToBool(isolate);
|
||||
base::MutexGuard guard(g_PerIsolateWasmControlsMutex.Pointer());
|
||||
WasmCompileControls& ctrl = (*GetPerIsolateWasmControls())[v8_isolate];
|
||||
ctrl.AllowAnySizeForAsync = allow_async;
|
||||
ctrl.MaxWasmBufferSize = static_cast<uint32_t>(block_size->value());
|
||||
ctrl.MaxWasmBufferSize = static_cast<uint32_t>(block_size);
|
||||
v8_isolate->SetWasmModuleCallback(WasmModuleOverride);
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
}
|
||||
@ -179,7 +179,7 @@ RUNTIME_FUNCTION(Runtime_WasmTraceEnter) {
|
||||
RUNTIME_FUNCTION(Runtime_WasmTraceExit) {
|
||||
HandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(Smi, value_addr_smi, 0);
|
||||
auto value_addr_smi = Smi::cast(args[0]);
|
||||
|
||||
PrintIndentation(WasmStackSize(isolate));
|
||||
PrintF("}");
|
||||
@ -233,7 +233,7 @@ RUNTIME_FUNCTION(Runtime_WasmTraceExit) {
|
||||
RUNTIME_FUNCTION(Runtime_IsAsmWasmCode) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(JSFunction, function, 0);
|
||||
auto function = JSFunction::cast(args[0]);
|
||||
if (!function.shared().HasAsmWasmData()) {
|
||||
return ReadOnlyRoots(isolate).false_value();
|
||||
}
|
||||
@ -257,7 +257,7 @@ bool DisallowWasmCodegenFromStringsCallback(v8::Local<v8::Context> context,
|
||||
RUNTIME_FUNCTION(Runtime_DisallowWasmCodegen) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_BOOLEAN_ARG_CHECKED(flag, 0);
|
||||
bool flag = Oddball::cast(args[0]).ToBool(isolate);
|
||||
v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
|
||||
v8_isolate->SetAllowWasmCodeGenerationCallback(
|
||||
flag ? DisallowWasmCodegenFromStringsCallback : nullptr);
|
||||
@ -267,7 +267,7 @@ RUNTIME_FUNCTION(Runtime_DisallowWasmCodegen) {
|
||||
RUNTIME_FUNCTION(Runtime_IsWasmCode) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(JSFunction, function, 0);
|
||||
auto function = JSFunction::cast(args[0]);
|
||||
CodeT code = function.code();
|
||||
bool is_js_to_wasm = code.kind() == CodeKind::JS_TO_WASM_FUNCTION ||
|
||||
(code.builtin_id() == Builtin::kGenericJSToWasmWrapper);
|
||||
@ -296,8 +296,8 @@ RUNTIME_FUNCTION(Runtime_GetWasmRecoveredTrapCount) {
|
||||
RUNTIME_FUNCTION(Runtime_GetWasmExceptionTagId) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmExceptionPackage, exception, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 1);
|
||||
Handle<WasmExceptionPackage> exception = args.at<WasmExceptionPackage>(0);
|
||||
Handle<WasmInstanceObject> instance = args.at<WasmInstanceObject>(1);
|
||||
Handle<Object> tag =
|
||||
WasmExceptionPackage::GetExceptionTag(isolate, exception);
|
||||
CHECK(tag->IsWasmExceptionTag());
|
||||
@ -311,7 +311,7 @@ RUNTIME_FUNCTION(Runtime_GetWasmExceptionTagId) {
|
||||
RUNTIME_FUNCTION(Runtime_GetWasmExceptionValues) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmExceptionPackage, exception, 0);
|
||||
Handle<WasmExceptionPackage> exception = args.at<WasmExceptionPackage>(0);
|
||||
Handle<Object> values_obj =
|
||||
WasmExceptionPackage::GetExceptionValues(isolate, exception);
|
||||
CHECK(values_obj->IsFixedArray()); // Only called with correct input.
|
||||
@ -322,7 +322,7 @@ RUNTIME_FUNCTION(Runtime_GetWasmExceptionValues) {
|
||||
RUNTIME_FUNCTION(Runtime_SerializeWasmModule) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmModuleObject, module_obj, 0);
|
||||
Handle<WasmModuleObject> module_obj = args.at<WasmModuleObject>(0);
|
||||
|
||||
wasm::NativeModule* native_module = module_obj->native_module();
|
||||
DCHECK(!native_module->compilation_state()->failed());
|
||||
@ -346,8 +346,8 @@ RUNTIME_FUNCTION(Runtime_SerializeWasmModule) {
|
||||
RUNTIME_FUNCTION(Runtime_DeserializeWasmModule) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, buffer, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, wire_bytes, 1);
|
||||
Handle<JSArrayBuffer> buffer = args.at<JSArrayBuffer>(0);
|
||||
Handle<JSTypedArray> wire_bytes = args.at<JSTypedArray>(1);
|
||||
CHECK(!buffer->was_detached());
|
||||
CHECK(!wire_bytes->WasDetached());
|
||||
|
||||
@ -374,7 +374,7 @@ RUNTIME_FUNCTION(Runtime_DeserializeWasmModule) {
|
||||
RUNTIME_FUNCTION(Runtime_WasmGetNumberOfInstances) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmModuleObject, module_obj, 0);
|
||||
Handle<WasmModuleObject> module_obj = args.at<WasmModuleObject>(0);
|
||||
int instance_count = 0;
|
||||
WeakArrayList weak_instance_list =
|
||||
module_obj->script().wasm_weak_instance_list();
|
||||
@ -387,7 +387,7 @@ RUNTIME_FUNCTION(Runtime_WasmGetNumberOfInstances) {
|
||||
RUNTIME_FUNCTION(Runtime_WasmNumCodeSpaces) {
|
||||
DCHECK_EQ(1, args.length());
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, argument, 0);
|
||||
Handle<JSObject> argument = args.at<JSObject>(0);
|
||||
Handle<WasmModuleObject> module;
|
||||
if (argument->IsWasmInstanceObject()) {
|
||||
module = handle(Handle<WasmInstanceObject>::cast(argument)->module_object(),
|
||||
@ -403,7 +403,7 @@ RUNTIME_FUNCTION(Runtime_WasmNumCodeSpaces) {
|
||||
RUNTIME_FUNCTION(Runtime_WasmTraceMemory) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(Smi, info_addr, 0);
|
||||
auto info_addr = Smi::cast(args[0]);
|
||||
|
||||
wasm::MemoryTracingInfo* info =
|
||||
reinterpret_cast<wasm::MemoryTracingInfo*>(info_addr.ptr());
|
||||
@ -429,8 +429,8 @@ RUNTIME_FUNCTION(Runtime_WasmTraceMemory) {
|
||||
RUNTIME_FUNCTION(Runtime_WasmTierUpFunction) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
|
||||
CONVERT_SMI_ARG_CHECKED(function_index, 1);
|
||||
Handle<WasmInstanceObject> instance = args.at<WasmInstanceObject>(0);
|
||||
int function_index = args.smi_value_at(1);
|
||||
auto* native_module = instance->module_object().native_module();
|
||||
wasm::GetWasmEngine()->CompileFunction(isolate, native_module, function_index,
|
||||
wasm::ExecutionTier::kTurbofan);
|
||||
@ -455,7 +455,7 @@ RUNTIME_FUNCTION(Runtime_WasmTierUp) {
|
||||
RUNTIME_FUNCTION(Runtime_IsLiftoffFunction) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
CHECK(WasmExportedFunction::IsWasmExportedFunction(*function));
|
||||
Handle<WasmExportedFunction> exp_fun =
|
||||
Handle<WasmExportedFunction>::cast(function);
|
||||
@ -470,7 +470,7 @@ RUNTIME_FUNCTION(Runtime_IsLiftoffFunction) {
|
||||
RUNTIME_FUNCTION(Runtime_IsTurboFanFunction) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
CHECK(WasmExportedFunction::IsWasmExportedFunction(*function));
|
||||
Handle<WasmExportedFunction> exp_fun =
|
||||
Handle<WasmExportedFunction>::cast(function);
|
||||
@ -485,7 +485,7 @@ RUNTIME_FUNCTION(Runtime_IsTurboFanFunction) {
|
||||
RUNTIME_FUNCTION(Runtime_FreezeWasmLazyCompilation) {
|
||||
DCHECK_EQ(1, args.length());
|
||||
DisallowGarbageCollection no_gc;
|
||||
CONVERT_ARG_CHECKED(WasmInstanceObject, instance, 0);
|
||||
auto instance = WasmInstanceObject::cast(args[0]);
|
||||
|
||||
instance.module_object().native_module()->set_lazy_compile_frozen(true);
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
|
@ -107,8 +107,8 @@ RUNTIME_FUNCTION(Runtime_ClearMegamorphicStubCache) {
|
||||
RUNTIME_FUNCTION(Runtime_ConstructDouble) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_NUMBER_CHECKED(uint32_t, hi, Uint32, args[0]);
|
||||
CONVERT_NUMBER_CHECKED(uint32_t, lo, Uint32, args[1]);
|
||||
uint32_t hi = NumberToUint32(args[0]);
|
||||
uint32_t lo = NumberToUint32(args[1]);
|
||||
uint64_t result = (static_cast<uint64_t>(hi) << 32) | lo;
|
||||
return *isolate->factory()->NewNumber(base::uint64_to_double(result));
|
||||
}
|
||||
@ -116,8 +116,8 @@ RUNTIME_FUNCTION(Runtime_ConstructDouble) {
|
||||
RUNTIME_FUNCTION(Runtime_ConstructConsString) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, left, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, right, 1);
|
||||
Handle<String> left = args.at<String>(0);
|
||||
Handle<String> right = args.at<String>(1);
|
||||
|
||||
CHECK(left->IsOneByteRepresentation());
|
||||
CHECK(right->IsOneByteRepresentation());
|
||||
@ -130,14 +130,14 @@ RUNTIME_FUNCTION(Runtime_ConstructConsString) {
|
||||
RUNTIME_FUNCTION(Runtime_ConstructSlicedString) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, string, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Smi, index, 1);
|
||||
Handle<String> string = args.at<String>(0);
|
||||
int index = args.smi_value_at(1);
|
||||
|
||||
CHECK(string->IsOneByteRepresentation());
|
||||
CHECK_LT(index->value(), string->length());
|
||||
CHECK_LT(index, string->length());
|
||||
|
||||
Handle<String> sliced_string = isolate->factory()->NewSubString(
|
||||
string, index->value(), string->length());
|
||||
Handle<String> sliced_string =
|
||||
isolate->factory()->NewSubString(string, index, string->length());
|
||||
CHECK(sliced_string->IsSlicedString());
|
||||
return *sliced_string;
|
||||
}
|
||||
@ -146,7 +146,7 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0);
|
||||
Handle<Object> function_object = args.at(0);
|
||||
if (!function_object->IsJSFunction()) return CrashUnlessFuzzing(isolate);
|
||||
Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
|
||||
|
||||
@ -188,7 +188,7 @@ RUNTIME_FUNCTION(Runtime_RunningInSimulator) {
|
||||
RUNTIME_FUNCTION(Runtime_RuntimeEvaluateREPL) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, source, 0);
|
||||
Handle<String> source = args.at<String>(0);
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
|
||||
isolate, result,
|
||||
@ -293,7 +293,7 @@ Object OptimizeFunctionOnNextCall(RuntimeArguments& args, Isolate* isolate) {
|
||||
return CrashUnlessFuzzing(isolate);
|
||||
}
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0);
|
||||
Handle<Object> function_object = args.at(0);
|
||||
if (!function_object->IsJSFunction()) return CrashUnlessFuzzing(isolate);
|
||||
Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
|
||||
|
||||
@ -307,7 +307,7 @@ Object OptimizeFunctionOnNextCall(RuntimeArguments& args, Isolate* isolate) {
|
||||
|
||||
ConcurrencyMode concurrency_mode = ConcurrencyMode::kNotConcurrent;
|
||||
if (args.length() == 2) {
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, type, 1);
|
||||
Handle<Object> type = args.at(1);
|
||||
if (!type->IsString()) return CrashUnlessFuzzing(isolate);
|
||||
if (Handle<String>::cast(type)->IsOneByteEqualTo(
|
||||
base::StaticCharVector("concurrent")) &&
|
||||
@ -368,7 +368,7 @@ RUNTIME_FUNCTION(Runtime_CompileBaseline) {
|
||||
if (args.length() != 1) {
|
||||
return CrashUnlessFuzzing(isolate);
|
||||
}
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0);
|
||||
Handle<Object> function_object = args.at(0);
|
||||
if (!function_object->IsJSFunction()) return CrashUnlessFuzzing(isolate);
|
||||
Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
|
||||
|
||||
@ -401,8 +401,8 @@ RUNTIME_FUNCTION(Runtime_CompileBaseline) {
|
||||
RUNTIME_FUNCTION(Runtime_BenchMaglev) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(args.length(), 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
CONVERT_SMI_ARG_CHECKED(count, 1);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
int count = args.smi_value_at(1);
|
||||
|
||||
Handle<CodeT> codet;
|
||||
base::ElapsedTimer timer;
|
||||
@ -429,7 +429,7 @@ RUNTIME_FUNCTION(Runtime_BenchMaglev) {
|
||||
RUNTIME_FUNCTION(Runtime_ActiveTierIsMaglev) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(args.length(), 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
return isolate->heap()->ToBoolean(function->ActiveTierIsMaglev());
|
||||
}
|
||||
|
||||
@ -437,7 +437,7 @@ RUNTIME_FUNCTION(Runtime_ActiveTierIsMaglev) {
|
||||
RUNTIME_FUNCTION(Runtime_OptimizeMaglevOnNextCall) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(args.length(), 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
|
||||
static constexpr CodeKind kCodeKind = CodeKind::MAGLEV;
|
||||
|
||||
@ -474,7 +474,7 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
|
||||
RUNTIME_FUNCTION(Runtime_EnsureFeedbackVectorForFunction) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
EnsureFeedbackVector(isolate, function);
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
}
|
||||
@ -484,11 +484,11 @@ RUNTIME_FUNCTION(Runtime_PrepareFunctionForOptimization) {
|
||||
if ((args.length() != 1 && args.length() != 2) || !args[0].IsJSFunction()) {
|
||||
return CrashUnlessFuzzing(isolate);
|
||||
}
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
|
||||
bool allow_heuristic_optimization = false;
|
||||
if (args.length() == 2) {
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, sync_object, 1);
|
||||
Handle<Object> sync_object = args.at(1);
|
||||
if (!sync_object->IsString()) return CrashUnlessFuzzing(isolate);
|
||||
Handle<String> sync = Handle<String>::cast(sync_object);
|
||||
if (sync->IsOneByteEqualTo(
|
||||
@ -531,7 +531,7 @@ RUNTIME_FUNCTION(Runtime_OptimizeOsr) {
|
||||
int stack_depth = 0;
|
||||
if (args.length() == 1) {
|
||||
if (!args[0].IsSmi()) return CrashUnlessFuzzing(isolate);
|
||||
stack_depth = args.smi_at(0);
|
||||
stack_depth = args.smi_value_at(0);
|
||||
}
|
||||
|
||||
// Find the JavaScript function on the top of the stack.
|
||||
@ -617,7 +617,7 @@ RUNTIME_FUNCTION(Runtime_BaselineOsr) {
|
||||
RUNTIME_FUNCTION(Runtime_NeverOptimizeFunction) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0);
|
||||
Handle<Object> function_object = args.at(0);
|
||||
if (!function_object->IsJSFunction()) return CrashUnlessFuzzing(isolate);
|
||||
Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
|
||||
Handle<SharedFunctionInfo> sfi(function->shared(), isolate);
|
||||
@ -656,7 +656,7 @@ RUNTIME_FUNCTION(Runtime_GetOptimizationStatus) {
|
||||
status |= static_cast<int>(OptimizationStatus::kMaybeDeopted);
|
||||
}
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0);
|
||||
Handle<Object> function_object = args.at(0);
|
||||
if (function_object->IsUndefined()) return Smi::FromInt(status);
|
||||
if (!function_object->IsJSFunction()) return CrashUnlessFuzzing(isolate);
|
||||
Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
|
||||
@ -790,7 +790,7 @@ RUNTIME_FUNCTION(Runtime_GetCallable) {
|
||||
RUNTIME_FUNCTION(Runtime_ClearFunctionFeedback) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
function->ClearTypeFeedbackInfo();
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
}
|
||||
@ -911,7 +911,7 @@ RUNTIME_FUNCTION(Runtime_TakeHeapSnapshot) {
|
||||
|
||||
if (args.length() >= 1) {
|
||||
HandleScope hs(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, filename_as_js_string, 0);
|
||||
Handle<String> filename_as_js_string = args.at<String>(0);
|
||||
std::unique_ptr<char[]> buffer = filename_as_js_string->ToCString();
|
||||
filename = std::string(buffer.get());
|
||||
}
|
||||
@ -984,7 +984,7 @@ RUNTIME_FUNCTION(Runtime_PrintWithNameForAssert) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
|
||||
CONVERT_ARG_CHECKED(String, name, 0);
|
||||
auto name = String::cast(args[0]);
|
||||
|
||||
PrintF(" * ");
|
||||
StringCharacterStream stream(name);
|
||||
@ -1011,10 +1011,10 @@ RUNTIME_FUNCTION(Runtime_DebugTrackRetainingPath) {
|
||||
DCHECK_LE(1, args.length());
|
||||
DCHECK_GE(2, args.length());
|
||||
CHECK(FLAG_track_retaining_path);
|
||||
CONVERT_ARG_HANDLE_CHECKED(HeapObject, object, 0);
|
||||
Handle<HeapObject> object = args.at<HeapObject>(0);
|
||||
RetainingPathOption option = RetainingPathOption::kDefault;
|
||||
if (args.length() == 2) {
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, str, 1);
|
||||
Handle<String> str = args.at<String>(1);
|
||||
const char track_ephemeron_path[] = "track-ephemeron-path";
|
||||
if (str->IsOneByteEqualTo(base::StaticCharVector(track_ephemeron_path))) {
|
||||
option = RetainingPathOption::kTrackEphemeronPath;
|
||||
@ -1032,7 +1032,7 @@ RUNTIME_FUNCTION(Runtime_GlobalPrint) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
|
||||
CONVERT_ARG_CHECKED(String, string, 0);
|
||||
auto string = String::cast(args[0]);
|
||||
StringCharacterStream stream(string);
|
||||
while (stream.HasMore()) {
|
||||
uint16_t character = stream.GetNext();
|
||||
@ -1053,7 +1053,7 @@ RUNTIME_FUNCTION(Runtime_SystemBreak) {
|
||||
RUNTIME_FUNCTION(Runtime_SetForceSlowPath) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(Object, arg, 0);
|
||||
Object arg = args[0];
|
||||
if (arg.IsTrue(isolate)) {
|
||||
isolate->set_force_slow_path(true);
|
||||
} else {
|
||||
@ -1066,7 +1066,7 @@ RUNTIME_FUNCTION(Runtime_SetForceSlowPath) {
|
||||
RUNTIME_FUNCTION(Runtime_Abort) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_SMI_ARG_CHECKED(message_id, 0);
|
||||
int message_id = args.smi_value_at(0);
|
||||
const char* message = GetAbortReason(static_cast<AbortReason>(message_id));
|
||||
base::OS::PrintError("abort: %s\n", message);
|
||||
isolate->PrintStack(stderr);
|
||||
@ -1077,7 +1077,7 @@ RUNTIME_FUNCTION(Runtime_Abort) {
|
||||
RUNTIME_FUNCTION(Runtime_AbortJS) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, message, 0);
|
||||
Handle<String> message = args.at<String>(0);
|
||||
if (FLAG_disable_abortjs) {
|
||||
base::OS::PrintError("[disabled] abort: %s\n", message->ToCString().get());
|
||||
return Object();
|
||||
@ -1091,7 +1091,7 @@ RUNTIME_FUNCTION(Runtime_AbortJS) {
|
||||
RUNTIME_FUNCTION(Runtime_AbortCSADcheck) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, message, 0);
|
||||
Handle<String> message = args.at<String>(0);
|
||||
base::OS::PrintError("abort: CSA_DCHECK failed: %s\n",
|
||||
message->ToCString().get());
|
||||
isolate->PrintStack(stderr);
|
||||
@ -1104,7 +1104,7 @@ RUNTIME_FUNCTION(Runtime_DisassembleFunction) {
|
||||
#ifdef DEBUG
|
||||
DCHECK_EQ(1, args.length());
|
||||
// Get the function and make sure it is compiled.
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0);
|
||||
Handle<JSFunction> func = args.at<JSFunction>(0);
|
||||
IsCompiledScope is_compiled_scope;
|
||||
CHECK(func->is_compiled() ||
|
||||
Compiler::Compile(isolate, func, Compiler::KEEP_EXCEPTION,
|
||||
@ -1147,7 +1147,7 @@ RUNTIME_FUNCTION(Runtime_TraceEnter) {
|
||||
RUNTIME_FUNCTION(Runtime_TraceExit) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(Object, obj, 0);
|
||||
Object obj = args[0];
|
||||
PrintIndentation(StackSize(isolate));
|
||||
PrintF("} -> ");
|
||||
obj.ShortPrint();
|
||||
@ -1158,15 +1158,15 @@ RUNTIME_FUNCTION(Runtime_TraceExit) {
|
||||
RUNTIME_FUNCTION(Runtime_HaveSameMap) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_CHECKED(JSObject, obj1, 0);
|
||||
CONVERT_ARG_CHECKED(JSObject, obj2, 1);
|
||||
auto obj1 = JSObject::cast(args[0]);
|
||||
auto obj2 = JSObject::cast(args[1]);
|
||||
return isolate->heap()->ToBoolean(obj1.map() == obj2.map());
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_InLargeObjectSpace) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(HeapObject, obj, 0);
|
||||
auto obj = HeapObject::cast(args[0]);
|
||||
return isolate->heap()->ToBoolean(
|
||||
isolate->heap()->new_lo_space()->Contains(obj) ||
|
||||
isolate->heap()->code_lo_space()->Contains(obj) ||
|
||||
@ -1176,7 +1176,7 @@ RUNTIME_FUNCTION(Runtime_InLargeObjectSpace) {
|
||||
RUNTIME_FUNCTION(Runtime_HasElementsInALargeObjectSpace) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(JSArray, array, 0);
|
||||
auto array = JSArray::cast(args[0]);
|
||||
FixedArrayBase elements = array.elements();
|
||||
return isolate->heap()->ToBoolean(
|
||||
isolate->heap()->new_lo_space()->Contains(elements) ||
|
||||
@ -1186,7 +1186,7 @@ RUNTIME_FUNCTION(Runtime_HasElementsInALargeObjectSpace) {
|
||||
RUNTIME_FUNCTION(Runtime_InYoungGeneration) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(Object, obj, 0);
|
||||
Object obj = args[0];
|
||||
return isolate->heap()->ToBoolean(ObjectInYoungGeneration(obj));
|
||||
}
|
||||
|
||||
@ -1195,7 +1195,7 @@ RUNTIME_FUNCTION(Runtime_PretenureAllocationSite) {
|
||||
DisallowGarbageCollection no_gc;
|
||||
|
||||
if (args.length() != 1) return CrashUnlessFuzzing(isolate);
|
||||
CONVERT_ARG_CHECKED(Object, arg, 0);
|
||||
Object arg = args[0];
|
||||
if (!arg.IsJSObject()) return CrashUnlessFuzzing(isolate);
|
||||
JSObject object = JSObject::cast(arg);
|
||||
|
||||
@ -1227,7 +1227,7 @@ v8::ModifyCodeGenerationFromStringsResult DisallowCodegenFromStringsCallback(
|
||||
RUNTIME_FUNCTION(Runtime_DisallowCodegenFromStrings) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_BOOLEAN_ARG_CHECKED(flag, 0);
|
||||
bool flag = Oddball::cast(args[0]).ToBool(isolate);
|
||||
v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
|
||||
v8_isolate->SetModifyCodeGenerationFromStringsCallback(
|
||||
flag ? DisallowCodegenFromStringsCallback : nullptr);
|
||||
@ -1237,8 +1237,8 @@ RUNTIME_FUNCTION(Runtime_DisallowCodegenFromStrings) {
|
||||
RUNTIME_FUNCTION(Runtime_RegexpHasBytecode) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_CHECKED(JSRegExp, regexp, 0);
|
||||
CONVERT_BOOLEAN_ARG_CHECKED(is_latin1, 1);
|
||||
auto regexp = JSRegExp::cast(args[0]);
|
||||
bool is_latin1 = Oddball::cast(args[1]).ToBool(isolate);
|
||||
bool result;
|
||||
if (regexp.type_tag() == JSRegExp::IRREGEXP) {
|
||||
result = regexp.bytecode(is_latin1).IsByteArray();
|
||||
@ -1251,8 +1251,8 @@ RUNTIME_FUNCTION(Runtime_RegexpHasBytecode) {
|
||||
RUNTIME_FUNCTION(Runtime_RegexpHasNativeCode) {
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_CHECKED(JSRegExp, regexp, 0);
|
||||
CONVERT_BOOLEAN_ARG_CHECKED(is_latin1, 1);
|
||||
auto regexp = JSRegExp::cast(args[0]);
|
||||
bool is_latin1 = Oddball::cast(args[1]).ToBool(isolate);
|
||||
bool result;
|
||||
if (regexp.type_tag() == JSRegExp::IRREGEXP) {
|
||||
result = regexp.code(is_latin1).IsCodeT();
|
||||
@ -1265,7 +1265,7 @@ RUNTIME_FUNCTION(Runtime_RegexpHasNativeCode) {
|
||||
RUNTIME_FUNCTION(Runtime_RegexpTypeTag) {
|
||||
HandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_CHECKED(JSRegExp, regexp, 0);
|
||||
auto regexp = JSRegExp::cast(args[0]);
|
||||
const char* type_str;
|
||||
switch (regexp.type_tag()) {
|
||||
case JSRegExp::NOT_COMPILED:
|
||||
@ -1287,14 +1287,14 @@ RUNTIME_FUNCTION(Runtime_RegexpTypeTag) {
|
||||
RUNTIME_FUNCTION(Runtime_RegexpIsUnmodified) {
|
||||
HandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0);
|
||||
Handle<JSRegExp> regexp = args.at<JSRegExp>(0);
|
||||
return isolate->heap()->ToBoolean(
|
||||
RegExp::IsUnmodifiedRegExp(isolate, regexp));
|
||||
}
|
||||
|
||||
#define ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(Name) \
|
||||
RUNTIME_FUNCTION(Runtime_##Name) { \
|
||||
CONVERT_ARG_CHECKED(JSObject, obj, 0); \
|
||||
auto obj = JSObject::cast(args[0]); \
|
||||
return isolate->heap()->ToBoolean(obj.Name()); \
|
||||
}
|
||||
|
||||
@ -1314,7 +1314,7 @@ ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(HasFastProperties)
|
||||
|
||||
#define FIXED_TYPED_ARRAYS_CHECK_RUNTIME_FUNCTION(Type, type, TYPE, ctype) \
|
||||
RUNTIME_FUNCTION(Runtime_HasFixed##Type##Elements) { \
|
||||
CONVERT_ARG_CHECKED(JSObject, obj, 0); \
|
||||
auto obj = JSObject::cast(args[0]); \
|
||||
return isolate->heap()->ToBoolean(obj.HasFixed##Type##Elements()); \
|
||||
}
|
||||
|
||||
@ -1403,7 +1403,7 @@ RUNTIME_FUNCTION(Runtime_SerializeDeserializeNow) {
|
||||
RUNTIME_FUNCTION(Runtime_HeapObjectVerify) {
|
||||
HandleScope shs(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
||||
Handle<Object> object = args.at(0);
|
||||
#ifdef VERIFY_HEAP
|
||||
object->ObjectVerify(isolate);
|
||||
#else
|
||||
@ -1433,7 +1433,7 @@ RUNTIME_FUNCTION(Runtime_CompleteInobjectSlackTracking) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
|
||||
Handle<JSObject> object = args.at<JSObject>(0);
|
||||
MapUpdater::CompleteInobjectSlackTracking(isolate, object->map());
|
||||
|
||||
return ReadOnlyRoots(isolate).undefined_value();
|
||||
@ -1506,9 +1506,10 @@ RUNTIME_FUNCTION(Runtime_NewRegExpWithBacktrackLimit) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, pattern, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, flags_string, 1);
|
||||
CONVERT_UINT32_ARG_CHECKED(backtrack_limit, 2);
|
||||
Handle<String> pattern = args.at<String>(0);
|
||||
Handle<String> flags_string = args.at<String>(1);
|
||||
uint32_t backtrack_limit = 0;
|
||||
CHECK(args[2].ToUint32(&backtrack_limit));
|
||||
|
||||
JSRegExp::Flags flags =
|
||||
JSRegExp::FlagsFromString(isolate, flags_string).value();
|
||||
@ -1532,15 +1533,15 @@ RUNTIME_FUNCTION(Runtime_BigIntMaxLengthBits) {
|
||||
RUNTIME_FUNCTION(Runtime_IsSameHeapObject) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(HeapObject, obj1, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(HeapObject, obj2, 1);
|
||||
Handle<HeapObject> obj1 = args.at<HeapObject>(0);
|
||||
Handle<HeapObject> obj2 = args.at<HeapObject>(1);
|
||||
return isolate->heap()->ToBoolean(obj1->address() == obj2->address());
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_IsSharedString) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(HeapObject, obj, 0);
|
||||
Handle<HeapObject> obj = args.at<HeapObject>(0);
|
||||
return isolate->heap()->ToBoolean(obj->IsString() &&
|
||||
Handle<String>::cast(obj)->IsShared());
|
||||
}
|
||||
@ -1554,7 +1555,7 @@ RUNTIME_FUNCTION(Runtime_WebSnapshotSerialize) {
|
||||
THROW_NEW_ERROR_RETURN_FAILURE(
|
||||
isolate, NewTypeError(MessageTemplate::kRuntimeWrongNumArgs));
|
||||
}
|
||||
Handle<Object> object = args.at<Object>(0);
|
||||
Handle<Object> object = args.at(0);
|
||||
Handle<FixedArray> block_list = isolate->factory()->empty_fixed_array();
|
||||
Handle<JSArray> block_list_js_array;
|
||||
if (args.length() == 2) {
|
||||
|
@ -122,9 +122,9 @@ RUNTIME_FUNCTION(Runtime_TraceUnoptimizedBytecodeEntry) {
|
||||
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(BytecodeArray, bytecode_array, 0);
|
||||
CONVERT_SMI_ARG_CHECKED(bytecode_offset, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, accumulator, 2);
|
||||
Handle<BytecodeArray> bytecode_array = args.at<BytecodeArray>(0);
|
||||
int bytecode_offset = args.smi_value_at(1);
|
||||
Handle<Object> accumulator = args.at(2);
|
||||
|
||||
int offset = bytecode_offset - BytecodeArray::kHeaderSize + kHeapObjectTag;
|
||||
interpreter::BytecodeArrayIterator bytecode_iterator(bytecode_array);
|
||||
@ -172,9 +172,9 @@ RUNTIME_FUNCTION(Runtime_TraceUnoptimizedBytecodeExit) {
|
||||
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(BytecodeArray, bytecode_array, 0);
|
||||
CONVERT_SMI_ARG_CHECKED(bytecode_offset, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, accumulator, 2);
|
||||
Handle<BytecodeArray> bytecode_array = args.at<BytecodeArray>(0);
|
||||
int bytecode_offset = args.smi_value_at(1);
|
||||
Handle<Object> accumulator = args.at(2);
|
||||
|
||||
int offset = bytecode_offset - BytecodeArray::kHeaderSize + kHeapObjectTag;
|
||||
interpreter::BytecodeArrayIterator bytecode_iterator(bytecode_array);
|
||||
@ -205,9 +205,9 @@ RUNTIME_FUNCTION(Runtime_TraceUpdateFeedback) {
|
||||
|
||||
SealHandleScope shs(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
||||
CONVERT_SMI_ARG_CHECKED(slot, 1);
|
||||
CONVERT_ARG_CHECKED(String, reason, 2);
|
||||
Handle<JSFunction> function = args.at<JSFunction>(0);
|
||||
int slot = args.smi_value_at(1);
|
||||
auto reason = String::cast(args[2]);
|
||||
|
||||
int slot_count = function->feedback_vector().metadata().slot_count();
|
||||
|
||||
|
@ -35,13 +35,10 @@ RUNTIME_FUNCTION(Runtime_ArrayBufferDetach) {
|
||||
RUNTIME_FUNCTION(Runtime_TypedArrayCopyElements) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, target, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, source, 1);
|
||||
CONVERT_NUMBER_ARG_HANDLE_CHECKED(length_obj, 2);
|
||||
|
||||
Handle<JSTypedArray> target = args.at<JSTypedArray>(0);
|
||||
Handle<Object> source = args.at(1);
|
||||
size_t length;
|
||||
CHECK(TryNumberToSize(*length_obj, &length));
|
||||
|
||||
CHECK(TryNumberToSize(args[2], &length));
|
||||
ElementsAccessor* accessor = target->GetElementsAccessor();
|
||||
return accessor->CopyElements(source, target, length, 0);
|
||||
}
|
||||
@ -49,14 +46,14 @@ RUNTIME_FUNCTION(Runtime_TypedArrayCopyElements) {
|
||||
RUNTIME_FUNCTION(Runtime_TypedArrayGetBuffer) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, holder, 0);
|
||||
Handle<JSTypedArray> holder = args.at<JSTypedArray>(0);
|
||||
return *holder->GetBuffer();
|
||||
}
|
||||
|
||||
RUNTIME_FUNCTION(Runtime_GrowableSharedArrayBufferByteLength) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, array_buffer, 0);
|
||||
Handle<JSArrayBuffer> array_buffer = args.at<JSArrayBuffer>(0);
|
||||
|
||||
CHECK_EQ(0, array_buffer->byte_length());
|
||||
size_t byte_length = array_buffer->GetBackingStore()->byte_length();
|
||||
@ -91,7 +88,7 @@ RUNTIME_FUNCTION(Runtime_TypedArraySortFast) {
|
||||
DCHECK_EQ(1, args.length());
|
||||
|
||||
// Validation is handled in the Torque builtin.
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, array, 0);
|
||||
Handle<JSTypedArray> array = args.at<JSTypedArray>(0);
|
||||
DCHECK(!array->WasDetached());
|
||||
|
||||
#if MULTI_MAPPED_ALLOCATOR_AVAILABLE
|
||||
@ -176,17 +173,12 @@ RUNTIME_FUNCTION(Runtime_TypedArraySortFast) {
|
||||
RUNTIME_FUNCTION(Runtime_TypedArraySet) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, target, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, source, 1);
|
||||
CONVERT_NUMBER_ARG_HANDLE_CHECKED(length_obj, 2);
|
||||
CONVERT_NUMBER_ARG_HANDLE_CHECKED(offset_obj, 3);
|
||||
|
||||
Handle<JSTypedArray> target = args.at<JSTypedArray>(0);
|
||||
Handle<Object> source = args.at(1);
|
||||
size_t length;
|
||||
CHECK(TryNumberToSize(*length_obj, &length));
|
||||
|
||||
CHECK(TryNumberToSize(args[2], &length));
|
||||
size_t offset;
|
||||
CHECK(TryNumberToSize(*offset_obj, &offset));
|
||||
|
||||
CHECK(TryNumberToSize(args[3], &offset));
|
||||
ElementsAccessor* accessor = target->GetElementsAccessor();
|
||||
return accessor->CopyElements(source, target, length, offset);
|
||||
}
|
||||
|
@ -13,103 +13,6 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
// Cast the given object to a value of the specified type and store
|
||||
// it in a variable with the given name. If the object is not of the
|
||||
// expected type we crash safely.
|
||||
#define CONVERT_ARG_CHECKED(Type, name, index) \
|
||||
CHECK(args[index].Is##Type()); \
|
||||
Type name = Type::cast(args[index]);
|
||||
|
||||
#define CONVERT_ARG_HANDLE_CHECKED(Type, name, index) \
|
||||
CHECK(args[index].Is##Type()); \
|
||||
Handle<Type> name = args.at<Type>(index);
|
||||
|
||||
#define CONVERT_NUMBER_ARG_HANDLE_CHECKED(name, index) \
|
||||
CHECK(args[index].IsNumber()); \
|
||||
Handle<Object> name = args.at(index);
|
||||
|
||||
// Cast the given object to a boolean and store it in a variable with
|
||||
// the given name. If the object is not a boolean we crash safely.
|
||||
#define CONVERT_BOOLEAN_ARG_CHECKED(name, index) \
|
||||
CHECK(args[index].IsBoolean()); \
|
||||
bool name = args[index].IsTrue(isolate);
|
||||
|
||||
// Cast the given argument to a Smi and store its value in an int variable
|
||||
// with the given name. If the argument is not a Smi we crash safely.
|
||||
#define CONVERT_SMI_ARG_CHECKED(name, index) \
|
||||
CHECK(args[index].IsSmi()); \
|
||||
int name = args.smi_at(index); \
|
||||
/* Ensure we have a Smi and not a TaggedIndex */ \
|
||||
DCHECK_IMPLIES(args[index].IsTaggedIndex(), \
|
||||
name == TaggedIndex(args[index].ptr()).value());
|
||||
|
||||
// Cast the given argument to a TaggedIndex and store its value in an int
|
||||
// variable with the given name. If the argument is not a TaggedIndex we crash
|
||||
// safely.
|
||||
#define CONVERT_TAGGED_INDEX_ARG_CHECKED(name, index) \
|
||||
CHECK(args[index].IsTaggedIndex()); \
|
||||
int name = args.tagged_index_at(index);
|
||||
|
||||
// Cast the given argument to a double and store it in a variable with
|
||||
// the given name. If the argument is not a number (as opposed to
|
||||
// the number not-a-number) we crash safely.
|
||||
#define CONVERT_DOUBLE_ARG_CHECKED(name, index) \
|
||||
CHECK(args[index].IsNumber()); \
|
||||
double name = args.number_at(index);
|
||||
|
||||
// Cast the given argument to a size_t and store its value in a variable with
|
||||
// the given name. If the argument is not a size_t we crash safely.
|
||||
#define CONVERT_SIZE_ARG_CHECKED(name, index) \
|
||||
CHECK(args[index].IsNumber()); \
|
||||
Handle<Object> name##_object = args.at(index); \
|
||||
size_t name = 0; \
|
||||
CHECK(TryNumberToSize(*name##_object, &name));
|
||||
|
||||
// Call the specified converter on the object *comand store the result in
|
||||
// a variable of the specified type with the given name. If the
|
||||
// object is not a Number we crash safely.
|
||||
#define CONVERT_NUMBER_CHECKED(type, name, Type, obj) \
|
||||
CHECK(obj.IsNumber()); \
|
||||
type name = NumberTo##Type(obj);
|
||||
|
||||
// Cast the given argument to PropertyDetails and store its value in a
|
||||
// variable with the given name. If the argument is not a Smi we crash safely.
|
||||
#define CONVERT_PROPERTY_DETAILS_CHECKED(name, index) \
|
||||
CHECK(args[index]->IsSmi()); \
|
||||
PropertyDetails name = PropertyDetails(Smi::cast(args[index]));
|
||||
|
||||
// Assert that the given argument has a valid value for a LanguageMode
|
||||
// and store it in a LanguageMode variable with the given name.
|
||||
#define CONVERT_LANGUAGE_MODE_ARG_CHECKED(name, index) \
|
||||
CHECK(args[index]->IsNumber()); \
|
||||
int32_t __tmp_##name = 0; \
|
||||
CHECK(args[index]->ToInt32(&__tmp_##name)); \
|
||||
CHECK(is_valid_language_mode(__tmp_##name)); \
|
||||
LanguageMode name = static_cast<LanguageMode>(__tmp_##name);
|
||||
|
||||
// Assert that the given argument is a number within the Int32 range
|
||||
// and convert it to int32_t. If the argument is not an Int32 we crash safely.
|
||||
#define CONVERT_INT32_ARG_CHECKED(name, index) \
|
||||
CHECK(args[index].IsNumber()); \
|
||||
int32_t name = 0; \
|
||||
CHECK(args[index].ToInt32(&name));
|
||||
|
||||
// Assert that the given argument is a number within the Uint32 range
|
||||
// and convert it to uint32_t. If the argument is not an Uint32 call
|
||||
// IllegalOperation and return.
|
||||
#define CONVERT_UINT32_ARG_CHECKED(name, index) \
|
||||
CHECK(args[index].IsNumber()); \
|
||||
uint32_t name = 0; \
|
||||
CHECK(args[index].ToUint32(&name));
|
||||
|
||||
// Cast the given argument to PropertyAttributes and store its value in a
|
||||
// variable with the given name. If the argument is not a Smi or the
|
||||
// enum value is out of range, we crash safely.
|
||||
#define CONVERT_PROPERTY_ATTRIBUTES_CHECKED(name, index) \
|
||||
CHECK(args[index].IsSmi()); \
|
||||
CHECK_EQ(args.smi_at(index) & ~(READ_ONLY | DONT_ENUM | DONT_DELETE), 0); \
|
||||
PropertyAttributes name = static_cast<PropertyAttributes>(args.smi_at(index));
|
||||
|
||||
// A mechanism to return a pair of Object pointers in registers (if possible).
|
||||
// How this is achieved is calling convention-dependent.
|
||||
// All currently supported x86 compiles uses calling conventions that are cdecl
|
||||
|
@ -107,11 +107,11 @@ RUNTIME_FUNCTION(Runtime_WasmIsValidRefValue) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
// 'raw_instance' can be either a WasmInstanceObject or undefined.
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, raw_instance, 0)
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
|
||||
Handle<Object> raw_instance = args.at(0);
|
||||
Handle<Object> value = args.at(1);
|
||||
// Make sure ValueType fits properly in a Smi.
|
||||
STATIC_ASSERT(wasm::ValueType::kLastUsedBit + 1 <= kSmiValueSize);
|
||||
CONVERT_SMI_ARG_CHECKED(raw_type, 2);
|
||||
int raw_type = args.smi_value_at(2);
|
||||
|
||||
const wasm::WasmModule* module =
|
||||
raw_instance->IsWasmInstanceObject()
|
||||
@ -130,10 +130,11 @@ RUNTIME_FUNCTION(Runtime_WasmMemoryGrow) {
|
||||
ClearThreadInWasmScope flag_scope(isolate);
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
|
||||
Handle<WasmInstanceObject> instance = args.at<WasmInstanceObject>(0);
|
||||
// {delta_pages} is checked to be a positive smi in the WasmMemoryGrow builtin
|
||||
// which calls this runtime function.
|
||||
CONVERT_UINT32_ARG_CHECKED(delta_pages, 1);
|
||||
uint32_t delta_pages = 0;
|
||||
CHECK(args[1].ToUint32(&delta_pages));
|
||||
|
||||
int ret = WasmMemoryObject::Grow(
|
||||
isolate, handle(instance->memory_object(), isolate), delta_pages);
|
||||
@ -147,7 +148,7 @@ RUNTIME_FUNCTION(Runtime_ThrowWasmError) {
|
||||
ClearThreadInWasmScope flag_scope(isolate);
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_SMI_ARG_CHECKED(message_id, 0);
|
||||
int message_id = args.smi_value_at(0);
|
||||
return ThrowWasmError(isolate, MessageTemplateFromInt(message_id));
|
||||
}
|
||||
|
||||
@ -176,8 +177,8 @@ RUNTIME_FUNCTION(Runtime_WasmThrow) {
|
||||
DCHECK_EQ(2, args.length());
|
||||
isolate->set_context(GetNativeContextFromWasmInstanceOnStackTop(isolate));
|
||||
|
||||
CONVERT_ARG_CHECKED(WasmExceptionTag, tag_raw, 0);
|
||||
CONVERT_ARG_CHECKED(FixedArray, values_raw, 1);
|
||||
auto tag_raw = WasmExceptionTag::cast(args[0]);
|
||||
auto values_raw = FixedArray::cast(args[1]);
|
||||
// TODO(wasm): Manually box because parameters are not visited yet.
|
||||
Handle<WasmExceptionTag> tag(tag_raw, isolate);
|
||||
Handle<FixedArray> values(values_raw, isolate);
|
||||
@ -211,8 +212,8 @@ RUNTIME_FUNCTION(Runtime_WasmCompileLazy) {
|
||||
ClearThreadInWasmScope wasm_flag(isolate);
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
|
||||
CONVERT_SMI_ARG_CHECKED(func_index, 1);
|
||||
Handle<WasmInstanceObject> instance = args.at<WasmInstanceObject>(0);
|
||||
int func_index = args.smi_value_at(1);
|
||||
|
||||
#ifdef DEBUG
|
||||
FrameFinder<WasmCompileLazyFrame> frame_finder(isolate);
|
||||
@ -253,8 +254,9 @@ void ReplaceWrapper(Isolate* isolate, Handle<WasmInstanceObject> instance,
|
||||
RUNTIME_FUNCTION(Runtime_WasmCompileWrapper) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmExportedFunctionData, function_data, 1);
|
||||
Handle<WasmInstanceObject> instance = args.at<WasmInstanceObject>(0);
|
||||
Handle<WasmExportedFunctionData> function_data =
|
||||
args.at<WasmExportedFunctionData>(1);
|
||||
DCHECK(isolate->context().is_null());
|
||||
isolate->set_context(instance->native_context());
|
||||
|
||||
@ -304,7 +306,7 @@ RUNTIME_FUNCTION(Runtime_WasmTriggerTierUp) {
|
||||
ClearThreadInWasmScope clear_wasm_flag(isolate);
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
|
||||
Handle<WasmInstanceObject> instance = args.at<WasmInstanceObject>(0);
|
||||
|
||||
// We're reusing this interrupt mechanism to interrupt long-running loops.
|
||||
StackLimitCheck check(isolate);
|
||||
@ -327,10 +329,10 @@ RUNTIME_FUNCTION(Runtime_WasmAtomicNotify) {
|
||||
ClearThreadInWasmScope clear_wasm_flag(isolate);
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
|
||||
CONVERT_DOUBLE_ARG_CHECKED(offset_double, 1);
|
||||
Handle<WasmInstanceObject> instance = args.at<WasmInstanceObject>(0);
|
||||
double offset_double = args.number_value_at(1);
|
||||
uintptr_t offset = static_cast<uintptr_t>(offset_double);
|
||||
CONVERT_NUMBER_CHECKED(uint32_t, count, Uint32, args[2]);
|
||||
uint32_t count = NumberToUint32(args[2]);
|
||||
Handle<JSArrayBuffer> array_buffer{instance->memory_object().array_buffer(),
|
||||
isolate};
|
||||
// Should have trapped if address was OOB.
|
||||
@ -343,11 +345,11 @@ RUNTIME_FUNCTION(Runtime_WasmI32AtomicWait) {
|
||||
ClearThreadInWasmScope clear_wasm_flag(isolate);
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
|
||||
CONVERT_DOUBLE_ARG_CHECKED(offset_double, 1);
|
||||
Handle<WasmInstanceObject> instance = args.at<WasmInstanceObject>(0);
|
||||
double offset_double = args.number_value_at(1);
|
||||
uintptr_t offset = static_cast<uintptr_t>(offset_double);
|
||||
CONVERT_NUMBER_CHECKED(int32_t, expected_value, Int32, args[2]);
|
||||
CONVERT_ARG_HANDLE_CHECKED(BigInt, timeout_ns, 3);
|
||||
int32_t expected_value = NumberToInt32(args[2]);
|
||||
Handle<BigInt> timeout_ns = args.at<BigInt>(3);
|
||||
|
||||
Handle<JSArrayBuffer> array_buffer{instance->memory_object().array_buffer(),
|
||||
isolate};
|
||||
@ -366,11 +368,11 @@ RUNTIME_FUNCTION(Runtime_WasmI64AtomicWait) {
|
||||
ClearThreadInWasmScope clear_wasm_flag(isolate);
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
|
||||
CONVERT_DOUBLE_ARG_CHECKED(offset_double, 1);
|
||||
Handle<WasmInstanceObject> instance = args.at<WasmInstanceObject>(0);
|
||||
double offset_double = args.number_value_at(1);
|
||||
uintptr_t offset = static_cast<uintptr_t>(offset_double);
|
||||
CONVERT_ARG_HANDLE_CHECKED(BigInt, expected_value, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(BigInt, timeout_ns, 3);
|
||||
Handle<BigInt> expected_value = args.at<BigInt>(2);
|
||||
Handle<BigInt> timeout_ns = args.at<BigInt>(3);
|
||||
|
||||
Handle<JSArrayBuffer> array_buffer{instance->memory_object().array_buffer(),
|
||||
isolate};
|
||||
@ -402,8 +404,9 @@ RUNTIME_FUNCTION(Runtime_WasmRefFunc) {
|
||||
ClearThreadInWasmScope flag_scope(isolate);
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
|
||||
CONVERT_UINT32_ARG_CHECKED(function_index, 1);
|
||||
Handle<WasmInstanceObject> instance = args.at<WasmInstanceObject>(0);
|
||||
uint32_t function_index = 0;
|
||||
CHECK(args[1].ToUint32(&function_index));
|
||||
|
||||
return *WasmInstanceObject::GetOrCreateWasmInternalFunction(isolate, instance,
|
||||
function_index);
|
||||
@ -413,9 +416,11 @@ RUNTIME_FUNCTION(Runtime_WasmFunctionTableGet) {
|
||||
ClearThreadInWasmScope flag_scope(isolate);
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(3, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
|
||||
CONVERT_UINT32_ARG_CHECKED(table_index, 1);
|
||||
CONVERT_UINT32_ARG_CHECKED(entry_index, 2);
|
||||
Handle<WasmInstanceObject> instance = args.at<WasmInstanceObject>(0);
|
||||
uint32_t table_index = 0;
|
||||
CHECK(args[1].ToUint32(&table_index));
|
||||
uint32_t entry_index = 0;
|
||||
CHECK(args[2].ToUint32(&entry_index));
|
||||
DCHECK_LT(table_index, instance->tables().length());
|
||||
auto table = handle(
|
||||
WasmTableObject::cast(instance->tables().get(table_index)), isolate);
|
||||
@ -437,10 +442,12 @@ RUNTIME_FUNCTION(Runtime_WasmFunctionTableSet) {
|
||||
ClearThreadInWasmScope flag_scope(isolate);
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
|
||||
CONVERT_UINT32_ARG_CHECKED(table_index, 1);
|
||||
CONVERT_UINT32_ARG_CHECKED(entry_index, 2);
|
||||
CONVERT_ARG_CHECKED(Object, element_raw, 3);
|
||||
Handle<WasmInstanceObject> instance = args.at<WasmInstanceObject>(0);
|
||||
uint32_t table_index = 0;
|
||||
CHECK(args[1].ToUint32(&table_index));
|
||||
uint32_t entry_index = 0;
|
||||
CHECK(args[2].ToUint32(&entry_index));
|
||||
Object element_raw = args[3];
|
||||
// TODO(wasm): Manually box because parameters are not visited yet.
|
||||
Handle<Object> element(element_raw, isolate);
|
||||
DCHECK_LT(table_index, instance->tables().length());
|
||||
@ -464,15 +471,20 @@ RUNTIME_FUNCTION(Runtime_WasmTableInit) {
|
||||
ClearThreadInWasmScope flag_scope(isolate);
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(6, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
|
||||
CONVERT_UINT32_ARG_CHECKED(table_index, 1);
|
||||
CONVERT_UINT32_ARG_CHECKED(elem_segment_index, 2);
|
||||
Handle<WasmInstanceObject> instance = args.at<WasmInstanceObject>(0);
|
||||
uint32_t table_index = 0;
|
||||
CHECK(args[1].ToUint32(&table_index));
|
||||
uint32_t elem_segment_index = 0;
|
||||
CHECK(args[2].ToUint32(&elem_segment_index));
|
||||
static_assert(
|
||||
wasm::kV8MaxWasmTableSize < kSmiMaxValue,
|
||||
"Make sure clamping to Smi range doesn't make an invalid call valid");
|
||||
CONVERT_UINT32_ARG_CHECKED(dst, 3);
|
||||
CONVERT_UINT32_ARG_CHECKED(src, 4);
|
||||
CONVERT_UINT32_ARG_CHECKED(count, 5);
|
||||
uint32_t dst = 0;
|
||||
CHECK(args[3].ToUint32(&dst));
|
||||
uint32_t src = 0;
|
||||
CHECK(args[4].ToUint32(&src));
|
||||
uint32_t count = 0;
|
||||
CHECK(args[5].ToUint32(&count));
|
||||
|
||||
DCHECK(!isolate->context().is_null());
|
||||
|
||||
@ -486,15 +498,20 @@ RUNTIME_FUNCTION(Runtime_WasmTableCopy) {
|
||||
ClearThreadInWasmScope flag_scope(isolate);
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(6, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
|
||||
CONVERT_UINT32_ARG_CHECKED(table_dst_index, 1);
|
||||
CONVERT_UINT32_ARG_CHECKED(table_src_index, 2);
|
||||
Handle<WasmInstanceObject> instance = args.at<WasmInstanceObject>(0);
|
||||
uint32_t table_dst_index = 0;
|
||||
CHECK(args[1].ToUint32(&table_dst_index));
|
||||
uint32_t table_src_index = 0;
|
||||
CHECK(args[2].ToUint32(&table_src_index));
|
||||
static_assert(
|
||||
wasm::kV8MaxWasmTableSize < kSmiMaxValue,
|
||||
"Make sure clamping to Smi range doesn't make an invalid call valid");
|
||||
CONVERT_UINT32_ARG_CHECKED(dst, 3);
|
||||
CONVERT_UINT32_ARG_CHECKED(src, 4);
|
||||
CONVERT_UINT32_ARG_CHECKED(count, 5);
|
||||
uint32_t dst = 0;
|
||||
CHECK(args[3].ToUint32(&dst));
|
||||
uint32_t src = 0;
|
||||
CHECK(args[4].ToUint32(&src));
|
||||
uint32_t count = 0;
|
||||
CHECK(args[5].ToUint32(&count));
|
||||
|
||||
DCHECK(!isolate->context().is_null());
|
||||
|
||||
@ -508,12 +525,14 @@ RUNTIME_FUNCTION(Runtime_WasmTableGrow) {
|
||||
ClearThreadInWasmScope flag_scope(isolate);
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(4, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
|
||||
CONVERT_UINT32_ARG_CHECKED(table_index, 1);
|
||||
CONVERT_ARG_CHECKED(Object, value_raw, 2);
|
||||
Handle<WasmInstanceObject> instance = args.at<WasmInstanceObject>(0);
|
||||
uint32_t table_index = 0;
|
||||
CHECK(args[1].ToUint32(&table_index));
|
||||
Object value_raw = args[2];
|
||||
// TODO(wasm): Manually box because parameters are not visited yet.
|
||||
Handle<Object> value(value_raw, isolate);
|
||||
CONVERT_UINT32_ARG_CHECKED(delta, 3);
|
||||
uint32_t delta = 0;
|
||||
CHECK(args[3].ToUint32(&delta));
|
||||
|
||||
Handle<WasmTableObject> table(
|
||||
WasmTableObject::cast(instance->tables().get(table_index)), isolate);
|
||||
@ -526,13 +545,16 @@ RUNTIME_FUNCTION(Runtime_WasmTableFill) {
|
||||
ClearThreadInWasmScope flag_scope(isolate);
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(5, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
|
||||
CONVERT_UINT32_ARG_CHECKED(table_index, 1);
|
||||
CONVERT_UINT32_ARG_CHECKED(start, 2);
|
||||
CONVERT_ARG_CHECKED(Object, value_raw, 3);
|
||||
Handle<WasmInstanceObject> instance = args.at<WasmInstanceObject>(0);
|
||||
uint32_t table_index = 0;
|
||||
CHECK(args[1].ToUint32(&table_index));
|
||||
uint32_t start = 0;
|
||||
CHECK(args[2].ToUint32(&start));
|
||||
Object value_raw = args[3];
|
||||
// TODO(wasm): Manually box because parameters are not visited yet.
|
||||
Handle<Object> value(value_raw, isolate);
|
||||
CONVERT_UINT32_ARG_CHECKED(count, 4);
|
||||
uint32_t count = 0;
|
||||
CHECK(args[4].ToUint32(&count));
|
||||
|
||||
Handle<WasmTableObject> table(
|
||||
WasmTableObject::cast(instance->tables().get(table_index)), isolate);
|
||||
@ -653,11 +675,14 @@ RUNTIME_FUNCTION(Runtime_WasmArrayCopy) {
|
||||
ClearThreadInWasmScope flag_scope(isolate);
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(5, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmArray, dst_array, 0);
|
||||
CONVERT_UINT32_ARG_CHECKED(dst_index, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmArray, src_array, 2);
|
||||
CONVERT_UINT32_ARG_CHECKED(src_index, 3);
|
||||
CONVERT_UINT32_ARG_CHECKED(length, 4);
|
||||
Handle<WasmArray> dst_array = args.at<WasmArray>(0);
|
||||
uint32_t dst_index = 0;
|
||||
CHECK(args[1].ToUint32(&dst_index));
|
||||
Handle<WasmArray> src_array = args.at<WasmArray>(2);
|
||||
uint32_t src_index = 0;
|
||||
CHECK(args[3].ToUint32(&src_index));
|
||||
uint32_t length = 0;
|
||||
CHECK(args[4].ToUint32(&length));
|
||||
DCHECK_GT(length, 0);
|
||||
bool overlapping_ranges =
|
||||
dst_array->ptr() == src_array->ptr() &&
|
||||
@ -696,11 +721,14 @@ RUNTIME_FUNCTION(Runtime_WasmArrayInitFromData) {
|
||||
ClearThreadInWasmScope flag_scope(isolate);
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(5, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
|
||||
CONVERT_UINT32_ARG_CHECKED(data_segment, 1);
|
||||
CONVERT_UINT32_ARG_CHECKED(offset, 2);
|
||||
CONVERT_UINT32_ARG_CHECKED(length, 3);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Map, rtt, 4);
|
||||
Handle<WasmInstanceObject> instance = args.at<WasmInstanceObject>(0);
|
||||
uint32_t data_segment = 0;
|
||||
CHECK(args[1].ToUint32(&data_segment));
|
||||
uint32_t offset = 0;
|
||||
CHECK(args[2].ToUint32(&offset));
|
||||
uint32_t length = 0;
|
||||
CHECK(args[3].ToUint32(&length));
|
||||
Handle<Map> rtt = args.at<Map>(4);
|
||||
uint32_t element_size = WasmArray::DecodeElementSizeFromMap(*rtt);
|
||||
uint32_t length_in_bytes = length * element_size;
|
||||
|
||||
@ -745,7 +773,7 @@ void SyncStackLimit(Isolate* isolate) {
|
||||
RUNTIME_FUNCTION(Runtime_WasmAllocateContinuation) {
|
||||
CHECK(FLAG_experimental_wasm_stack_switching);
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmSuspenderObject, suspender, 0);
|
||||
Handle<WasmSuspenderObject> suspender = args.at<WasmSuspenderObject>(0);
|
||||
|
||||
// Update the continuation state.
|
||||
auto parent =
|
||||
@ -787,8 +815,8 @@ RUNTIME_FUNCTION(Runtime_WasmSyncStackLimit) {
|
||||
RUNTIME_FUNCTION(Runtime_WasmCreateResumePromise) {
|
||||
CHECK(FLAG_experimental_wasm_stack_switching);
|
||||
HandleScope scope(isolate);
|
||||
CONVERT_ARG_HANDLE_CHECKED(Object, promise, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(WasmSuspenderObject, suspender, 1);
|
||||
Handle<Object> promise = args.at(0);
|
||||
Handle<WasmSuspenderObject> suspender = args.at<WasmSuspenderObject>(1);
|
||||
|
||||
// Instantiate onFulfilled callback.
|
||||
Handle<WasmOnFulfilledData> function_data =
|
||||
|
@ -13,7 +13,8 @@ namespace internal {
|
||||
RUNTIME_FUNCTION(Runtime_ShrinkFinalizationRegistryUnregisterTokenMap) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFinalizationRegistry, finalization_registry, 0);
|
||||
Handle<JSFinalizationRegistry> finalization_registry =
|
||||
args.at<JSFinalizationRegistry>(0);
|
||||
|
||||
if (!finalization_registry->key_map().IsUndefined(isolate)) {
|
||||
Handle<SimpleNumberDictionary> key_map =
|
||||
@ -30,8 +31,9 @@ RUNTIME_FUNCTION(
|
||||
Runtime_JSFinalizationRegistryRegisterWeakCellWithUnregisterToken) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(2, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSFinalizationRegistry, finalization_registry, 0);
|
||||
CONVERT_ARG_HANDLE_CHECKED(WeakCell, weak_cell, 1);
|
||||
Handle<JSFinalizationRegistry> finalization_registry =
|
||||
args.at<JSFinalizationRegistry>(0);
|
||||
Handle<WeakCell> weak_cell = args.at<WeakCell>(1);
|
||||
|
||||
JSFinalizationRegistry::RegisterWeakCellWithUnregisterToken(
|
||||
finalization_registry, weak_cell, isolate);
|
||||
@ -42,7 +44,7 @@ RUNTIME_FUNCTION(
|
||||
RUNTIME_FUNCTION(Runtime_JSWeakRefAddToKeptObjects) {
|
||||
HandleScope scope(isolate);
|
||||
DCHECK_EQ(1, args.length());
|
||||
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0);
|
||||
Handle<JSReceiver> object = args.at<JSReceiver>(0);
|
||||
|
||||
isolate->heap()->KeepDuringJob(object);
|
||||
|
||||
|
@ -184,10 +184,10 @@ uint32_t WebSnapshotSerializerDeserializer::AttributesToFlags(
|
||||
|
||||
PropertyAttributes WebSnapshotSerializerDeserializer::FlagsToAttributes(
|
||||
uint32_t flags) {
|
||||
uint32_t attributes = ReadOnlyBitField::decode(flags) * READ_ONLY +
|
||||
!ConfigurableBitField::decode(flags) * DONT_DELETE +
|
||||
!EnumerableBitField::decode(flags) * DONT_ENUM;
|
||||
return static_cast<PropertyAttributes>(attributes);
|
||||
int attributes = ReadOnlyBitField::decode(flags) * READ_ONLY +
|
||||
!ConfigurableBitField::decode(flags) * DONT_DELETE +
|
||||
!EnumerableBitField::decode(flags) * DONT_ENUM;
|
||||
return PropertyAttributesFromInt(attributes);
|
||||
}
|
||||
|
||||
WebSnapshotSerializer::WebSnapshotSerializer(v8::Isolate* isolate)
|
||||
|
@ -1099,7 +1099,7 @@ TEST(TransitionLookup) {
|
||||
|
||||
if ((i & 2) == 0) {
|
||||
for (int j = 0; j < ATTRS_COUNT; j++) {
|
||||
PropertyAttributes attributes = static_cast<PropertyAttributes>(j);
|
||||
auto attributes = PropertyAttributesFromInt(j);
|
||||
if (attributes == base_attributes) continue;
|
||||
// Don't add private symbols with enumerable attributes.
|
||||
if (is_private && ((attributes & DONT_ENUM) == 0)) continue;
|
||||
|
@ -3112,7 +3112,7 @@ TEST(DeletePropertyGeneralizesConstness) {
|
||||
std::vector<Handle<Map>> transitions;
|
||||
Handle<Object> value = handle(Smi::FromInt(0), isolate);
|
||||
for (int i = 0; i < kPropertyAttributesCombinationsCount; i++) {
|
||||
PropertyAttributes attributes = static_cast<PropertyAttributes>(i);
|
||||
auto attributes = PropertyAttributesFromInt(i);
|
||||
|
||||
Handle<Map> tmp;
|
||||
// Add some transitions to "x" and "y".
|
||||
|
@ -27,8 +27,7 @@ std::vector<PropertyDetails> MakeDistinctDetails() {
|
||||
if (!configurable) {
|
||||
attrs |= PropertyAttributes::DONT_DELETE;
|
||||
}
|
||||
PropertyAttributes attributes =
|
||||
static_cast<PropertyAttributes>(attrs);
|
||||
auto attributes = PropertyAttributesFromInt(attrs);
|
||||
PropertyDetails details(kind, attributes,
|
||||
PropertyCellType::kNoCell);
|
||||
details = details.CopyWithConstness(constness);
|
||||
|
@ -211,7 +211,7 @@ TEST(TransitionArray_SameFieldNamesDifferentAttributesSimple) {
|
||||
|
||||
// Add transitions for same field name but different attributes.
|
||||
for (int i = 0; i < ATTRS_COUNT; i++) {
|
||||
PropertyAttributes attributes = static_cast<PropertyAttributes>(i);
|
||||
auto attributes = PropertyAttributesFromInt(i);
|
||||
|
||||
Handle<Map> map =
|
||||
Map::CopyWithField(isolate, map0, name, FieldType::Any(isolate),
|
||||
@ -226,7 +226,7 @@ TEST(TransitionArray_SameFieldNamesDifferentAttributesSimple) {
|
||||
// Ensure that transitions for |name| field are valid.
|
||||
TransitionsAccessor transitions(isolate, *map0);
|
||||
for (int i = 0; i < ATTRS_COUNT; i++) {
|
||||
PropertyAttributes attributes = static_cast<PropertyAttributes>(i);
|
||||
auto attributes = PropertyAttributesFromInt(i);
|
||||
CHECK_EQ(*attr_maps[i], transitions.SearchTransition(
|
||||
*name, PropertyKind::kData, attributes));
|
||||
// All transitions use the same key, so this check doesn't need to
|
||||
@ -274,7 +274,7 @@ TEST(TransitionArray_SameFieldNamesDifferentAttributes) {
|
||||
|
||||
// Add transitions for same field name but different attributes.
|
||||
for (int i = 0; i < ATTRS_COUNT; i++) {
|
||||
PropertyAttributes attributes = static_cast<PropertyAttributes>(i);
|
||||
auto attributes = PropertyAttributesFromInt(i);
|
||||
|
||||
Handle<Map> map =
|
||||
Map::CopyWithField(isolate, map0, name, FieldType::Any(isolate),
|
||||
@ -289,7 +289,7 @@ TEST(TransitionArray_SameFieldNamesDifferentAttributes) {
|
||||
// Ensure that transitions for |name| field are valid.
|
||||
TransitionsAccessor transitions(isolate, *map0);
|
||||
for (int i = 0; i < ATTRS_COUNT; i++) {
|
||||
PropertyAttributes attr = static_cast<PropertyAttributes>(i);
|
||||
auto attr = PropertyAttributesFromInt(i);
|
||||
CHECK_EQ(*attr_maps[i],
|
||||
transitions.SearchTransition(*name, PropertyKind::kData, attr));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user