Skip to content

perf(jsruntime): improve exception handling #201

@masnagam

Description

@masnagam

performance degraration occurred in b720076 (bencher report).

this degraration probably caused due to the exception handling in Compiler::Call():

// Handle an exception if it's thrown.
auto* is_exception =
builder_->CreateICmpEQ(status, builder_->getInt32(static_cast<int32_t>(Status::Exception)));
auto* then_block = llvm::BasicBlock::Create(*context_, "", function_);
auto* else_block = llvm::BasicBlock::Create(*context_, "", function_);
builder_->CreateCondBr(is_exception, then_block, else_block);
builder_->SetInsertPoint(then_block);
// Store the exception.
builder_->CreateStore(status, status_);
builder_->CreateMemCpy(
ret_, llvm::MaybeAlign(), ret, llvm::MaybeAlign(), builder_->getInt32(sizeof(Value)));
assert(!catch_stack_.empty());
auto* catch_block = catch_stack_.back();
builder_->CreateBr(catch_block);

by this change, the exception handling always performs every function call.

in this issue, we investigate ways to improve the exception handling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions