Lines Matching refs:obj

333 function ObjectKeys(obj) {
334 if (!IS_SPEC_OBJECT(obj)) {
337 if (%IsJSProxy(obj)) {
338 var handler = %GetHandler(obj);
342 return %LocalKeys(obj);
393 var obj = new $Object();
396 %IgnoreAttributesAndSetProperty(obj, "value", desc.getValue(), NONE);
399 %IgnoreAttributesAndSetProperty(obj, "writable", desc.isWritable(), NONE);
402 %IgnoreAttributesAndSetProperty(obj, "get", desc.getGet(), NONE);
405 %IgnoreAttributesAndSetProperty(obj, "set", desc.getSet(), NONE);
408 %IgnoreAttributesAndSetProperty(obj, "enumerable",
412 %IgnoreAttributesAndSetProperty(obj, "configurable",
415 return obj;
420 function ToPropertyDescriptor(obj) {
421 if (!IS_SPEC_OBJECT(obj)) {
422 throw MakeTypeError("property_desc_object", [obj]);
426 if ("enumerable" in obj) {
427 desc.setEnumerable(ToBoolean(obj.enumerable));
430 if ("configurable" in obj) {
431 desc.setConfigurable(ToBoolean(obj.configurable));
434 if ("value" in obj) {
435 desc.setValue(obj.value);
438 if ("writable" in obj) {
439 desc.setWritable(ToBoolean(obj.writable));
442 if ("get" in obj) {
443 var get = obj.get;
450 if ("set" in obj) {
451 var set = obj.set;
459 throw MakeTypeError("value_and_accessor", [obj]);
466 function ToCompletePropertyDescriptor(obj) {
467 var desc = ToPropertyDescriptor(obj);
637 function GetOwnProperty(obj, v) {
639 if (%IsJSProxy(obj)) {
640 var handler = %GetHandler(obj);
653 // If p is not a property on obj undefined is returned.
654 var props = %GetOwnProperty(ToObject(obj), ToString(v));
664 function Delete(obj, p, should_throw) {
665 var desc = GetOwnProperty(obj, p);
668 %DeleteProperty(obj, p, 0);
679 function DefineProxyProperty(obj, p, attributes, should_throw) {
680 var handler = %GetHandler(obj);
695 function DefineObjectProperty(obj, p, desc, should_throw) {
696 var current_or_access = %GetOwnProperty(ToObject(obj), ToString(p));
701 var extensible = %IsExtensible(ToObject(obj));
836 %DefineOrRedefineDataProperty(obj, p, value, flag);
846 %DefineOrRedefineAccessorProperty(obj, p, getter, setter, flag);
853 function DefineArrayProperty(obj, p, desc, should_throw) {
860 var length = obj.length;
862 return DefineObjectProperty(obj, "length", desc, should_throw);
868 var length_desc = GetOwnProperty(obj, "length");
878 if (!Delete(obj, ToString(length), false)) {
886 obj.length = new_length;
889 if (!DefineObjectProperty(obj, "length", desc, should_throw) || threw) {
902 var length = obj.length;
903 var length_desc = GetOwnProperty(obj, "length");
905 !DefineObjectProperty(obj, p, desc, true)) {
913 obj.length = index + 1;
919 return DefineObjectProperty(obj, p, desc, should_throw);
924 function DefineOwnProperty(obj, p, desc, should_throw) {
925 if (%IsJSProxy(obj)) {
927 return DefineProxyProperty(obj, p, attributes, should_throw);
928 } else if (IS_ARRAY(obj)) {
929 return DefineArrayProperty(obj, p, desc, should_throw);
931 return DefineObjectProperty(obj, p, desc, should_throw);
937 function ObjectGetPrototypeOf(obj) {
938 if (!IS_SPEC_OBJECT(obj)) {
941 return %GetPrototype(obj);
946 function ObjectGetOwnPropertyDescriptor(obj, p) {
947 if (!IS_SPEC_OBJECT(obj)) {
951 var desc = GetOwnProperty(obj, p);
957 function ToStringArray(obj, trap) {
958 if (!IS_SPEC_OBJECT(obj)) {
959 throw MakeTypeError("proxy_non_object_prop_names", [obj, trap]);
961 var n = ToUint32(obj.length);
965 var s = ToString(obj[index]);
967 throw MakeTypeError("proxy_repeated_prop_name", [obj, trap, s]);
977 function ObjectGetOwnPropertyNames(obj) {
978 if (!IS_SPEC_OBJECT(obj)) {
982 if (%IsJSProxy(obj)) {
983 var handler = %GetHandler(obj);
991 var propertyNames = %GetLocalElementNames(obj);
994 if (%GetInterceptorInfo(obj) & 1) {
996 %GetIndexedInterceptorElementNames(obj);
1005 propertyNames = propertyNames.concat(%GetLocalPropertyNames(obj));
1009 if (%GetInterceptorInfo(obj) & 2) {
1011 %GetNamedInterceptorPropertyNames(obj);
1042 var obj = new $Object();
1043 obj.__proto__ = proto;
1044 if (!IS_UNDEFINED(properties)) ObjectDefineProperties(obj, properties);
1045 return obj;
1050 function ObjectDefineProperty(obj, p, attributes) {
1051 if (!IS_SPEC_OBJECT(obj)) {
1055 if (%IsJSProxy(obj)) {
1063 DefineProxyProperty(obj, name, attributesClone, true);
1084 DefineOwnProperty(obj, name, desc, true);
1086 return obj;
1102 function ObjectDefineProperties(obj, properties) {
1103 if (!IS_SPEC_OBJECT(obj)) {
1113 DefineOwnProperty(obj, names[i], descriptors[i], true);
1115 return obj;
1120 function ProxyFix(obj) {
1121 var handler = %GetHandler(obj);
1127 if (%IsJSFunctionProxy(obj)) {
1128 var callTrap = %GetCallTrap(obj);
1129 var constructTrap = %GetConstructTrap(obj);
1131 %Fix(obj); // becomes a regular function
1132 %SetCode(obj, code);
1137 {value: obj, writable: true, enumerable: false, configurable: true});
1139 %FunctionSetPrototype(obj, prototype);
1140 obj.length = 0;
1142 %Fix(obj);
1144 ObjectDefineProperties(obj, props);
1149 function ObjectSeal(obj) {
1150 if (!IS_SPEC_OBJECT(obj)) {
1153 if (%IsJSProxy(obj)) {
1154 ProxyFix(obj);
1156 var names = ObjectGetOwnPropertyNames(obj);
1159 var desc = GetOwnProperty(obj, name);
1162 DefineOwnProperty(obj, name, desc, true);
1165 %PreventExtensions(obj);
1166 return obj;
1171 function ObjectFreeze(obj) {
1172 if (!IS_SPEC_OBJECT(obj)) {
1175 if (%IsJSProxy(obj)) {
1176 ProxyFix(obj);
1178 var names = ObjectGetOwnPropertyNames(obj);
1181 var desc = GetOwnProperty(obj, name);
1185 DefineOwnProperty(obj, name, desc, true);
1188 %PreventExtensions(obj);
1189 return obj;
1194 function ObjectPreventExtension(obj) {
1195 if (!IS_SPEC_OBJECT(obj)) {
1198 if (%IsJSProxy(obj)) {
1199 ProxyFix(obj);
1201 %PreventExtensions(obj);
1202 return obj;
1207 function ObjectIsSealed(obj) {
1208 if (!IS_SPEC_OBJECT(obj)) {
1211 if (%IsJSProxy(obj)) {
1214 var names = ObjectGetOwnPropertyNames(obj);
1217 var desc = GetOwnProperty(obj, name);
1220 if (!ObjectIsExtensible(obj)) {
1228 function ObjectIsFrozen(obj) {
1229 if (!IS_SPEC_OBJECT(obj)) {
1232 if (%IsJSProxy(obj)) {
1235 var names = ObjectGetOwnPropertyNames(obj);
1238 var desc = GetOwnProperty(obj, name);
1242 if (!ObjectIsExtensible(obj)) {
1250 function ObjectIsExtensible(obj) {
1251 if (!IS_SPEC_OBJECT(obj)) {
1254 if (%IsJSProxy(obj)) {
1257 return %IsExtensible(obj);