Commit ba9775fd authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[CSA][cleanup] TNodify builtins-object-gen

Also TNodify:
 - LoadJSPrimitiveWrapperValue
 - GetSuperConstructor
 - InstanceOf

BUG=v8:6949,v8:9396

Change-Id: I4b39b418cdf01bd72e35441f037d16ede9c89ce9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1803639
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: 's avatarSantiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63791}
parent 82176ac3
...@@ -48,8 +48,8 @@ TF_BUILTIN(LoadIC_StringLength, CodeStubAssembler) { ...@@ -48,8 +48,8 @@ TF_BUILTIN(LoadIC_StringLength, CodeStubAssembler) {
} }
TF_BUILTIN(LoadIC_StringWrapperLength, CodeStubAssembler) { TF_BUILTIN(LoadIC_StringWrapperLength, CodeStubAssembler) {
Node* value = Parameter(Descriptor::kReceiver); TNode<JSPrimitiveWrapper> value = CAST(Parameter(Descriptor::kReceiver));
Node* string = LoadJSPrimitiveWrapperValue(value); TNode<String> string = CAST(LoadJSPrimitiveWrapperValue(value));
Return(LoadStringLengthAsSmi(string)); Return(LoadStringLengthAsSmi(string));
} }
......
This diff is collapsed.
...@@ -1218,7 +1218,8 @@ void CodeStubAssembler::BranchIfPrototypesHaveNoElements( ...@@ -1218,7 +1218,8 @@ void CodeStubAssembler::BranchIfPrototypesHaveNoElements(
GotoIfNot( GotoIfNot(
InstanceTypeEqual(prototype_instance_type, JS_PRIMITIVE_WRAPPER_TYPE), InstanceTypeEqual(prototype_instance_type, JS_PRIMITIVE_WRAPPER_TYPE),
possibly_elements); possibly_elements);
Node* prototype_value = LoadJSPrimitiveWrapperValue(prototype); TNode<Object> prototype_value =
LoadJSPrimitiveWrapperValue(CAST(prototype));
Branch(IsEmptyString(prototype_value), &if_notcustom, possibly_elements); Branch(IsEmptyString(prototype_value), &if_notcustom, possibly_elements);
} }
...@@ -2004,8 +2005,8 @@ Node* CodeStubAssembler::PointerToSeqStringData(Node* seq_string) { ...@@ -2004,8 +2005,8 @@ Node* CodeStubAssembler::PointerToSeqStringData(Node* seq_string) {
IntPtrConstant(SeqOneByteString::kHeaderSize - kHeapObjectTag)); IntPtrConstant(SeqOneByteString::kHeaderSize - kHeapObjectTag));
} }
Node* CodeStubAssembler::LoadJSPrimitiveWrapperValue(Node* object) { TNode<Object> CodeStubAssembler::LoadJSPrimitiveWrapperValue(
CSA_ASSERT(this, IsJSPrimitiveWrapper(object)); TNode<JSPrimitiveWrapper> object) {
return LoadObjectField(object, JSPrimitiveWrapper::kValueOffset); return LoadObjectField(object, JSPrimitiveWrapper::kValueOffset);
} }
...@@ -9731,10 +9732,11 @@ TNode<Object> CodeStubAssembler::CallGetterIfAccessor( ...@@ -9731,10 +9732,11 @@ TNode<Object> CodeStubAssembler::CallGetterIfAccessor(
GotoIfNot(IsLengthString( GotoIfNot(IsLengthString(
LoadObjectField(accessor_info, AccessorInfo::kNameOffset)), LoadObjectField(accessor_info, AccessorInfo::kNameOffset)),
if_bailout); if_bailout);
Node* receiver_value = LoadJSPrimitiveWrapperValue(receiver); TNode<Object> receiver_value =
LoadJSPrimitiveWrapperValue(CAST(receiver));
GotoIfNot(TaggedIsNotSmi(receiver_value), if_bailout); GotoIfNot(TaggedIsNotSmi(receiver_value), if_bailout);
GotoIfNot(IsString(receiver_value), if_bailout); GotoIfNot(IsString(CAST(receiver_value)), if_bailout);
var_value.Bind(LoadStringLengthAsSmi(receiver_value)); var_value.Bind(LoadStringLengthAsSmi(CAST(receiver_value)));
Goto(&done); Goto(&done);
} }
} }
...@@ -9922,18 +9924,14 @@ void CodeStubAssembler::TryLookupElement(Node* object, Node* map, ...@@ -9922,18 +9924,14 @@ void CodeStubAssembler::TryLookupElement(Node* object, Node* map,
} }
BIND(&if_isfaststringwrapper); BIND(&if_isfaststringwrapper);
{ {
CSA_ASSERT(this, HasInstanceType(object, JS_PRIMITIVE_WRAPPER_TYPE)); TNode<String> string = CAST(LoadJSPrimitiveWrapperValue(CAST(object)));
Node* string = LoadJSPrimitiveWrapperValue(object);
CSA_ASSERT(this, IsString(string));
TNode<IntPtrT> length = LoadStringLengthAsWord(string); TNode<IntPtrT> length = LoadStringLengthAsWord(string);
GotoIf(UintPtrLessThan(intptr_index, length), if_found); GotoIf(UintPtrLessThan(intptr_index, length), if_found);
Goto(&if_isobjectorsmi); Goto(&if_isobjectorsmi);
} }
BIND(&if_isslowstringwrapper); BIND(&if_isslowstringwrapper);
{ {
CSA_ASSERT(this, HasInstanceType(object, JS_PRIMITIVE_WRAPPER_TYPE)); TNode<String> string = CAST(LoadJSPrimitiveWrapperValue(CAST(object)));
Node* string = LoadJSPrimitiveWrapperValue(object);
CSA_ASSERT(this, IsString(string));
TNode<IntPtrT> length = LoadStringLengthAsWord(string); TNode<IntPtrT> length = LoadStringLengthAsWord(string);
GotoIf(UintPtrLessThan(intptr_index, length), if_found); GotoIf(UintPtrLessThan(intptr_index, length), if_found);
Goto(&if_isdictionary); Goto(&if_isdictionary);
...@@ -13085,7 +13083,7 @@ TNode<String> CodeStubAssembler::Typeof(SloppyTNode<Object> value) { ...@@ -13085,7 +13083,7 @@ TNode<String> CodeStubAssembler::Typeof(SloppyTNode<Object> value) {
} }
TNode<Object> CodeStubAssembler::GetSuperConstructor( TNode<Object> CodeStubAssembler::GetSuperConstructor(
SloppyTNode<Context> context, SloppyTNode<JSFunction> active_function) { TNode<Context> context, TNode<JSFunction> active_function) {
Label is_not_constructor(this, Label::kDeferred), out(this); Label is_not_constructor(this, Label::kDeferred), out(this);
TVARIABLE(Object, result); TVARIABLE(Object, result);
...@@ -13148,9 +13146,10 @@ TNode<JSReceiver> CodeStubAssembler::SpeciesConstructor( ...@@ -13148,9 +13146,10 @@ TNode<JSReceiver> CodeStubAssembler::SpeciesConstructor(
return var_result.value(); return var_result.value();
} }
Node* CodeStubAssembler::InstanceOf(Node* object, Node* callable, TNode<Oddball> CodeStubAssembler::InstanceOf(TNode<Object> object,
Node* context) { TNode<Object> callable,
VARIABLE(var_result, MachineRepresentation::kTagged); TNode<Context> context) {
TVARIABLE(Oddball, var_result);
Label if_notcallable(this, Label::kDeferred), Label if_notcallable(this, Label::kDeferred),
if_notreceiver(this, Label::kDeferred), if_otherhandler(this), if_notreceiver(this, Label::kDeferred), if_otherhandler(this),
if_nohandler(this, Label::kDeferred), return_true(this), if_nohandler(this, Label::kDeferred), return_true(this),
...@@ -13158,7 +13157,7 @@ Node* CodeStubAssembler::InstanceOf(Node* object, Node* callable, ...@@ -13158,7 +13157,7 @@ Node* CodeStubAssembler::InstanceOf(Node* object, Node* callable,
// Ensure that the {callable} is actually a JSReceiver. // Ensure that the {callable} is actually a JSReceiver.
GotoIf(TaggedIsSmi(callable), &if_notreceiver); GotoIf(TaggedIsSmi(callable), &if_notreceiver);
GotoIfNot(IsJSReceiver(callable), &if_notreceiver); GotoIfNot(IsJSReceiver(CAST(callable)), &if_notreceiver);
// Load the @@hasInstance property from {callable}. // Load the @@hasInstance property from {callable}.
TNode<Object> inst_of_handler = TNode<Object> inst_of_handler =
...@@ -13176,8 +13175,8 @@ Node* CodeStubAssembler::InstanceOf(Node* object, Node* callable, ...@@ -13176,8 +13175,8 @@ Node* CodeStubAssembler::InstanceOf(Node* object, Node* callable,
// Call to Function.prototype[@@hasInstance] directly. // Call to Function.prototype[@@hasInstance] directly.
Callable builtin(BUILTIN_CODE(isolate(), FunctionPrototypeHasInstance), Callable builtin(BUILTIN_CODE(isolate(), FunctionPrototypeHasInstance),
CallTrampolineDescriptor{}); CallTrampolineDescriptor{});
Node* result = CallJS(builtin, context, inst_of_handler, callable, object); var_result =
var_result.Bind(result); CAST(CallJS(builtin, context, inst_of_handler, callable, object));
Goto(&return_result); Goto(&return_result);
} }
...@@ -13199,12 +13198,11 @@ Node* CodeStubAssembler::InstanceOf(Node* object, Node* callable, ...@@ -13199,12 +13198,11 @@ Node* CodeStubAssembler::InstanceOf(Node* object, Node* callable,
BIND(&if_nohandler); BIND(&if_nohandler);
{ {
// Ensure that the {callable} is actually Callable. // Ensure that the {callable} is actually Callable.
GotoIfNot(IsCallable(callable), &if_notcallable); GotoIfNot(IsCallable(CAST(callable)), &if_notcallable);
// Use the OrdinaryHasInstance algorithm. // Use the OrdinaryHasInstance algorithm.
TNode<Object> result = var_result = CAST(
CallBuiltin(Builtins::kOrdinaryHasInstance, context, callable, object); CallBuiltin(Builtins::kOrdinaryHasInstance, context, callable, object));
var_result.Bind(result);
Goto(&return_result); Goto(&return_result);
} }
...@@ -13215,11 +13213,11 @@ Node* CodeStubAssembler::InstanceOf(Node* object, Node* callable, ...@@ -13215,11 +13213,11 @@ Node* CodeStubAssembler::InstanceOf(Node* object, Node* callable,
{ ThrowTypeError(context, MessageTemplate::kNonObjectInInstanceOfCheck); } { ThrowTypeError(context, MessageTemplate::kNonObjectInInstanceOfCheck); }
BIND(&return_true); BIND(&return_true);
var_result.Bind(TrueConstant()); var_result = TrueConstant();
Goto(&return_result); Goto(&return_result);
BIND(&return_false); BIND(&return_false);
var_result.Bind(FalseConstant()); var_result = FalseConstant();
Goto(&return_result); Goto(&return_result);
BIND(&return_result); BIND(&return_result);
......
...@@ -1198,7 +1198,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -1198,7 +1198,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
// Loads a pointer to the sequential String char array. // Loads a pointer to the sequential String char array.
Node* PointerToSeqStringData(Node* seq_string); Node* PointerToSeqStringData(Node* seq_string);
// Load value field of a JSPrimitiveWrapper object. // Load value field of a JSPrimitiveWrapper object.
Node* LoadJSPrimitiveWrapperValue(Node* object); TNode<Object> LoadJSPrimitiveWrapperValue(TNode<JSPrimitiveWrapper> object);
// Figures out whether the value of maybe_object is: // Figures out whether the value of maybe_object is:
// - a SMI (jump to "if_smi", "extracted" will be the SMI value) // - a SMI (jump to "if_smi", "extracted" will be the SMI value)
...@@ -3497,14 +3497,15 @@ class V8_EXPORT_PRIVATE CodeStubAssembler ...@@ -3497,14 +3497,15 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<String> Typeof(SloppyTNode<Object> value); TNode<String> Typeof(SloppyTNode<Object> value);
TNode<Object> GetSuperConstructor(SloppyTNode<Context> context, TNode<Object> GetSuperConstructor(TNode<Context> context,
SloppyTNode<JSFunction> active_function); TNode<JSFunction> active_function);
TNode<JSReceiver> SpeciesConstructor( TNode<JSReceiver> SpeciesConstructor(
SloppyTNode<Context> context, SloppyTNode<Object> object, SloppyTNode<Context> context, SloppyTNode<Object> object,
SloppyTNode<JSReceiver> default_constructor); SloppyTNode<JSReceiver> default_constructor);
Node* InstanceOf(Node* object, Node* callable, Node* context); TNode<Oddball> InstanceOf(TNode<Object> object, TNode<Object> callable,
TNode<Context> context);
// Debug helpers // Debug helpers
Node* IsDebugActive(); Node* IsDebugActive();
......
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
using Node = compiler::Node;
enum class StoreMode { kOrdinary, kInLiteral }; enum class StoreMode { kOrdinary, kInLiteral };
class KeyedStoreGenericAssembler : public AccessorAssembler { class KeyedStoreGenericAssembler : public AccessorAssembler {
......
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