| Index: src/runtime/runtime-classes.cc
|
| diff --git a/src/runtime/runtime-classes.cc b/src/runtime/runtime-classes.cc
|
| index 5448159513bda41508a1c8cd1f72e859be74197a..532c88edda5e49aa6b973d6fbbf49f6781435c90 100644
|
| --- a/src/runtime/runtime-classes.cc
|
| +++ b/src/runtime/runtime-classes.cc
|
| @@ -75,6 +75,27 @@ RUNTIME_FUNCTION(Runtime_ThrowIfStaticPrototype) {
|
| return *name;
|
| }
|
|
|
| +RUNTIME_FUNCTION(Runtime_ThrowIfMissingPrivateField) {
|
| + // TODO(bakkot) it would be better if this were done as part of the property
|
| + // lookup, instead of prior to it.
|
| + // Currently the parser emits code which looks like
|
| + // %ThrowIfMissingPrivateField(x, field)[field]
|
| + HandleScope scope(isolate);
|
| + DCHECK(args.length() == 2);
|
| + CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
|
| + CONVERT_ARG_HANDLE_CHECKED(Symbol, name, 1);
|
| + DCHECK(name->is_private());
|
| +
|
| + if (!object->IsJSReceiver() ||
|
| + !JSReceiver::HasOwnProperty(Handle<JSReceiver>::cast(object), name)
|
| + .FromMaybe(false)) { // Note that this does not trigger proxy traps
|
| + // when name is a private symbol.
|
| + THROW_NEW_ERROR_RETURN_FAILURE(
|
| + isolate, NewTypeError(MessageTemplate::kMissingPrivateField));
|
| + }
|
| + return *object; // This is used; after calling this method the field is
|
| + // immediately accessed.
|
| +}
|
|
|
| RUNTIME_FUNCTION(Runtime_HomeObjectSymbol) {
|
| DCHECK(args.length() == 0);
|
|
|