Commit 54aac1f7 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

Revert of [deoptimizer] Remove dead Code::LookupRangeInHandlerTable. (patchset...

Revert of [deoptimizer] Remove dead Code::LookupRangeInHandlerTable. (patchset #2 id:20001 of https://codereview.chromium.org/2529343003/ )

Reason for revert:
Seems to break TSAN builds.

https://build.chromium.org/p/client.v8/builders/V8%20Linux64%20TSAN/builds/12897/steps/Check/logs/stack-traces

Original issue's description:
> [deoptimizer] Remove dead Code::LookupRangeInHandlerTable.
>
> This removes the supporting function to perform a range-lookup in the
> exception handler table for unoptimized code. Such tables are by now
> guaranteed to be empty, the deoptimizer cannot encounter this case.
>
> R=jarin@chromium.org
>
> Committed: https://crrev.com/1f27ed9d7da78904e0418364c6394f913eabbe70
> Cr-Commit-Position: refs/heads/master@{#41318}

TBR=jarin@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review-Url: https://codereview.chromium.org/2536673002
Cr-Commit-Position: refs/heads/master@{#41319}
parent 1f27ed9d
...@@ -627,23 +627,28 @@ namespace { ...@@ -627,23 +627,28 @@ namespace {
int LookupCatchHandler(TranslatedFrame* translated_frame, int* data_out) { int LookupCatchHandler(TranslatedFrame* translated_frame, int* data_out) {
switch (translated_frame->kind()) { switch (translated_frame->kind()) {
case TranslatedFrame::kFunction: { case TranslatedFrame::kFunction: {
#ifdef DEBUG BailoutId node_id = translated_frame->node_id();
JSFunction* function = JSFunction* function =
JSFunction::cast(translated_frame->begin()->GetRawValue()); JSFunction::cast(translated_frame->begin()->GetRawValue());
Code* non_optimized_code = function->shared()->code(); Code* non_optimized_code = function->shared()->code();
FixedArray* raw_data = non_optimized_code->deoptimization_data();
DeoptimizationOutputData* data = DeoptimizationOutputData::cast(raw_data);
unsigned pc_and_state =
Deoptimizer::GetOutputInfo(data, node_id, function->shared());
unsigned pc_offset = FullCodeGenerator::PcField::decode(pc_and_state);
HandlerTable* table = HandlerTable* table =
HandlerTable::cast(non_optimized_code->handler_table()); HandlerTable::cast(non_optimized_code->handler_table());
DCHECK_EQ(0, table->NumberOfRangeEntries()); HandlerTable::CatchPrediction prediction;
#endif return table->LookupRange(pc_offset, data_out, &prediction);
break;
} }
case TranslatedFrame::kInterpretedFunction: { case TranslatedFrame::kInterpretedFunction: {
int bytecode_offset = translated_frame->node_id().ToInt(); int bytecode_offset = translated_frame->node_id().ToInt();
JSFunction* function = JSFunction* function =
JSFunction::cast(translated_frame->begin()->GetRawValue()); JSFunction::cast(translated_frame->begin()->GetRawValue());
BytecodeArray* bytecode = function->shared()->bytecode_array(); BytecodeArray* bytecode = function->shared()->bytecode_array();
HandlerTable::CatchPrediction prediction;
return bytecode->LookupRangeInHandlerTable(bytecode_offset, data_out, return bytecode->LookupRangeInHandlerTable(bytecode_offset, data_out,
nullptr); &prediction);
} }
default: default:
break; break;
......
...@@ -14402,6 +14402,13 @@ uint32_t Code::TranslateAstIdToPcOffset(BailoutId ast_id) { ...@@ -14402,6 +14402,13 @@ uint32_t Code::TranslateAstIdToPcOffset(BailoutId ast_id) {
return 0; return 0;
} }
int Code::LookupRangeInHandlerTable(int code_offset, int* data,
HandlerTable::CatchPrediction* prediction) {
DCHECK(!is_optimized_code());
HandlerTable* table = HandlerTable::cast(handler_table());
return table->LookupRange(code_offset, data, prediction);
}
void Code::MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate) { void Code::MakeCodeAgeSequenceYoung(byte* sequence, Isolate* isolate) {
PatchPlatformCodeAge(isolate, sequence, kNoAgeCodeAge, NO_MARKING_PARITY); PatchPlatformCodeAge(isolate, sequence, kNoAgeCodeAge, NO_MARKING_PARITY);
} }
......
...@@ -5713,6 +5713,9 @@ class Code: public HeapObject { ...@@ -5713,6 +5713,9 @@ class Code: public HeapObject {
BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset); BailoutId TranslatePcOffsetToAstId(uint32_t pc_offset);
uint32_t TranslateAstIdToPcOffset(BailoutId ast_id); uint32_t TranslateAstIdToPcOffset(BailoutId ast_id);
int LookupRangeInHandlerTable(int code_offset, int* data,
HandlerTable::CatchPrediction* prediction);
#define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge,
enum Age { enum Age {
kToBeExecutedOnceCodeAge = -3, kToBeExecutedOnceCodeAge = -3,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment