[vm,dyn_modules] Recognize the vm:invisible pragma.
Adds a new isInvisible flag for both FunctionDeclarations and
ClosureDeclarations and sets it if the function or closure declaration
is annotated with @pragma('vm:invisible'). This way, function visibility
is appropriately recorded even if options.emitAnnotations is false.
The bytecode reader checks for the isInvisible flag when reading
FunctionDeclarations and ClosureDeclarations and appropriately
sets the is_visible flag for the Function object accordingly.
TEST=pkg/dart2bytecode/test/bytecode_generator_test
vm/dart/invisible_function_pragma_test
Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try
Change-Id: If435afbe5e74adc022ce064784b6b3e5e8a88164
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/486381
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
committed by
Commit Queue
parent
cd55f11e3a
commit
db8563d4d6
@@ -372,6 +372,7 @@ void BytecodeReaderHelper::ReadClosureDeclaration(const Function& function,
|
||||
const int kHasParameterFlagsFlag = 1 << 8;
|
||||
const int kHasAnnotationsFlag = 1 << 9;
|
||||
const int kHasPragmaFlag = 1 << 10;
|
||||
const int kIsInvisibleFlag = 1 << 11;
|
||||
|
||||
const intptr_t flags = reader_.ReadUInt();
|
||||
const bool has_pragma = (flags & kHasPragmaFlag) != 0;
|
||||
@@ -410,6 +411,7 @@ void BytecodeReaderHelper::ReadClosureDeclaration(const Function& function,
|
||||
closure.set_is_inlinable(false);
|
||||
}
|
||||
closure.set_is_debuggable((flags & kIsDebuggableFlag) != 0);
|
||||
closure.set_is_visible((flags & kIsInvisibleFlag) == 0);
|
||||
closure.set_has_pragma(has_pragma);
|
||||
|
||||
closures_->SetAt(closureIndex, closure);
|
||||
@@ -2072,6 +2074,7 @@ void BytecodeReaderHelper::ReadFunctionDeclarations(const Class& cls) {
|
||||
const int kHasPragmaFlag = 1 << 22;
|
||||
const int kHasCustomScriptFlag = 1 << 23;
|
||||
const int kIsExtensionTypeMemberFlag = 1 << 24;
|
||||
const int kIsInvisibleFlag = 1 << 25;
|
||||
|
||||
const intptr_t num_functions = reader_.ReadListLength();
|
||||
ASSERT(function_index_ + num_functions == functions_->Length());
|
||||
@@ -2154,6 +2157,7 @@ void BytecodeReaderHelper::ReadFunctionDeclarations(const Class& cls) {
|
||||
function.set_is_synthetic((flags & kIsNoSuchMethodForwarderFlag) != 0);
|
||||
function.set_is_reflectable((flags & kIsReflectableFlag) != 0);
|
||||
function.set_is_debuggable((flags & kIsDebuggableFlag) != 0);
|
||||
function.set_is_visible((flags & kIsInvisibleFlag) == 0);
|
||||
function.set_is_extension_member(is_extension_member);
|
||||
function.set_is_extension_type_member(is_extension_type_member);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user