Commit 20d29a36 authored by Tobias Tebbi's avatar Tobias Tebbi Committed by Commit Bot

[torque] check TNode return types of CSA macros

This disallows using CSA macros from Torque that have a Node* return
type instead of TNode<>. By enforcing CSA types at the boundary between
CSA and Torque, we can ensure that the Torque types and the CSA types
match.

As a drive-by, this CL adds a bit more of CSA typing where it made sense.

Bug: v8:7793, v8:6949

Change-Id: I12ea0337c628105ea3c420be747ae50d3a172547
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1660481
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62293}
parent 31a951d8
...@@ -56,7 +56,7 @@ namespace array_join { ...@@ -56,7 +56,7 @@ namespace array_join {
assert(!IsDetachedBuffer(typedArray.buffer)); assert(!IsDetachedBuffer(typedArray.buffer));
return typed_array::LoadFixedTypedArrayElementAsTagged( return typed_array::LoadFixedTypedArrayElementAsTagged(
typedArray.data_ptr, UnsafeCast<Smi>(k), typedArray.data_ptr, UnsafeCast<Smi>(k),
typed_array::KindForArrayType<T>(), SMI_PARAMETERS); typed_array::KindForArrayType<T>());
} }
transitioning builtin ConvertToLocaleString( transitioning builtin ConvertToLocaleString(
......
...@@ -189,9 +189,7 @@ type LayoutDescriptor extends ByteArray ...@@ -189,9 +189,7 @@ type LayoutDescriptor extends ByteArray
type TransitionArray extends WeakFixedArray type TransitionArray extends WeakFixedArray
generates 'TNode<TransitionArray>'; generates 'TNode<TransitionArray>';
// InstanceType actually extends uint16, but a bunch of methods in type InstanceType extends uint16 constexpr 'InstanceType';
// CodeStubAssembler expect a TNode<Int32T>, so keeping it signed for now.
type InstanceType extends int16 constexpr 'InstanceType';
extern class Map extends HeapObject { extern class Map extends HeapObject {
instance_size_in_words: uint8; instance_size_in_words: uint8;
...@@ -342,8 +340,8 @@ extern class JSFunction extends JSObject { ...@@ -342,8 +340,8 @@ extern class JSFunction extends JSObject {
} }
extern class JSProxy extends JSReceiver { extern class JSProxy extends JSReceiver {
target: Object; target: JSReceiver | Null;
handler: Object; handler: JSReceiver | Null;
} }
// Just a starting shape for JSObject; properties can move after initialization. // Just a starting shape for JSObject; properties can move after initialization.
...@@ -763,8 +761,6 @@ type LanguageMode extends Smi constexpr 'LanguageMode'; ...@@ -763,8 +761,6 @@ type LanguageMode extends Smi constexpr 'LanguageMode';
type ExtractFixedArrayFlags type ExtractFixedArrayFlags
generates 'TNode<Smi>' generates 'TNode<Smi>'
constexpr 'CodeStubAssembler::ExtractFixedArrayFlags'; constexpr 'CodeStubAssembler::ExtractFixedArrayFlags';
type ParameterMode
generates 'TNode<Int32T>' constexpr 'ParameterMode';
type WriteBarrierMode type WriteBarrierMode
generates 'TNode<Int32T>' constexpr 'WriteBarrierMode'; generates 'TNode<Int32T>' constexpr 'WriteBarrierMode';
...@@ -1128,11 +1124,6 @@ const false: constexpr bool generates 'false'; ...@@ -1128,11 +1124,6 @@ const false: constexpr bool generates 'false';
const kStrict: constexpr LanguageMode generates 'LanguageMode::kStrict'; const kStrict: constexpr LanguageMode generates 'LanguageMode::kStrict';
const kSloppy: constexpr LanguageMode generates 'LanguageMode::kSloppy'; const kSloppy: constexpr LanguageMode generates 'LanguageMode::kSloppy';
const SMI_PARAMETERS: constexpr ParameterMode
generates 'CodeStubAssembler::SMI_PARAMETERS';
const INTPTR_PARAMETERS: constexpr ParameterMode
generates 'CodeStubAssembler::INTPTR_PARAMETERS';
const SKIP_WRITE_BARRIER: const SKIP_WRITE_BARRIER:
constexpr WriteBarrierMode generates 'SKIP_WRITE_BARRIER'; constexpr WriteBarrierMode generates 'SKIP_WRITE_BARRIER';
const UNSAFE_SKIP_WRITE_BARRIER: const UNSAFE_SKIP_WRITE_BARRIER:
...@@ -2059,7 +2050,7 @@ extern macro ChangeInt32ToIntPtr(int32): intptr; // Sign-extends. ...@@ -2059,7 +2050,7 @@ extern macro ChangeInt32ToIntPtr(int32): intptr; // Sign-extends.
extern macro ChangeUint32ToWord(uint32): uintptr; // Doesn't sign-extend. extern macro ChangeUint32ToWord(uint32): uintptr; // Doesn't sign-extend.
extern macro LoadNativeContext(Context): NativeContext; extern macro LoadNativeContext(Context): NativeContext;
extern macro TruncateFloat64ToFloat32(float64): float32; extern macro TruncateFloat64ToFloat32(float64): float32;
extern macro TruncateHeapNumberValueToWord32(Number): int32; extern macro TruncateHeapNumberValueToWord32(HeapNumber): int32;
extern macro LoadJSArrayElementsMap(constexpr ElementsKind, Context): Map; extern macro LoadJSArrayElementsMap(constexpr ElementsKind, Context): Map;
extern macro LoadJSArrayElementsMap(ElementsKind, Context): Map; extern macro LoadJSArrayElementsMap(ElementsKind, Context): Map;
extern macro ChangeNonnegativeNumberToUintPtr(Number): uintptr; extern macro ChangeNonnegativeNumberToUintPtr(Number): uintptr;
...@@ -2487,7 +2478,7 @@ extern macro AllocateJSArray(constexpr ElementsKind, Map, Smi, Smi): JSArray; ...@@ -2487,7 +2478,7 @@ extern macro AllocateJSArray(constexpr ElementsKind, Map, Smi, Smi): JSArray;
extern macro AllocateJSArray(Map, FixedArrayBase, Smi): JSArray; extern macro AllocateJSArray(Map, FixedArrayBase, Smi): JSArray;
extern macro AllocateJSObjectFromMap(Map): JSObject; extern macro AllocateJSObjectFromMap(Map): JSObject;
extern macro AllocateJSObjectFromMap( extern macro AllocateJSObjectFromMap(
Map, FixedArray, FixedArray, constexpr AllocationFlags, Map, FixedArray | PropertyArray, FixedArray, constexpr AllocationFlags,
constexpr SlackTrackingMode): JSObject; constexpr SlackTrackingMode): JSObject;
extern macro LoadDoubleWithHoleCheck(FixedDoubleArray, Smi): float64 extern macro LoadDoubleWithHoleCheck(FixedDoubleArray, Smi): float64
......
...@@ -266,7 +266,8 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewSloppyArguments(Node* context, ...@@ -266,7 +266,8 @@ Node* ArgumentsBuiltinsAssembler::EmitFastNewSloppyArguments(Node* context,
var_list1, argument_offset, mapped_offset, var_list1, argument_offset, mapped_offset,
[this, elements, &current_argument](Node* offset) { [this, elements, &current_argument](Node* offset) {
Increment(&current_argument, kSystemPointerSize); Increment(&current_argument, kSystemPointerSize);
Node* arg = LoadBufferObject(current_argument.value(), 0); Node* arg = LoadBufferObject(
UncheckedCast<RawPtrT>(current_argument.value()), 0);
StoreNoWriteBarrier(MachineRepresentation::kTagged, elements, offset, StoreNoWriteBarrier(MachineRepresentation::kTagged, elements, offset,
arg); arg);
}, },
......
...@@ -227,7 +227,7 @@ ArrayBuiltinsAssembler::ArrayBuiltinsAssembler( ...@@ -227,7 +227,7 @@ ArrayBuiltinsAssembler::ArrayBuiltinsAssembler(
VariableList list({&a_, &k_, &to_}, zone()); VariableList list({&a_, &k_, &to_}, zone());
FastLoopBody body = [&](Node* index) { FastLoopBody body = [&](Node* index) {
GotoIf(IsDetachedBuffer(array_buffer), detached); GotoIf(IsDetachedBuffer(CAST(array_buffer)), detached);
TNode<RawPtrT> data_ptr = LoadJSTypedArrayBackingStore(typed_array); TNode<RawPtrT> data_ptr = LoadJSTypedArrayBackingStore(typed_array);
Node* value = LoadFixedTypedArrayElementAsTagged( Node* value = LoadFixedTypedArrayElementAsTagged(
data_ptr, index, source_elements_kind_, SMI_PARAMETERS); data_ptr, index, source_elements_kind_, SMI_PARAMETERS);
...@@ -402,7 +402,7 @@ TF_BUILTIN(ArrayPrototypePush, CodeStubAssembler) { ...@@ -402,7 +402,7 @@ TF_BUILTIN(ArrayPrototypePush, CodeStubAssembler) {
CodeStubArguments args(this, ChangeInt32ToIntPtr(argc)); CodeStubArguments args(this, ChangeInt32ToIntPtr(argc));
TNode<Object> receiver = args.GetReceiver(); TNode<Object> receiver = args.GetReceiver();
TNode<JSArray> array_receiver; TNode<JSArray> array_receiver;
Node* kind = nullptr; TNode<Int32T> kind;
Label fast(this); Label fast(this);
BranchIfFastJSArray(receiver, context, &fast, &runtime); BranchIfFastJSArray(receiver, context, &fast, &runtime);
...@@ -709,19 +709,19 @@ TF_BUILTIN(ArrayFrom, ArrayPopulatorAssembler) { ...@@ -709,19 +709,19 @@ TF_BUILTIN(ArrayFrom, ArrayPopulatorAssembler) {
iterator_assembler.GetIterator(context, items, iterator_method); iterator_assembler.GetIterator(context, items, iterator_method);
TNode<Context> native_context = LoadNativeContext(context); TNode<Context> native_context = LoadNativeContext(context);
TNode<Object> fast_iterator_result_map = TNode<Map> fast_iterator_result_map = CAST(
LoadContextElement(native_context, Context::ITERATOR_RESULT_MAP_INDEX); LoadContextElement(native_context, Context::ITERATOR_RESULT_MAP_INDEX));
Goto(&loop); Goto(&loop);
BIND(&loop); BIND(&loop);
{ {
// Loop while iterator is not done. // Loop while iterator is not done.
TNode<Object> next = iterator_assembler.IteratorStep( TNode<JSReceiver> next = iterator_assembler.IteratorStep(
context, iterator_record, &loop_done, fast_iterator_result_map); context, iterator_record, &loop_done, fast_iterator_result_map);
TVARIABLE(Object, value, TVARIABLE(Object, value,
CAST(iterator_assembler.IteratorValue( iterator_assembler.IteratorValue(context, next,
context, next, fast_iterator_result_map))); fast_iterator_result_map));
// If a map_function is supplied then call it (using this_arg as // If a map_function is supplied then call it (using this_arg as
// receiver), on the value returned from the iterator. Exceptions are // receiver), on the value returned from the iterator. Exceptions are
...@@ -2035,8 +2035,7 @@ void ArrayBuiltinsAssembler::CreateArrayDispatchSingleArgument( ...@@ -2035,8 +2035,7 @@ void ArrayBuiltinsAssembler::CreateArrayDispatchSingleArgument(
&normal_sequence); &normal_sequence);
{ {
// Make elements kind holey and update elements kind in the type info. // Make elements kind holey and update elements kind in the type info.
var_elements_kind = var_elements_kind = Word32Or(var_elements_kind.value(), Int32Constant(1));
Signed(Word32Or(var_elements_kind.value(), Int32Constant(1)));
StoreObjectFieldNoWriteBarrier( StoreObjectFieldNoWriteBarrier(
allocation_site, AllocationSite::kTransitionInfoOrBoilerplateOffset, allocation_site, AllocationSite::kTransitionInfoOrBoilerplateOffset,
SmiOr(transition_info, SmiConstant(fast_elements_kind_holey_mask))); SmiOr(transition_info, SmiConstant(fast_elements_kind_holey_mask)));
......
...@@ -15,22 +15,23 @@ namespace internal { ...@@ -15,22 +15,23 @@ namespace internal {
// ES6 #sec-boolean.prototype.tostring // ES6 #sec-boolean.prototype.tostring
TF_BUILTIN(BooleanPrototypeToString, CodeStubAssembler) { TF_BUILTIN(BooleanPrototypeToString, CodeStubAssembler) {
Node* context = Parameter(Descriptor::kContext); TNode<Context> context = CAST(Parameter(Descriptor::kContext));
Node* receiver = Parameter(Descriptor::kReceiver); TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
Node* value = ToThisValue(context, receiver, PrimitiveType::kBoolean, TNode<Oddball> value =
"Boolean.prototype.toString"); CAST(ToThisValue(context, receiver, PrimitiveType::kBoolean,
Node* result = LoadObjectField(value, Oddball::kToStringOffset); "Boolean.prototype.toString"));
TNode<String> result = CAST(LoadObjectField(value, Oddball::kToStringOffset));
Return(result); Return(result);
} }
// ES6 #sec-boolean.prototype.valueof // ES6 #sec-boolean.prototype.valueof
TF_BUILTIN(BooleanPrototypeValueOf, CodeStubAssembler) { TF_BUILTIN(BooleanPrototypeValueOf, CodeStubAssembler) {
Node* context = Parameter(Descriptor::kContext); TNode<Context> context = CAST(Parameter(Descriptor::kContext));
Node* receiver = Parameter(Descriptor::kReceiver); TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
Node* result = ToThisValue(context, receiver, PrimitiveType::kBoolean, TNode<Oddball> result = CAST(ToThisValue(
"Boolean.prototype.valueOf"); context, receiver, PrimitiveType::kBoolean, "Boolean.prototype.valueOf"));
Return(result); Return(result);
} }
......
...@@ -66,19 +66,19 @@ class BaseCollectionsAssembler : public CodeStubAssembler { ...@@ -66,19 +66,19 @@ class BaseCollectionsAssembler : public CodeStubAssembler {
TNode<Object> iterable); TNode<Object> iterable);
// Constructs a collection instance. Choosing a fast path when possible. // Constructs a collection instance. Choosing a fast path when possible.
TNode<Object> AllocateJSCollection(TNode<Context> context, TNode<JSObject> AllocateJSCollection(TNode<Context> context,
TNode<JSFunction> constructor, TNode<JSFunction> constructor,
TNode<Object> new_target); TNode<JSReceiver> new_target);
// Fast path for constructing a collection instance if the constructor // Fast path for constructing a collection instance if the constructor
// function has not been modified. // function has not been modified.
TNode<Object> AllocateJSCollectionFast(TNode<HeapObject> constructor); TNode<JSObject> AllocateJSCollectionFast(TNode<JSFunction> constructor);
// Fallback for constructing a collection instance if the constructor function // Fallback for constructing a collection instance if the constructor function
// has been modified. // has been modified.
TNode<Object> AllocateJSCollectionSlow(TNode<Context> context, TNode<JSObject> AllocateJSCollectionSlow(TNode<Context> context,
TNode<JSFunction> constructor, TNode<JSFunction> constructor,
TNode<Object> new_target); TNode<JSReceiver> new_target);
// Allocates the backing store for a collection. // Allocates the backing store for a collection.
virtual TNode<Object> AllocateTable(Variant variant, TNode<Context> context, virtual TNode<Object> AllocateTable(Variant variant, TNode<Context> context,
...@@ -320,17 +320,17 @@ void BaseCollectionsAssembler::AddConstructorEntriesFromIterable( ...@@ -320,17 +320,17 @@ void BaseCollectionsAssembler::AddConstructorEntriesFromIterable(
CSA_ASSERT(this, Word32BinaryNot(IsUndefined(iterator.object))); CSA_ASSERT(this, Word32BinaryNot(IsUndefined(iterator.object)));
TNode<Object> fast_iterator_result_map = TNode<Map> fast_iterator_result_map = CAST(
LoadContextElement(native_context, Context::ITERATOR_RESULT_MAP_INDEX); LoadContextElement(native_context, Context::ITERATOR_RESULT_MAP_INDEX));
TVARIABLE(Object, var_exception); TVARIABLE(Object, var_exception);
Goto(&loop); Goto(&loop);
BIND(&loop); BIND(&loop);
{ {
TNode<Object> next = iterator_assembler.IteratorStep( TNode<JSReceiver> next = iterator_assembler.IteratorStep(
context, iterator, &exit, fast_iterator_result_map); context, iterator, &exit, fast_iterator_result_map);
TNode<Object> next_value = CAST(iterator_assembler.IteratorValue( TNode<Object> next_value = iterator_assembler.IteratorValue(
context, next, fast_iterator_result_map)); context, next, fast_iterator_result_map);
AddConstructorEntry(variant, context, collection, add_func, next_value, AddConstructorEntry(variant, context, collection, add_func, next_value,
nullptr, &if_exception, &var_exception); nullptr, &if_exception, &var_exception);
Goto(&loop); Goto(&loop);
...@@ -367,33 +367,33 @@ void BaseCollectionsAssembler::GotoIfInitialAddFunctionModified( ...@@ -367,33 +367,33 @@ void BaseCollectionsAssembler::GotoIfInitialAddFunctionModified(
GetAddFunctionNameIndex(variant), if_modified); GetAddFunctionNameIndex(variant), if_modified);
} }
TNode<Object> BaseCollectionsAssembler::AllocateJSCollection( TNode<JSObject> BaseCollectionsAssembler::AllocateJSCollection(
TNode<Context> context, TNode<JSFunction> constructor, TNode<Context> context, TNode<JSFunction> constructor,
TNode<Object> new_target) { TNode<JSReceiver> new_target) {
TNode<BoolT> is_target_unmodified = WordEqual(constructor, new_target); TNode<BoolT> is_target_unmodified = WordEqual(constructor, new_target);
return Select<Object>(is_target_unmodified, return Select<JSObject>(
[=] { return AllocateJSCollectionFast(constructor); }, is_target_unmodified,
[=] { [=] { return AllocateJSCollectionFast(constructor); },
return AllocateJSCollectionSlow(context, constructor, [=] {
new_target); return AllocateJSCollectionSlow(context, constructor, new_target);
}); });
} }
TNode<Object> BaseCollectionsAssembler::AllocateJSCollectionFast( TNode<JSObject> BaseCollectionsAssembler::AllocateJSCollectionFast(
TNode<HeapObject> constructor) { TNode<JSFunction> constructor) {
CSA_ASSERT(this, IsConstructorMap(LoadMap(constructor))); CSA_ASSERT(this, IsConstructorMap(LoadMap(constructor)));
TNode<Object> initial_map = TNode<Map> initial_map =
LoadObjectField(constructor, JSFunction::kPrototypeOrInitialMapOffset); CAST(LoadJSFunctionPrototypeOrInitialMap(constructor));
return CAST(AllocateJSObjectFromMap(initial_map)); return AllocateJSObjectFromMap(initial_map);
} }
TNode<Object> BaseCollectionsAssembler::AllocateJSCollectionSlow( TNode<JSObject> BaseCollectionsAssembler::AllocateJSCollectionSlow(
TNode<Context> context, TNode<JSFunction> constructor, TNode<Context> context, TNode<JSFunction> constructor,
TNode<Object> new_target) { TNode<JSReceiver> new_target) {
ConstructorBuiltinsAssembler constructor_assembler(this->state()); ConstructorBuiltinsAssembler constructor_assembler(this->state());
return CAST(constructor_assembler.EmitFastNewObject(context, constructor, return constructor_assembler.EmitFastNewObject(context, constructor,
new_target)); new_target);
} }
void BaseCollectionsAssembler::GenerateConstructor( void BaseCollectionsAssembler::GenerateConstructor(
...@@ -408,7 +408,7 @@ void BaseCollectionsAssembler::GenerateConstructor( ...@@ -408,7 +408,7 @@ void BaseCollectionsAssembler::GenerateConstructor(
TNode<Context> native_context = LoadNativeContext(context); TNode<Context> native_context = LoadNativeContext(context);
TNode<Object> collection = AllocateJSCollection( TNode<Object> collection = AllocateJSCollection(
context, GetConstructor(variant, native_context), new_target); context, GetConstructor(variant, native_context), CAST(new_target));
AddConstructorEntries(variant, context, native_context, collection, iterable); AddConstructorEntries(variant, context, native_context, collection, iterable);
Return(collection); Return(collection);
......
...@@ -147,44 +147,40 @@ TF_BUILTIN(FastNewClosure, ConstructorBuiltinsAssembler) { ...@@ -147,44 +147,40 @@ TF_BUILTIN(FastNewClosure, ConstructorBuiltinsAssembler) {
} }
TF_BUILTIN(FastNewObject, ConstructorBuiltinsAssembler) { TF_BUILTIN(FastNewObject, ConstructorBuiltinsAssembler) {
Node* context = Parameter(Descriptor::kContext); TNode<Context> context = CAST(Parameter(Descriptor::kContext));
Node* target = Parameter(Descriptor::kTarget); TNode<JSFunction> target = CAST(Parameter(Descriptor::kTarget));
Node* new_target = Parameter(Descriptor::kNewTarget); TNode<JSReceiver> new_target = CAST(Parameter(Descriptor::kNewTarget));
Label call_runtime(this); Label call_runtime(this);
Node* result = EmitFastNewObject(context, target, new_target, &call_runtime); TNode<JSObject> result =
EmitFastNewObject(context, target, new_target, &call_runtime);
Return(result); Return(result);
BIND(&call_runtime); BIND(&call_runtime);
TailCallRuntime(Runtime::kNewObject, context, target, new_target); TailCallRuntime(Runtime::kNewObject, context, target, new_target);
} }
Node* ConstructorBuiltinsAssembler::EmitFastNewObject(Node* context, compiler::TNode<JSObject> ConstructorBuiltinsAssembler::EmitFastNewObject(
Node* target, SloppyTNode<Context> context, SloppyTNode<JSFunction> target,
Node* new_target) { SloppyTNode<JSReceiver> new_target) {
VARIABLE(var_obj, MachineRepresentation::kTagged); TVARIABLE(JSObject, var_obj);
Label call_runtime(this), end(this); Label call_runtime(this), end(this);
Node* result = EmitFastNewObject(context, target, new_target, &call_runtime); var_obj = EmitFastNewObject(context, target, new_target, &call_runtime);
var_obj.Bind(result);
Goto(&end); Goto(&end);
BIND(&call_runtime); BIND(&call_runtime);
var_obj.Bind(CallRuntime(Runtime::kNewObject, context, target, new_target)); var_obj = CAST(CallRuntime(Runtime::kNewObject, context, target, new_target));
Goto(&end); Goto(&end);
BIND(&end); BIND(&end);
return var_obj.value(); return var_obj.value();
} }
Node* ConstructorBuiltinsAssembler::EmitFastNewObject(Node* context, compiler::TNode<JSObject> ConstructorBuiltinsAssembler::EmitFastNewObject(
Node* target, SloppyTNode<Context> context, SloppyTNode<JSFunction> target,
Node* new_target, SloppyTNode<JSReceiver> new_target, Label* call_runtime) {
Label* call_runtime) {
CSA_ASSERT(this, HasInstanceType(target, JS_FUNCTION_TYPE));
CSA_ASSERT(this, IsJSReceiver(new_target));
// Verify that the new target is a JSFunction. // Verify that the new target is a JSFunction.
Label fast(this), end(this); Label fast(this), end(this);
GotoIf(HasInstanceType(new_target, JS_FUNCTION_TYPE), &fast); GotoIf(HasInstanceType(new_target, JS_FUNCTION_TYPE), &fast);
......
...@@ -31,10 +31,14 @@ class ConstructorBuiltinsAssembler : public CodeStubAssembler { ...@@ -31,10 +31,14 @@ class ConstructorBuiltinsAssembler : public CodeStubAssembler {
Label* call_runtime); Label* call_runtime);
Node* EmitCreateEmptyObjectLiteral(Node* context); Node* EmitCreateEmptyObjectLiteral(Node* context);
Node* EmitFastNewObject(Node* context, Node* target, Node* new_target); TNode<JSObject> EmitFastNewObject(SloppyTNode<Context> context,
SloppyTNode<JSFunction> target,
Node* EmitFastNewObject(Node* context, Node* target, Node* new_target, SloppyTNode<JSReceiver> new_target);
Label* call_runtime);
TNode<JSObject> EmitFastNewObject(SloppyTNode<Context> context,
SloppyTNode<JSFunction> target,
SloppyTNode<JSReceiver> new_target,
Label* call_runtime);
}; };
} // namespace internal } // namespace internal
......
...@@ -17,13 +17,13 @@ class DataViewBuiltinsAssembler : public CodeStubAssembler { ...@@ -17,13 +17,13 @@ class DataViewBuiltinsAssembler : public CodeStubAssembler {
explicit DataViewBuiltinsAssembler(compiler::CodeAssemblerState* state) explicit DataViewBuiltinsAssembler(compiler::CodeAssemblerState* state)
: CodeStubAssembler(state) {} : CodeStubAssembler(state) {}
TNode<Int32T> LoadUint8(TNode<RawPtrT> data_pointer, TNode<UintPtrT> offset) { TNode<Uint8T> LoadUint8(TNode<RawPtrT> data_pointer, TNode<UintPtrT> offset) {
return UncheckedCast<Int32T>( return UncheckedCast<Uint8T>(
Load(MachineType::Uint8(), data_pointer, offset)); Load(MachineType::Uint8(), data_pointer, offset));
} }
TNode<Int32T> LoadInt8(TNode<RawPtrT> data_pointer, TNode<UintPtrT> offset) { TNode<Int8T> LoadInt8(TNode<RawPtrT> data_pointer, TNode<UintPtrT> offset) {
return UncheckedCast<Int32T>( return UncheckedCast<Int8T>(
Load(MachineType::Int8(), data_pointer, offset)); Load(MachineType::Int8(), data_pointer, offset));
} }
......
...@@ -75,7 +75,7 @@ IteratorRecord IteratorBuiltinsAssembler::GetIterator(Node* context, ...@@ -75,7 +75,7 @@ IteratorRecord IteratorBuiltinsAssembler::GetIterator(Node* context,
} }
} }
TNode<Object> IteratorBuiltinsAssembler::IteratorStep( TNode<JSReceiver> IteratorBuiltinsAssembler::IteratorStep(
Node* context, const IteratorRecord& iterator, Label* if_done, Node* context, const IteratorRecord& iterator, Label* if_done,
Node* fast_iterator_result_map, Label* if_exception, Variable* exception) { Node* fast_iterator_result_map, Label* if_exception, Variable* exception) {
DCHECK_NOT_NULL(if_done); DCHECK_NOT_NULL(if_done);
...@@ -125,23 +125,21 @@ TNode<Object> IteratorBuiltinsAssembler::IteratorStep( ...@@ -125,23 +125,21 @@ TNode<Object> IteratorBuiltinsAssembler::IteratorStep(
} }
BIND(&return_result); BIND(&return_result);
return UncheckedCast<Object>(result); return CAST(result);
} }
Node* IteratorBuiltinsAssembler::IteratorValue(Node* context, Node* result, TNode<Object> IteratorBuiltinsAssembler::IteratorValue(
Node* fast_iterator_result_map, TNode<Context> context, TNode<JSReceiver> result,
Label* if_exception, base::Optional<TNode<Map>> fast_iterator_result_map, Label* if_exception,
Variable* exception) { Variable* exception) {
CSA_ASSERT(this, IsJSReceiver(result));
Label exit(this); Label exit(this);
VARIABLE(var_value, MachineRepresentation::kTagged); TVARIABLE(Object, var_value);
if (fast_iterator_result_map != nullptr) { if (fast_iterator_result_map) {
// Fast iterator result case: // Fast iterator result case:
Label if_generic(this); Label if_generic(this);
Node* map = LoadMap(result); Node* map = LoadMap(result);
GotoIfNot(WordEqual(map, fast_iterator_result_map), &if_generic); GotoIfNot(WordEqual(map, *fast_iterator_result_map), &if_generic);
var_value.Bind(LoadObjectField(result, JSIteratorResult::kValueOffset)); var_value = LoadObjectField(result, JSIteratorResult::kValueOffset);
Goto(&exit); Goto(&exit);
BIND(&if_generic); BIND(&if_generic);
...@@ -149,9 +147,10 @@ Node* IteratorBuiltinsAssembler::IteratorValue(Node* context, Node* result, ...@@ -149,9 +147,10 @@ Node* IteratorBuiltinsAssembler::IteratorValue(Node* context, Node* result,
// Generic iterator result case: // Generic iterator result case:
{ {
Node* value = GetProperty(context, result, factory()->value_string()); TNode<Object> value =
GetProperty(context, result, factory()->value_string());
GotoIfException(value, if_exception, exception); GotoIfException(value, if_exception, exception);
var_value.Bind(value); var_value = value;
Goto(&exit); Goto(&exit);
} }
...@@ -217,10 +216,10 @@ TNode<JSArray> IteratorBuiltinsAssembler::IterableToList( ...@@ -217,10 +216,10 @@ TNode<JSArray> IteratorBuiltinsAssembler::IterableToList(
BIND(&loop_start); BIND(&loop_start);
{ {
// a. Set next to ? IteratorStep(iteratorRecord). // a. Set next to ? IteratorStep(iteratorRecord).
TNode<Object> next = IteratorStep(context, iterator_record, &done); TNode<JSReceiver> next = IteratorStep(context, iterator_record, &done);
// b. If next is not false, then // b. If next is not false, then
// i. Let nextValue be ? IteratorValue(next). // i. Let nextValue be ? IteratorValue(next).
TNode<Object> next_value = CAST(IteratorValue(context, next)); TNode<Object> next_value = IteratorValue(context, next);
// ii. Append nextValue to the end of the List values. // ii. Append nextValue to the end of the List values.
values.Push(next_value); values.Push(next_value);
Goto(&loop_start); Goto(&loop_start);
......
...@@ -32,18 +32,19 @@ class IteratorBuiltinsAssembler : public CodeStubAssembler { ...@@ -32,18 +32,19 @@ class IteratorBuiltinsAssembler : public CodeStubAssembler {
Variable* exception = nullptr); Variable* exception = nullptr);
// https://tc39.github.io/ecma262/#sec-iteratorstep // https://tc39.github.io/ecma262/#sec-iteratorstep
// Returns `false` if the iterator is done, otherwise returns an // If the iterator is done, goto {if_done}, otherwise returns an iterator
// iterator result. // result.
// `fast_iterator_result_map` refers to the map for the JSIteratorResult // `fast_iterator_result_map` refers to the map for the JSIteratorResult
// object, loaded from the native context. // object, loaded from the native context.
TNode<Object> IteratorStep(Node* context, const IteratorRecord& iterator, TNode<JSReceiver> IteratorStep(Node* context, const IteratorRecord& iterator,
Label* if_done, Label* if_done,
Node* fast_iterator_result_map = nullptr, Node* fast_iterator_result_map = nullptr,
Label* if_exception = nullptr, Label* if_exception = nullptr,
Variable* exception = nullptr); Variable* exception = nullptr);
TNode<Object> IteratorStep(Node* context, const IteratorRecord& iterator, TNode<JSReceiver> IteratorStep(Node* context, const IteratorRecord& iterator,
Node* fast_iterator_result_map, Label* if_done) { Node* fast_iterator_result_map,
Label* if_done) {
return IteratorStep(context, iterator, if_done, fast_iterator_result_map); return IteratorStep(context, iterator, if_done, fast_iterator_result_map);
} }
...@@ -51,10 +52,10 @@ class IteratorBuiltinsAssembler : public CodeStubAssembler { ...@@ -51,10 +52,10 @@ class IteratorBuiltinsAssembler : public CodeStubAssembler {
// Return the `value` field from an iterator. // Return the `value` field from an iterator.
// `fast_iterator_result_map` refers to the map for the JSIteratorResult // `fast_iterator_result_map` refers to the map for the JSIteratorResult
// object, loaded from the native context. // object, loaded from the native context.
Node* IteratorValue(Node* context, Node* result, TNode<Object> IteratorValue(
Node* fast_iterator_result_map = nullptr, TNode<Context> context, TNode<JSReceiver> result,
Label* if_exception = nullptr, base::Optional<TNode<Map>> fast_iterator_result_map = base::nullopt,
Variable* exception = nullptr); Label* if_exception = nullptr, Variable* exception = nullptr);
// https://tc39.github.io/ecma262/#sec-iteratorclose // https://tc39.github.io/ecma262/#sec-iteratorclose
void IteratorCloseOnException(Node* context, const IteratorRecord& iterator, void IteratorCloseOnException(Node* context, const IteratorRecord& iterator,
......
...@@ -315,8 +315,8 @@ TF_BUILTIN(NumberParseInt, CodeStubAssembler) { ...@@ -315,8 +315,8 @@ TF_BUILTIN(NumberParseInt, CodeStubAssembler) {
// ES6 #sec-number.prototype.valueof // ES6 #sec-number.prototype.valueof
TF_BUILTIN(NumberPrototypeValueOf, CodeStubAssembler) { TF_BUILTIN(NumberPrototypeValueOf, CodeStubAssembler) {
Node* context = Parameter(Descriptor::kContext); TNode<Context> context = CAST(Parameter(Descriptor::kContext));
Node* receiver = Parameter(Descriptor::kReceiver); TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
Node* result = ToThisValue(context, receiver, PrimitiveType::kNumber, Node* result = ToThisValue(context, receiver, PrimitiveType::kNumber,
"Number.prototype.valueOf"); "Number.prototype.valueOf");
...@@ -996,8 +996,8 @@ TF_BUILTIN(Equal, CodeStubAssembler) { ...@@ -996,8 +996,8 @@ TF_BUILTIN(Equal, CodeStubAssembler) {
} }
TF_BUILTIN(StrictEqual, CodeStubAssembler) { TF_BUILTIN(StrictEqual, CodeStubAssembler) {
Node* lhs = Parameter(Descriptor::kLeft); TNode<Object> lhs = CAST(Parameter(Descriptor::kLeft));
Node* rhs = Parameter(Descriptor::kRight); TNode<Object> rhs = CAST(Parameter(Descriptor::kRight));
Return(StrictEqual(lhs, rhs)); Return(StrictEqual(lhs, rhs));
} }
......
...@@ -2077,9 +2077,9 @@ Node* PromiseBuiltinsAssembler::PerformPromiseAll( ...@@ -2077,9 +2077,9 @@ Node* PromiseBuiltinsAssembler::PerformPromiseAll(
// Let next be IteratorStep(iteratorRecord.[[Iterator]]). // Let next be IteratorStep(iteratorRecord.[[Iterator]]).
// If next is an abrupt completion, set iteratorRecord.[[Done]] to true. // If next is an abrupt completion, set iteratorRecord.[[Done]] to true.
// ReturnIfAbrupt(next). // ReturnIfAbrupt(next).
Node* const fast_iterator_result_map = TNode<Map> const fast_iterator_result_map = CAST(
LoadContextElement(native_context, Context::ITERATOR_RESULT_MAP_INDEX); LoadContextElement(native_context, Context::ITERATOR_RESULT_MAP_INDEX));
Node* const next = iter_assembler.IteratorStep( TNode<JSReceiver> const next = iter_assembler.IteratorStep(
native_context, iterator, &done_loop, fast_iterator_result_map, native_context, iterator, &done_loop, fast_iterator_result_map,
if_exception, var_exception); if_exception, var_exception);
...@@ -2087,7 +2087,7 @@ Node* PromiseBuiltinsAssembler::PerformPromiseAll( ...@@ -2087,7 +2087,7 @@ Node* PromiseBuiltinsAssembler::PerformPromiseAll(
// If nextValue is an abrupt completion, set iteratorRecord.[[Done]] to // If nextValue is an abrupt completion, set iteratorRecord.[[Done]] to
// true. // true.
// ReturnIfAbrupt(nextValue). // ReturnIfAbrupt(nextValue).
Node* const next_value = iter_assembler.IteratorValue( TNode<Object> const next_value = iter_assembler.IteratorValue(
native_context, next, fast_iterator_result_map, if_exception, native_context, next, fast_iterator_result_map, if_exception,
var_exception); var_exception);
...@@ -2148,7 +2148,7 @@ Node* PromiseBuiltinsAssembler::PerformPromiseAll( ...@@ -2148,7 +2148,7 @@ Node* PromiseBuiltinsAssembler::PerformPromiseAll(
&if_slow); &if_slow);
GotoIf(IsPromiseSpeciesProtectorCellInvalid(), &if_slow); GotoIf(IsPromiseSpeciesProtectorCellInvalid(), &if_slow);
GotoIf(TaggedIsSmi(next_value), &if_slow); GotoIf(TaggedIsSmi(next_value), &if_slow);
Node* const next_value_map = LoadMap(next_value); Node* const next_value_map = LoadMap(CAST(next_value));
BranchIfPromiseThenLookupChainIntact(native_context, next_value_map, BranchIfPromiseThenLookupChainIntact(native_context, next_value_map,
&if_fast, &if_slow); &if_fast, &if_slow);
...@@ -2526,8 +2526,7 @@ TF_BUILTIN(PromiseAllSettledResolveElementClosure, PromiseBuiltinsAssembler) { ...@@ -2526,8 +2526,7 @@ TF_BUILTIN(PromiseAllSettledResolveElementClosure, PromiseBuiltinsAssembler) {
LoadContextElement(native_context, Context::OBJECT_FUNCTION_INDEX)); LoadContextElement(native_context, Context::OBJECT_FUNCTION_INDEX));
TNode<Map> object_function_map = Cast(LoadObjectField( TNode<Map> object_function_map = Cast(LoadObjectField(
object_function, JSFunction::kPrototypeOrInitialMapOffset)); object_function, JSFunction::kPrototypeOrInitialMapOffset));
TNode<JSObject> obj = TNode<JSObject> obj = AllocateJSObjectFromMap(object_function_map);
Cast(AllocateJSObjectFromMap(object_function_map));
// 10. Perform ! CreateDataProperty(obj, "status", "fulfilled"). // 10. Perform ! CreateDataProperty(obj, "status", "fulfilled").
CallBuiltin(Builtins::kFastCreateDataProperty, context, obj, CallBuiltin(Builtins::kFastCreateDataProperty, context, obj,
...@@ -2557,8 +2556,7 @@ TF_BUILTIN(PromiseAllSettledRejectElementClosure, PromiseBuiltinsAssembler) { ...@@ -2557,8 +2556,7 @@ TF_BUILTIN(PromiseAllSettledRejectElementClosure, PromiseBuiltinsAssembler) {
LoadContextElement(native_context, Context::OBJECT_FUNCTION_INDEX)); LoadContextElement(native_context, Context::OBJECT_FUNCTION_INDEX));
TNode<Map> object_function_map = Cast(LoadObjectField( TNode<Map> object_function_map = Cast(LoadObjectField(
object_function, JSFunction::kPrototypeOrInitialMapOffset)); object_function, JSFunction::kPrototypeOrInitialMapOffset));
TNode<JSObject> obj = TNode<JSObject> obj = AllocateJSObjectFromMap(object_function_map);
Cast(AllocateJSObjectFromMap(object_function_map));
// 10. Perform ! CreateDataProperty(obj, "status", "rejected"). // 10. Perform ! CreateDataProperty(obj, "status", "rejected").
CallBuiltin(Builtins::kFastCreateDataProperty, context, obj, CallBuiltin(Builtins::kFastCreateDataProperty, context, obj,
...@@ -2579,7 +2577,7 @@ TF_BUILTIN(PromiseRace, PromiseBuiltinsAssembler) { ...@@ -2579,7 +2577,7 @@ TF_BUILTIN(PromiseRace, PromiseBuiltinsAssembler) {
VARIABLE(var_exception, MachineRepresentation::kTagged, TheHoleConstant()); VARIABLE(var_exception, MachineRepresentation::kTagged, TheHoleConstant());
Node* const receiver = Parameter(Descriptor::kReceiver); Node* const receiver = Parameter(Descriptor::kReceiver);
Node* const context = Parameter(Descriptor::kContext); TNode<Context> const context = CAST(Parameter(Descriptor::kContext));
ThrowIfNotJSReceiver(context, receiver, MessageTemplate::kCalledOnNonObject, ThrowIfNotJSReceiver(context, receiver, MessageTemplate::kCalledOnNonObject,
"Promise.race"); "Promise.race");
...@@ -2630,7 +2628,7 @@ TF_BUILTIN(PromiseRace, PromiseBuiltinsAssembler) { ...@@ -2630,7 +2628,7 @@ TF_BUILTIN(PromiseRace, PromiseBuiltinsAssembler) {
// 4. If IsCallable(_promiseResolve_) is *false*, throw a *TypeError* // 4. If IsCallable(_promiseResolve_) is *false*, throw a *TypeError*
// exception. // exception.
ThrowIfNotCallable(CAST(context), resolve, "resolve"); ThrowIfNotCallable(context, resolve, "resolve");
var_promise_resolve_function = resolve; var_promise_resolve_function = resolve;
Goto(&loop); Goto(&loop);
...@@ -2638,13 +2636,13 @@ TF_BUILTIN(PromiseRace, PromiseBuiltinsAssembler) { ...@@ -2638,13 +2636,13 @@ TF_BUILTIN(PromiseRace, PromiseBuiltinsAssembler) {
BIND(&loop); BIND(&loop);
{ {
Node* const fast_iterator_result_map = LoadContextElement( TNode<Map> const fast_iterator_result_map = CAST(LoadContextElement(
native_context, Context::ITERATOR_RESULT_MAP_INDEX); native_context, Context::ITERATOR_RESULT_MAP_INDEX));
// Let next be IteratorStep(iteratorRecord.[[Iterator]]). // Let next be IteratorStep(iteratorRecord.[[Iterator]]).
// If next is an abrupt completion, set iteratorRecord.[[Done]] to true. // If next is an abrupt completion, set iteratorRecord.[[Done]] to true.
// ReturnIfAbrupt(next). // ReturnIfAbrupt(next).
Node* const next = iter_assembler.IteratorStep( TNode<JSReceiver> const next = iter_assembler.IteratorStep(
context, iterator, &break_loop, fast_iterator_result_map, context, iterator, &break_loop, fast_iterator_result_map,
&reject_promise, &var_exception); &reject_promise, &var_exception);
...@@ -2652,7 +2650,7 @@ TF_BUILTIN(PromiseRace, PromiseBuiltinsAssembler) { ...@@ -2652,7 +2650,7 @@ TF_BUILTIN(PromiseRace, PromiseBuiltinsAssembler) {
// If nextValue is an abrupt completion, set iteratorRecord.[[Done]] to // If nextValue is an abrupt completion, set iteratorRecord.[[Done]] to
// true. // true.
// ReturnIfAbrupt(nextValue). // ReturnIfAbrupt(nextValue).
Node* const next_value = TNode<Object> const next_value =
iter_assembler.IteratorValue(context, next, fast_iterator_result_map, iter_assembler.IteratorValue(context, next, fast_iterator_result_map,
&reject_promise, &var_exception); &reject_promise, &var_exception);
......
...@@ -13,8 +13,9 @@ ...@@ -13,8 +13,9 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
Node* ProxiesCodeStubAssembler::AllocateProxy(Node* target, Node* handler, compiler::TNode<JSProxy> ProxiesCodeStubAssembler::AllocateProxy(
Node* context) { TNode<Context> context, TNode<JSReceiver> target,
TNode<JSReceiver> handler) {
VARIABLE(map, MachineRepresentation::kTagged); VARIABLE(map, MachineRepresentation::kTagged);
Label callable_target(this), constructor_target(this), none_target(this), Label callable_target(this), constructor_target(this), none_target(this),
...@@ -53,7 +54,7 @@ Node* ProxiesCodeStubAssembler::AllocateProxy(Node* target, Node* handler, ...@@ -53,7 +54,7 @@ Node* ProxiesCodeStubAssembler::AllocateProxy(Node* target, Node* handler,
StoreObjectFieldNoWriteBarrier(proxy, JSProxy::kTargetOffset, target); StoreObjectFieldNoWriteBarrier(proxy, JSProxy::kTargetOffset, target);
StoreObjectFieldNoWriteBarrier(proxy, JSProxy::kHandlerOffset, handler); StoreObjectFieldNoWriteBarrier(proxy, JSProxy::kHandlerOffset, handler);
return proxy; return CAST(proxy);
} }
Node* ProxiesCodeStubAssembler::AllocateJSArrayForCodeStubArguments( Node* ProxiesCodeStubAssembler::AllocateJSArrayForCodeStubArguments(
...@@ -121,8 +122,9 @@ Node* ProxiesCodeStubAssembler::CreateProxyRevokeFunctionContext( ...@@ -121,8 +122,9 @@ Node* ProxiesCodeStubAssembler::CreateProxyRevokeFunctionContext(
return context; return context;
} }
Node* ProxiesCodeStubAssembler::AllocateProxyRevokeFunction(Node* proxy, compiler::TNode<JSFunction>
Node* context) { ProxiesCodeStubAssembler::AllocateProxyRevokeFunction(TNode<Context> context,
TNode<JSProxy> proxy) {
Node* const native_context = LoadNativeContext(context); Node* const native_context = LoadNativeContext(context);
Node* const proxy_context = Node* const proxy_context =
...@@ -132,8 +134,8 @@ Node* ProxiesCodeStubAssembler::AllocateProxyRevokeFunction(Node* proxy, ...@@ -132,8 +134,8 @@ Node* ProxiesCodeStubAssembler::AllocateProxyRevokeFunction(Node* proxy,
Node* const revoke_info = Node* const revoke_info =
LoadContextElement(native_context, Context::PROXY_REVOKE_SHARED_FUN); LoadContextElement(native_context, Context::PROXY_REVOKE_SHARED_FUN);
return AllocateFunctionWithMapAndContext(revoke_map, revoke_info, return CAST(AllocateFunctionWithMapAndContext(revoke_map, revoke_info,
proxy_context); proxy_context));
} }
TF_BUILTIN(CallProxy, ProxiesCodeStubAssembler) { TF_BUILTIN(CallProxy, ProxiesCodeStubAssembler) {
...@@ -257,8 +259,9 @@ TF_BUILTIN(ConstructProxy, ProxiesCodeStubAssembler) { ...@@ -257,8 +259,9 @@ TF_BUILTIN(ConstructProxy, ProxiesCodeStubAssembler) {
{ ThrowTypeError(context, MessageTemplate::kProxyRevoked, "construct"); } { ThrowTypeError(context, MessageTemplate::kProxyRevoked, "construct"); }
} }
Node* ProxiesCodeStubAssembler::CheckGetSetTrapResult( void ProxiesCodeStubAssembler::CheckGetSetTrapResult(
Node* context, Node* target, Node* proxy, Node* name, Node* trap_result, TNode<Context> context, TNode<JSReceiver> target, TNode<JSProxy> proxy,
TNode<Name> name, TNode<Object> trap_result,
JSProxy::AccessKind access_kind) { JSProxy::AccessKind access_kind) {
// TODO(mslekova): Think of a better name for the trap_result param. // TODO(mslekova): Think of a better name for the trap_result param.
Node* map = LoadMap(target); Node* map = LoadMap(target);
...@@ -269,7 +272,7 @@ Node* ProxiesCodeStubAssembler::CheckGetSetTrapResult( ...@@ -269,7 +272,7 @@ Node* ProxiesCodeStubAssembler::CheckGetSetTrapResult(
Label if_found_value(this), check_in_runtime(this, Label::kDeferred), Label if_found_value(this), check_in_runtime(this, Label::kDeferred),
check_passed(this); check_passed(this);
GotoIfNot(IsUniqueNameNoIndex(CAST(name)), &check_in_runtime); GotoIfNot(IsUniqueNameNoIndex(name), &check_in_runtime);
Node* instance_type = LoadInstanceType(target); Node* instance_type = LoadInstanceType(target);
TryGetOwnProperty(context, target, target, map, instance_type, name, TryGetOwnProperty(context, target, target, map, instance_type, name,
&if_found_value, &var_value, &var_details, &var_raw_value, &if_found_value, &var_value, &var_details, &var_raw_value,
...@@ -362,12 +365,13 @@ Node* ProxiesCodeStubAssembler::CheckGetSetTrapResult( ...@@ -362,12 +365,13 @@ Node* ProxiesCodeStubAssembler::CheckGetSetTrapResult(
} }
BIND(&check_passed); BIND(&check_passed);
return trap_result;
} }
} }
Node* ProxiesCodeStubAssembler::CheckHasTrapResult(Node* context, Node* target, void ProxiesCodeStubAssembler::CheckHasTrapResult(TNode<Context> context,
Node* proxy, Node* name) { TNode<JSReceiver> target,
TNode<JSProxy> proxy,
TNode<Name> name) {
Node* target_map = LoadMap(target); Node* target_map = LoadMap(target);
VARIABLE(var_value, MachineRepresentation::kTagged); VARIABLE(var_value, MachineRepresentation::kTagged);
VARIABLE(var_details, MachineRepresentation::kWord32); VARIABLE(var_details, MachineRepresentation::kWord32);
...@@ -379,7 +383,7 @@ Node* ProxiesCodeStubAssembler::CheckHasTrapResult(Node* context, Node* target, ...@@ -379,7 +383,7 @@ Node* ProxiesCodeStubAssembler::CheckHasTrapResult(Node* context, Node* target,
check_in_runtime(this, Label::kDeferred); check_in_runtime(this, Label::kDeferred);
// 9.a. Let targetDesc be ? target.[[GetOwnProperty]](P). // 9.a. Let targetDesc be ? target.[[GetOwnProperty]](P).
GotoIfNot(IsUniqueNameNoIndex(CAST(name)), &check_in_runtime); GotoIfNot(IsUniqueNameNoIndex(name), &check_in_runtime);
Node* instance_type = LoadInstanceType(target); Node* instance_type = LoadInstanceType(target);
TryGetOwnProperty(context, target, target, target_map, instance_type, name, TryGetOwnProperty(context, target, target, target_map, instance_type, name,
&if_found_value, &var_value, &var_details, &var_raw_value, &if_found_value, &var_value, &var_details, &var_raw_value,
...@@ -415,7 +419,6 @@ Node* ProxiesCodeStubAssembler::CheckHasTrapResult(Node* context, Node* target, ...@@ -415,7 +419,6 @@ Node* ProxiesCodeStubAssembler::CheckHasTrapResult(Node* context, Node* target,
} }
BIND(&check_passed); BIND(&check_passed);
return FalseConstant();
} }
} // namespace internal } // namespace internal
......
...@@ -17,15 +17,18 @@ class ProxiesCodeStubAssembler : public CodeStubAssembler { ...@@ -17,15 +17,18 @@ class ProxiesCodeStubAssembler : public CodeStubAssembler {
explicit ProxiesCodeStubAssembler(compiler::CodeAssemblerState* state) explicit ProxiesCodeStubAssembler(compiler::CodeAssemblerState* state)
: CodeStubAssembler(state) {} : CodeStubAssembler(state) {}
Node* AllocateProxy(Node* target, Node* handler, Node* context); TNode<JSProxy> AllocateProxy(TNode<Context> context, TNode<JSReceiver> target,
Node* AllocateProxyRevokeFunction(Node* proxy, Node* context); TNode<JSReceiver> handler);
TNode<JSFunction> AllocateProxyRevokeFunction(TNode<Context> context,
Node* CheckGetSetTrapResult(Node* context, Node* target, Node* proxy, TNode<JSProxy> proxy);
Node* name, Node* trap_result,
JSProxy::AccessKind access_kind); void CheckGetSetTrapResult(TNode<Context> context, TNode<JSReceiver> target,
TNode<JSProxy> proxy, TNode<Name> name,
Node* CheckHasTrapResult(Node* context, Node* target, Node* proxy, TNode<Object> trap_result,
Node* name); JSProxy::AccessKind access_kind);
void CheckHasTrapResult(TNode<Context> context, TNode<JSReceiver> target,
TNode<JSProxy> proxy, TNode<Name> name);
protected: protected:
enum ProxyRevokeFunctionContextSlot { enum ProxyRevokeFunctionContextSlot {
......
This diff is collapsed.
...@@ -42,15 +42,20 @@ class RegExpBuiltinsAssembler : public CodeStubAssembler { ...@@ -42,15 +42,20 @@ class RegExpBuiltinsAssembler : public CodeStubAssembler {
TNode<Context> context, TNode<Smi> length, TNode<Smi> index, TNode<Context> context, TNode<Smi> length, TNode<Smi> index,
TNode<String> input, TNode<FixedArray>* elements_out = nullptr); TNode<String> input, TNode<FixedArray>* elements_out = nullptr);
TNode<Object> FastLoadLastIndex(TNode<JSRegExp> regexp); TNode<Object> FastLoadLastIndexBeforeSmiCheck(TNode<JSRegExp> regexp);
TNode<Smi> FastLoadLastIndex(TNode<JSRegExp> regexp) {
return CAST(FastLoadLastIndexBeforeSmiCheck(regexp));
}
TNode<Object> SlowLoadLastIndex(TNode<Context> context, TNode<Object> regexp); TNode<Object> SlowLoadLastIndex(TNode<Context> context, TNode<Object> regexp);
TNode<Object> LoadLastIndex(TNode<Context> context, TNode<Object> regexp, TNode<Object> LoadLastIndex(TNode<Context> context, TNode<Object> regexp,
bool is_fastpath); bool is_fastpath);
void FastStoreLastIndex(Node* regexp, Node* value); void FastStoreLastIndex(TNode<JSRegExp> regexp, TNode<Smi> value);
void SlowStoreLastIndex(Node* context, Node* regexp, Node* value); void SlowStoreLastIndex(SloppyTNode<Context> context,
void StoreLastIndex(Node* context, Node* regexp, Node* value, SloppyTNode<Object> regexp,
bool is_fastpath); SloppyTNode<Number> value);
void StoreLastIndex(TNode<Context> context, TNode<Object> regexp,
TNode<Number> value, bool is_fastpath);
// Loads {var_string_start} and {var_string_end} with the corresponding // Loads {var_string_start} and {var_string_end} with the corresponding
// offsets into the given {string_data}. // offsets into the given {string_data}.
...@@ -127,20 +132,23 @@ class RegExpBuiltinsAssembler : public CodeStubAssembler { ...@@ -127,20 +132,23 @@ class RegExpBuiltinsAssembler : public CodeStubAssembler {
Node* RegExpExec(Node* context, Node* regexp, Node* string); Node* RegExpExec(Node* context, Node* regexp, Node* string);
Node* AdvanceStringIndex(Node* const string, Node* const index, TNode<Number> AdvanceStringIndex(SloppyTNode<String> string,
Node* const is_unicode, bool is_fastpath); SloppyTNode<Number> index,
SloppyTNode<BoolT> is_unicode,
bool is_fastpath);
Node* AdvanceStringIndexFast(Node* const string, Node* const index, TNode<Smi> AdvanceStringIndexFast(TNode<String> string, TNode<Smi> index,
Node* const is_unicode) { TNode<BoolT> is_unicode) {
return AdvanceStringIndex(string, index, is_unicode, true); return CAST(AdvanceStringIndex(string, index, is_unicode, true));
} }
void RegExpPrototypeMatchBody(Node* const context, Node* const regexp, void RegExpPrototypeMatchBody(TNode<Context> context, TNode<Object> regexp,
TNode<String> const string, TNode<String> const string,
const bool is_fastpath); const bool is_fastpath);
void RegExpPrototypeSearchBodyFast(Node* const context, Node* const regexp, void RegExpPrototypeSearchBodyFast(TNode<Context> context,
Node* const string); TNode<JSRegExp> regexp,
TNode<String> string);
void RegExpPrototypeSearchBodySlow(Node* const context, Node* const regexp, void RegExpPrototypeSearchBodySlow(Node* const context, Node* const regexp,
Node* const string); Node* const string);
......
...@@ -1986,12 +1986,12 @@ TNode<Int32T> StringBuiltinsAssembler::LoadSurrogatePairAt( ...@@ -1986,12 +1986,12 @@ TNode<Int32T> StringBuiltinsAssembler::LoadSurrogatePairAt(
switch (encoding) { switch (encoding) {
case UnicodeEncoding::UTF16: case UnicodeEncoding::UTF16:
var_result = Signed(Word32Or( var_result = Word32Or(
// Need to swap the order for big-endian platforms // Need to swap the order for big-endian platforms
#if V8_TARGET_BIG_ENDIAN #if V8_TARGET_BIG_ENDIAN
Word32Shl(lead, Int32Constant(16)), trail)); Word32Shl(lead, Int32Constant(16)), trail);
#else #else
Word32Shl(trail, Int32Constant(16)), lead)); Word32Shl(trail, Int32Constant(16)), lead);
#endif #endif
break; break;
...@@ -2002,8 +2002,8 @@ TNode<Int32T> StringBuiltinsAssembler::LoadSurrogatePairAt( ...@@ -2002,8 +2002,8 @@ TNode<Int32T> StringBuiltinsAssembler::LoadSurrogatePairAt(
Int32Constant(0x10000 - (0xD800 << 10) - 0xDC00); Int32Constant(0x10000 - (0xD800 << 10) - 0xDC00);
// (lead << 10) + trail + SURROGATE_OFFSET // (lead << 10) + trail + SURROGATE_OFFSET
var_result = Signed(Int32Add(Word32Shl(lead, Int32Constant(10)), var_result = Int32Add(Word32Shl(lead, Int32Constant(10)),
Int32Add(trail, surrogate_offset))); Int32Add(trail, surrogate_offset));
break; break;
} }
} }
......
...@@ -13,8 +13,8 @@ namespace internal { ...@@ -13,8 +13,8 @@ namespace internal {
// ES #sec-symbol-objects // ES #sec-symbol-objects
// ES #sec-symbol.prototype.description // ES #sec-symbol.prototype.description
TF_BUILTIN(SymbolPrototypeDescriptionGetter, CodeStubAssembler) { TF_BUILTIN(SymbolPrototypeDescriptionGetter, CodeStubAssembler) {
Node* context = Parameter(Descriptor::kContext); TNode<Context> context = CAST(Parameter(Descriptor::kContext));
Node* receiver = Parameter(Descriptor::kReceiver); TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
Node* value = ToThisValue(context, receiver, PrimitiveType::kSymbol, Node* value = ToThisValue(context, receiver, PrimitiveType::kSymbol,
"Symbol.prototype.description"); "Symbol.prototype.description");
...@@ -24,8 +24,8 @@ TF_BUILTIN(SymbolPrototypeDescriptionGetter, CodeStubAssembler) { ...@@ -24,8 +24,8 @@ TF_BUILTIN(SymbolPrototypeDescriptionGetter, CodeStubAssembler) {
// ES6 #sec-symbol.prototype-@@toprimitive // ES6 #sec-symbol.prototype-@@toprimitive
TF_BUILTIN(SymbolPrototypeToPrimitive, CodeStubAssembler) { TF_BUILTIN(SymbolPrototypeToPrimitive, CodeStubAssembler) {
Node* context = Parameter(Descriptor::kContext); TNode<Context> context = CAST(Parameter(Descriptor::kContext));
Node* receiver = Parameter(Descriptor::kReceiver); TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
Node* result = ToThisValue(context, receiver, PrimitiveType::kSymbol, Node* result = ToThisValue(context, receiver, PrimitiveType::kSymbol,
"Symbol.prototype [ @@toPrimitive ]"); "Symbol.prototype [ @@toPrimitive ]");
...@@ -34,8 +34,8 @@ TF_BUILTIN(SymbolPrototypeToPrimitive, CodeStubAssembler) { ...@@ -34,8 +34,8 @@ TF_BUILTIN(SymbolPrototypeToPrimitive, CodeStubAssembler) {
// ES6 #sec-symbol.prototype.tostring // ES6 #sec-symbol.prototype.tostring
TF_BUILTIN(SymbolPrototypeToString, CodeStubAssembler) { TF_BUILTIN(SymbolPrototypeToString, CodeStubAssembler) {
Node* context = Parameter(Descriptor::kContext); TNode<Context> context = CAST(Parameter(Descriptor::kContext));
Node* receiver = Parameter(Descriptor::kReceiver); TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
Node* value = ToThisValue(context, receiver, PrimitiveType::kSymbol, Node* value = ToThisValue(context, receiver, PrimitiveType::kSymbol,
"Symbol.prototype.toString"); "Symbol.prototype.toString");
...@@ -45,8 +45,8 @@ TF_BUILTIN(SymbolPrototypeToString, CodeStubAssembler) { ...@@ -45,8 +45,8 @@ TF_BUILTIN(SymbolPrototypeToString, CodeStubAssembler) {
// ES6 #sec-symbol.prototype.valueof // ES6 #sec-symbol.prototype.valueof
TF_BUILTIN(SymbolPrototypeValueOf, CodeStubAssembler) { TF_BUILTIN(SymbolPrototypeValueOf, CodeStubAssembler) {
Node* context = Parameter(Descriptor::kContext); TNode<Context> context = CAST(Parameter(Descriptor::kContext));
Node* receiver = Parameter(Descriptor::kReceiver); TNode<Object> receiver = CAST(Parameter(Descriptor::kReceiver));
Node* result = ToThisValue(context, receiver, PrimitiveType::kSymbol, Node* result = ToThisValue(context, receiver, PrimitiveType::kSymbol,
"Symbol.prototype.valueOf"); "Symbol.prototype.valueOf");
......
...@@ -169,13 +169,13 @@ TF_BUILTIN(TypedArrayPrototypeLength, TypedArrayBuiltinsAssembler) { ...@@ -169,13 +169,13 @@ TF_BUILTIN(TypedArrayPrototypeLength, TypedArrayBuiltinsAssembler) {
Return(ChangeUintPtrToTagged(length)); Return(ChangeUintPtrToTagged(length));
} }
TNode<Word32T> TypedArrayBuiltinsAssembler::IsUint8ElementsKind( TNode<BoolT> TypedArrayBuiltinsAssembler::IsUint8ElementsKind(
TNode<Word32T> kind) { TNode<Word32T> kind) {
return Word32Or(Word32Equal(kind, Int32Constant(UINT8_ELEMENTS)), return Word32Or(Word32Equal(kind, Int32Constant(UINT8_ELEMENTS)),
Word32Equal(kind, Int32Constant(UINT8_CLAMPED_ELEMENTS))); Word32Equal(kind, Int32Constant(UINT8_CLAMPED_ELEMENTS)));
} }
TNode<Word32T> TypedArrayBuiltinsAssembler::IsBigInt64ElementsKind( TNode<BoolT> TypedArrayBuiltinsAssembler::IsBigInt64ElementsKind(
TNode<Word32T> kind) { TNode<Word32T> kind) {
return Word32Or(Word32Equal(kind, Int32Constant(BIGINT64_ELEMENTS)), return Word32Or(Word32Equal(kind, Int32Constant(BIGINT64_ELEMENTS)),
Word32Equal(kind, Int32Constant(BIGUINT64_ELEMENTS))); Word32Equal(kind, Int32Constant(BIGUINT64_ELEMENTS)));
...@@ -268,10 +268,9 @@ TNode<JSArrayBuffer> TypedArrayBuiltinsAssembler::GetBuffer( ...@@ -268,10 +268,9 @@ TNode<JSArrayBuffer> TypedArrayBuiltinsAssembler::GetBuffer(
Label call_runtime(this), done(this); Label call_runtime(this), done(this);
TVARIABLE(Object, var_result); TVARIABLE(Object, var_result);
TNode<Object> buffer = LoadObjectField(array, JSTypedArray::kBufferOffset); TNode<JSArrayBuffer> buffer = LoadJSArrayBufferViewBuffer(array);
GotoIf(IsDetachedBuffer(buffer), &call_runtime); GotoIf(IsDetachedBuffer(buffer), &call_runtime);
TNode<UintPtrT> backing_store = LoadObjectField<UintPtrT>( TNode<RawPtrT> backing_store = LoadJSArrayBufferBackingStore(buffer);
CAST(buffer), JSArrayBuffer::kBackingStoreOffset);
GotoIf(WordEqual(backing_store, IntPtrConstant(0)), &call_runtime); GotoIf(WordEqual(backing_store, IntPtrConstant(0)), &call_runtime);
var_result = buffer; var_result = buffer;
Goto(&done); Goto(&done);
...@@ -301,10 +300,10 @@ void TypedArrayBuiltinsAssembler::SetTypedArraySource( ...@@ -301,10 +300,10 @@ void TypedArrayBuiltinsAssembler::SetTypedArraySource(
TNode<Context> context, TNode<JSTypedArray> source, TNode<Context> context, TNode<JSTypedArray> source,
TNode<JSTypedArray> target, TNode<IntPtrT> offset, Label* call_runtime, TNode<JSTypedArray> target, TNode<IntPtrT> offset, Label* call_runtime,
Label* if_source_too_large) { Label* if_source_too_large) {
CSA_ASSERT(this, Word32BinaryNot(IsDetachedBuffer( CSA_ASSERT(this, Word32BinaryNot(
LoadObjectField(source, JSTypedArray::kBufferOffset)))); IsDetachedBuffer(LoadJSArrayBufferViewBuffer(source))));
CSA_ASSERT(this, Word32BinaryNot(IsDetachedBuffer( CSA_ASSERT(this, Word32BinaryNot(
LoadObjectField(target, JSTypedArray::kBufferOffset)))); IsDetachedBuffer(LoadJSArrayBufferViewBuffer(target))));
CSA_ASSERT(this, IntPtrGreaterThanOrEqual(offset, IntPtrConstant(0))); CSA_ASSERT(this, IntPtrGreaterThanOrEqual(offset, IntPtrConstant(0)));
CSA_ASSERT(this, CSA_ASSERT(this,
IntPtrLessThanOrEqual(offset, IntPtrConstant(Smi::kMaxValue))); IntPtrLessThanOrEqual(offset, IntPtrConstant(Smi::kMaxValue)));
...@@ -748,8 +747,8 @@ TF_BUILTIN(TypedArrayOf, TypedArrayBuiltinsAssembler) { ...@@ -748,8 +747,8 @@ TF_BUILTIN(TypedArrayOf, TypedArrayBuiltinsAssembler) {
// ToNumber/ToBigInt may execute JavaScript code, which could // ToNumber/ToBigInt may execute JavaScript code, which could
// detach the array's buffer. // detach the array's buffer.
Node* buffer = TNode<JSArrayBuffer> buffer =
LoadObjectField(new_typed_array, JSTypedArray::kBufferOffset); LoadJSArrayBufferViewBuffer(new_typed_array);
GotoIf(IsDetachedBuffer(buffer), &if_detached); GotoIf(IsDetachedBuffer(buffer), &if_detached);
// GC may move backing store in ToNumber, thus load backing // GC may move backing store in ToNumber, thus load backing
...@@ -971,8 +970,8 @@ TF_BUILTIN(TypedArrayFrom, TypedArrayBuiltinsAssembler) { ...@@ -971,8 +970,8 @@ TF_BUILTIN(TypedArrayFrom, TypedArrayBuiltinsAssembler) {
// ToNumber/ToBigInt may execute JavaScript code, which could // ToNumber/ToBigInt may execute JavaScript code, which could
// detach the array's buffer. // detach the array's buffer.
Node* buffer = LoadObjectField(target_obj.value(), TNode<JSArrayBuffer> buffer =
JSTypedArray::kBufferOffset); LoadJSArrayBufferViewBuffer(target_obj.value());
GotoIf(IsDetachedBuffer(buffer), &if_detached); GotoIf(IsDetachedBuffer(buffer), &if_detached);
// GC may move backing store in map_fn, thus load backing // GC may move backing store in map_fn, thus load backing
......
...@@ -41,10 +41,10 @@ class TypedArrayBuiltinsAssembler : public CodeStubAssembler { ...@@ -41,10 +41,10 @@ class TypedArrayBuiltinsAssembler : public CodeStubAssembler {
TNode<UintPtrT> byte_offset); TNode<UintPtrT> byte_offset);
// Returns true if kind is either UINT8_ELEMENTS or UINT8_CLAMPED_ELEMENTS. // Returns true if kind is either UINT8_ELEMENTS or UINT8_CLAMPED_ELEMENTS.
TNode<Word32T> IsUint8ElementsKind(TNode<Word32T> kind); TNode<BoolT> IsUint8ElementsKind(TNode<Word32T> kind);
// Returns true if kind is either BIGINT64_ELEMENTS or BIGUINT64_ELEMENTS. // Returns true if kind is either BIGINT64_ELEMENTS or BIGUINT64_ELEMENTS.
TNode<Word32T> IsBigInt64ElementsKind(TNode<Word32T> kind); TNode<BoolT> IsBigInt64ElementsKind(TNode<Word32T> kind);
// Returns the byte size of an element for a TypedArray elements kind. // Returns the byte size of an element for a TypedArray elements kind.
TNode<IntPtrT> GetTypedArrayElementSize(TNode<Word32T> elements_kind); TNode<IntPtrT> GetTypedArrayElementSize(TNode<Word32T> elements_kind);
......
...@@ -20,16 +20,16 @@ namespace iterator { ...@@ -20,16 +20,16 @@ namespace iterator {
implicit context: Context)(Object): IteratorRecord; implicit context: Context)(Object): IteratorRecord;
extern macro IteratorBuiltinsAssembler::IteratorStep( extern macro IteratorBuiltinsAssembler::IteratorStep(
implicit context: Context)(IteratorRecord): Object implicit context: Context)(IteratorRecord): JSReceiver
labels Done; labels Done;
extern macro IteratorBuiltinsAssembler::IteratorStep( extern macro IteratorBuiltinsAssembler::IteratorStep(
implicit context: Context)(IteratorRecord, Map): Object implicit context: Context)(IteratorRecord, Map): JSReceiver
labels Done; labels Done;
extern macro IteratorBuiltinsAssembler::IteratorValue( extern macro IteratorBuiltinsAssembler::IteratorValue(
implicit context: Context)(Object): Object; implicit context: Context)(JSReceiver): Object;
extern macro IteratorBuiltinsAssembler::IteratorValue( extern macro IteratorBuiltinsAssembler::IteratorValue(
implicit context: Context)(Object, Map): Object; implicit context: Context)(JSReceiver, Map): Object;
extern macro IteratorBuiltinsAssembler::IteratorCloseOnException( extern macro IteratorBuiltinsAssembler::IteratorCloseOnException(
implicit context: Context)(IteratorRecord, Object): never; implicit context: Context)(IteratorRecord, Object): never;
......
...@@ -47,7 +47,8 @@ namespace object { ...@@ -47,7 +47,8 @@ namespace object {
try { try {
assert(!IsNullOrUndefined(i.object)); assert(!IsNullOrUndefined(i.object));
while (true) { while (true) {
const step: Object = iterator::IteratorStep(i, fastIteratorResultMap) const step: JSReceiver =
iterator::IteratorStep(i, fastIteratorResultMap)
otherwise return result; otherwise return result;
const iteratorValue: Object = const iteratorValue: Object =
iterator::IteratorValue(step, fastIteratorResultMap); iterator::IteratorValue(step, fastIteratorResultMap);
......
...@@ -22,30 +22,32 @@ namespace proxy { ...@@ -22,30 +22,32 @@ namespace proxy {
assert(!IsPrivateSymbol(name)); assert(!IsPrivateSymbol(name));
// 2. Let handler be O.[[ProxyHandler]]. // 2. Let handler be O.[[ProxyHandler]].
const handler: Object = proxy.handler;
// 3. If handler is null, throw a TypeError exception. // 3. If handler is null, throw a TypeError exception.
if (handler == Null) {
ThrowTypeError(kProxyRevoked, 'get');
}
// 4. Assert: Type(handler) is Object. // 4. Assert: Type(handler) is Object.
const handlerJSReceiver = UnsafeCast<JSReceiver>(handler); let handler: JSReceiver;
typeswitch (proxy.handler) {
case (Null): {
ThrowTypeError(kProxyRevoked, 'get');
}
case (h: JSReceiver): {
handler = h;
}
}
// 5. Let target be O.[[ProxyTarget]]. // 5. Let target be O.[[ProxyTarget]].
const target = proxy.target; const target = Cast<JSReceiver>(proxy.target) otherwise unreachable;
// 6. Let trap be ? GetMethod(handler, "get"). // 6. Let trap be ? GetMethod(handler, "get").
// 7. If trap is undefined, then (see 7.a below). // 7. If trap is undefined, then (see 7.a below).
// 7.a. Return ? target.[[Get]](P, Receiver). // 7.a. Return ? target.[[Get]](P, Receiver).
// TODO(mslekova): Introduce GetPropertyWithReceiver stub // TODO(mslekova): Introduce GetPropertyWithReceiver stub
const trap: Callable = GetMethod(handlerJSReceiver, 'get') const trap: Callable = GetMethod(handler, 'get')
otherwise return GetPropertyWithReceiver( otherwise return GetPropertyWithReceiver(
target, name, receiverValue, onNonExistent); target, name, receiverValue, onNonExistent);
// 8. Let trapResult be ? Call(trap, handler, « target, P, Receiver »). // 8. Let trapResult be ? Call(trap, handler, « target, P, Receiver »).
const trapResult = const trapResult =
Call(context, trap, handlerJSReceiver, target, name, receiverValue); Call(context, trap, handler, target, name, receiverValue);
// 9. Let targetDesc be ? target.[[GetOwnProperty]](P). // 9. Let targetDesc be ? target.[[GetOwnProperty]](P).
// 10. If targetDesc is not undefined and targetDesc.[[Configurable]] is // 10. If targetDesc is not undefined and targetDesc.[[Configurable]] is
...@@ -58,6 +60,7 @@ namespace proxy { ...@@ -58,6 +60,7 @@ namespace proxy {
// is undefined, then // is undefined, then
// i. If trapResult is not undefined, throw a TypeError exception. // i. If trapResult is not undefined, throw a TypeError exception.
// 11. Return trapResult. // 11. Return trapResult.
return CheckGetSetTrapResult(target, proxy, name, trapResult, kProxyGet); CheckGetSetTrapResult(target, proxy, name, trapResult, kProxyGet);
return trapResult;
} }
} }
...@@ -26,7 +26,7 @@ namespace proxy { ...@@ -26,7 +26,7 @@ namespace proxy {
Cast<JSReceiver>(proxy.handler) otherwise ThrowProxyHandlerRevoked; Cast<JSReceiver>(proxy.handler) otherwise ThrowProxyHandlerRevoked;
// 5. Let target be O.[[ProxyTarget]]. // 5. Let target be O.[[ProxyTarget]].
const target = proxy.target; const target = Cast<JSReceiver>(proxy.target) otherwise unreachable;
// 6. Let trap be ? GetMethod(handler, "has"). // 6. Let trap be ? GetMethod(handler, "has").
// 7. If trap is undefined, then (see 7.a below). // 7. If trap is undefined, then (see 7.a below).
...@@ -42,7 +42,8 @@ namespace proxy { ...@@ -42,7 +42,8 @@ namespace proxy {
if (BranchIfToBooleanIsTrue(trapResult)) { if (BranchIfToBooleanIsTrue(trapResult)) {
return True; return True;
} }
return CheckHasTrapResult(target, proxy, name); CheckHasTrapResult(target, proxy, name);
return False;
} }
label TrapUndefined(target: Object) { label TrapUndefined(target: Object) {
// 7.a. Return ? target.[[HasProperty]](P). // 7.a. Return ? target.[[HasProperty]](P).
......
...@@ -7,11 +7,7 @@ ...@@ -7,11 +7,7 @@
namespace proxy { namespace proxy {
extern macro ProxiesCodeStubAssembler::AllocateProxyRevokeFunction( extern macro ProxiesCodeStubAssembler::AllocateProxyRevokeFunction(
Object, Object): JSFunction; implicit context: Context)(JSProxy): JSFunction;
macro AllocateProxyRevokeFunction(implicit context: Context)(proxy: JSProxy):
JSFunction {
return AllocateProxyRevokeFunction(proxy, context);
}
// Proxy.revocable(target, handler) // Proxy.revocable(target, handler)
// https://tc39.github.io/ecma262/#sec-proxy.revocable // https://tc39.github.io/ecma262/#sec-proxy.revocable
......
...@@ -40,7 +40,7 @@ namespace proxy { ...@@ -40,7 +40,7 @@ namespace proxy {
Cast<JSReceiver>(handler) otherwise ThrowProxyHandlerRevoked; Cast<JSReceiver>(handler) otherwise ThrowProxyHandlerRevoked;
// 5. Let target be O.[[ProxyTarget]]. // 5. Let target be O.[[ProxyTarget]].
const target = proxy.target; const target = UnsafeCast<JSReceiver>(proxy.target);
// 6. Let trap be ? GetMethod(handler, "set"). // 6. Let trap be ? GetMethod(handler, "set").
// 7. If trap is undefined, then (see 7.a below). // 7. If trap is undefined, then (see 7.a below).
...@@ -64,7 +64,8 @@ namespace proxy { ...@@ -64,7 +64,8 @@ namespace proxy {
const trapResult = Call( const trapResult = Call(
context, trap, handlerJSReceiver, target, name, value, receiverValue); context, trap, handlerJSReceiver, target, name, value, receiverValue);
if (BranchIfToBooleanIsTrue(trapResult)) { if (BranchIfToBooleanIsTrue(trapResult)) {
return CheckGetSetTrapResult(target, proxy, name, value, kProxySet); CheckGetSetTrapResult(target, proxy, name, value, kProxySet);
return value;
} }
ThrowTypeErrorIfStrict( ThrowTypeErrorIfStrict(
SmiConstant(kProxyTrapReturnedFalsishFor), 'set', name); SmiConstant(kProxyTrapReturnedFalsishFor), 'set', name);
......
...@@ -7,11 +7,7 @@ ...@@ -7,11 +7,7 @@
namespace proxy { namespace proxy {
extern macro ProxiesCodeStubAssembler::AllocateProxy( extern macro ProxiesCodeStubAssembler::AllocateProxy(
JSReceiver, JSReceiver, Context): JSProxy; implicit context: Context)(JSReceiver, JSReceiver): JSProxy;
macro AllocateProxy(implicit context: Context)(
target: JSReceiver, handler: JSReceiver): JSProxy {
return AllocateProxy(target, handler, context);
}
macro IsRevokedProxy(implicit context: Context)(o: JSReceiver): bool { macro IsRevokedProxy(implicit context: Context)(o: JSReceiver): bool {
const proxy: JSProxy = Cast<JSProxy>(o) otherwise return false; const proxy: JSProxy = Cast<JSProxy>(o) otherwise return false;
...@@ -21,10 +17,10 @@ namespace proxy { ...@@ -21,10 +17,10 @@ namespace proxy {
extern transitioning macro ProxiesCodeStubAssembler::CheckGetSetTrapResult( extern transitioning macro ProxiesCodeStubAssembler::CheckGetSetTrapResult(
implicit context: implicit context:
Context)(Object, JSProxy, Name, Object, constexpr int31): Object; Context)(JSReceiver, JSProxy, Name, Object, constexpr int31);
extern transitioning macro ProxiesCodeStubAssembler::CheckHasTrapResult( extern transitioning macro ProxiesCodeStubAssembler::CheckHasTrapResult(
implicit context: Context)(Object, JSProxy, Name): Object; implicit context: Context)(JSReceiver, JSProxy, Name);
const kProxyNonObject: constexpr MessageTemplate const kProxyNonObject: constexpr MessageTemplate
generates 'MessageTemplate::kProxyNonObject'; generates 'MessageTemplate::kProxyNonObject';
......
...@@ -22,7 +22,7 @@ namespace regexp_replace { ...@@ -22,7 +22,7 @@ namespace regexp_replace {
String, JSRegExp, Callable): String; String, JSRegExp, Callable): String;
extern macro extern macro
RegExpBuiltinsAssembler::AdvanceStringIndexFast(String, Number, bool): Smi; RegExpBuiltinsAssembler::AdvanceStringIndexFast(String, Smi, bool): Smi;
extern macro extern macro
RegExpBuiltinsAssembler::RegExpPrototypeExecBodyWithoutResultFast( RegExpBuiltinsAssembler::RegExpPrototypeExecBodyWithoutResultFast(
implicit context: Context)(JSReceiver, String): implicit context: Context)(JSReceiver, String):
......
...@@ -70,10 +70,9 @@ namespace typed_array { ...@@ -70,10 +70,9 @@ namespace typed_array {
extern macro TypedArrayBuiltinsAssembler::IsBigInt64ElementsKind( extern macro TypedArrayBuiltinsAssembler::IsBigInt64ElementsKind(
ElementsKind): bool; ElementsKind): bool;
extern macro LoadFixedTypedArrayElementAsTagged( extern macro LoadFixedTypedArrayElementAsTagged(
RawPtr, Smi, constexpr ElementsKind, constexpr ParameterMode): Object; RawPtr, Smi, constexpr ElementsKind): Numeric;
extern macro StoreJSTypedArrayElementFromTagged( extern macro StoreJSTypedArrayElementFromTagged(
Context, JSTypedArray, Smi, Object, constexpr ElementsKind, Context, JSTypedArray, Smi, Object, constexpr ElementsKind);
constexpr ParameterMode);
type LoadFn = builtin(Context, JSTypedArray, Smi) => Object; type LoadFn = builtin(Context, JSTypedArray, Smi) => Object;
type StoreFn = builtin(Context, JSTypedArray, Smi, Object) => Object; type StoreFn = builtin(Context, JSTypedArray, Smi, Object) => Object;
...@@ -193,15 +192,14 @@ namespace typed_array { ...@@ -193,15 +192,14 @@ namespace typed_array {
builtin LoadFixedElement<T: type>( builtin LoadFixedElement<T: type>(
_context: Context, array: JSTypedArray, index: Smi): Object { _context: Context, array: JSTypedArray, index: Smi): Object {
return LoadFixedTypedArrayElementAsTagged( return LoadFixedTypedArrayElementAsTagged(
array.data_ptr, index, KindForArrayType<T>(), SMI_PARAMETERS); array.data_ptr, index, KindForArrayType<T>());
} }
builtin StoreFixedElement<T: type>( builtin StoreFixedElement<T: type>(
context: Context, typedArray: JSTypedArray, index: Smi, context: Context, typedArray: JSTypedArray, index: Smi,
value: Object): Object { value: Object): Object {
StoreJSTypedArrayElementFromTagged( StoreJSTypedArrayElementFromTagged(
context, typedArray, index, value, KindForArrayType<T>(), context, typedArray, index, value, KindForArrayType<T>());
SMI_PARAMETERS);
return Undefined; return Undefined;
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -441,16 +441,16 @@ void CodeAssembler::Bind(Label* label, AssemblerDebugInfo debug_info) { ...@@ -441,16 +441,16 @@ void CodeAssembler::Bind(Label* label, AssemblerDebugInfo debug_info) {
} }
#endif // DEBUG #endif // DEBUG
Node* CodeAssembler::LoadFramePointer() { TNode<RawPtrT> CodeAssembler::LoadFramePointer() {
return raw_assembler()->LoadFramePointer(); return UncheckedCast<RawPtrT>(raw_assembler()->LoadFramePointer());
} }
Node* CodeAssembler::LoadParentFramePointer() { TNode<RawPtrT> CodeAssembler::LoadParentFramePointer() {
return raw_assembler()->LoadParentFramePointer(); return UncheckedCast<RawPtrT>(raw_assembler()->LoadParentFramePointer());
} }
Node* CodeAssembler::LoadStackPointer() { TNode<RawPtrT> CodeAssembler::LoadStackPointer() {
return raw_assembler()->LoadStackPointer(); return UncheckedCast<RawPtrT>(raw_assembler()->LoadStackPointer());
} }
TNode<Object> CodeAssembler::TaggedPoisonOnSpeculation( TNode<Object> CodeAssembler::TaggedPoisonOnSpeculation(
......
...@@ -107,13 +107,13 @@ struct Uint32T : Word32T { ...@@ -107,13 +107,13 @@ struct Uint32T : Word32T {
struct Int16T : Int32T { struct Int16T : Int32T {
static constexpr MachineType kMachineType = MachineType::Int16(); static constexpr MachineType kMachineType = MachineType::Int16();
}; };
struct Uint16T : Uint32T { struct Uint16T : Uint32T, Int32T {
static constexpr MachineType kMachineType = MachineType::Uint16(); static constexpr MachineType kMachineType = MachineType::Uint16();
}; };
struct Int8T : Int16T { struct Int8T : Int16T {
static constexpr MachineType kMachineType = MachineType::Int8(); static constexpr MachineType kMachineType = MachineType::Int8();
}; };
struct Uint8T : Uint16T { struct Uint8T : Uint16T, Int16T {
static constexpr MachineType kMachineType = MachineType::Uint8(); static constexpr MachineType kMachineType = MachineType::Uint8();
}; };
...@@ -419,6 +419,10 @@ struct types_have_common_values { ...@@ -419,6 +419,10 @@ struct types_have_common_values {
static const bool value = is_subtype<T, U>::value || is_subtype<U, T>::value; static const bool value = is_subtype<T, U>::value || is_subtype<U, T>::value;
}; };
template <class U> template <class U>
struct types_have_common_values<BoolT, U> {
static const bool value = types_have_common_values<Word32T, U>::value;
};
template <class U>
struct types_have_common_values<Uint32T, U> { struct types_have_common_values<Uint32T, U> {
static const bool value = types_have_common_values<Word32T, U>::value; static const bool value = types_have_common_values<Word32T, U>::value;
}; };
...@@ -617,15 +621,15 @@ TNode<Float64T> Float64Add(TNode<Float64T> a, TNode<Float64T> b); ...@@ -617,15 +621,15 @@ TNode<Float64T> Float64Add(TNode<Float64T> a, TNode<Float64T> b);
V(Float64Sqrt, Float64T, Float64T) \ V(Float64Sqrt, Float64T, Float64T) \
V(Float64Tan, Float64T, Float64T) \ V(Float64Tan, Float64T, Float64T) \
V(Float64Tanh, Float64T, Float64T) \ V(Float64Tanh, Float64T, Float64T) \
V(Float64ExtractLowWord32, Word32T, Float64T) \ V(Float64ExtractLowWord32, Uint32T, Float64T) \
V(Float64ExtractHighWord32, Word32T, Float64T) \ V(Float64ExtractHighWord32, Uint32T, Float64T) \
V(BitcastTaggedToWord, IntPtrT, Object) \ V(BitcastTaggedToWord, IntPtrT, Object) \
V(BitcastTaggedSignedToWord, IntPtrT, Smi) \ V(BitcastTaggedSignedToWord, IntPtrT, Smi) \
V(BitcastMaybeObjectToWord, IntPtrT, MaybeObject) \ V(BitcastMaybeObjectToWord, IntPtrT, MaybeObject) \
V(BitcastWordToTagged, Object, WordT) \ V(BitcastWordToTagged, Object, WordT) \
V(BitcastWordToTaggedSigned, Smi, WordT) \ V(BitcastWordToTaggedSigned, Smi, WordT) \
V(TruncateFloat64ToFloat32, Float32T, Float64T) \ V(TruncateFloat64ToFloat32, Float32T, Float64T) \
V(TruncateFloat64ToWord32, Word32T, Float64T) \ V(TruncateFloat64ToWord32, Uint32T, Float64T) \
V(TruncateInt64ToInt32, Int32T, Int64T) \ V(TruncateInt64ToInt32, Int32T, Int64T) \
V(ChangeFloat32ToFloat64, Float64T, Float32T) \ V(ChangeFloat32ToFloat64, Float64T, Float32T) \
V(ChangeFloat64ToUint32, Uint32T, Float64T) \ V(ChangeFloat64ToUint32, Uint32T, Float64T) \
...@@ -635,7 +639,7 @@ TNode<Float64T> Float64Add(TNode<Float64T> a, TNode<Float64T> b); ...@@ -635,7 +639,7 @@ TNode<Float64T> Float64Add(TNode<Float64T> a, TNode<Float64T> b);
V(ChangeUint32ToFloat64, Float64T, Word32T) \ V(ChangeUint32ToFloat64, Float64T, Word32T) \
V(ChangeUint32ToUint64, Uint64T, Word32T) \ V(ChangeUint32ToUint64, Uint64T, Word32T) \
V(BitcastInt32ToFloat32, Float32T, Word32T) \ V(BitcastInt32ToFloat32, Float32T, Word32T) \
V(BitcastFloat32ToInt32, Word32T, Float32T) \ V(BitcastFloat32ToInt32, Uint32T, Float32T) \
V(RoundFloat64ToInt32, Int32T, Float64T) \ V(RoundFloat64ToInt32, Int32T, Float64T) \
V(RoundInt32ToFloat32, Int32T, Float32T) \ V(RoundInt32ToFloat32, Int32T, Float32T) \
V(Float64SilenceNaN, Float64T, Float64T) \ V(Float64SilenceNaN, Float64T, Float64T) \
...@@ -948,11 +952,11 @@ class V8_EXPORT_PRIVATE CodeAssembler { ...@@ -948,11 +952,11 @@ class V8_EXPORT_PRIVATE CodeAssembler {
Label** case_labels, size_t case_count); Label** case_labels, size_t case_count);
// Access to the frame pointer // Access to the frame pointer
Node* LoadFramePointer(); TNode<RawPtrT> LoadFramePointer();
Node* LoadParentFramePointer(); TNode<RawPtrT> LoadParentFramePointer();
// Access to the stack pointer // Access to the stack pointer
Node* LoadStackPointer(); TNode<RawPtrT> LoadStackPointer();
// Poison |value| on speculative paths. // Poison |value| on speculative paths.
TNode<Object> TaggedPoisonOnSpeculation(SloppyTNode<Object> value); TNode<Object> TaggedPoisonOnSpeculation(SloppyTNode<Object> value);
...@@ -1057,20 +1061,60 @@ class V8_EXPORT_PRIVATE CodeAssembler { ...@@ -1057,20 +1061,60 @@ class V8_EXPORT_PRIVATE CodeAssembler {
CODE_ASSEMBLER_BINARY_OP_LIST(DECLARE_CODE_ASSEMBLER_BINARY_OP) CODE_ASSEMBLER_BINARY_OP_LIST(DECLARE_CODE_ASSEMBLER_BINARY_OP)
#undef DECLARE_CODE_ASSEMBLER_BINARY_OP #undef DECLARE_CODE_ASSEMBLER_BINARY_OP
TNode<IntPtrT> WordShr(TNode<IntPtrT> left, TNode<IntegralT> right) { TNode<UintPtrT> WordShr(TNode<UintPtrT> left, TNode<IntegralT> right) {
return UncheckedCast<IntPtrT>( return Unsigned(
WordShr(static_cast<Node*>(left), static_cast<Node*>(right))); WordShr(static_cast<Node*>(left), static_cast<Node*>(right)));
} }
TNode<IntPtrT> WordSar(TNode<IntPtrT> left, TNode<IntegralT> right) { TNode<IntPtrT> WordSar(TNode<IntPtrT> left, TNode<IntegralT> right) {
return UncheckedCast<IntPtrT>( return Signed(WordSar(static_cast<Node*>(left), static_cast<Node*>(right)));
WordSar(static_cast<Node*>(left), static_cast<Node*>(right))); }
TNode<IntPtrT> WordShl(TNode<IntPtrT> left, TNode<IntegralT> right) {
return Signed(WordShl(static_cast<Node*>(left), static_cast<Node*>(right)));
}
TNode<UintPtrT> WordShl(TNode<UintPtrT> left, TNode<IntegralT> right) {
return Unsigned(
WordShl(static_cast<Node*>(left), static_cast<Node*>(right)));
}
TNode<Int32T> Word32Shl(TNode<Int32T> left, TNode<Int32T> right) {
return Signed(
Word32Shl(static_cast<Node*>(left), static_cast<Node*>(right)));
}
TNode<Uint32T> Word32Shl(TNode<Uint32T> left, TNode<Uint32T> right) {
return Unsigned(
Word32Shl(static_cast<Node*>(left), static_cast<Node*>(right)));
}
TNode<Uint32T> Word32Shr(TNode<Uint32T> left, TNode<Uint32T> right) {
return Unsigned(
Word32Shr(static_cast<Node*>(left), static_cast<Node*>(right)));
} }
TNode<IntPtrT> WordAnd(TNode<IntPtrT> left, TNode<IntPtrT> right) { TNode<IntPtrT> WordAnd(TNode<IntPtrT> left, TNode<IntPtrT> right) {
return UncheckedCast<IntPtrT>( return Signed(WordAnd(static_cast<Node*>(left), static_cast<Node*>(right)));
}
TNode<UintPtrT> WordAnd(TNode<UintPtrT> left, TNode<UintPtrT> right) {
return Unsigned(
WordAnd(static_cast<Node*>(left), static_cast<Node*>(right))); WordAnd(static_cast<Node*>(left), static_cast<Node*>(right)));
} }
TNode<Int32T> Word32And(TNode<Int32T> left, TNode<Int32T> right) {
return Signed(
Word32And(static_cast<Node*>(left), static_cast<Node*>(right)));
}
TNode<Uint32T> Word32And(TNode<Uint32T> left, TNode<Uint32T> right) {
return Unsigned(
Word32And(static_cast<Node*>(left), static_cast<Node*>(right)));
}
TNode<Int32T> Word32Or(TNode<Int32T> left, TNode<Int32T> right) {
return Signed(
Word32Or(static_cast<Node*>(left), static_cast<Node*>(right)));
}
TNode<Uint32T> Word32Or(TNode<Uint32T> left, TNode<Uint32T> right) {
return Unsigned(
Word32Or(static_cast<Node*>(left), static_cast<Node*>(right)));
}
template <class Left, class Right, template <class Left, class Right,
class = typename std::enable_if< class = typename std::enable_if<
std::is_base_of<Object, Left>::value && std::is_base_of<Object, Left>::value &&
...@@ -1116,6 +1160,15 @@ class V8_EXPORT_PRIVATE CodeAssembler { ...@@ -1116,6 +1160,15 @@ class V8_EXPORT_PRIVATE CodeAssembler {
TNode<BoolT> Word64NotEqual(SloppyTNode<Word64T> left, TNode<BoolT> Word64NotEqual(SloppyTNode<Word64T> left,
SloppyTNode<Word64T> right); SloppyTNode<Word64T> right);
TNode<BoolT> Word32Or(TNode<BoolT> left, TNode<BoolT> right) {
return UncheckedCast<BoolT>(
Word32Or(static_cast<Node*>(left), static_cast<Node*>(right)));
}
TNode<BoolT> Word32And(TNode<BoolT> left, TNode<BoolT> right) {
return UncheckedCast<BoolT>(
Word32And(static_cast<Node*>(left), static_cast<Node*>(right)));
}
TNode<Int32T> Int32Add(TNode<Int32T> left, TNode<Int32T> right) { TNode<Int32T> Int32Add(TNode<Int32T> left, TNode<Int32T> right) {
return Signed( return Signed(
Int32Add(static_cast<Node*>(left), static_cast<Node*>(right))); Int32Add(static_cast<Node*>(left), static_cast<Node*>(right)));
...@@ -1126,6 +1179,16 @@ class V8_EXPORT_PRIVATE CodeAssembler { ...@@ -1126,6 +1179,16 @@ class V8_EXPORT_PRIVATE CodeAssembler {
Int32Add(static_cast<Node*>(left), static_cast<Node*>(right))); Int32Add(static_cast<Node*>(left), static_cast<Node*>(right)));
} }
TNode<Int32T> Int32Sub(TNode<Int32T> left, TNode<Int32T> right) {
return Signed(
Int32Sub(static_cast<Node*>(left), static_cast<Node*>(right)));
}
TNode<Int32T> Int32Mul(TNode<Int32T> left, TNode<Int32T> right) {
return Signed(
Int32Mul(static_cast<Node*>(left), static_cast<Node*>(right)));
}
TNode<WordT> IntPtrAdd(SloppyTNode<WordT> left, SloppyTNode<WordT> right); TNode<WordT> IntPtrAdd(SloppyTNode<WordT> left, SloppyTNode<WordT> right);
TNode<IntPtrT> IntPtrDiv(TNode<IntPtrT> left, TNode<IntPtrT> right); TNode<IntPtrT> IntPtrDiv(TNode<IntPtrT> left, TNode<IntPtrT> right);
TNode<WordT> IntPtrSub(SloppyTNode<WordT> left, SloppyTNode<WordT> right); TNode<WordT> IntPtrSub(SloppyTNode<WordT> left, SloppyTNode<WordT> right);
......
...@@ -1964,7 +1964,7 @@ void AccessorAssembler::EmitElementLoad( ...@@ -1964,7 +1964,7 @@ void AccessorAssembler::EmitElementLoad(
{ {
Comment("typed elements"); Comment("typed elements");
// Check if buffer has been detached. // Check if buffer has been detached.
Node* buffer = LoadObjectField(object, JSArrayBufferView::kBufferOffset); TNode<JSArrayBuffer> buffer = LoadJSArrayBufferViewBuffer(CAST(object));
GotoIf(IsDetachedBuffer(buffer), miss); GotoIf(IsDetachedBuffer(buffer), miss);
// Bounds check. // Bounds check.
...@@ -1973,7 +1973,8 @@ void AccessorAssembler::EmitElementLoad( ...@@ -1973,7 +1973,8 @@ void AccessorAssembler::EmitElementLoad(
if (access_mode == LoadAccessMode::kHas) { if (access_mode == LoadAccessMode::kHas) {
exit_point->Return(TrueConstant()); exit_point->Return(TrueConstant());
} else { } else {
Node* backing_store = LoadJSTypedArrayBackingStore(CAST(object)); TNode<RawPtrT> backing_store =
LoadJSTypedArrayBackingStore(CAST(object));
Label uint8_elements(this), int8_elements(this), uint16_elements(this), Label uint8_elements(this), int8_elements(this), uint16_elements(this),
int16_elements(this), uint32_elements(this), int32_elements(this), int16_elements(this), uint32_elements(this), int32_elements(this),
...@@ -3640,7 +3641,7 @@ void AccessorAssembler::GenerateCloneObjectIC_Slow() { ...@@ -3640,7 +3641,7 @@ void AccessorAssembler::GenerateCloneObjectIC_Slow() {
LoadObjectField(object_fn, JSFunction::kPrototypeOrInitialMapOffset)); LoadObjectField(object_fn, JSFunction::kPrototypeOrInitialMapOffset));
CSA_ASSERT(this, IsMap(initial_map)); CSA_ASSERT(this, IsMap(initial_map));
TNode<JSObject> result = CAST(AllocateJSObjectFromMap(initial_map)); TNode<JSObject> result = AllocateJSObjectFromMap(initial_map);
{ {
Label did_set_proto_if_needed(this); Label did_set_proto_if_needed(this);
...@@ -3708,8 +3709,8 @@ void AccessorAssembler::GenerateCloneObjectIC() { ...@@ -3708,8 +3709,8 @@ void AccessorAssembler::GenerateCloneObjectIC() {
// Handlers for the CloneObjectIC stub are weak references to the Map of // Handlers for the CloneObjectIC stub are weak references to the Map of
// a result object. // a result object.
TNode<Map> result_map = CAST(var_handler.value()); TNode<Map> result_map = CAST(var_handler.value());
TVARIABLE(Object, var_properties, EmptyFixedArrayConstant()); TVARIABLE(HeapObject, var_properties, EmptyFixedArrayConstant());
TVARIABLE(FixedArrayBase, var_elements, EmptyFixedArrayConstant()); TVARIABLE(FixedArray, var_elements, EmptyFixedArrayConstant());
Label allocate_object(this); Label allocate_object(this);
GotoIf(IsNullOrUndefined(source), &allocate_object); GotoIf(IsNullOrUndefined(source), &allocate_object);
......
...@@ -185,7 +185,7 @@ void KeyedStoreGenericAssembler::BranchIfPrototypesHaveNonFastElements( ...@@ -185,7 +185,7 @@ void KeyedStoreGenericAssembler::BranchIfPrototypesHaveNonFastElements(
TNode<Int32T> instance_type = LoadMapInstanceType(prototype_map); TNode<Int32T> instance_type = LoadMapInstanceType(prototype_map);
GotoIf(IsCustomElementsReceiverInstanceType(instance_type), GotoIf(IsCustomElementsReceiverInstanceType(instance_type),
non_fast_elements); non_fast_elements);
Node* elements_kind = LoadMapElementsKind(prototype_map); TNode<Int32T> elements_kind = LoadMapElementsKind(prototype_map);
GotoIf(IsFastElementsKind(elements_kind), &loop_body); GotoIf(IsFastElementsKind(elements_kind), &loop_body);
GotoIf(Word32Equal(elements_kind, Int32Constant(NO_ELEMENTS)), &loop_body); GotoIf(Word32Equal(elements_kind, Int32Constant(NO_ELEMENTS)), &loop_body);
Goto(non_fast_elements); Goto(non_fast_elements);
...@@ -500,7 +500,7 @@ void KeyedStoreGenericAssembler::EmitGenericElementStore( ...@@ -500,7 +500,7 @@ void KeyedStoreGenericAssembler::EmitGenericElementStore(
if_grow(this), if_nonfast(this), if_typed_array(this), if_grow(this), if_nonfast(this), if_typed_array(this),
if_dictionary(this); if_dictionary(this);
Node* elements = LoadElements(receiver); Node* elements = LoadElements(receiver);
Node* elements_kind = LoadMapElementsKind(receiver_map); TNode<Int32T> elements_kind = LoadMapElementsKind(receiver_map);
Branch(IsFastElementsKind(elements_kind), &if_fast, &if_nonfast); Branch(IsFastElementsKind(elements_kind), &if_fast, &if_nonfast);
BIND(&if_fast); BIND(&if_fast);
......
...@@ -1265,7 +1265,7 @@ void InterpreterAssembler::UpdateInterruptBudget(Node* weight, bool backward) { ...@@ -1265,7 +1265,7 @@ void InterpreterAssembler::UpdateInterruptBudget(Node* weight, bool backward) {
// Make sure we include the current bytecode in the budget calculation. // Make sure we include the current bytecode in the budget calculation.
TNode<Int32T> budget_after_bytecode = TNode<Int32T> budget_after_bytecode =
Signed(Int32Sub(old_budget, Int32Constant(CurrentBytecodeSize()))); Int32Sub(old_budget, Int32Constant(CurrentBytecodeSize()));
Label done(this); Label done(this);
TVARIABLE(Int32T, new_budget); TVARIABLE(Int32T, new_budget);
......
...@@ -314,8 +314,7 @@ void CSAGenerator::EmitInstruction(const CallCsaMacroInstruction& instruction, ...@@ -314,8 +314,7 @@ void CSAGenerator::EmitInstruction(const CallCsaMacroInstruction& instruction,
out_ << ") = "; out_ << ") = ";
} else { } else {
if (results.size() == 1) { if (results.size() == 1) {
out_ << results[0] << " = ca_.UncheckedCast<" out_ << results[0] << " = ";
<< return_type->GetGeneratedTNodeTypeName() << ">(";
} else { } else {
DCHECK_EQ(0, results.size()); DCHECK_EQ(0, results.size());
} }
...@@ -330,7 +329,6 @@ void CSAGenerator::EmitInstruction(const CallCsaMacroInstruction& instruction, ...@@ -330,7 +329,6 @@ void CSAGenerator::EmitInstruction(const CallCsaMacroInstruction& instruction,
if (needs_flattening) { if (needs_flattening) {
out_ << ").Flatten();\n"; out_ << ").Flatten();\n";
} else { } else {
if (results.size() == 1) out_ << ")";
out_ << ");\n"; out_ << ");\n";
} }
PostCallableExceptionPreparation(catch_name, return_type, PostCallableExceptionPreparation(catch_name, return_type,
......
...@@ -744,16 +744,16 @@ namespace test { ...@@ -744,16 +744,16 @@ namespace test {
// IteratorBuiltinsAssembler match the signatures provided in // IteratorBuiltinsAssembler match the signatures provided in
// iterator.tq. // iterator.tq.
@export @export
macro TestIterator(implicit context: Context)(o: Object, map: Map) { macro TestIterator(implicit context: Context)(o: JSReceiver, map: Map) {
try { try {
const t1: Object = iterator::GetIteratorMethod(o); const t1: Object = iterator::GetIteratorMethod(o);
const t2: iterator::IteratorRecord = iterator::GetIterator(o); const t2: iterator::IteratorRecord = iterator::GetIterator(o);
const _t3: Object = iterator::IteratorStep(t2) otherwise Fail; const _t3: Object = iterator::IteratorStep(t2) otherwise Fail;
const t4: Object = iterator::IteratorStep(t2, map) otherwise Fail; const _t4: Object = iterator::IteratorStep(t2, map) otherwise Fail;
const t5: Object = iterator::IteratorValue(t4); const t5: Object = iterator::IteratorValue(o);
const _t6: Object = iterator::IteratorValue(t4, map); const _t6: Object = iterator::IteratorValue(o, map);
const _t7: JSArray = iterator::IterableToList(t1, t1); const _t7: JSArray = iterator::IterableToList(t1, t1);
......
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