dart-sdk/runtime/lib/class_id.cc
Vyacheslav Egorov 364b8575de VM: Restore old implementation of ClassID.cid* fields.
When we were implementing bootstraping from Kernel in 23fd1a184b we switched ClassID.cid* fields to become 'static final' lazily initialized fields instead of constants as they were before. This was mainly done to allow dartk compile patched_sdk - because these fields were previously injected in runtime and never existed in the text form.

However this regressed code quality for app-jit and app-aot snapshots because 'static final' fields are reset by snapshotting so resulting code contains InitStaticField and LoadStaticField instructions.

BUG=
R=kustermann@google.com

Review-Url: https://codereview.chromium.org/2693863006 .
2017-02-16 17:43:42 +01:00

17 lines
498 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 "platform/assert.h"
#include "vm/bootstrap_natives.h"
namespace dart {
DEFINE_NATIVE_ENTRY(ClassID_getID, 1) {
const Instance& instance =
Instance::CheckedHandle(zone, arguments->NativeArgAt(0));
return Smi::New(instance.GetClassId());
}
} // namespace dart