[interpreter] Fix lookup of overlapping handler ranges.

This fixes corner cases where the start offsets of exception handler
regions within the handler table fall together. This assumption was
based on full-codegen code and no longer holds with the interpreter.
The tables however are still well nested and code has been added to
verify that in debug mode.

R=rmcilroy@chromium.org
BUG=v8:4674
LOG=n

Review URL: https://codereview.chromium.org/1633573002

Cr-Commit-Position: refs/heads/master@{#33495}
This commit is contained in:
mstarzinger 2016-01-25 08:18:09 -08:00 committed by Commit bot
parent b707ca4b54
commit 21b6e077fa
3 changed files with 10 additions and 23 deletions

View File

@ -10952,6 +10952,11 @@ Handle<LiteralsArray> LiteralsArray::New(Isolate* isolate,
int HandlerTable::LookupRange(int pc_offset, int* stack_depth_out,
CatchPrediction* prediction_out) {
int innermost_handler = -1, innermost_start = -1;
#ifdef DEBUG
// Assuming that ranges are well nested, we don't need to track the innermost
// end offset. This is just to verify that the table is actually well nested.
int innermost_end = std::numeric_limits<int>::max();
#endif
for (int i = 0; i < length(); i += kRangeEntrySize) {
int start_offset = Smi::cast(get(i + kRangeStartIndex))->value();
int end_offset = Smi::cast(get(i + kRangeEndIndex))->value();
@ -10960,10 +10965,13 @@ int HandlerTable::LookupRange(int pc_offset, int* stack_depth_out,
CatchPrediction prediction = HandlerPredictionField::decode(handler_field);
int stack_depth = Smi::cast(get(i + kRangeDepthIndex))->value();
if (pc_offset > start_offset && pc_offset <= end_offset) {
DCHECK_NE(start_offset, innermost_start);
if (start_offset < innermost_start) continue;
DCHECK_LT(end_offset, innermost_end);
innermost_handler = handler_offset;
innermost_start = start_offset;
#ifdef DEBUG
innermost_end = end_offset;
#endif
*stack_depth_out = stack_depth;
if (prediction_out) *prediction_out = prediction;
}

View File

@ -755,13 +755,6 @@
# TODO(bradnelson): Figure out why these tests fail with ignition.
'wasm/*': [SKIP],
# TODO(mstarzinger,4674): Beginning of two "try" statements can overlap.
'regress/regress-1213516': [SKIP],
'regress/regress-444805': [SKIP],
'regress/regress-86': [SKIP],
'regress/regress-binop': [SKIP],
'string-charat': [SKIP],
# TODO(4684): Support for "with" statements is missing.
'regress/regress-1528': [FAIL],
'regress/regress-2594': [FAIL],

View File

@ -589,21 +589,6 @@
'language/statements/generators/*': [SKIP],
'language/statements/with/*': [SKIP],
# TODO(mstarzinger,4674): Beginning of two "try" statements can overlap.
'language/statements/try/*': [SKIP],
'built-ins/Object/defineProperties/15.2.3.7-2-18': [SKIP],
'built-ins/Promise/S25.4.3.1_A2.3_T1': [SKIP],
'built-ins/Promise/S25.4.3.1_A2.4_T1': [SKIP],
'built-ins/Promise/S25.4.3.1_A4.1_T1': [SKIP],
'built-ins/Promise/exception-after-resolve-in-executor': [SKIP],
'built-ins/Promise/prototype/catch/S25.4.5.1_A3.1_T2': [SKIP],
'built-ins/Promise/prototype/then/S25.4.2.1_A2.1_T1': [SKIP],
'built-ins/Promise/prototype/then/S25.4.5.3_A4.1_T2': [SKIP],
'built-ins/Promise/prototype/then/S25.4.5.3_A4.2_T2': [SKIP],
'built-ins/Promise/prototype/then/on-fulfilled-throw': [SKIP],
'language/block-scope/leave/finally-block-let-declaration-only-shadows-outer-parameter-value-2': [SKIP],
'language/block-scope/leave/verify-context-in-finally-block': [SKIP],
'built-ins/Array/prototype/concat/Array.prototype.concat_non-array': [SKIP],
'built-ins/Date/prototype/toISOString/15.9.5.43-0-13': [SKIP],
'built-ins/Object/prototype/hasOwnProperty/S15.2.4.5_A12': [SKIP],
@ -732,6 +717,7 @@
'language/statements/let/global-closure-set-before-initialization': [SKIP],
'language/statements/let/global-use-before-initialization-in-declaration-statement': [SKIP],
'language/statements/let/global-use-before-initialization-in-prior-statement': [SKIP],
'language/statements/try/S12.14_A14': [SKIP],
'language/statements/while/S12.6.2_A4_T5': [SKIP],
}], # ignition == True