Commit 08931d45 authored by tebbi's avatar tebbi Committed by Commit bot

[parser] removed redundant undefined check of for-of iterator

Removed a redundant check: If completion is not normal, then #iterator cannot be undefined.

Review-Url: https://codereview.chromium.org/2533803002
Cr-Commit-Position: refs/heads/master@{#41321}
parent e0d608a2
...@@ -5461,7 +5461,7 @@ Statement* Parser::FinalizeForOfStatement(ForOfStatement* loop, ...@@ -5461,7 +5461,7 @@ Statement* Parser::FinalizeForOfStatement(ForOfStatement* loop,
// %ReThrow(e); // %ReThrow(e);
// } // }
// } finally { // } finally {
// if (!(completion === kNormalCompletion || IS_UNDEFINED(#iterator))) { // if (!(completion === kNormalCompletion)) {
// #BuildIteratorCloseForCompletion(#iterator, completion) // #BuildIteratorCloseForCompletion(#iterator, completion)
// } // }
// } // }
...@@ -5472,18 +5472,13 @@ Statement* Parser::FinalizeForOfStatement(ForOfStatement* loop, ...@@ -5472,18 +5472,13 @@ Statement* Parser::FinalizeForOfStatement(ForOfStatement* loop,
const int nopos = kNoSourcePosition; const int nopos = kNoSourcePosition;
// !(completion === kNormalCompletion || IS_UNDEFINED(#iterator)) // !(completion === kNormalCompletion)
Expression* closing_condition; Expression* closing_condition;
{ {
Expression* lhs = factory()->NewCompareOperation( Expression* cmp = factory()->NewCompareOperation(
Token::EQ_STRICT, factory()->NewVariableProxy(var_completion), Token::EQ_STRICT, factory()->NewVariableProxy(var_completion),
factory()->NewSmiLiteral(Parser::kNormalCompletion, nopos), nopos); factory()->NewSmiLiteral(Parser::kNormalCompletion, nopos), nopos);
Expression* rhs = factory()->NewCompareOperation( closing_condition = factory()->NewUnaryOperation(Token::NOT, cmp, nopos);
Token::EQ_STRICT, factory()->NewVariableProxy(loop->iterator()),
factory()->NewUndefinedLiteral(nopos), nopos);
closing_condition = factory()->NewUnaryOperation(
Token::NOT, factory()->NewBinaryOperation(Token::OR, lhs, rhs, nopos),
nopos);
} }
Block* final_loop = factory()->NewBlock(nullptr, 2, false, nopos); Block* final_loop = factory()->NewBlock(nullptr, 2, false, nopos);
......
...@@ -11,7 +11,7 @@ snippet: " ...@@ -11,7 +11,7 @@ snippet: "
" "
frame size: 15 frame size: 15
parameter count: 1 parameter count: 1
bytecode array length: 274 bytecode array length: 268
bytecodes: [ bytecodes: [
/* 30 E> */ B(StackCheck), /* 30 E> */ B(StackCheck),
B(LdaZero), B(LdaZero),
...@@ -71,24 +71,21 @@ bytecodes: [ ...@@ -71,24 +71,21 @@ bytecodes: [
B(Star), R(11), B(Star), R(11),
B(LdaZero), B(LdaZero),
B(TestEqualStrict), R(4), U8(15), B(TestEqualStrict), R(4), U8(15),
B(JumpIfTrue), U8(119),
B(LdaUndefined),
B(TestEqualStrict), R(2), U8(16),
B(JumpIfTrue), U8(113), B(JumpIfTrue), U8(113),
B(LdaNamedProperty), R(2), U8(7), U8(17), B(LdaNamedProperty), R(2), U8(7), U8(16),
B(Star), R(6), B(Star), R(6),
B(LdaNull), B(LdaNull),
B(TestEqual), R(6), U8(19), B(TestEqual), R(6), U8(18),
B(JumpIfFalse), U8(4), B(JumpIfFalse), U8(4),
B(Jump), U8(99), B(Jump), U8(99),
B(LdaSmi), U8(1), B(LdaSmi), U8(1),
B(TestEqualStrict), R(4), U8(20), B(TestEqualStrict), R(4), U8(19),
B(JumpIfFalse), U8(67), B(JumpIfFalse), U8(67),
B(Ldar), R(6), B(Ldar), R(6),
B(TypeOf), B(TypeOf),
B(Star), R(12), B(Star), R(12),
B(LdaConstant), U8(8), B(LdaConstant), U8(8),
B(TestEqualStrict), R(12), U8(21), B(TestEqualStrict), R(12), U8(20),
B(JumpIfFalse), U8(4), B(JumpIfFalse), U8(4),
B(Jump), U8(18), B(Jump), U8(18),
B(Wide), B(LdaSmi), U16(130), B(Wide), B(LdaSmi), U16(130),
...@@ -147,7 +144,7 @@ constant pool: [ ...@@ -147,7 +144,7 @@ constant pool: [
handlers: [ handlers: [
[7, 120, 126], [7, 120, 126],
[10, 84, 86], [10, 84, 86],
[201, 211, 213], [195, 205, 207],
] ]
--- ---
...@@ -157,7 +154,7 @@ snippet: " ...@@ -157,7 +154,7 @@ snippet: "
" "
frame size: 16 frame size: 16
parameter count: 1 parameter count: 1
bytecode array length: 285 bytecode array length: 279
bytecodes: [ bytecodes: [
/* 30 E> */ B(StackCheck), /* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaConstant), U8(0), /* 42 S> */ B(LdaConstant), U8(0),
...@@ -218,24 +215,21 @@ bytecodes: [ ...@@ -218,24 +215,21 @@ bytecodes: [
B(Star), R(12), B(Star), R(12),
B(LdaZero), B(LdaZero),
B(TestEqualStrict), R(5), U8(15), B(TestEqualStrict), R(5), U8(15),
B(JumpIfTrue), U8(119),
B(LdaUndefined),
B(TestEqualStrict), R(3), U8(16),
B(JumpIfTrue), U8(113), B(JumpIfTrue), U8(113),
B(LdaNamedProperty), R(3), U8(7), U8(17), B(LdaNamedProperty), R(3), U8(7), U8(16),
B(Star), R(7), B(Star), R(7),
B(LdaNull), B(LdaNull),
B(TestEqual), R(7), U8(19), B(TestEqual), R(7), U8(18),
B(JumpIfFalse), U8(4), B(JumpIfFalse), U8(4),
B(Jump), U8(99), B(Jump), U8(99),
B(LdaSmi), U8(1), B(LdaSmi), U8(1),
B(TestEqualStrict), R(5), U8(20), B(TestEqualStrict), R(5), U8(19),
B(JumpIfFalse), U8(67), B(JumpIfFalse), U8(67),
B(Ldar), R(7), B(Ldar), R(7),
B(TypeOf), B(TypeOf),
B(Star), R(13), B(Star), R(13),
B(LdaConstant), U8(8), B(LdaConstant), U8(8),
B(TestEqualStrict), R(13), U8(21), B(TestEqualStrict), R(13), U8(20),
B(JumpIfFalse), U8(4), B(JumpIfFalse), U8(4),
B(Jump), U8(18), B(Jump), U8(18),
B(Wide), B(LdaSmi), U16(130), B(Wide), B(LdaSmi), U16(130),
...@@ -299,7 +293,7 @@ constant pool: [ ...@@ -299,7 +293,7 @@ constant pool: [
handlers: [ handlers: [
[11, 120, 126], [11, 120, 126],
[14, 84, 86], [14, 84, 86],
[202, 212, 214], [196, 206, 208],
] ]
--- ---
...@@ -311,7 +305,7 @@ snippet: " ...@@ -311,7 +305,7 @@ snippet: "
" "
frame size: 15 frame size: 15
parameter count: 1 parameter count: 1
bytecode array length: 292 bytecode array length: 286
bytecodes: [ bytecodes: [
/* 30 E> */ B(StackCheck), /* 30 E> */ B(StackCheck),
B(LdaZero), B(LdaZero),
...@@ -379,24 +373,21 @@ bytecodes: [ ...@@ -379,24 +373,21 @@ bytecodes: [
B(Star), R(11), B(Star), R(11),
B(LdaZero), B(LdaZero),
B(TestEqualStrict), R(4), U8(17), B(TestEqualStrict), R(4), U8(17),
B(JumpIfTrue), U8(119),
B(LdaUndefined),
B(TestEqualStrict), R(2), U8(18),
B(JumpIfTrue), U8(113), B(JumpIfTrue), U8(113),
B(LdaNamedProperty), R(2), U8(7), U8(19), B(LdaNamedProperty), R(2), U8(7), U8(18),
B(Star), R(6), B(Star), R(6),
B(LdaNull), B(LdaNull),
B(TestEqual), R(6), U8(21), B(TestEqual), R(6), U8(20),
B(JumpIfFalse), U8(4), B(JumpIfFalse), U8(4),
B(Jump), U8(99), B(Jump), U8(99),
B(LdaSmi), U8(1), B(LdaSmi), U8(1),
B(TestEqualStrict), R(4), U8(22), B(TestEqualStrict), R(4), U8(21),
B(JumpIfFalse), U8(67), B(JumpIfFalse), U8(67),
B(Ldar), R(6), B(Ldar), R(6),
B(TypeOf), B(TypeOf),
B(Star), R(12), B(Star), R(12),
B(LdaConstant), U8(8), B(LdaConstant), U8(8),
B(TestEqualStrict), R(12), U8(23), B(TestEqualStrict), R(12), U8(22),
B(JumpIfFalse), U8(4), B(JumpIfFalse), U8(4),
B(Jump), U8(18), B(Jump), U8(18),
B(Wide), B(LdaSmi), U16(130), B(Wide), B(LdaSmi), U16(130),
...@@ -455,7 +446,7 @@ constant pool: [ ...@@ -455,7 +446,7 @@ constant pool: [
handlers: [ handlers: [
[7, 138, 144], [7, 138, 144],
[10, 102, 104], [10, 102, 104],
[219, 229, 231], [213, 223, 225],
] ]
--- ---
...@@ -465,7 +456,7 @@ snippet: " ...@@ -465,7 +456,7 @@ snippet: "
" "
frame size: 14 frame size: 14
parameter count: 1 parameter count: 1
bytecode array length: 299 bytecode array length: 293
bytecodes: [ bytecodes: [
/* 30 E> */ B(StackCheck), /* 30 E> */ B(StackCheck),
/* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(8), /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(8),
...@@ -530,24 +521,21 @@ bytecodes: [ ...@@ -530,24 +521,21 @@ bytecodes: [
B(Star), R(10), B(Star), R(10),
B(LdaZero), B(LdaZero),
B(TestEqualStrict), R(3), U8(19), B(TestEqualStrict), R(3), U8(19),
B(JumpIfTrue), U8(119),
B(LdaUndefined),
B(TestEqualStrict), R(1), U8(20),
B(JumpIfTrue), U8(113), B(JumpIfTrue), U8(113),
B(LdaNamedProperty), R(1), U8(9), U8(21), B(LdaNamedProperty), R(1), U8(9), U8(20),
B(Star), R(5), B(Star), R(5),
B(LdaNull), B(LdaNull),
B(TestEqual), R(5), U8(23), B(TestEqual), R(5), U8(22),
B(JumpIfFalse), U8(4), B(JumpIfFalse), U8(4),
B(Jump), U8(99), B(Jump), U8(99),
B(LdaSmi), U8(1), B(LdaSmi), U8(1),
B(TestEqualStrict), R(3), U8(24), B(TestEqualStrict), R(3), U8(23),
B(JumpIfFalse), U8(67), B(JumpIfFalse), U8(67),
B(Ldar), R(5), B(Ldar), R(5),
B(TypeOf), B(TypeOf),
B(Star), R(11), B(Star), R(11),
B(LdaConstant), U8(10), B(LdaConstant), U8(10),
B(TestEqualStrict), R(11), U8(25), B(TestEqualStrict), R(11), U8(24),
B(JumpIfFalse), U8(4), B(JumpIfFalse), U8(4),
B(Jump), U8(18), B(Jump), U8(18),
B(Wide), B(LdaSmi), U16(130), B(Wide), B(LdaSmi), U16(130),
...@@ -613,6 +601,6 @@ constant pool: [ ...@@ -613,6 +601,6 @@ constant pool: [
handlers: [ handlers: [
[15, 134, 140], [15, 134, 140],
[18, 98, 100], [18, 98, 100],
[216, 226, 228], [210, 220, 222],
] ]
...@@ -277,7 +277,7 @@ snippet: " ...@@ -277,7 +277,7 @@ snippet: "
" "
frame size: 17 frame size: 17
parameter count: 1 parameter count: 1
bytecode array length: 783 bytecode array length: 771
bytecodes: [ bytecodes: [
B(Ldar), R(new_target), B(Ldar), R(new_target),
B(JumpIfUndefined), U8(28), B(JumpIfUndefined), U8(28),
...@@ -332,7 +332,7 @@ bytecodes: [ ...@@ -332,7 +332,7 @@ bytecodes: [
B(Star), R(5), B(Star), R(5),
B(LdaZero), B(LdaZero),
B(Star), R(4), B(Star), R(4),
B(JumpConstant), U8(19), B(JumpConstant), U8(18),
B(Ldar), R(9), B(Ldar), R(9),
/* 11 E> */ B(Throw), /* 11 E> */ B(Throw),
B(Ldar), R(closure), B(Ldar), R(closure),
...@@ -471,29 +471,24 @@ bytecodes: [ ...@@ -471,29 +471,24 @@ bytecodes: [
B(JumpIfTrueConstant), U8(17), B(JumpIfTrueConstant), U8(17),
B(LdaContextSlot), R(1), U8(7), U8(0), B(LdaContextSlot), R(1), U8(7), U8(0),
B(Star), R(10), B(Star), R(10),
B(LdaUndefined), B(LdaNamedProperty), R(10), U8(12), U8(16),
B(TestEqualStrict), R(10), U8(16),
B(JumpIfTrueConstant), U8(18),
B(LdaContextSlot), R(1), U8(7), U8(0),
B(Star), R(10),
B(LdaNamedProperty), R(10), U8(12), U8(17),
B(StaContextSlot), R(1), U8(11), U8(0), B(StaContextSlot), R(1), U8(11), U8(0),
B(LdaContextSlot), R(1), U8(11), U8(0), B(LdaContextSlot), R(1), U8(11), U8(0),
B(Star), R(10), B(Star), R(10),
B(LdaNull), B(LdaNull),
B(TestEqual), R(10), U8(19), B(TestEqual), R(10), U8(18),
B(JumpIfFalse), U8(4), B(JumpIfFalse), U8(4),
B(JumpConstant), U8(16), B(JumpConstant), U8(16),
B(LdaContextSlot), R(1), U8(9), U8(0), B(LdaContextSlot), R(1), U8(9), U8(0),
B(Star), R(10), B(Star), R(10),
B(LdaSmi), U8(1), B(LdaSmi), U8(1),
B(TestEqualStrict), R(10), U8(20), B(TestEqualStrict), R(10), U8(19),
B(JumpIfFalse), U8(75), B(JumpIfFalse), U8(75),
B(LdaContextSlot), R(1), U8(11), U8(0), B(LdaContextSlot), R(1), U8(11), U8(0),
B(TypeOf), B(TypeOf),
B(Star), R(10), B(Star), R(10),
B(LdaConstant), U8(13), B(LdaConstant), U8(13),
B(TestEqualStrict), R(10), U8(21), B(TestEqualStrict), R(10), U8(20),
B(JumpIfFalse), U8(4), B(JumpIfFalse), U8(4),
B(Jump), U8(18), B(Jump), U8(18),
B(Wide), B(LdaSmi), U16(130), B(Wide), B(LdaSmi), U16(130),
...@@ -625,14 +620,13 @@ constant pool: [ ...@@ -625,14 +620,13 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
FIXED_ARRAY_TYPE, FIXED_ARRAY_TYPE,
Smi [133], Smi [133],
Smi [173],
Smi [161], Smi [161],
Smi [593], Smi [581],
] ]
handlers: [ handlers: [
[46, 702, 708], [46, 690, 696],
[143, 438, 444], [143, 438, 444],
[146, 394, 396], [146, 394, 396],
[554, 570, 572], [542, 558, 560],
] ]
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