| Index: src/runtime.cc
|
| diff --git a/src/runtime.cc b/src/runtime.cc
|
| index ad18cfc02097d9fbb00b7c6cf601185c1e775fdc..65b1d35650930035c1f1c3b6ecc905537941e159 100644
|
| --- a/src/runtime.cc
|
| +++ b/src/runtime.cc
|
| @@ -1662,6 +1662,14 @@ static bool CheckAccessException(Object* callback,
|
| (access_type == v8::ACCESS_GET && info->all_can_read()) ||
|
| (access_type == v8::ACCESS_SET && info->all_can_write());
|
| }
|
| + if (callback->IsAccessorPair()) {
|
| + AccessorPair* info = AccessorPair::cast(callback);
|
| + return
|
| + (access_type == v8::ACCESS_HAS &&
|
| + (info->all_can_read() || info->all_can_write())) ||
|
| + (access_type == v8::ACCESS_GET && info->all_can_read()) ||
|
| + (access_type == v8::ACCESS_SET && info->all_can_write());
|
| + }
|
| return false;
|
| }
|
|
|
| @@ -1943,6 +1951,35 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_EnableAccessChecks) {
|
| }
|
|
|
|
|
| +// Transform getter or setter into something DefineAccessor can handle.
|
| +static Handle<Object> InstantiateAccessorComponent(Isolate* isolate,
|
| + Handle<Object> component) {
|
| + if (component->IsUndefined()) return isolate->factory()->null_value();
|
| + Handle<FunctionTemplateInfo> info =
|
| + Handle<FunctionTemplateInfo>::cast(component);
|
| + return Utils::OpenHandle(*Utils::ToLocal(info)->GetFunction());
|
| +}
|
| +
|
| +
|
| +RUNTIME_FUNCTION(MaybeObject*, Runtime_SetAccessorProperty) {
|
| + HandleScope scope(isolate);
|
| + ASSERT(args.length() == 6);
|
| + CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
|
| + CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
|
| + CONVERT_ARG_HANDLE_CHECKED(Object, getter, 2);
|
| + CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3);
|
| + CONVERT_SMI_ARG_CHECKED(attribute, 4);
|
| + CONVERT_SMI_ARG_CHECKED(access_control, 5);
|
| + JSObject::DefineAccessor(object,
|
| + name,
|
| + InstantiateAccessorComponent(isolate, getter),
|
| + InstantiateAccessorComponent(isolate, setter),
|
| + static_cast<PropertyAttributes>(attribute),
|
| + static_cast<v8::AccessControl>(access_control));
|
| + return isolate->heap()->undefined_value();
|
| +}
|
| +
|
| +
|
| static Failure* ThrowRedeclarationError(Isolate* isolate,
|
| const char* type,
|
| Handle<String> name) {
|
|
|