Commit 88e11c80 authored by machenbach's avatar machenbach Committed by Commit bot

Revert of [stubs] Fix TypeOfStub to properly return "undefined" for...

Revert of [stubs] Fix TypeOfStub to properly return "undefined" for undetectable. (patchset #1 id:1 of https://codereview.chromium.org/1527863003/ )

Reason for revert:
[Sheriff] Changes layout tests. Please fix upstream first:
https://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Linux%2064/builds/3491

Original issue's description:
> [stubs] Fix TypeOfStub to properly return "undefined" for undetectable.
>
> The TypeOfStub didn't test the undetectable bit properly if the instance
> was also callable, and therefore returned "object" for document.all
> (which is both undetectable and callable).
>
> R=yangguo@chromium.org
> BUG=chromium:567998
> LOG=n
>
> Committed: https://crrev.com/02cc310370df7e51ac4f705038820066fdfd0cdc
> Cr-Commit-Position: refs/heads/master@{#32852}

TBR=yangguo@chromium.org,bmeurer@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:567998

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

Cr-Commit-Position: refs/heads/master@{#32855}
parent bc895e62
...@@ -396,7 +396,8 @@ HValue* CodeStubGraphBuilder<TypeofStub>::BuildCodeStub() { ...@@ -396,7 +396,8 @@ HValue* CodeStubGraphBuilder<TypeofStub>::BuildCodeStub() {
// Is it an undetectable object? // Is it an undetectable object?
IfBuilder is_undetectable(this); IfBuilder is_undetectable(this);
is_undetectable.If<HCompareNumericAndBranch>( is_undetectable.If<HCompareNumericAndBranch>(
bit_field_masked, graph()->GetConstant0(), Token::NE); bit_field_masked, Add<HConstant>(1 << Map::kIsUndetectable),
Token::EQ);
is_undetectable.Then(); is_undetectable.Then();
{ {
// typeof an undetectable object is 'undefined'. // typeof an undetectable object is 'undefined'.
......
...@@ -11654,54 +11654,6 @@ THREADED_TEST(CallableObject) { ...@@ -11654,54 +11654,6 @@ THREADED_TEST(CallableObject) {
} }
THREADED_TEST(Regress567998) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
Local<v8::FunctionTemplate> desc =
v8::FunctionTemplate::New(env->GetIsolate());
desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable
desc->InstanceTemplate()->SetCallAsFunctionHandler(ReturnThis); // callable
Local<v8::Object> obj = desc->GetFunction(env.local())
.ToLocalChecked()
->NewInstance(env.local())
.ToLocalChecked();
CHECK(
env->Global()->Set(env.local(), v8_str("undetectable"), obj).FromJust());
ExpectString("undetectable.toString()", "[object Object]");
ExpectString("typeof undetectable", "undefined");
ExpectString("typeof(undetectable)", "undefined");
ExpectBoolean("typeof undetectable == 'undefined'", true);
ExpectBoolean("typeof undetectable == 'object'", false);
ExpectBoolean("if (undetectable) { true; } else { false; }", false);
ExpectBoolean("!undetectable", true);
ExpectObject("true&&undetectable", obj);
ExpectBoolean("false&&undetectable", false);
ExpectBoolean("true||undetectable", true);
ExpectObject("false||undetectable", obj);
ExpectObject("undetectable&&true", obj);
ExpectObject("undetectable&&false", obj);
ExpectBoolean("undetectable||true", true);
ExpectBoolean("undetectable||false", false);
ExpectBoolean("undetectable==null", true);
ExpectBoolean("null==undetectable", true);
ExpectBoolean("undetectable==undefined", true);
ExpectBoolean("undefined==undetectable", true);
ExpectBoolean("undetectable==undetectable", true);
ExpectBoolean("undetectable===null", false);
ExpectBoolean("null===undetectable", false);
ExpectBoolean("undetectable===undefined", false);
ExpectBoolean("undefined===undetectable", false);
ExpectBoolean("undetectable===undetectable", true);
}
static int Recurse(v8::Isolate* isolate, int depth, int iterations) { static int Recurse(v8::Isolate* isolate, int depth, int iterations) {
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
if (depth == 0) return v8::HandleScope::NumberOfHandles(isolate); if (depth == 0) return v8::HandleScope::NumberOfHandles(isolate);
......
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