Commit 323b5962 authored by Liu Yu's avatar Liu Yu Committed by V8 LUCI CQ

[mips][baseline] Adds EmbeddedObjectMatches

Port 6bf0b704

Bug: v8:11872

Change-Id: I08a88402229e56b923a0551d64c53d73b8e909f4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3068323
Auto-Submit: Liu yu <liuyu@loongson.cn>
Reviewed-by: 's avatarZhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Commit-Queue: Zhao Jiazhong <zhaojiazhong-hf@loongson.cn>
Cr-Commit-Position: refs/heads/master@{#76056}
parent 204dc4aa
......@@ -1629,6 +1629,14 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
void set_last_call_pc_(byte* pc) { last_call_pc_ = pc; }
#ifdef DEBUG
bool EmbeddedObjectMatches(int pc_offset, Handle<Object> object) {
return target_address_at(
reinterpret_cast<Address>(buffer_->start() + pc_offset)) ==
(IsOnHeap() ? object->ptr() : object.address());
}
#endif
private:
// Avoid overflows for displacements etc.
static const int kMaximalBufferSize = 512 * MB;
......
......@@ -1396,13 +1396,16 @@ void TurboAssembler::li(Register rd, Operand j, LiFlags mode) {
}
} else if (IsOnHeap() && RelocInfo::IsEmbeddedObjectMode(j.rmode())) {
BlockGrowBufferScope block_growbuffer(this);
int offset = pc_offset();
Address address = j.immediate();
saved_handles_for_raw_object_ptr_.push_back(
std::make_pair(pc_offset(), j.immediate()));
Handle<HeapObject> handle(reinterpret_cast<Address*>(j.immediate()));
int32_t immediate = handle->ptr();
std::make_pair(offset, address));
Handle<HeapObject> object(reinterpret_cast<Address*>(address));
int32_t immediate = object->ptr();
RecordRelocInfo(j.rmode(), immediate);
lui(rd, (immediate >> kLuiShift) & kImm16Mask);
ori(rd, rd, (immediate & kImm16Mask));
DCHECK(EmbeddedObjectMatches(offset, object));
} else {
int32_t immediate;
if (j.IsHeapObjectRequest()) {
......
......@@ -1667,6 +1667,14 @@ class V8_EXPORT_PRIVATE Assembler : public AssemblerBase {
void set_last_call_pc_(byte* pc) { last_call_pc_ = pc; }
#ifdef DEBUG
bool EmbeddedObjectMatches(int pc_offset, Handle<Object> object) {
return target_address_at(
reinterpret_cast<Address>(buffer_->start() + pc_offset)) ==
(IsOnHeap() ? object->ptr() : object.address());
}
#endif
private:
// Avoid overflows for displacements etc.
static const int kMaximalBufferSize = 512 * MB;
......
......@@ -1916,15 +1916,18 @@ void TurboAssembler::li(Register rd, Operand j, LiFlags mode) {
}
} else if (IsOnHeap() && RelocInfo::IsEmbeddedObjectMode(j.rmode())) {
BlockGrowBufferScope block_growbuffer(this);
int offset = pc_offset();
Address address = j.immediate();
saved_handles_for_raw_object_ptr_.push_back(
std::make_pair(pc_offset(), j.immediate()));
Handle<HeapObject> handle(reinterpret_cast<Address*>(j.immediate()));
int64_t immediate = handle->ptr();
std::make_pair(offset, address));
Handle<HeapObject> object(reinterpret_cast<Address*>(address));
int64_t immediate = object->ptr();
RecordRelocInfo(j.rmode(), immediate);
lui(rd, (immediate >> 32) & kImm16Mask);
ori(rd, rd, (immediate >> 16) & kImm16Mask);
dsll(rd, rd, 16);
ori(rd, rd, immediate & kImm16Mask);
DCHECK(EmbeddedObjectMatches(offset, object));
} else if (MustUseReg(j.rmode())) {
int64_t immediate;
if (j.IsHeapObjectRequest()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment