Commit ec532ac2 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[turbofan] Remove ObjectRef::TypeOf.

It turns out that this function didn't make much sense since
ReduceTypeOf already dispatches on the type of the input.

Bug: v8:7790
Change-Id: Ib02149db78e507500bbe79e16380ea7de8c4abfe
Reviewed-on: https://chromium-review.googlesource.com/1219329
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55854}
parent 967f24b4
......@@ -1102,13 +1102,6 @@ bool ObjectRef::equals(const ObjectRef& other) const {
return data_ == other.data_;
}
StringRef ObjectRef::TypeOf() const {
AllowHandleAllocation handle_allocation;
AllowHandleDereference handle_dereference;
return StringRef(broker(),
Object::TypeOf(broker()->isolate(), object<Object>()));
}
Isolate* ObjectRef::isolate() const { return broker()->isolate(); }
base::Optional<ContextRef> ContextRef::previous() const {
......
......@@ -126,7 +126,6 @@ class ObjectRef {
HEAP_BROKER_OBJECT_LIST(HEAP_AS_METHOD_DECL)
#undef HEAP_AS_METHOD_DECL
StringRef TypeOf() const;
bool BooleanValue();
double OddballToNumber() const;
......
......@@ -604,8 +604,6 @@ Reduction TypedOptimization::ReduceTypeOf(Node* node) {
} else if (type.Is(Type::Function())) {
return Replace(
jsgraph()->Constant(ObjectRef(js_heap_broker(), f->function_string())));
} else if (type.IsHeapConstant()) {
return Replace(jsgraph()->Constant(type.AsHeapConstant()->Ref().TypeOf()));
}
return NoChange();
}
......
// Copyright 2008 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
'use strict';
// The type of a regular expression should be 'object', including in
// the context of string equality comparisons.
{
const r = new RegExp;
var r = new RegExp;
assertEquals('object', typeof r);
assertTrue(typeof r == 'object');
assertFalse(typeof r == 'function');
assertEquals('object', typeof r);
assertTrue(typeof r == 'object');
assertFalse(typeof r == 'function');
function test(x, y) { return x == y; }
assertTrue(test('object', typeof r));
function equals(x, y) { return x == y; }
assertTrue(equals('object', typeof r));
}
assertFalse(typeof null == "undefined");
assertEquals('undefined', typeof undefined);
assertEquals('object', typeof null);
assertEquals('boolean', typeof true);
assertEquals('boolean', typeof false);
assertEquals('number', typeof 42.42);
assertEquals('number', typeof 42);
assertEquals('bigint', typeof 42n);
assertEquals('string', typeof '42');
assertEquals('symbol', typeof Symbol(42));
assertEquals('object', typeof {});
assertEquals('object', typeof []);
assertEquals('object', typeof new Proxy({}, {}));
assertEquals('object', typeof new Proxy([], {}));
assertEquals('function', typeof (_ => 42));
assertEquals('function', typeof function() {});
assertEquals('function', typeof function*() {});
assertEquals('function', typeof async function() {});
assertEquals('function', typeof async function*() {});
assertEquals('function', typeof new Proxy(_ => 42, {}));
assertEquals('function', typeof class {});
assertEquals('function', typeof Object);
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