Commit 35e5b682 authored by jkummerow's avatar jkummerow Committed by Commit bot

[proxies] Fix bogus cast in HasOwnPropertyImplementation

BUG=v8:1543,chromium:570120
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#32892}
parent 654efd0a
......@@ -671,7 +671,7 @@ static Object* HasOwnPropertyImplementation(Isolate* isolate,
// look like they are on this object.
PrototypeIterator iter(isolate, object);
if (!iter.IsAtEnd() &&
Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter))
PrototypeIterator::GetCurrent<HeapObject>(iter)
->map()
->is_hidden_prototype()) {
// TODO(verwaest): The recursion is not necessary for keys that are array
......@@ -679,8 +679,7 @@ static Object* HasOwnPropertyImplementation(Isolate* isolate,
// Casting to JSObject is fine because JSProxies are never used as
// hidden prototypes.
return HasOwnPropertyImplementation(
isolate, Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)),
key);
isolate, PrototypeIterator::GetCurrent<JSObject>(iter), key);
}
RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate);
return isolate->heap()->false_value();
......
......@@ -54,3 +54,10 @@ assertThrows("'nonconf' in proxy", TypeError);
assertThrows("'target_one' in proxy", TypeError);
assertFalse("target_two" in proxy);
assertFalse("in_your_dreams" in proxy);
// Regression test for crbug.com/570120 (stray JSObject::cast).
(function TestHasPropertyFastPath() {
var proxy = new Proxy({}, {});
var object = Object.create(proxy);
object.hasOwnProperty(0);
})();
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