Commit 0c7bc1cd authored by neis's avatar neis Committed by Commit bot

Remove Object::IsSpecObject, use Object::IsJSReceiver instead.

R=bmeurer@chromium.org
BUG=

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

Cr-Commit-Position: refs/heads/master@{#32398}
parent b1578a15
......@@ -1189,7 +1189,7 @@ bool HasConcatSpreadableModifier(Isolate* isolate, Handle<JSArray> obj) {
bool IsConcatSpreadable(Isolate* isolate, Handle<Object> obj) {
HandleScope handle_scope(isolate);
if (!obj->IsSpecObject()) return false;
if (!obj->IsJSReceiver()) return false;
if (FLAG_harmony_concat_spreadable) {
Handle<Symbol> key(isolate->factory()->is_concat_spreadable_symbol());
Handle<Object> value;
......
......@@ -969,7 +969,7 @@ bool ToBooleanStub::Types::UpdateStatus(Handle<Object> object) {
} else if (object->IsSmi()) {
Add(SMI);
return Smi::cast(*object)->value() != 0;
} else if (object->IsSpecObject()) {
} else if (object->IsJSReceiver()) {
Add(SPEC_OBJECT);
return !object->IsUndetectableObject();
} else if (object->IsString()) {
......
......@@ -161,7 +161,7 @@ static Maybe<PropertyAttributes> UnscopableLookup(LookupIterator* it) {
if (!maybe_unscopables.ToHandle(&unscopables)) {
return Nothing<PropertyAttributes>();
}
if (!unscopables->IsSpecObject()) return attrs;
if (!unscopables->IsJSReceiver()) return attrs;
Handle<Object> blacklist;
MaybeHandle<Object> maybe_blacklist =
Object::GetProperty(unscopables, it->name());
......
......@@ -198,12 +198,6 @@ bool Object::IsConstructor() const {
}
bool Object::IsSpecObject() const {
return Object::IsHeapObject()
&& HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_RECEIVER_TYPE;
}
bool Object::IsTemplateInfo() const {
return IsObjectTemplateInfo() || IsFunctionTemplateInfo();
}
......@@ -2373,7 +2367,7 @@ bool Object::IsStringObjectWithCharacterAt(uint32_t index) {
void Object::VerifyApiCallResultType() {
#if DEBUG
if (!(IsSmi() || IsString() || IsSymbol() || IsSpecObject() ||
if (!(IsSmi() || IsString() || IsSymbol() || IsJSReceiver() ||
IsHeapNumber() || IsSimd128Value() || IsUndefined() || IsTrue() ||
IsFalse() || IsNull())) {
FATAL("API call returned invalid object");
......
......@@ -858,7 +858,7 @@ MaybeHandle<Object> JSProxy::GetPrototype(Handle<JSProxy> proxy) {
Handle<Object> raw_handler(proxy->handler(), isolate);
// 2. If handler is null, throw a TypeError exception.
// 3. Assert: Type(handler) is Object.
if (!raw_handler->IsSpecObject()) {
if (!raw_handler->IsJSReceiver()) {
// TODO(cbruni): Throw correct error message.
THROW_NEW_ERROR(
isolate, NewTypeError(MessageTemplate::kProxyHandlerNonObject), Object);
......@@ -883,7 +883,7 @@ MaybeHandle<Object> JSProxy::GetPrototype(Handle<JSProxy> proxy) {
isolate, handler_proto,
Execution::Call(isolate, trap, handler, arraysize(argv), argv), Object);
// 8. If Type(handlerProto) is neither Object nor Null, throw a TypeError.
if (!(handler_proto->IsSpecObject() || handler_proto->IsNull())) {
if (!(handler_proto->IsJSReceiver() || handler_proto->IsNull())) {
THROW_NEW_ERROR(isolate,
NewTypeError(MessageTemplate::kProxyHandlerTrapMissing,
handler, trap_name),
......@@ -6090,7 +6090,7 @@ Object* JSReceiver::DefineProperty(Isolate* isolate, Handle<Object> object,
Handle<Object> key,
Handle<Object> attributes) {
// 1. If Type(O) is not Object, throw a TypeError exception.
if (!object->IsSpecObject()) {
if (!object->IsJSReceiver()) {
Handle<String> fun_name =
isolate->factory()->InternalizeUtf8String("Object.defineProperty");
THROW_NEW_ERROR_RETURN_FAILURE(
......@@ -6121,7 +6121,7 @@ Object* JSReceiver::DefineProperty(Isolate* isolate, Handle<Object> object,
Object* JSReceiver::DefineProperties(Isolate* isolate, Handle<Object> object,
Handle<Object> properties) {
// 1. If Type(O) is not Object, throw a TypeError exception.
if (!object->IsSpecObject()) {
if (!object->IsJSReceiver()) {
Handle<String> fun_name =
isolate->factory()->InternalizeUtf8String("Object.defineProperties");
THROW_NEW_ERROR_RETURN_FAILURE(
......@@ -6802,7 +6802,7 @@ bool JSProxy::DefineOwnProperty(Isolate* isolate, Handle<JSProxy> proxy,
// 4. Assert: Type(handler) is Object.
DCHECK(handler->IsJSReceiver());
// If the handler is not null, the target can't be null either.
DCHECK(proxy->target()->IsSpecObject());
DCHECK(proxy->target()->IsJSReceiver());
// 5. Let target be the value of the [[ProxyTarget]] internal slot of O.
Handle<JSReceiver> target(JSReceiver::cast(proxy->target()), isolate);
// 6. Let trap be ? GetMethod(handler, "defineProperty").
......@@ -6985,9 +6985,9 @@ bool JSProxy::GetOwnPropertyDescriptor(LookupIterator* it,
return false;
}
// 4. Assert: Type(handler) is Object.
DCHECK(handler->IsSpecObject());
DCHECK(handler->IsJSReceiver());
// If the handler is not null, the target can't be null either.
DCHECK(it->GetHolder<JSProxy>()->target()->IsSpecObject());
DCHECK(it->GetHolder<JSProxy>()->target()->IsJSReceiver());
// 5. Let target be the value of the [[ProxyTarget]] internal slot of O.
Handle<JSReceiver> target(
JSReceiver::cast(it->GetHolder<JSProxy>()->target()), isolate);
......@@ -7010,7 +7010,7 @@ bool JSProxy::GetOwnPropertyDescriptor(LookupIterator* it,
Execution::Call(isolate, trap, handler, arraysize(args), args), false);
// 9. If Type(trapResultObj) is neither Object nor Undefined, throw a
// TypeError exception.
if (!trap_result_obj->IsSpecObject() && !trap_result_obj->IsUndefined()) {
if (!trap_result_obj->IsJSReceiver() && !trap_result_obj->IsUndefined()) {
isolate->Throw(*isolate->factory()->NewTypeError(
MessageTemplate::kProxyHandlerReturned, handler, trap_result_obj,
property_name));
......
......@@ -1060,7 +1060,6 @@ class Object {
// ES6, section 7.2.4 IsConstructor.
INLINE(bool IsConstructor() const);
INLINE(bool IsSpecObject()) const;
INLINE(bool IsTemplateInfo()) const;
INLINE(bool IsNameDictionary() const);
INLINE(bool IsGlobalDictionary() const);
......
......@@ -148,7 +148,7 @@ bool PropertyDescriptor::ToPropertyDescriptor(Isolate* isolate,
PropertyDescriptor* desc) {
// 1. ReturnIfAbrupt(Obj).
// 2. If Type(Obj) is not Object, throw a TypeError exception.
if (!obj->IsSpecObject()) {
if (!obj->IsJSReceiver()) {
isolate->Throw(*isolate->factory()->NewTypeError(
MessageTemplate::kPropertyDescObject, obj));
return false;
......
......@@ -108,7 +108,7 @@ static MaybeHandle<Object> DefineClass(Isolate* isolate, Handle<Object> name,
isolate->factory()->prototype_string(),
SLOPPY),
Object);
if (!prototype_parent->IsNull() && !prototype_parent->IsSpecObject()) {
if (!prototype_parent->IsNull() && !prototype_parent->IsJSReceiver()) {
THROW_NEW_ERROR(
isolate, NewTypeError(MessageTemplate::kPrototypeParentNotAnObject,
prototype_parent),
......
......@@ -1263,7 +1263,7 @@ RUNTIME_FUNCTION(Runtime_IsSpecObject) {
SealHandleScope shs(isolate);
DCHECK(args.length() == 1);
CONVERT_ARG_CHECKED(Object, obj, 0);
return isolate->heap()->ToBoolean(obj->IsSpecObject());
return isolate->heap()->ToBoolean(obj->IsJSReceiver());
}
......
......@@ -16,11 +16,11 @@ RUNTIME_FUNCTION(Runtime_CreateJSProxy) {
DCHECK(args.length() == 2);
CONVERT_ARG_HANDLE_CHECKED(Object, target, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, handler, 1);
if (!target->IsSpecObject()) {
if (!target->IsJSReceiver()) {
THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kProxyTargetNonObject));
}
if (!handler->IsSpecObject()) {
if (!handler->IsJSReceiver()) {
THROW_NEW_ERROR_RETURN_FAILURE(
isolate, NewTypeError(MessageTemplate::kProxyHandlerNonObject));
}
......
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