Skip to content

Commit

Permalink
src: fixes for V8 6.9 and 7.0
Browse files Browse the repository at this point in the history
- PositionInfo removed from SFI and PreParsedData ((v8/v8@39e2d97)[])
  - PositionInfo is now available on ScopeInfo or UncompiledData
- DebugInfo was removed from SFI ((v8/v8@c51bcd1)[])
  - InferredName is available on ScopeInfo or UncompiledData
    ((v8/v8@c941f11)[])
- StackLocal removed from ScopeInfo ((v8/v8@467eb14)[])
- ParamCount (from ScopeInfo) size decreased ((v8/v8@53d4dfc)[])

[v8/v8@39e2d97]: v8/v8@39e2d97
[v8/v8@c51bcd1]: v8/v8@c51bcd1
[v8/v8@c941f11]: v8/v8@c941f11
[v8/v8@467eb14]: v8/v8@467eb14
[v8/v8@53d4dfc]: v8/v8@53d4dfc

PR-URL: #247
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
mmarchini committed Sep 12, 2019
1 parent 99d06e7 commit ab2a786
Show file tree
Hide file tree
Showing 7 changed files with 295 additions and 45 deletions.
28 changes: 25 additions & 3 deletions src/llv8-constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ void JSDate::Load() {


void SharedInfo::Load() {
kFunctionDataOffset =
LoadConstant("class_SharedFunctionInfo__function_data__Object");
kNameOrScopeInfoOffset =
LoadConstant("class_SharedFunctionInfo__name_or_scope_info__Object");
kNameOffset = LoadConstant("class_SharedFunctionInfo__raw_name__Object",
Expand All @@ -193,6 +195,8 @@ void SharedInfo::Load() {
LoadConstant("class_SharedFunctionInfo__inferred_name__String",
"class_SharedFunctionInfo__function_identifier__Object");
kScriptOffset = LoadConstant("class_SharedFunctionInfo__script__Object");
kScriptOrDebugInfoOffset =
LoadConstant("class_SharedFunctionInfo__script_or_debug_info__Object");
kStartPositionOffset =
LoadConstant("class_SharedFunctionInfo__start_position_and_type__int",
"class_SharedFunctionInfo__start_position_and_type__SMI");
Expand All @@ -201,11 +205,12 @@ void SharedInfo::Load() {
"class_SharedFunctionInfo__end_position__SMI");
kParameterCountOffset = LoadConstant(
"class_SharedFunctionInfo__internal_formal_parameter_count__int",
"class_SharedFunctionInfo__internal_formal_parameter_count__SMI");
"class_SharedFunctionInfo__internal_formal_parameter_count__uint16_t");

if (kParameterCountOffset == -1) {
kParameterCountOffset =
LoadConstant("class_SharedFunctionInfo__formal_parameter_count__SMI");
kParameterCountOffset = LoadConstant(
"class_SharedFunctionInfo__internal_formal_parameter_count__SMI",
"class_SharedFunctionInfo__formal_parameter_count__SMI");
}

// NOTE: Could potentially be -1 on v4 and v5 node, should check in llv8
Expand All @@ -229,6 +234,16 @@ void SharedInfo::Load() {
}


void UncompiledData::Load() {
kInferredNameOffset =
LoadConstant("class_UncompiledData__inferred_name__String");
kStartPositionOffset =
LoadConstant("class_UncompiledData__start_position__int32_t");
kEndPositionOffset =
LoadConstant("class_UncompiledData__end_position__int32_t");
}


void Code::Load() {
kStartOffset = LoadConstant("class_Code__instruction_start__uintptr_t");
kSizeOffset = LoadConstant("class_Code__instruction_size__int");
Expand All @@ -238,6 +253,7 @@ void Code::Load() {
void ScopeInfo::Load() {
kParameterCountOffset = LoadConstant("scopeinfo_idx_nparams");
kStackLocalCountOffset = LoadConstant("scopeinfo_idx_nstacklocals");
kEmbeddedParamAndStackLocals = kStackLocalCountOffset != -1;
kContextLocalCountOffset = LoadConstant("scopeinfo_idx_ncontextlocals");
kVariablePartIndex = LoadConstant("scopeinfo_idx_first_vars");
}
Expand Down Expand Up @@ -516,6 +532,12 @@ void Types::Load() {
kJSDateType = LoadConstant("type_JSDate__JS_DATE_TYPE");
kSharedFunctionInfoType =
LoadConstant("type_SharedFunctionInfo__SHARED_FUNCTION_INFO_TYPE");
kUncompiledDataWithoutPreParsedScopeType = LoadConstant(
"type_UncompiledDataWithoutPreParsedScope__UNCOMPILED_DATA_WITHOUT_PRE_"
"PARSED_SCOPE_TYPE");
kUncompiledDataWithPreParsedScopeType = LoadConstant(
"type_UncompiledDataWithPreParsedScope__UNCOMPILED_DATA_WITH_PRE_PARSED_"
"SCOPE_TYPE");
kScriptType = LoadConstant("type_Script__SCRIPT_TYPE");
kScopeInfoType = LoadConstant("type_ScopeInfo__SCOPE_INFO_TYPE");
kSymbolType = LoadConstant("type_Symbol__SYMBOL_TYPE");
Expand Down
17 changes: 17 additions & 0 deletions src/llv8-constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,12 @@ class SharedInfo : public Module {
int64_t kNameOffset;
int64_t kInferredNameOffset;
int64_t kScriptOffset;
int64_t kScriptOrDebugInfoOffset;
int64_t kStartPositionOffset;
int64_t kEndPositionOffset;
int64_t kParameterCountOffset;
int64_t kScopeInfoOffset;
int64_t kFunctionDataOffset;

int64_t kStartPositionMask;
int64_t kStartPositionShift;
Expand All @@ -170,6 +172,18 @@ class SharedInfo : public Module {
void Load();
};

class UncompiledData : public Module {
public:
CONSTANTS_DEFAULT_METHODS(UncompiledData);

int64_t kInferredNameOffset;
int64_t kStartPositionOffset;
int64_t kEndPositionOffset;

protected:
void Load();
};

class Code : public Module {
public:
CONSTANTS_DEFAULT_METHODS(Code)
Expand All @@ -188,6 +202,7 @@ class ScopeInfo : public Module {
int64_t kParameterCountOffset;
int64_t kStackLocalCountOffset;
int64_t kContextLocalCountOffset;
bool kEmbeddedParamAndStackLocals;
int64_t kVariablePartIndex;

protected:
Expand Down Expand Up @@ -508,6 +523,8 @@ class Types : public Module {
int64_t kJSRegExpType;
int64_t kJSDateType;
int64_t kSharedFunctionInfoType;
int64_t kUncompiledDataWithoutPreParsedScopeType;
int64_t kUncompiledDataWithPreParsedScopeType;
int64_t kScriptType;
int64_t kScopeInfoType;
int64_t kSymbolType;
Expand Down
Loading

0 comments on commit ab2a786

Please sign in to comment.