Files
sdk/runtime/lib/profiler.cc
Alexander Markov 6195ea86bc [vm] Remove irregular type arguments parameter from factories
In the VM, factory constructors always had an extra "type arguments"
parameter, even if class is not generic. Factory constructor bodies
were using class type parameters instead of function type parameters.

This results in extra code when calling non-generic factories
which is slightly inefficient in terms of code size and performance.
Also, it creates an additional complexity throughout the system as
factories should be special cased in many places.

This change removes artificial "type arguments" parameter, treating
factory constructors basically as static methods. This matches
kernel AST representation.

TEST=ci

Change-Id: I957583cb2ce9a3c408699880a04036e06b01dd31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/501762
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2026-05-12 06:11:15 -07:00

34 lines
986 B
C++

// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#include "vm/bootstrap_natives.h"
#include "include/dart_api.h"
#include "vm/exceptions.h"
#include "vm/native_entry.h"
#include "vm/object.h"
#include "vm/object_store.h"
namespace dart {
// Native implementations of the profiler parts of the dart:developer library.
DEFINE_NATIVE_ENTRY(UserTag_new, 0, 1) {
GET_NON_NULL_NATIVE_ARGUMENT(String, tag_label, arguments->NativeArgAt(0));
return UserTag::New(thread, tag_label);
}
DEFINE_NATIVE_ENTRY(UserTag_label, 0, 1) {
const UserTag& self = UserTag::CheckedHandle(zone, arguments->NativeArgAt(0));
return self.label();
}
DEFINE_NATIVE_ENTRY(UserTag_makeCurrent, 0, 1) {
const UserTag& self = UserTag::CheckedHandle(zone, arguments->NativeArgAt(0));
return self.MakeActive();
}
} // namespace dart