Skip to content

Commit

Permalink
src: update SFI script accessor for V8 8.1
Browse files Browse the repository at this point in the history
The metadata used to access the script field from an SFI changed on V8
8.1. The field is still the same, so no other changes are necessary.
This fixes `v8 bt` on 8.1, as well as `stack-test` suite.
  • Loading branch information
mmarchini committed Mar 28, 2020
1 parent 1948512 commit 345f72d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/llv8-constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ void SharedInfo::Load() {
"class_SharedFunctionInfo__function_identifier__Object");
kScriptOffset = LoadConstant("class_SharedFunctionInfo__script__Object");
kScriptOrDebugInfoOffset =
LoadConstant("class_SharedFunctionInfo__script_or_debug_info__Object");
LoadConstant({"class_SharedFunctionInfo__script_or_debug_info__Object",
"class_SharedFunctionInfo__script_or_debug_info__HeapObject"});
kStartPositionOffset =
LoadConstant("class_SharedFunctionInfo__start_position_and_type__int",
"class_SharedFunctionInfo__start_position_and_type__SMI");
Expand Down
2 changes: 1 addition & 1 deletion src/llv8-constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class SharedInfo : public Module {
int64_t kNameOffset;
int64_t kInferredNameOffset;
int64_t kScriptOffset;
int64_t kScriptOrDebugInfoOffset;
Constant<int64_t> kScriptOrDebugInfoOffset;
int64_t kStartPositionOffset;
int64_t kEndPositionOffset;
int64_t kParameterCountOffset;
Expand Down
6 changes: 4 additions & 2 deletions src/llv8-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ ACCESSOR(SharedFunctionInfo, name, shared_info()->kNameOffset, String)
ACCESSOR(SharedFunctionInfo, inferred_name, shared_info()->kInferredNameOffset,
Value)
ACCESSOR(SharedFunctionInfo, script, shared_info()->kScriptOffset, Script)
ACCESSOR(SharedFunctionInfo, script_or_debug_info,
SAFE_ACCESSOR(SharedFunctionInfo, script_or_debug_info,
shared_info()->kScriptOrDebugInfoOffset, HeapObject)
ACCESSOR(SharedFunctionInfo, scope_info, shared_info()->kScopeInfoOffset,
HeapObject)
Expand Down Expand Up @@ -493,7 +493,9 @@ HeapObject SharedFunctionInfo::GetScopeInfo(Error& err) {
}

Script SharedFunctionInfo::GetScript(Error& err) {
if (v8()->shared_info()->kScriptOrDebugInfoOffset == -1) return script(err);
if (!v8()->shared_info()->kScriptOrDebugInfoOffset.Loaded()) {
return script(err);
}

HeapObject maybe_script = script_or_debug_info(err);
if (maybe_script.IsScript(err)) return maybe_script;
Expand Down

0 comments on commit 345f72d

Please sign in to comment.