Skip to content

Commit

Permalink
src: guess Symbol.name offset
Browse files Browse the repository at this point in the history
PR-URL: #330
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
  • Loading branch information
mmarchini committed Jan 21, 2020
1 parent b30cf41 commit c981f7f
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/llv8-constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,24 @@ void Frame::Load() {


void Symbol::Load() {
kNameOffset = LoadConstant({"class_Symbol__name__Object"});
// map is the last field of HeapObject
Constant<int64_t> maybe_name_offset =
LoadConstant({"class_HeapObject__map__Map"});
common_->Load();
if (maybe_name_offset.Check()) {
int name_offset = *maybe_name_offset;

name_offset += common_->kPointerSize;
// class Name extends HeapObject and has only one uint32 field
name_offset += sizeof(uint32_t);
// class Symbol extends Name and has one int32 field before name
name_offset += sizeof(int32_t);

kNameOffset =
LoadOptionalConstant({"class_Symbol__name__Object"}, name_offset);
} else {
kNameOffset = LoadConstant({"class_Symbol__name__Object"});
}
}


Expand Down

0 comments on commit c981f7f

Please sign in to comment.