mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
[vm] Remove the branch from pointer decompression in the runtime.
In particular, this removes the branch from Deserializer::Ref. Startup.ReadProgramSnapshot(StartupTime): on a Moto x4 arm64c 46063 -> 44714 us (-2.93%) TEST=ci Change-Id: I1cdd6e8b36ad695f15552ebea0f3fc726b467863 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242500 Reviewed-by: Liam Appelbe <liama@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
parent
017393ecdc
commit
49c039b5ab
|
@ -9260,11 +9260,6 @@ class Smi : public Integer {
|
|||
return raw_smi;
|
||||
}
|
||||
|
||||
static SmiPtr FromAlignedAddress(uword address) {
|
||||
ASSERT((address & kSmiTagMask) == kSmiTag);
|
||||
return static_cast<SmiPtr>(address);
|
||||
}
|
||||
|
||||
static ClassPtr Class();
|
||||
|
||||
static intptr_t Value(const SmiPtr raw_smi) { return RawSmiValue(raw_smi); }
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "platform/assert.h"
|
||||
#include "platform/utils.h"
|
||||
#include "vm/class_id.h"
|
||||
#include "vm/globals.h"
|
||||
#include "vm/pointer_tagging.h"
|
||||
|
||||
namespace dart {
|
||||
|
@ -66,13 +67,29 @@ class UntaggedObject;
|
|||
return (addr & kObjectAlignmentMask) != kOldObjectBits; \
|
||||
} \
|
||||
\
|
||||
bool operator==(const type& other) { return ptr == other.ptr; } \
|
||||
bool operator!=(const type& other) { return ptr != other.ptr; } \
|
||||
bool operator==(const type& other) { \
|
||||
return (ptr & kSmiTagMask) == kHeapObjectTag \
|
||||
? ptr == other.ptr \
|
||||
: static_cast<compressed_uword>(ptr) == \
|
||||
static_cast<compressed_uword>(other.ptr); \
|
||||
} \
|
||||
bool operator!=(const type& other) { \
|
||||
return (ptr & kSmiTagMask) == kHeapObjectTag \
|
||||
? ptr != other.ptr \
|
||||
: static_cast<compressed_uword>(ptr) != \
|
||||
static_cast<compressed_uword>(other.ptr); \
|
||||
} \
|
||||
constexpr bool operator==(const type& other) const { \
|
||||
return ptr == other.ptr; \
|
||||
return (ptr & kSmiTagMask) == kHeapObjectTag \
|
||||
? ptr == other.ptr \
|
||||
: static_cast<compressed_uword>(ptr) == \
|
||||
static_cast<compressed_uword>(other.ptr); \
|
||||
} \
|
||||
constexpr bool operator!=(const type& other) const { \
|
||||
return ptr != other.ptr; \
|
||||
return (ptr & kSmiTagMask) == kHeapObjectTag \
|
||||
? ptr != other.ptr \
|
||||
: static_cast<compressed_uword>(ptr) != \
|
||||
static_cast<compressed_uword>(other.ptr); \
|
||||
}
|
||||
|
||||
class ObjectPtr {
|
||||
|
@ -251,11 +268,6 @@ class CompressedObjectPtr {
|
|||
: compressed_pointer_(static_cast<uint32_t>(tagged)) {}
|
||||
|
||||
ObjectPtr Decompress(uword heap_base) const {
|
||||
if ((compressed_pointer_ & kSmiTagMask) != kHeapObjectTag) {
|
||||
// TODO(liama): Make all native code robust to junk in the upper 32-bits
|
||||
// of SMIs, then remove this special casing.
|
||||
return DecompressSmi();
|
||||
}
|
||||
return static_cast<ObjectPtr>(static_cast<uword>(compressed_pointer_) +
|
||||
heap_base);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue