diff --git a/src/interpreter/interpreter-intrinsics-generator.cc b/src/interpreter/interpreter-intrinsics-generator.cc index c54c090d4f..96dbef77ae 100644 --- a/src/interpreter/interpreter-intrinsics-generator.cc +++ b/src/interpreter/interpreter-intrinsics-generator.cc @@ -31,8 +31,9 @@ class IntrinsicsGenerator { zone_(assembler->zone()), assembler_(assembler) {} - Node* InvokeIntrinsic(TNode function_id, TNode context, - const InterpreterAssembler::RegListNodePair& args); + TNode InvokeIntrinsic( + TNode function_id, TNode context, + const InterpreterAssembler::RegListNodePair& args); private: enum InstanceTypeCompareMode { @@ -40,18 +41,20 @@ class IntrinsicsGenerator { kInstanceTypeGreaterThanOrEqual }; - Node* IsInstanceType(Node* input, int type); - Node* CompareInstanceType(Node* map, int type, InstanceTypeCompareMode mode); - Node* IntrinsicAsStubCall(const InterpreterAssembler::RegListNodePair& args, - TNode context, Callable const& callable); - Node* IntrinsicAsBuiltinCall( + TNode IsInstanceType(TNode input, int type); + TNode CompareInstanceType(TNode map, int type, + InstanceTypeCompareMode mode); + TNode IntrinsicAsStubCall( + const InterpreterAssembler::RegListNodePair& args, TNode context, + Callable const& callable); + TNode IntrinsicAsBuiltinCall( const InterpreterAssembler::RegListNodePair& args, TNode context, Builtins::Name name); void AbortIfArgCountMismatch(int expected, compiler::TNode actual); -#define DECLARE_INTRINSIC_HELPER(name, lower_case, count) \ - Node* name(const InterpreterAssembler::RegListNodePair& args, \ - TNode context); +#define DECLARE_INTRINSIC_HELPER(name, lower_case, count) \ + TNode name(const InterpreterAssembler::RegListNodePair& args, \ + TNode context); INTRINSICS_LIST(DECLARE_INTRINSIC_HELPER) #undef DECLARE_INTRINSIC_HELPER @@ -66,7 +69,7 @@ class IntrinsicsGenerator { DISALLOW_COPY_AND_ASSIGN(IntrinsicsGenerator); }; -Node* GenerateInvokeIntrinsic( +TNode GenerateInvokeIntrinsic( InterpreterAssembler* assembler, TNode function_id, TNode context, const InterpreterAssembler::RegListNodePair& args) { IntrinsicsGenerator generator(assembler); @@ -75,12 +78,11 @@ Node* GenerateInvokeIntrinsic( #define __ assembler_-> -Node* IntrinsicsGenerator::InvokeIntrinsic( +TNode IntrinsicsGenerator::InvokeIntrinsic( TNode function_id, TNode context, const InterpreterAssembler::RegListNodePair& args) { InterpreterAssembler::Label abort(assembler_), end(assembler_); - InterpreterAssembler::Variable result(assembler_, - MachineRepresentation::kTagged); + InterpreterAssembler::TVariable result(assembler_); #define MAKE_LABEL(name, lower_case, count) \ InterpreterAssembler::Label lower_case(assembler_); @@ -103,9 +105,9 @@ Node* IntrinsicsGenerator::InvokeIntrinsic( if (FLAG_debug_code && expected_arg_count >= 0) { \ AbortIfArgCountMismatch(expected_arg_count, args.reg_count()); \ } \ - Node* value = name(args, context); \ + TNode value = name(args, context); \ if (value) { \ - result.Bind(value); \ + result = value; \ __ Goto(&end); \ } \ } @@ -115,7 +117,7 @@ Node* IntrinsicsGenerator::InvokeIntrinsic( __ BIND(&abort); { __ Abort(AbortReason::kUnexpectedFunctionIDForInvokeIntrinsic); - result.Bind(__ UndefinedConstant()); + result = __ UndefinedConstant(); __ Goto(&end); } @@ -123,8 +125,8 @@ Node* IntrinsicsGenerator::InvokeIntrinsic( return result.value(); } -Node* IntrinsicsGenerator::CompareInstanceType(Node* object, int type, - InstanceTypeCompareMode mode) { +TNode IntrinsicsGenerator::CompareInstanceType( + TNode object, int type, InstanceTypeCompareMode mode) { TNode instance_type = __ LoadInstanceType(object); if (mode == kInstanceTypeEqual) { @@ -135,17 +137,18 @@ Node* IntrinsicsGenerator::CompareInstanceType(Node* object, int type, } } -Node* IntrinsicsGenerator::IsInstanceType(Node* input, int type) { +TNode IntrinsicsGenerator::IsInstanceType(TNode input, + int type) { TNode result = __ Select( __ TaggedIsSmi(input), [=] { return __ FalseConstant(); }, [=] { return __ SelectBooleanConstant( - CompareInstanceType(input, type, kInstanceTypeEqual)); + CompareInstanceType(__ CAST(input), type, kInstanceTypeEqual)); }); return result; } -Node* IntrinsicsGenerator::IsJSReceiver( +TNode IntrinsicsGenerator::IsJSReceiver( const InterpreterAssembler::RegListNodePair& args, TNode context) { TNode input = __ LoadRegisterFromRegisterList(args, 0); TNode result = __ Select( @@ -156,19 +159,19 @@ Node* IntrinsicsGenerator::IsJSReceiver( return result; } -Node* IntrinsicsGenerator::IsArray( +TNode IntrinsicsGenerator::IsArray( const InterpreterAssembler::RegListNodePair& args, TNode context) { TNode input = __ LoadRegisterFromRegisterList(args, 0); return IsInstanceType(input, JS_ARRAY_TYPE); } -Node* IntrinsicsGenerator::IsSmi( +TNode IntrinsicsGenerator::IsSmi( const InterpreterAssembler::RegListNodePair& args, TNode context) { TNode input = __ LoadRegisterFromRegisterList(args, 0); return __ SelectBooleanConstant(__ TaggedIsSmi(input)); } -Node* IntrinsicsGenerator::IntrinsicAsStubCall( +TNode IntrinsicsGenerator::IntrinsicAsStubCall( const InterpreterAssembler::RegListNodePair& args, TNode context, Callable const& callable) { int param_count = callable.descriptor().GetParameterCount(); @@ -180,56 +183,57 @@ Node* IntrinsicsGenerator::IntrinsicAsStubCall( stub_args[index++] = __ LoadRegisterFromRegisterList(args, i); } stub_args[index++] = context; - return __ CallStubN(StubCallMode::kCallCodeObject, callable.descriptor(), 1, - input_count, stub_args); + return __ CAST(__ CallStubN(StubCallMode::kCallCodeObject, + callable.descriptor(), 1, input_count, + stub_args)); } -Node* IntrinsicsGenerator::IntrinsicAsBuiltinCall( +TNode IntrinsicsGenerator::IntrinsicAsBuiltinCall( const InterpreterAssembler::RegListNodePair& args, TNode context, Builtins::Name name) { Callable callable = Builtins::CallableFor(isolate_, name); return IntrinsicAsStubCall(args, context, callable); } -Node* IntrinsicsGenerator::CopyDataProperties( +TNode IntrinsicsGenerator::CopyDataProperties( const InterpreterAssembler::RegListNodePair& args, TNode context) { return IntrinsicAsStubCall( args, context, Builtins::CallableFor(isolate(), Builtins::kCopyDataProperties)); } -Node* IntrinsicsGenerator::CreateIterResultObject( +TNode IntrinsicsGenerator::CreateIterResultObject( const InterpreterAssembler::RegListNodePair& args, TNode context) { return IntrinsicAsStubCall( args, context, Builtins::CallableFor(isolate(), Builtins::kCreateIterResultObject)); } -Node* IntrinsicsGenerator::HasProperty( +TNode IntrinsicsGenerator::HasProperty( const InterpreterAssembler::RegListNodePair& args, TNode context) { return IntrinsicAsStubCall( args, context, Builtins::CallableFor(isolate(), Builtins::kHasProperty)); } -Node* IntrinsicsGenerator::ToStringRT( +TNode IntrinsicsGenerator::ToStringRT( const InterpreterAssembler::RegListNodePair& args, TNode context) { return IntrinsicAsStubCall( args, context, Builtins::CallableFor(isolate(), Builtins::kToString)); } -Node* IntrinsicsGenerator::ToLength( +TNode IntrinsicsGenerator::ToLength( const InterpreterAssembler::RegListNodePair& args, TNode context) { return IntrinsicAsStubCall( args, context, Builtins::CallableFor(isolate(), Builtins::kToLength)); } -Node* IntrinsicsGenerator::ToObject( +TNode IntrinsicsGenerator::ToObject( const InterpreterAssembler::RegListNodePair& args, TNode context) { return IntrinsicAsStubCall( args, context, Builtins::CallableFor(isolate(), Builtins::kToObject)); } -Node* IntrinsicsGenerator::Call( +TNode IntrinsicsGenerator::Call( const InterpreterAssembler::RegListNodePair& args, TNode context) { // First argument register contains the function target. TNode function = __ LoadRegisterFromRegisterList(args, 0); @@ -252,16 +256,15 @@ Node* IntrinsicsGenerator::Call( __ CallJSAndDispatch(function, context, target_args, ConvertReceiverMode::kAny); - return nullptr; // We never return from the CallJSAndDispatch above. + return TNode(); // We never return from the CallJSAndDispatch above. } -Node* IntrinsicsGenerator::CreateAsyncFromSyncIterator( +TNode IntrinsicsGenerator::CreateAsyncFromSyncIterator( const InterpreterAssembler::RegListNodePair& args, TNode context) { InterpreterAssembler::Label not_receiver( assembler_, InterpreterAssembler::Label::kDeferred); InterpreterAssembler::Label done(assembler_); - InterpreterAssembler::Variable return_value(assembler_, - MachineRepresentation::kTagged); + InterpreterAssembler::TVariable return_value(assembler_); TNode sync_iterator = __ LoadRegisterFromRegisterList(args, 0); @@ -281,13 +284,13 @@ Node* IntrinsicsGenerator::CreateAsyncFromSyncIterator( __ StoreObjectFieldNoWriteBarrier(iterator, JSAsyncFromSyncIterator::kNextOffset, next); - return_value.Bind(iterator); + return_value = iterator; __ Goto(&done); __ BIND(¬_receiver); { - return_value.Bind( - __ CallRuntime(Runtime::kThrowSymbolIteratorInvalid, context)); + return_value = + __ CallRuntime(Runtime::kThrowSymbolIteratorInvalid, context); // Unreachable due to the Throw in runtime call. __ Goto(&done); @@ -297,13 +300,13 @@ Node* IntrinsicsGenerator::CreateAsyncFromSyncIterator( return return_value.value(); } -Node* IntrinsicsGenerator::CreateJSGeneratorObject( +TNode IntrinsicsGenerator::CreateJSGeneratorObject( const InterpreterAssembler::RegListNodePair& args, TNode context) { return IntrinsicAsBuiltinCall(args, context, Builtins::kCreateGeneratorObject); } -Node* IntrinsicsGenerator::GeneratorGetResumeMode( +TNode IntrinsicsGenerator::GeneratorGetResumeMode( const InterpreterAssembler::RegListNodePair& args, TNode context) { TNode generator = __ CAST(__ LoadRegisterFromRegisterList(args, 0)); @@ -313,7 +316,7 @@ Node* IntrinsicsGenerator::GeneratorGetResumeMode( return value; } -Node* IntrinsicsGenerator::GeneratorClose( +TNode IntrinsicsGenerator::GeneratorClose( const InterpreterAssembler::RegListNodePair& args, TNode context) { TNode generator = __ CAST(__ LoadRegisterFromRegisterList(args, 0)); @@ -323,7 +326,7 @@ Node* IntrinsicsGenerator::GeneratorClose( return __ UndefinedConstant(); } -Node* IntrinsicsGenerator::GetImportMetaObject( +TNode IntrinsicsGenerator::GetImportMetaObject( const InterpreterAssembler::RegListNodePair& args, TNode context) { TNode const module_context = __ LoadModuleContext(context); TNode const module = @@ -331,71 +334,70 @@ Node* IntrinsicsGenerator::GetImportMetaObject( TNode const import_meta = __ LoadObjectField(module, SourceTextModule::kImportMetaOffset); - InterpreterAssembler::Variable return_value(assembler_, - MachineRepresentation::kTagged); - return_value.Bind(import_meta); + InterpreterAssembler::TVariable return_value(assembler_); + return_value = import_meta; InterpreterAssembler::Label end(assembler_); __ GotoIfNot(__ IsTheHole(import_meta), &end); - return_value.Bind(__ CallRuntime(Runtime::kGetImportMetaObject, context)); + return_value = __ CallRuntime(Runtime::kGetImportMetaObject, context); __ Goto(&end); __ BIND(&end); return return_value.value(); } -Node* IntrinsicsGenerator::AsyncFunctionAwaitCaught( +TNode IntrinsicsGenerator::AsyncFunctionAwaitCaught( const InterpreterAssembler::RegListNodePair& args, TNode context) { return IntrinsicAsBuiltinCall(args, context, Builtins::kAsyncFunctionAwaitCaught); } -Node* IntrinsicsGenerator::AsyncFunctionAwaitUncaught( +TNode IntrinsicsGenerator::AsyncFunctionAwaitUncaught( const InterpreterAssembler::RegListNodePair& args, TNode context) { return IntrinsicAsBuiltinCall(args, context, Builtins::kAsyncFunctionAwaitUncaught); } -Node* IntrinsicsGenerator::AsyncFunctionEnter( +TNode IntrinsicsGenerator::AsyncFunctionEnter( const InterpreterAssembler::RegListNodePair& args, TNode context) { return IntrinsicAsBuiltinCall(args, context, Builtins::kAsyncFunctionEnter); } -Node* IntrinsicsGenerator::AsyncFunctionReject( +TNode IntrinsicsGenerator::AsyncFunctionReject( const InterpreterAssembler::RegListNodePair& args, TNode context) { return IntrinsicAsBuiltinCall(args, context, Builtins::kAsyncFunctionReject); } -Node* IntrinsicsGenerator::AsyncFunctionResolve( +TNode IntrinsicsGenerator::AsyncFunctionResolve( const InterpreterAssembler::RegListNodePair& args, TNode context) { return IntrinsicAsBuiltinCall(args, context, Builtins::kAsyncFunctionResolve); } -Node* IntrinsicsGenerator::AsyncGeneratorAwaitCaught( +TNode IntrinsicsGenerator::AsyncGeneratorAwaitCaught( const InterpreterAssembler::RegListNodePair& args, TNode context) { return IntrinsicAsBuiltinCall(args, context, Builtins::kAsyncGeneratorAwaitCaught); } -Node* IntrinsicsGenerator::AsyncGeneratorAwaitUncaught( +TNode IntrinsicsGenerator::AsyncGeneratorAwaitUncaught( const InterpreterAssembler::RegListNodePair& args, TNode context) { return IntrinsicAsBuiltinCall(args, context, Builtins::kAsyncGeneratorAwaitUncaught); } -Node* IntrinsicsGenerator::AsyncGeneratorReject( +TNode IntrinsicsGenerator::AsyncGeneratorReject( const InterpreterAssembler::RegListNodePair& args, TNode context) { return IntrinsicAsBuiltinCall(args, context, Builtins::kAsyncGeneratorReject); } -Node* IntrinsicsGenerator::AsyncGeneratorResolve( +TNode IntrinsicsGenerator::AsyncGeneratorResolve( const InterpreterAssembler::RegListNodePair& args, TNode context) { return IntrinsicAsBuiltinCall(args, context, Builtins::kAsyncGeneratorResolve); } -Node* IntrinsicsGenerator::AsyncGeneratorYield( +TNode IntrinsicsGenerator::AsyncGeneratorYield( const InterpreterAssembler::RegListNodePair& args, TNode context) { return IntrinsicAsBuiltinCall(args, context, Builtins::kAsyncGeneratorYield); } diff --git a/src/interpreter/interpreter-intrinsics-generator.h b/src/interpreter/interpreter-intrinsics-generator.h index 22e501e230..0944a611c4 100644 --- a/src/interpreter/interpreter-intrinsics-generator.h +++ b/src/interpreter/interpreter-intrinsics-generator.h @@ -16,7 +16,7 @@ class Node; namespace interpreter { -extern compiler::Node* GenerateInvokeIntrinsic( +extern compiler::TNode GenerateInvokeIntrinsic( InterpreterAssembler* assembler, compiler::TNode function_id, compiler::TNode context, const InterpreterAssembler::RegListNodePair& args);