summaryrefslogtreecommitdiff
path: root/deps/v8/src/builtins/builtins-function-gen.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/builtins/builtins-function-gen.cc')
-rw-r--r--deps/v8/src/builtins/builtins-function-gen.cc47
1 files changed, 21 insertions, 26 deletions
diff --git a/deps/v8/src/builtins/builtins-function-gen.cc b/deps/v8/src/builtins/builtins-function-gen.cc
index ee1f67d434..f0853e9bd9 100644
--- a/deps/v8/src/builtins/builtins-function-gen.cc
+++ b/deps/v8/src/builtins/builtins-function-gen.cc
@@ -15,14 +15,12 @@ namespace internal {
TF_BUILTIN(FastFunctionPrototypeBind, CodeStubAssembler) {
Label slow(this);
- // TODO(ishell): use constants from Descriptor once the JSFunction linkage
- // arguments are reordered.
TNode<Int32T> argc =
UncheckedCast<Int32T>(Parameter(Descriptor::kJSActualArgumentsCount));
- Node* context = Parameter(Descriptor::kContext);
- Node* new_target = Parameter(Descriptor::kJSNewTarget);
+ TNode<Context> context = CAST(Parameter(Descriptor::kContext));
+ TNode<Object> new_target = CAST(Parameter(Descriptor::kJSNewTarget));
- CodeStubArguments args(this, ChangeInt32ToIntPtr(argc));
+ CodeStubArguments args(this, argc);
// Check that receiver has instance type of JS_FUNCTION_TYPE
TNode<Object> receiver = args.GetReceiver();
@@ -85,21 +83,20 @@ TF_BUILTIN(FastFunctionPrototypeBind, CodeStubAssembler) {
// Choose the right bound function map based on whether the target is
// constructable.
Comment("Choose the right bound function map");
- VARIABLE(bound_function_map, MachineRepresentation::kTagged);
+ TVARIABLE(Map, bound_function_map);
{
Label with_constructor(this);
- VariableList vars({&bound_function_map}, zone());
TNode<NativeContext> native_context = LoadNativeContext(context);
- Label map_done(this, vars);
+ Label map_done(this, &bound_function_map);
GotoIf(IsConstructorMap(receiver_map), &with_constructor);
- bound_function_map.Bind(LoadContextElement(
+ bound_function_map = CAST(LoadContextElement(
native_context, Context::BOUND_FUNCTION_WITHOUT_CONSTRUCTOR_MAP_INDEX));
Goto(&map_done);
BIND(&with_constructor);
- bound_function_map.Bind(LoadContextElement(
+ bound_function_map = CAST(LoadContextElement(
native_context, Context::BOUND_FUNCTION_WITH_CONSTRUCTOR_MAP_INDEX));
Goto(&map_done);
@@ -115,30 +112,28 @@ TF_BUILTIN(FastFunctionPrototypeBind, CodeStubAssembler) {
// Allocate the arguments array.
Comment("Allocate the arguments array");
- VARIABLE(argument_array, MachineRepresentation::kTagged);
+ TVARIABLE(FixedArray, argument_array);
{
Label empty_arguments(this);
Label arguments_done(this, &argument_array);
GotoIf(Uint32LessThanOrEqual(argc, Int32Constant(1)), &empty_arguments);
TNode<IntPtrT> elements_length =
Signed(ChangeUint32ToWord(Unsigned(Int32Sub(argc, Int32Constant(1)))));
- TNode<FixedArray> elements = CAST(AllocateFixedArray(
- PACKED_ELEMENTS, elements_length, kAllowLargeObjectAllocation));
- VARIABLE(index, MachineType::PointerRepresentation());
- index.Bind(IntPtrConstant(0));
+ argument_array = CAST(AllocateFixedArray(PACKED_ELEMENTS, elements_length,
+ kAllowLargeObjectAllocation));
+ TVARIABLE(IntPtrT, index, IntPtrConstant(0));
VariableList foreach_vars({&index}, zone());
args.ForEach(
foreach_vars,
- [this, elements, &index](Node* arg) {
- StoreFixedArrayElement(elements, index.value(), arg);
+ [&](TNode<Object> arg) {
+ StoreFixedArrayElement(argument_array.value(), index.value(), arg);
Increment(&index);
},
IntPtrConstant(1));
- argument_array.Bind(elements);
Goto(&arguments_done);
BIND(&empty_arguments);
- argument_array.Bind(EmptyFixedArrayConstant());
+ argument_array = EmptyFixedArrayConstant();
Goto(&arguments_done);
BIND(&arguments_done);
@@ -146,16 +141,16 @@ TF_BUILTIN(FastFunctionPrototypeBind, CodeStubAssembler) {
// Determine bound receiver.
Comment("Determine bound receiver");
- VARIABLE(bound_receiver, MachineRepresentation::kTagged);
+ TVARIABLE(Object, bound_receiver);
{
Label has_receiver(this);
Label receiver_done(this, &bound_receiver);
GotoIf(Word32NotEqual(argc, Int32Constant(0)), &has_receiver);
- bound_receiver.Bind(UndefinedConstant());
+ bound_receiver = UndefinedConstant();
Goto(&receiver_done);
BIND(&has_receiver);
- bound_receiver.Bind(args.AtIndex(0));
+ bound_receiver = args.AtIndex(0);
Goto(&receiver_done);
BIND(&receiver_done);
@@ -196,10 +191,10 @@ TF_BUILTIN(FastFunctionPrototypeBind, CodeStubAssembler) {
// ES6 #sec-function.prototype-@@hasinstance
TF_BUILTIN(FunctionPrototypeHasInstance, CodeStubAssembler) {
- Node* context = Parameter(Descriptor::kContext);
- Node* f = Parameter(Descriptor::kReceiver);
- Node* v = Parameter(Descriptor::kV);
- Node* result = OrdinaryHasInstance(context, f, v);
+ TNode<Context> context = CAST(Parameter(Descriptor::kContext));
+ TNode<Object> f = CAST(Parameter(Descriptor::kReceiver));
+ TNode<Object> v = CAST(Parameter(Descriptor::kV));
+ TNode<Oddball> result = OrdinaryHasInstance(context, f, v);
Return(result);
}