Commit 37b8684e authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[CSA] Type CodeStubAssembler::Is* methods

Bug: v8:7570
Change-Id: I74b482b670ce0e78dca012cbe8d9c2f65fdae5b9
Reviewed-on: https://chromium-review.googlesource.com/1030554
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52846}
parent 440533d5
...@@ -290,7 +290,8 @@ macro HasPropertyObject( ...@@ -290,7 +290,8 @@ macro HasPropertyObject(
} }
} }
extern macro IsCallable(Object): bit; extern macro IsCallable(HeapObject): bit;
extern macro TaggedIsCallable(Object): bit;
extern macro IsDetachedBuffer(JSArrayBuffer): bit; extern macro IsDetachedBuffer(JSArrayBuffer): bit;
type ParameterMode; type ParameterMode;
......
...@@ -1305,7 +1305,7 @@ TF_BUILTIN(ArrayPrototypeSlice, ArrayPrototypeSliceCodeStubAssembler) { ...@@ -1305,7 +1305,7 @@ TF_BUILTIN(ArrayPrototypeSlice, ArrayPrototypeSliceCodeStubAssembler) {
load_arguments_length(this); load_arguments_length(this);
GotoIf(TaggedIsSmi(receiver), &generic_length); GotoIf(TaggedIsSmi(receiver), &generic_length);
GotoIfNot(IsJSArray(receiver), &check_arguments_length); GotoIfNot(IsJSArray(CAST(receiver)), &check_arguments_length);
TNode<JSArray> array_receiver = CAST(receiver); TNode<JSArray> array_receiver = CAST(receiver);
o = array_receiver; o = array_receiver;
...@@ -1852,7 +1852,7 @@ class ArrayPopulatorAssembler : public CodeStubAssembler { ...@@ -1852,7 +1852,7 @@ class ArrayPopulatorAssembler : public CodeStubAssembler {
TVARIABLE(Object, array); TVARIABLE(Object, array);
Label is_constructor(this), is_not_constructor(this), done(this); Label is_constructor(this), is_not_constructor(this), done(this);
GotoIf(TaggedIsSmi(receiver), &is_not_constructor); GotoIf(TaggedIsSmi(receiver), &is_not_constructor);
Branch(IsConstructor(receiver), &is_constructor, &is_not_constructor); Branch(IsConstructor(CAST(receiver)), &is_constructor, &is_not_constructor);
BIND(&is_constructor); BIND(&is_constructor);
{ {
...@@ -1885,7 +1885,7 @@ class ArrayPopulatorAssembler : public CodeStubAssembler { ...@@ -1885,7 +1885,7 @@ class ArrayPopulatorAssembler : public CodeStubAssembler {
Label is_constructor(this), is_not_constructor(this), done(this); Label is_constructor(this), is_not_constructor(this), done(this);
CSA_ASSERT(this, IsNumberNormalized(length)); CSA_ASSERT(this, IsNumberNormalized(length));
GotoIf(TaggedIsSmi(receiver), &is_not_constructor); GotoIf(TaggedIsSmi(receiver), &is_not_constructor);
Branch(IsConstructor(receiver), &is_constructor, &is_not_constructor); Branch(IsConstructor(CAST(receiver)), &is_constructor, &is_not_constructor);
BIND(&is_constructor); BIND(&is_constructor);
{ {
...@@ -1996,7 +1996,7 @@ TF_BUILTIN(ArrayFrom, ArrayPopulatorAssembler) { ...@@ -1996,7 +1996,7 @@ TF_BUILTIN(ArrayFrom, ArrayPopulatorAssembler) {
Label no_error(this), error(this); Label no_error(this), error(this);
GotoIf(IsUndefined(map_function), &no_error); GotoIf(IsUndefined(map_function), &no_error);
GotoIf(TaggedIsSmi(map_function), &error); GotoIf(TaggedIsSmi(map_function), &error);
Branch(IsCallable(map_function), &no_error, &error); Branch(IsCallable(CAST(map_function)), &no_error, &error);
BIND(&error); BIND(&error);
ThrowTypeError(context, MessageTemplate::kCalledNonCallable, map_function); ThrowTypeError(context, MessageTemplate::kCalledNonCallable, map_function);
...@@ -2033,7 +2033,7 @@ TF_BUILTIN(ArrayFrom, ArrayPopulatorAssembler) { ...@@ -2033,7 +2033,7 @@ TF_BUILTIN(ArrayFrom, ArrayPopulatorAssembler) {
{ {
Label get_method_not_callable(this, Label::kDeferred), next(this); Label get_method_not_callable(this, Label::kDeferred), next(this);
GotoIf(TaggedIsSmi(iterator_method), &get_method_not_callable); GotoIf(TaggedIsSmi(iterator_method), &get_method_not_callable);
GotoIfNot(IsCallable(iterator_method), &get_method_not_callable); GotoIfNot(IsCallable(CAST(iterator_method)), &get_method_not_callable);
Goto(&next); Goto(&next);
BIND(&get_method_not_callable); BIND(&get_method_not_callable);
...@@ -2073,7 +2073,7 @@ TF_BUILTIN(ArrayFrom, ArrayPopulatorAssembler) { ...@@ -2073,7 +2073,7 @@ TF_BUILTIN(ArrayFrom, ArrayPopulatorAssembler) {
Label next(this); Label next(this);
GotoIf(IsUndefined(map_function), &next); GotoIf(IsUndefined(map_function), &next);
CSA_ASSERT(this, IsCallable(map_function)); CSA_ASSERT(this, IsCallable(CAST(map_function)));
Node* v = CallJS(CodeFactory::Call(isolate()), context, map_function, Node* v = CallJS(CodeFactory::Call(isolate()), context, map_function,
this_arg, value.value(), index.value()); this_arg, value.value(), index.value());
GotoIfException(v, &on_exception, &var_exception); GotoIfException(v, &on_exception, &var_exception);
...@@ -2149,7 +2149,7 @@ TF_BUILTIN(ArrayFrom, ArrayPopulatorAssembler) { ...@@ -2149,7 +2149,7 @@ TF_BUILTIN(ArrayFrom, ArrayPopulatorAssembler) {
Label next(this); Label next(this);
GotoIf(IsUndefined(map_function), &next); GotoIf(IsUndefined(map_function), &next);
CSA_ASSERT(this, IsCallable(map_function)); CSA_ASSERT(this, IsCallable(CAST(map_function)));
value = CAST(CallJS(CodeFactory::Call(isolate()), context, map_function, value = CAST(CallJS(CodeFactory::Call(isolate()), context, map_function,
this_arg, value.value(), index.value())); this_arg, value.value(), index.value()));
Goto(&next); Goto(&next);
...@@ -3191,7 +3191,7 @@ void ArrayIncludesIndexofAssembler::GenerateSmiOrObject( ...@@ -3191,7 +3191,7 @@ void ArrayIncludesIndexofAssembler::GenerateSmiOrObject(
&return_not_found); &return_not_found);
Node* element_k = LoadFixedArrayElement(elements, index_var.value()); Node* element_k = LoadFixedArrayElement(elements, index_var.value());
GotoIf(TaggedIsSmi(element_k), &continue_loop); GotoIf(TaggedIsSmi(element_k), &continue_loop);
GotoIfNot(IsHeapNumber(element_k), &continue_loop); GotoIfNot(IsHeapNumber(CAST(element_k)), &continue_loop);
BranchIfFloat64IsNaN(LoadHeapNumberValue(element_k), &return_found, BranchIfFloat64IsNaN(LoadHeapNumberValue(element_k), &return_found,
&continue_loop); &continue_loop);
...@@ -3243,7 +3243,7 @@ void ArrayIncludesIndexofAssembler::GenerateSmiOrObject( ...@@ -3243,7 +3243,7 @@ void ArrayIncludesIndexofAssembler::GenerateSmiOrObject(
Node* element_k = LoadFixedArrayElement(elements, index_var.value()); Node* element_k = LoadFixedArrayElement(elements, index_var.value());
Label continue_loop(this); Label continue_loop(this);
GotoIf(TaggedIsSmi(element_k), &continue_loop); GotoIf(TaggedIsSmi(element_k), &continue_loop);
GotoIfNot(IsBigInt(element_k), &continue_loop); GotoIfNot(IsBigInt(CAST(element_k)), &continue_loop);
TNode<Object> result = CallRuntime(Runtime::kBigIntEqualToBigInt, context, TNode<Object> result = CallRuntime(Runtime::kBigIntEqualToBigInt, context,
search_element, element_k); search_element, element_k);
Branch(WordEqual(result, TrueConstant()), &return_found, &continue_loop); Branch(WordEqual(result, TrueConstant()), &return_found, &continue_loop);
...@@ -3548,7 +3548,7 @@ TF_BUILTIN(ArrayIteratorPrototypeNext, CodeStubAssembler) { ...@@ -3548,7 +3548,7 @@ TF_BUILTIN(ArrayIteratorPrototypeNext, CodeStubAssembler) {
// If O does not have all of the internal slots of an Array Iterator Instance // If O does not have all of the internal slots of an Array Iterator Instance
// (22.1.5.3), throw a TypeError exception // (22.1.5.3), throw a TypeError exception
GotoIf(TaggedIsSmi(iterator), &throw_bad_receiver); GotoIf(TaggedIsSmi(iterator), &throw_bad_receiver);
GotoIfNot(IsJSArrayIterator(iterator), &throw_bad_receiver); GotoIfNot(IsJSArrayIterator(CAST(iterator)), &throw_bad_receiver);
// Let a be O.[[IteratedObject]]. // Let a be O.[[IteratedObject]].
Node* array = Node* array =
......
This diff is collapsed.
...@@ -17,7 +17,7 @@ void ProxiesCodeStubAssembler::GotoIfRevokedProxy(Node* object, ...@@ -17,7 +17,7 @@ void ProxiesCodeStubAssembler::GotoIfRevokedProxy(Node* object,
Label* if_proxy_revoked) { Label* if_proxy_revoked) {
Label proxy_not_revoked(this); Label proxy_not_revoked(this);
GotoIfNot(IsJSProxy(object), &proxy_not_revoked); GotoIfNot(IsJSProxy(object), &proxy_not_revoked);
Branch(IsJSReceiver(LoadObjectField(object, JSProxy::kHandlerOffset)), Branch(IsJSReceiver(CAST(LoadObjectField(object, JSProxy::kHandlerOffset))),
&proxy_not_revoked, if_proxy_revoked); &proxy_not_revoked, if_proxy_revoked);
BIND(&proxy_not_revoked); BIND(&proxy_not_revoked);
} }
......
...@@ -906,7 +906,7 @@ void RegExpBuiltinsAssembler::BranchIfFastRegExp(Node* const context, ...@@ -906,7 +906,7 @@ void RegExpBuiltinsAssembler::BranchIfFastRegExp(Node* const context,
Node* const initial_proto_initial_map = Node* const initial_proto_initial_map =
LoadContextElement(native_context, Context::REGEXP_PROTOTYPE_MAP_INDEX); LoadContextElement(native_context, Context::REGEXP_PROTOTYPE_MAP_INDEX);
Node* const proto_map = LoadMap(CAST(LoadMapPrototype(map))); Node* const proto_map = LoadMap(LoadMapPrototype(map));
Node* const proto_has_initialmap = Node* const proto_has_initialmap =
WordEqual(proto_map, initial_proto_initial_map); WordEqual(proto_map, initial_proto_initial_map);
...@@ -3151,8 +3151,8 @@ TF_BUILTIN(RegExpStringIteratorPrototypeNext, RegExpStringIteratorAssembler) { ...@@ -3151,8 +3151,8 @@ TF_BUILTIN(RegExpStringIteratorPrototypeNext, RegExpStringIteratorAssembler) {
// 1. Let O be the this value. // 1. Let O be the this value.
// 2. If Type(O) is not Object, throw a TypeError exception. // 2. If Type(O) is not Object, throw a TypeError exception.
GotoIf(TaggedIsSmi(maybe_receiver), &throw_bad_receiver); GotoIf(TaggedIsSmi(maybe_receiver), &throw_bad_receiver);
GotoIfNot(IsJSReceiver(maybe_receiver), &throw_bad_receiver);
TNode<HeapObject> receiver = CAST(maybe_receiver); TNode<HeapObject> receiver = CAST(maybe_receiver);
GotoIfNot(IsJSReceiver(receiver), &throw_bad_receiver);
// 3. If O does not have all of the internal slots of a RegExp String Iterator // 3. If O does not have all of the internal slots of a RegExp String Iterator
// Object Instance (see 5.3), throw a TypeError exception. // Object Instance (see 5.3), throw a TypeError exception.
......
...@@ -1045,7 +1045,7 @@ void StringBuiltinsAssembler::MaybeCallFunctionAtSymbol( ...@@ -1045,7 +1045,7 @@ void StringBuiltinsAssembler::MaybeCallFunctionAtSymbol(
LoadContextElement(native_context, Context::STRING_FUNCTION_INDEX); LoadContextElement(native_context, Context::STRING_FUNCTION_INDEX);
Node* const initial_map = Node* const initial_map =
LoadObjectField(string_fun, JSFunction::kPrototypeOrInitialMapOffset); LoadObjectField(string_fun, JSFunction::kPrototypeOrInitialMapOffset);
Node* const proto_map = LoadMap(CAST(LoadMapPrototype(initial_map))); Node* const proto_map = LoadMap(LoadMapPrototype(initial_map));
Branch(WordEqual(proto_map, initial_proto_initial_map), &out, &next); Branch(WordEqual(proto_map, initial_proto_initial_map), &out, &next);
...@@ -1519,8 +1519,8 @@ TF_BUILTIN(StringPrototypeMatchAll, StringBuiltinsAssembler) { ...@@ -1519,8 +1519,8 @@ TF_BUILTIN(StringPrototypeMatchAll, StringBuiltinsAssembler) {
auto if_regexp_call = [&] { auto if_regexp_call = [&] {
// MaybeCallFunctionAtSymbol guarantees fast path is chosen only if // MaybeCallFunctionAtSymbol guarantees fast path is chosen only if
// maybe_regexp is a fast regexp and receiver is a string. // maybe_regexp is a fast regexp and receiver is a string.
CSA_ASSERT(this, IsString(receiver));
var_receiver_string = CAST(receiver); var_receiver_string = CAST(receiver);
CSA_ASSERT(this, IsString(var_receiver_string.value()));
var_is_fast_regexp = Int32TrueConstant(); var_is_fast_regexp = Int32TrueConstant();
Goto(&return_match_all_iterator); Goto(&return_match_all_iterator);
}; };
...@@ -1904,7 +1904,7 @@ TF_BUILTIN(StringPrototypeSubstr, StringBuiltinsAssembler) { ...@@ -1904,7 +1904,7 @@ TF_BUILTIN(StringPrototypeSubstr, StringBuiltinsAssembler) {
// two cases according to the spec: if it is negative, "" is returned; if // two cases according to the spec: if it is negative, "" is returned; if
// it is positive, then length is set to {string_length} - {start}. // it is positive, then length is set to {string_length} - {start}.
CSA_ASSERT(this, IsHeapNumber(var_length.value())); CSA_ASSERT(this, IsHeapNumber(CAST(var_length.value())));
Label if_isnegative(this), if_ispositive(this); Label if_isnegative(this), if_ispositive(this);
TNode<Float64T> const float_zero = Float64Constant(0.); TNode<Float64T> const float_zero = Float64Constant(0.);
......
...@@ -625,10 +625,10 @@ void TypedArrayBuiltinsAssembler::ConstructByArrayLike( ...@@ -625,10 +625,10 @@ void TypedArrayBuiltinsAssembler::ConstructByArrayLike(
void TypedArrayBuiltinsAssembler::ConstructByIterable( void TypedArrayBuiltinsAssembler::ConstructByIterable(
TNode<Context> context, TNode<JSTypedArray> holder, TNode<Context> context, TNode<JSTypedArray> holder,
TNode<JSReceiver> iterable, TNode<Object> iterator_fn, TNode<JSReceiver> iterable, TNode<JSReceiver> iterator_fn,
TNode<Smi> element_size) { TNode<Smi> element_size) {
CSA_ASSERT(this, IsCallable(iterator_fn));
Label fast_path(this), slow_path(this), done(this); Label fast_path(this), slow_path(this), done(this);
CSA_ASSERT(this, IsCallable(iterator_fn));
TNode<JSArray> array_like = CAST( TNode<JSArray> array_like = CAST(
CallBuiltin(Builtins::kIterableToList, context, iterable, iterator_fn)); CallBuiltin(Builtins::kIterableToList, context, iterable, iterator_fn));
...@@ -669,9 +669,10 @@ TF_BUILTIN(CreateTypedArray, TypedArrayBuiltinsAssembler) { ...@@ -669,9 +669,10 @@ TF_BUILTIN(CreateTypedArray, TypedArrayBuiltinsAssembler) {
SmiTag(GetTypedArrayElementSize(LoadElementsKind(result))); SmiTag(GetTypedArrayElementSize(LoadElementsKind(result)));
GotoIf(TaggedIsSmi(arg1), &if_arg1isnumber); GotoIf(TaggedIsSmi(arg1), &if_arg1isnumber);
GotoIf(IsJSArrayBuffer(arg1), &if_arg1isbuffer); TNode<HeapObject> arg1_heap_object = UncheckedCast<HeapObject>(arg1);
GotoIf(IsJSTypedArray(arg1), &if_arg1istypedarray); GotoIf(IsJSArrayBuffer(arg1_heap_object), &if_arg1isbuffer);
GotoIf(IsJSReceiver(arg1), &if_arg1isreceiver); GotoIf(IsJSTypedArray(arg1_heap_object), &if_arg1istypedarray);
GotoIf(IsJSReceiver(arg1_heap_object), &if_arg1isreceiver);
Goto(&if_arg1isnumber); Goto(&if_arg1isnumber);
// https://tc39.github.io/ecma262/#sec-typedarray-buffer-byteoffset-length // https://tc39.github.io/ecma262/#sec-typedarray-buffer-byteoffset-length
...@@ -685,7 +686,7 @@ TF_BUILTIN(CreateTypedArray, TypedArrayBuiltinsAssembler) { ...@@ -685,7 +686,7 @@ TF_BUILTIN(CreateTypedArray, TypedArrayBuiltinsAssembler) {
// https://tc39.github.io/ecma262/#sec-typedarray-typedarray // https://tc39.github.io/ecma262/#sec-typedarray-typedarray
BIND(&if_arg1istypedarray); BIND(&if_arg1istypedarray);
{ {
TNode<JSTypedArray> typed_array = CAST(arg1); TNode<JSTypedArray> typed_array = CAST(arg1_heap_object);
ConstructByTypedArray(context, result, typed_array, element_size); ConstructByTypedArray(context, result, typed_array, element_size);
Goto(&return_result); Goto(&return_result);
} }
...@@ -695,18 +696,19 @@ TF_BUILTIN(CreateTypedArray, TypedArrayBuiltinsAssembler) { ...@@ -695,18 +696,19 @@ TF_BUILTIN(CreateTypedArray, TypedArrayBuiltinsAssembler) {
{ {
Label if_iteratorundefined(this), if_iteratornotcallable(this); Label if_iteratorundefined(this), if_iteratornotcallable(this);
// Get iterator symbol // Get iterator symbol
TNode<Object> iteratorFn = TNode<Object> iteratorFn = CAST(GetMethod(
CAST(GetMethod(context, arg1, isolate()->factory()->iterator_symbol(), context, arg1_heap_object, isolate()->factory()->iterator_symbol(),
&if_iteratorundefined)); &if_iteratorundefined));
GotoIf(TaggedIsSmi(iteratorFn), &if_iteratornotcallable); GotoIf(TaggedIsSmi(iteratorFn), &if_iteratornotcallable);
GotoIfNot(IsCallable(iteratorFn), &if_iteratornotcallable); GotoIfNot(IsCallable(CAST(iteratorFn)), &if_iteratornotcallable);
ConstructByIterable(context, result, CAST(arg1), iteratorFn, element_size); ConstructByIterable(context, result, CAST(arg1_heap_object),
CAST(iteratorFn), element_size);
Goto(&return_result); Goto(&return_result);
BIND(&if_iteratorundefined); BIND(&if_iteratorundefined);
{ {
TNode<HeapObject> array_like = CAST(arg1); TNode<HeapObject> array_like = arg1_heap_object;
TNode<Object> initial_length = TNode<Object> initial_length =
GetProperty(context, arg1, LengthStringConstant()); GetProperty(context, arg1, LengthStringConstant());
...@@ -914,9 +916,8 @@ TNode<JSTypedArray> TypedArrayBuiltinsAssembler::SpeciesCreateByLength( ...@@ -914,9 +916,8 @@ TNode<JSTypedArray> TypedArrayBuiltinsAssembler::SpeciesCreateByLength(
CSA_ASSERT(this, TaggedIsPositiveSmi(len)); CSA_ASSERT(this, TaggedIsPositiveSmi(len));
// Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor). // Let constructor be ? SpeciesConstructor(exemplar, defaultConstructor).
TNode<Object> constructor = TypedArraySpeciesConstructor(context, exemplar); TNode<JSFunction> constructor =
CSA_ASSERT(this, IsJSFunction(constructor)); CAST(TypedArraySpeciesConstructor(context, exemplar));
return CreateByLength(context, constructor, len, method_name); return CreateByLength(context, constructor, len, method_name);
} }
...@@ -1204,7 +1205,7 @@ TNode<BoolT> TypedArrayBuiltinsAssembler::NumberIsNaN(TNode<Number> value) { ...@@ -1204,7 +1205,7 @@ TNode<BoolT> TypedArrayBuiltinsAssembler::NumberIsNaN(TNode<Number> value) {
BIND(&is_heapnumber); BIND(&is_heapnumber);
{ {
CSA_ASSERT(this, IsHeapNumber(value)); CSA_ASSERT(this, IsHeapNumber(CAST(value)));
TNode<Float64T> value_f = LoadHeapNumberValue(CAST(value)); TNode<Float64T> value_f = LoadHeapNumberValue(CAST(value));
result = Float64NotEqual(value_f, value_f); result = Float64NotEqual(value_f, value_f);
...@@ -1230,7 +1231,7 @@ TF_BUILTIN(TypedArrayPrototypeSet, TypedArrayBuiltinsAssembler) { ...@@ -1230,7 +1231,7 @@ TF_BUILTIN(TypedArrayPrototypeSet, TypedArrayBuiltinsAssembler) {
// Check the receiver is a typed array. // Check the receiver is a typed array.
TNode<Object> receiver = args.GetReceiver(); TNode<Object> receiver = args.GetReceiver();
GotoIf(TaggedIsSmi(receiver), &if_receiver_is_not_typedarray); GotoIf(TaggedIsSmi(receiver), &if_receiver_is_not_typedarray);
GotoIfNot(IsJSTypedArray(receiver), &if_receiver_is_not_typedarray); GotoIfNot(IsJSTypedArray(CAST(receiver)), &if_receiver_is_not_typedarray);
// Normalize offset argument (using ToInteger) and handle heap number cases. // Normalize offset argument (using ToInteger) and handle heap number cases.
TNode<Object> offset = args.GetOptionalArgumentValue(1, SmiConstant(0)); TNode<Object> offset = args.GetOptionalArgumentValue(1, SmiConstant(0));
...@@ -1256,7 +1257,7 @@ TF_BUILTIN(TypedArrayPrototypeSet, TypedArrayBuiltinsAssembler) { ...@@ -1256,7 +1257,7 @@ TF_BUILTIN(TypedArrayPrototypeSet, TypedArrayBuiltinsAssembler) {
Label call_runtime(this); Label call_runtime(this);
TNode<Object> source = args.GetOptionalArgumentValue(0); TNode<Object> source = args.GetOptionalArgumentValue(0);
GotoIf(TaggedIsSmi(source), &call_runtime); GotoIf(TaggedIsSmi(source), &call_runtime);
GotoIf(IsJSTypedArray(source), &if_source_is_typed_array); GotoIf(IsJSTypedArray(CAST(source)), &if_source_is_typed_array);
BranchIfFastJSArray(source, context, &if_source_is_fast_jsarray, BranchIfFastJSArray(source, context, &if_source_is_fast_jsarray,
&call_runtime); &call_runtime);
...@@ -1535,7 +1536,7 @@ void TypedArrayBuiltinsAssembler::GenerateTypedArrayPrototypeIterationMethod( ...@@ -1535,7 +1536,7 @@ void TypedArrayBuiltinsAssembler::GenerateTypedArrayPrototypeIterationMethod(
Label throw_bad_receiver(this, Label::kDeferred); Label throw_bad_receiver(this, Label::kDeferred);
GotoIf(TaggedIsSmi(receiver), &throw_bad_receiver); GotoIf(TaggedIsSmi(receiver), &throw_bad_receiver);
GotoIfNot(IsJSTypedArray(receiver), &throw_bad_receiver); GotoIfNot(IsJSTypedArray(CAST(receiver)), &throw_bad_receiver);
// Check if the {receiver}'s JSArrayBuffer was neutered. // Check if the {receiver}'s JSArrayBuffer was neutered.
Node* receiver_buffer = Node* receiver_buffer =
...@@ -1596,7 +1597,7 @@ TF_BUILTIN(TypedArrayOf, TypedArrayBuiltinsAssembler) { ...@@ -1596,7 +1597,7 @@ TF_BUILTIN(TypedArrayOf, TypedArrayBuiltinsAssembler) {
// 4. If IsConstructor(C) is false, throw a TypeError exception. // 4. If IsConstructor(C) is false, throw a TypeError exception.
TNode<Object> receiver = args.GetReceiver(); TNode<Object> receiver = args.GetReceiver();
GotoIf(TaggedIsSmi(receiver), &if_not_constructor); GotoIf(TaggedIsSmi(receiver), &if_not_constructor);
GotoIfNot(IsConstructor(receiver), &if_not_constructor); GotoIfNot(IsConstructor(CAST(receiver)), &if_not_constructor);
// 5. Let newObj be ? TypedArrayCreate(C, len). // 5. Let newObj be ? TypedArrayCreate(C, len).
TNode<JSTypedArray> new_typed_array = TNode<JSTypedArray> new_typed_array =
...@@ -1742,7 +1743,7 @@ TF_BUILTIN(TypedArrayFrom, TypedArrayBuiltinsAssembler) { ...@@ -1742,7 +1743,7 @@ TF_BUILTIN(TypedArrayFrom, TypedArrayBuiltinsAssembler) {
// 2. If IsConstructor(C) is false, throw a TypeError exception. // 2. If IsConstructor(C) is false, throw a TypeError exception.
TNode<Object> receiver = args.GetReceiver(); TNode<Object> receiver = args.GetReceiver();
GotoIf(TaggedIsSmi(receiver), &if_not_constructor); GotoIf(TaggedIsSmi(receiver), &if_not_constructor);
GotoIfNot(IsConstructor(receiver), &if_not_constructor); GotoIfNot(IsConstructor(CAST(receiver)), &if_not_constructor);
// 3. If mapfn is present and mapfn is not undefined, then // 3. If mapfn is present and mapfn is not undefined, then
TNode<Object> map_fn = args.GetOptionalArgumentValue(1); TNode<Object> map_fn = args.GetOptionalArgumentValue(1);
...@@ -1753,7 +1754,7 @@ TF_BUILTIN(TypedArrayFrom, TypedArrayBuiltinsAssembler) { ...@@ -1753,7 +1754,7 @@ TF_BUILTIN(TypedArrayFrom, TypedArrayBuiltinsAssembler) {
// b. Let mapping be true. // b. Let mapping be true.
// 4. Else, let mapping be false. // 4. Else, let mapping be false.
GotoIf(TaggedIsSmi(map_fn), &if_map_fn_not_callable); GotoIf(TaggedIsSmi(map_fn), &if_map_fn_not_callable);
GotoIfNot(IsCallable(map_fn), &if_map_fn_not_callable); GotoIfNot(IsCallable(CAST(map_fn)), &if_map_fn_not_callable);
mapping = Int32TrueConstant(); mapping = Int32TrueConstant();
Goto(&check_iterator); Goto(&check_iterator);
...@@ -1776,7 +1777,7 @@ TF_BUILTIN(TypedArrayFrom, TypedArrayBuiltinsAssembler) { ...@@ -1776,7 +1777,7 @@ TF_BUILTIN(TypedArrayFrom, TypedArrayBuiltinsAssembler) {
CAST(GetMethod(context, source, isolate()->factory()->iterator_symbol(), CAST(GetMethod(context, source, isolate()->factory()->iterator_symbol(),
&from_array_like)); &from_array_like));
GotoIf(TaggedIsSmi(iterator_fn), &if_iterator_fn_not_callable); GotoIf(TaggedIsSmi(iterator_fn), &if_iterator_fn_not_callable);
GotoIfNot(IsCallable(iterator_fn), &if_iterator_fn_not_callable); GotoIfNot(IsCallable(CAST(iterator_fn)), &if_iterator_fn_not_callable);
// We are using the iterator. // We are using the iterator.
Label if_length_not_smi(this, Label::kDeferred); Label if_length_not_smi(this, Label::kDeferred);
...@@ -1923,7 +1924,7 @@ TF_BUILTIN(TypedArrayPrototypeFilter, TypedArrayBuiltinsAssembler) { ...@@ -1923,7 +1924,7 @@ TF_BUILTIN(TypedArrayPrototypeFilter, TypedArrayBuiltinsAssembler) {
// 4. If IsCallable(callbackfn) is false, throw a TypeError exception. // 4. If IsCallable(callbackfn) is false, throw a TypeError exception.
TNode<Object> callbackfn = args.GetOptionalArgumentValue(0); TNode<Object> callbackfn = args.GetOptionalArgumentValue(0);
GotoIf(TaggedIsSmi(callbackfn), &if_callback_not_callable); GotoIf(TaggedIsSmi(callbackfn), &if_callback_not_callable);
GotoIfNot(IsCallable(callbackfn), &if_callback_not_callable); GotoIfNot(IsCallable(CAST(callbackfn)), &if_callback_not_callable);
// 5. If thisArg is present, let T be thisArg; else let T be undefined. // 5. If thisArg is present, let T be thisArg; else let T be undefined.
TNode<Object> this_arg = args.GetOptionalArgumentValue(1); TNode<Object> this_arg = args.GetOptionalArgumentValue(1);
......
...@@ -45,7 +45,8 @@ class TypedArrayBuiltinsAssembler : public CodeStubAssembler { ...@@ -45,7 +45,8 @@ class TypedArrayBuiltinsAssembler : public CodeStubAssembler {
TNode<JSReceiver> buffer_constructor); TNode<JSReceiver> buffer_constructor);
void ConstructByIterable(TNode<Context> context, TNode<JSTypedArray> holder, void ConstructByIterable(TNode<Context> context, TNode<JSTypedArray> holder,
TNode<JSReceiver> iterable, TNode<JSReceiver> iterable,
TNode<Object> iterator_fn, TNode<Smi> element_size); TNode<JSReceiver> iterator_fn,
TNode<Smi> element_size);
void SetupTypedArray(TNode<JSTypedArray> holder, TNode<Smi> length, void SetupTypedArray(TNode<JSTypedArray> holder, TNode<Smi> length,
TNode<Number> byte_offset, TNode<Number> byte_length); TNode<Number> byte_offset, TNode<Number> byte_length);
......
...@@ -269,8 +269,7 @@ module typed_array { ...@@ -269,8 +269,7 @@ module typed_array {
// 1. If comparefn is not undefined and IsCallable(comparefn) is false, // 1. If comparefn is not undefined and IsCallable(comparefn) is false,
// throw a TypeError exception. // throw a TypeError exception.
let comparefn_obj: Object = arguments.length > 0 ? arguments[0] : undefined; let comparefn_obj: Object = arguments.length > 0 ? arguments[0] : undefined;
if (comparefn_obj != undefined && if (comparefn_obj != undefined && !TaggedIsCallable(comparefn_obj)) {
(TaggedIsSmi(comparefn_obj) || !IsCallable(comparefn_obj))) {
ThrowTypeError(context, kBadSortComparisonFunction, comparefn_obj); ThrowTypeError(context, kBadSortComparisonFunction, comparefn_obj);
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -1654,7 +1654,8 @@ Node* InterpreterAssembler::ImportRegisterFile( ...@@ -1654,7 +1654,8 @@ Node* InterpreterAssembler::ImportRegisterFile(
Node* reg_index = IntPtrSub(IntPtrConstant(Register(0).ToOperand()), index); Node* reg_index = IntPtrSub(IntPtrConstant(Register(0).ToOperand()), index);
StoreRegister(value, reg_index); StoreRegister(value, reg_index);
StoreFixedArrayElement(array, index, StaleRegisterConstant()); StoreFixedArrayElement(array, index,
LoadRoot(Heap::kStaleRegisterRootIndex));
var_index.Bind(IntPtrAdd(index, IntPtrConstant(1))); var_index.Bind(IntPtrAdd(index, IntPtrConstant(1)));
Goto(&loop); Goto(&loop);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment