Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
src: make Symbol more resilient
Instead of crashing if llnode fails to parse a Symbol, just return  a
??? token.
  • Loading branch information
mmarchini committed Jan 16, 2020
commit ece9589264be09a9319e099703aaedef9799dac6
2 changes: 1 addition & 1 deletion src/llv8-constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ void Frame::Load() {


void Symbol::Load() {
kNameOffset = LoadConstant("class_Symbol__name__Object");
kNameOffset = LoadConstant({"class_Symbol__name__Object"});
}


Expand Down
2 changes: 1 addition & 1 deletion src/llv8-constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ class Symbol : public Module {
public:
CONSTANTS_DEFAULT_METHODS(Symbol);

int64_t kNameOffset;
Constant<int64_t> kNameOffset;

protected:
void Load();
Expand Down
2 changes: 1 addition & 1 deletion src/llv8-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ ACCESSOR(Map, MaybeConstructor, map()->kMaybeConstructorOffset, HeapObject)
SAFE_ACCESSOR(Map, InstanceDescriptors, map()->kInstanceDescriptorsOffset,
HeapObject)

ACCESSOR(Symbol, Name, symbol()->kNameOffset, HeapObject)
SAFE_ACCESSOR(Symbol, Name, symbol()->kNameOffset, HeapObject)

inline int64_t Map::BitField3(Error& err) {
return v8()->LoadUnsigned(LeaField(v8()->map()->kBitField3Offset), 4, err);
Expand Down
1 change: 1 addition & 0 deletions src/llv8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@ std::string Symbol::ToString(Error& err) {
return "Symbol()";
}
HeapObject name = Name(err);
RETURN_IF_INVALID(name, "Symbol(???)");
return "Symbol('" + String(name).ToString(err) + "')";
}

Expand Down