Commit 217d654c authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

[parser] moved load property position after dot

Currently LdaNamedProperty bytecode for expressions like a.b has position before dot. This CL moves this location after dot.
It's important for later removing of Nop bytecodes in expressions like a.b() where a is local variable, property call and property load should have the same position.

R=jgruber@chromium.org

Bug: v8:6425
Change-Id: I528c5007de52215beba80851ab04693ecec038e2
Reviewed-on: https://chromium-review.googlesource.com/543047Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46163}
parent b45f2066
...@@ -3639,7 +3639,7 @@ ParserBase<Impl>::ParseMemberExpressionContinuation(ExpressionT expression, ...@@ -3639,7 +3639,7 @@ ParserBase<Impl>::ParseMemberExpressionContinuation(ExpressionT expression,
ArrowFormalParametersUnexpectedToken(); ArrowFormalParametersUnexpectedToken();
Consume(Token::PERIOD); Consume(Token::PERIOD);
int pos = position(); int pos = peek_position();
IdentifierT name = ParseIdentifierName(CHECK_OK); IdentifierT name = ParseIdentifierName(CHECK_OK);
expression = factory()->NewProperty( expression = factory()->NewProperty(
expression, factory()->NewStringLiteral(name, pos), pos); expression, factory()->NewStringLiteral(name, pos), pos);
......
...@@ -16,7 +16,7 @@ bytecodes: [ ...@@ -16,7 +16,7 @@ bytecodes: [
/* 30 E> */ B(StackCheck), /* 30 E> */ B(StackCheck),
/* 34 S> */ B(LdaGlobal), U8(0), U8(5), /* 34 S> */ B(LdaGlobal), U8(0), U8(5),
B(Star), R(1), B(Star), R(1),
/* 38 E> */ B(LdaNamedProperty), R(1), U8(1), U8(7), /* 39 E> */ B(LdaNamedProperty), R(1), U8(1), U8(7),
B(Star), R(0), B(Star), R(0),
B(CreateArrayLiteral), U8(2), U8(9), U8(17), B(CreateArrayLiteral), U8(2), U8(9), U8(17),
B(Star), R(2), B(Star), R(2),
...@@ -43,7 +43,7 @@ bytecodes: [ ...@@ -43,7 +43,7 @@ bytecodes: [
/* 30 E> */ B(StackCheck), /* 30 E> */ B(StackCheck),
/* 34 S> */ B(LdaGlobal), U8(0), U8(5), /* 34 S> */ B(LdaGlobal), U8(0), U8(5),
B(Star), R(1), B(Star), R(1),
/* 38 E> */ B(LdaNamedProperty), R(1), U8(1), U8(7), /* 39 E> */ B(LdaNamedProperty), R(1), U8(1), U8(7),
B(Star), R(0), B(Star), R(0),
B(LdaZero), B(LdaZero),
B(Star), R(2), B(Star), R(2),
......
...@@ -805,13 +805,13 @@ bytecodes: [ ...@@ -805,13 +805,13 @@ bytecodes: [
/* 45 S> */ B(Return), /* 45 S> */ B(Return),
/* 27 S> */ B(LdaImmutableCurrentContextSlot), U8(5), /* 27 S> */ B(LdaImmutableCurrentContextSlot), U8(5),
B(Star), R(4), B(Star), R(4),
/* 30 E> */ B(LdaNamedProperty), R(4), U8(4), U8(5), /* 31 E> */ B(LdaNamedProperty), R(4), U8(4), U8(5),
B(Star), R(3), B(Star), R(3),
B(LdaImmutableCurrentContextSlot), U8(5), B(LdaImmutableCurrentContextSlot), U8(5),
B(Star), R(5), B(Star), R(5),
B(LdaImmutableCurrentContextSlot), U8(5), B(LdaImmutableCurrentContextSlot), U8(5),
B(Star), R(6), B(Star), R(6),
/* 41 E> */ B(LdaNamedProperty), R(6), U8(5), U8(7), /* 42 E> */ B(LdaNamedProperty), R(6), U8(5), U8(7),
B(Star), R(6), B(Star), R(6),
/* 31 E> */ B(CallProperty2), R(3), R(4), R(5), R(6), U8(3), /* 31 E> */ B(CallProperty2), R(3), R(4), R(5), R(6), U8(3),
B(StaCurrentContextSlot), U8(6), B(StaCurrentContextSlot), U8(6),
......
...@@ -52,7 +52,7 @@ bytecodes: [ ...@@ -52,7 +52,7 @@ bytecodes: [
/* 30 E> */ B(StackCheck), /* 30 E> */ B(StackCheck),
/* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(5), U8(0), /* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(5), U8(0),
B(Star), R(1), B(Star), R(1),
/* 47 E> */ B(LdaNamedProperty), R(1), U8(1), U8(6), /* 48 E> */ B(LdaNamedProperty), R(1), U8(1), U8(6),
B(Star), R(0), B(Star), R(0),
B(LdaConstant), U8(2), B(LdaConstant), U8(2),
B(Star), R(2), B(Star), R(2),
......
...@@ -54,7 +54,7 @@ assertEquals(42, get); ...@@ -54,7 +54,7 @@ assertEquals(42, get);
assertEquals([ assertEquals([
"a0", "a0",
"b17", "h4b17", "i2b17", // [[Has]] "b17", "h4b17", "i2b17", // [[Has]]
"c15", "j4c15", "k2c15", // [[Get]] "c16", "j4c16", "k2c16", // [[Get]]
"d0", "l4d11", "m2d11", // [[Set]] "d0", "l4d11", "m2d11", // [[Set]]
"g0" "g0"
], log); ], log);
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*%(basename)s:31: TypeError: Cannot read property 'x' of undefined *%(basename)s:31: TypeError: Cannot read property 'x' of undefined
undefined.x undefined.x
^ ^
TypeError: Cannot read property 'x' of undefined TypeError: Cannot read property 'x' of undefined
at *%(basename)s:31:10 at *%(basename)s:31:11
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