Commit 7bcec7ae authored by Ross McIlroy's avatar Ross McIlroy Committed by Commit Bot

[Interpreter] Fix expression position on keyed property loads.

BUG=v8:6609

Change-Id: If4c3520fba0653e23e6d34bf344fb00cdbfc6082
Reviewed-on: https://chromium-review.googlesource.com/575049Reviewed-by: 's avatarSathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46741}
parent f249c069
...@@ -3072,29 +3072,30 @@ void BytecodeGenerator::VisitThrow(Throw* expr) { ...@@ -3072,29 +3072,30 @@ void BytecodeGenerator::VisitThrow(Throw* expr) {
builder()->Throw(); builder()->Throw();
} }
void BytecodeGenerator::VisitPropertyLoad(Register obj, Property* expr) { void BytecodeGenerator::VisitPropertyLoad(Register obj, Property* property) {
LhsKind property_kind = Property::GetAssignType(expr); LhsKind property_kind = Property::GetAssignType(property);
FeedbackSlot slot = expr->PropertyFeedbackSlot(); FeedbackSlot slot = property->PropertyFeedbackSlot();
builder()->SetExpressionPosition(expr);
switch (property_kind) { switch (property_kind) {
case VARIABLE: case VARIABLE:
UNREACHABLE(); UNREACHABLE();
case NAMED_PROPERTY: { case NAMED_PROPERTY: {
builder()->SetExpressionPosition(property);
builder()->LoadNamedProperty( builder()->LoadNamedProperty(
obj, expr->key()->AsLiteral()->AsRawPropertyName(), obj, property->key()->AsLiteral()->AsRawPropertyName(),
feedback_index(slot)); feedback_index(slot));
break; break;
} }
case KEYED_PROPERTY: { case KEYED_PROPERTY: {
VisitForAccumulatorValue(expr->key()); VisitForAccumulatorValue(property->key());
builder()->SetExpressionPosition(property);
builder()->LoadKeyedProperty(obj, feedback_index(slot)); builder()->LoadKeyedProperty(obj, feedback_index(slot));
break; break;
} }
case NAMED_SUPER_PROPERTY: case NAMED_SUPER_PROPERTY:
VisitNamedSuperPropertyLoad(expr, Register::invalid_value()); VisitNamedSuperPropertyLoad(property, Register::invalid_value());
break; break;
case KEYED_SUPER_PROPERTY: case KEYED_SUPER_PROPERTY:
VisitKeyedSuperPropertyLoad(expr, Register::invalid_value()); VisitKeyedSuperPropertyLoad(property, Register::invalid_value());
break; break;
} }
} }
...@@ -3115,6 +3116,8 @@ void BytecodeGenerator::VisitNamedSuperPropertyLoad(Property* property, ...@@ -3115,6 +3116,8 @@ void BytecodeGenerator::VisitNamedSuperPropertyLoad(Property* property,
RegisterList args = register_allocator()->NewRegisterList(3); RegisterList args = register_allocator()->NewRegisterList(3);
VisitForRegisterValue(super_property->this_var(), args[0]); VisitForRegisterValue(super_property->this_var(), args[0]);
VisitForRegisterValue(super_property->home_object(), args[1]); VisitForRegisterValue(super_property->home_object(), args[1]);
builder()->SetExpressionPosition(property);
builder() builder()
->LoadLiteral(property->key()->AsLiteral()->AsRawPropertyName()) ->LoadLiteral(property->key()->AsLiteral()->AsRawPropertyName())
.StoreAccumulatorInRegister(args[2]) .StoreAccumulatorInRegister(args[2])
...@@ -3134,6 +3137,8 @@ void BytecodeGenerator::VisitKeyedSuperPropertyLoad(Property* property, ...@@ -3134,6 +3137,8 @@ void BytecodeGenerator::VisitKeyedSuperPropertyLoad(Property* property,
VisitForRegisterValue(super_property->this_var(), args[0]); VisitForRegisterValue(super_property->this_var(), args[0]);
VisitForRegisterValue(super_property->home_object(), args[1]); VisitForRegisterValue(super_property->home_object(), args[1]);
VisitForRegisterValue(property->key(), args[2]); VisitForRegisterValue(property->key(), args[2]);
builder()->SetExpressionPosition(property);
builder()->CallRuntime(Runtime::kLoadKeyedFromSuper, args); builder()->CallRuntime(Runtime::kLoadKeyedFromSuper, args);
if (opt_receiver_out.is_valid()) { if (opt_receiver_out.is_valid()) {
......
...@@ -32,7 +32,7 @@ bytecodes: [ ...@@ -32,7 +32,7 @@ bytecodes: [
B(LdaConstant), U8(1), B(LdaConstant), U8(1),
B(Star), R(5), B(Star), R(5),
B(Mov), R(this), R(3), B(Mov), R(this), R(3),
B(CallRuntime), U16(Runtime::kLoadFromSuper), R(3), U8(3), /* 117 E> */ B(CallRuntime), U16(Runtime::kLoadFromSuper), R(3), U8(3),
B(Star), R(1), B(Star), R(1),
/* 117 E> */ B(CallAnyReceiver), R(1), R(this), U8(1), U8(3), /* 117 E> */ B(CallAnyReceiver), R(1), R(this), U8(1), U8(3),
/* 126 E> */ B(AddSmi), I8(1), U8(9), /* 126 E> */ B(AddSmi), I8(1), U8(9),
...@@ -81,7 +81,7 @@ bytecodes: [ ...@@ -81,7 +81,7 @@ bytecodes: [
B(LdaConstant), U8(1), B(LdaConstant), U8(1),
B(Star), R(3), B(Star), R(3),
B(Mov), R(this), R(1), B(Mov), R(this), R(1),
B(CallRuntime), U16(Runtime::kLoadFromSuper), R(1), U8(3), /* 156 E> */ B(CallRuntime), U16(Runtime::kLoadFromSuper), R(1), U8(3),
/* 158 S> */ B(Return), /* 158 S> */ B(Return),
] ]
constant pool: [ constant pool: [
......
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var x = undefined;
x[Symbol.iterator];
# Copyright 2017 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
*%(basename)s:6: TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined
x[Symbol.iterator];
^
TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined
at *%(basename)s:6:2
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