Skip to content

Instantly share code, notes, and snippets.

@littledivy
Created July 14, 2022 05:53
Show Gist options
  • Select an option

  • Save littledivy/32f224ab837f15c2958500942c8534a2 to your computer and use it in GitHub Desktop.

Select an option

Save littledivy/32f224ab837f15c2958500942c8534a2 to your computer and use it in GitHub Desktop.

Revisions

  1. littledivy created this gist Jul 14, 2022.
    71 changes: 71 additions & 0 deletions uint8_fast_calls.patch
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,71 @@
    diff --git a/include/v8-fast-api-calls.h b/include/v8-fast-api-calls.h
    index 6ef950c10f..c2f436f7cc 100644
    --- a/include/v8-fast-api-calls.h
    +++ b/include/v8-fast-api-calls.h
    @@ -258,6 +258,7 @@ class CTypeInfo {
    // actual type. It's currently used by the arm64 simulator
    // and can be added to the other simulators as well when fast
    // calls having both GP and FP params need to be supported.
    + kUint8,
    };

    // kCallbackOptionsType is not part of the Type enum
    diff --git a/src/codegen/machine-type.h b/src/codegen/machine-type.h
    index ccbfbfd476..4756e22ee3 100644
    --- a/src/codegen/machine-type.h
    +++ b/src/codegen/machine-type.h
    @@ -289,6 +289,8 @@ class MachineType {
    return MachineType::AnyTagged();
    case CTypeInfo::Type::kBool:
    return MachineType::Bool();
    + case CTypeInfo::Type::kUint8:
    + return MachineType::Uint8();
    case CTypeInfo::Type::kInt32:
    return MachineType::Int32();
    case CTypeInfo::Type::kUint32:
    diff --git a/src/compiler/effect-control-linearizer.cc b/src/compiler/effect-control-linearizer.cc
    index 5825045052..cbf5fab7fb 100644
    --- a/src/compiler/effect-control-linearizer.cc
    +++ b/src/compiler/effect-control-linearizer.cc
    @@ -4859,7 +4859,7 @@ void EffectControlLinearizer::LowerStoreMessage(Node* node) {

    Node* EffectControlLinearizer::AdaptFastCallTypedArrayArgument(
    Node* node, ElementsKind expected_elements_kind,
    - GraphAssemblerLabel<0>* bailout) {
    + GraphAssemblerLabel<0>* bailout) {
    Node* value_map = __ LoadField(AccessBuilder::ForMap(), node);
    Node* value_instance_type =
    __ LoadField(AccessBuilder::ForMapInstanceType(), value_map);
    @@ -5323,6 +5323,7 @@ Node* EffectControlLinearizer::LowerFastApiCall(Node* node) {
    break;
    case CTypeInfo::Type::kV8Value:
    case CTypeInfo::Type::kApiObject:
    + case CTypeInfo::Type::kUint8:
    UNREACHABLE();
    case CTypeInfo::Type::kAny:
    fast_call_result =
    diff --git a/src/compiler/fast-api-calls.cc b/src/compiler/fast-api-calls.cc
    index 54dc22e99c..fd88e58e03 100644
    --- a/src/compiler/fast-api-calls.cc
    +++ b/src/compiler/fast-api-calls.cc
    @@ -13,6 +13,8 @@ namespace fast_api_call {

    ElementsKind GetTypedArrayElementsKind(CTypeInfo::Type type) {
    switch (type) {
    + case CTypeInfo::Type::kUint8:
    + return UINT8_ELEMENTS;
    case CTypeInfo::Type::kInt32:
    return INT32_ELEMENTS;
    case CTypeInfo::Type::kUint32:
    diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc
    index 8be53e250a..4990e2a45e 100644
    --- a/src/compiler/simplified-lowering.cc
    +++ b/src/compiler/simplified-lowering.cc
    @@ -1894,6 +1894,7 @@ class RepresentationSelector {
    case CTypeInfo::SequenceType::kScalar: {
    switch (type.GetType()) {
    case CTypeInfo::Type::kVoid:
    + case CTypeInfo::Type::kUint8:
    UNREACHABLE();
    case CTypeInfo::Type::kBool:
    return UseInfo::Bool();