libraries/v8/runtime.cc
// Implements part of 8.12.9 DefineOwnProperty.
// There are 3 cases that lead here:
// Step 4b - define a new accessor property.
// Steps 9c & 12 - replace an existing data property with an accessor property.
// Step 12 - update an existing accessor property with an accessor or generic
//           descriptor.
Implements part of 8.12.9 DefineOwnProperty.
There are 3 cases that lead here:
Step 4b - define a new accessor property.
Steps 9c & 12 - replace an existing data property with an accessor property.
Step 12 - update an existing accessor property with an accessor or generic
descriptor.
Implements part of 8 . 12 . 9 DefineOwnProperty . There are 3 cases that lead here : Step 4b - define a new accessor property . Steps 9c & 12 - replace an existing data property with an accessor property . Step 12 - update an existing accessor property with an accessor or generic descriptor .
RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineAccessorProperty) {
  HandleScope scope(isolate);
  ASSERT(args.length() == 5);
  CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
  RUNTIME_ASSERT(!obj->IsNull());
  CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
  CONVERT_ARG_HANDLE_CHECKED(Object, getter, 2);
  RUNTIME_ASSERT(IsValidAccessor(getter));
  CONVERT_ARG_HANDLE_CHECKED(Object, setter, 3);
  RUNTIME_ASSERT(IsValidAccessor(setter));
  CONVERT_SMI_ARG_CHECKED(unchecked, 4);
  RUNTIME_ASSERT((unchecked & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
  PropertyAttributes attr = static_cast<PropertyAttributes>(unchecked);
  bool fast = obj->HasFastProperties();
  JSObject::DefineAccessor(obj, name, getter, setter, attr);
  RETURN_IF_SCHEDULED_EXCEPTION(isolate);
  if (fast) JSObject::TransformToFastProperties(obj, 0);
  return isolate->heap()->undefined_value();
}
RUNTIME_FUNCTION ( MaybeObject * , Runtime_DefineOrRedefineAccessorProperty ) { HandleScope scope ( isolate ) ; ASSERT ( args . length ( ) == 5 ) ; CONVERT_ARG_HANDLE_CHECKED ( JSObject , obj , 0 ) ; RUNTIME_ASSERT ( ! obj -> IsNull ( ) ) ; CONVERT_ARG_HANDLE_CHECKED ( Name , name , 1 ) ; CONVERT_ARG_HANDLE_CHECKED ( Object , getter , 2 ) ; RUNTIME_ASSERT ( IsValidAccessor ( getter ) ) ; CONVERT_ARG_HANDLE_CHECKED ( Object , setter , 3 ) ; RUNTIME_ASSERT ( IsValidAccessor ( setter ) ) ; CONVERT_SMI_ARG_CHECKED ( unchecked , 4 ) ; RUNTIME_ASSERT ( ( unchecked & ~ ( READ_ONLY | DONT_ENUM | DONT_DELETE ) ) == 0 ) ; PropertyAttributes attr = static_cast < PropertyAttributes > ( unchecked ) ; bool fast = obj -> HasFastProperties ( ) ; JSObject :: DefineAccessor ( obj , name , getter , setter , attr ) ; RETURN_IF_SCHEDULED_EXCEPTION ( isolate ) ; if ( fast ) JSObject :: TransformToFastProperties ( obj , 0 ) ; return isolate -> heap ( ) -> undefined_value ( ) ; }
Implements part of 8.12.9 DefineOwnProperty.
Implements part of 8 . 12 . 9 DefineOwnProperty .