Index: src/v8natives.js |
=================================================================== |
--- src/v8natives.js (revision 5085) |
+++ src/v8natives.js (working copy) |
@@ -225,16 +225,14 @@ |
// ECMA-262 - 15.2.4.6 |
function ObjectIsPrototypeOf(V) { |
- if (!IS_SPEC_OBJECT_OR_NULL(V) && !IS_UNDETECTABLE(V)) return false; |
+ if (!IS_SPEC_OBJECT(V)) return false; |
return %IsInPrototypeChain(this, V); |
} |
// ECMA-262 - 15.2.4.6 |
function ObjectPropertyIsEnumerable(V) { |
- if (this == null) return false; |
- if (!IS_SPEC_OBJECT_OR_NULL(this)) return false; |
- return %IsPropertyEnumerable(this, ToString(V)); |
+ return %IsPropertyEnumerable(ToObject(this), ToString(V)); |
} |
@@ -279,8 +277,7 @@ |
function ObjectKeys(obj) { |
- if ((!IS_SPEC_OBJECT_OR_NULL(obj) || IS_NULL_OR_UNDEFINED(obj)) && |
- !IS_UNDETECTABLE(obj)) |
+ if (!IS_SPEC_OBJECT(obj)) |
throw MakeTypeError("obj_ctor_property_non_object", ["keys"]); |
return %LocalKeys(obj); |
} |
@@ -329,7 +326,7 @@ |
// ES5 8.10.5. |
function ToPropertyDescriptor(obj) { |
- if (!IS_SPEC_OBJECT_OR_NULL(obj)) { |
+ if (!IS_SPEC_OBJECT(obj)) { |
throw MakeTypeError("property_desc_object", [obj]); |
} |
var desc = new PropertyDescriptor(); |
@@ -626,8 +623,7 @@ |
// ES5 section 15.2.3.2. |
function ObjectGetPrototypeOf(obj) { |
- if ((!IS_SPEC_OBJECT_OR_NULL(obj) || IS_NULL_OR_UNDEFINED(obj)) && |
- !IS_UNDETECTABLE(obj)) |
+ if (!IS_SPEC_OBJECT(obj)) |
throw MakeTypeError("obj_ctor_property_non_object", ["getPrototypeOf"]); |
return obj.__proto__; |
} |
@@ -635,8 +631,7 @@ |
// ES5 section 15.2.3.3 |
function ObjectGetOwnPropertyDescriptor(obj, p) { |
- if ((!IS_SPEC_OBJECT_OR_NULL(obj) || IS_NULL_OR_UNDEFINED(obj)) && |
- !IS_UNDETECTABLE(obj)) |
+ if (!IS_SPEC_OBJECT(obj)) |
throw MakeTypeError("obj_ctor_property_non_object", ["getOwnPropertyDescriptor"]); |
var desc = GetOwnProperty(obj, p); |
return FromPropertyDescriptor(desc); |
@@ -645,8 +640,7 @@ |
// ES5 section 15.2.3.4. |
function ObjectGetOwnPropertyNames(obj) { |
- if ((!IS_SPEC_OBJECT_OR_NULL(obj) || IS_NULL_OR_UNDEFINED(obj)) && |
- !IS_UNDETECTABLE(obj)) |
+ if (!IS_SPEC_OBJECT(obj)) |
throw MakeTypeError("obj_ctor_property_non_object", ["getOwnPropertyNames"]); |
// Find all the indexed properties. |
@@ -698,7 +692,7 @@ |
// ES5 section 15.2.3.5. |
function ObjectCreate(proto, properties) { |
- if (!IS_SPEC_OBJECT_OR_NULL(proto)) { |
+ if (!IS_SPEC_OBJECT(proto) && proto !== null) { |
throw MakeTypeError("proto_object_or_null", [proto]); |
} |
var obj = new $Object(); |
@@ -710,8 +704,7 @@ |
// ES5 section 15.2.3.6. |
function ObjectDefineProperty(obj, p, attributes) { |
- if ((!IS_SPEC_OBJECT_OR_NULL(obj) || IS_NULL_OR_UNDEFINED(obj)) && |
- !IS_UNDETECTABLE(obj)) { |
+ if (!IS_SPEC_OBJECT(obj)) { |
throw MakeTypeError("obj_ctor_property_non_object", ["defineProperty"]); |
} |
var name = ToString(p); |
@@ -723,8 +716,7 @@ |
// ES5 section 15.2.3.7. |
function ObjectDefineProperties(obj, properties) { |
- if ((!IS_SPEC_OBJECT_OR_NULL(obj) || IS_NULL_OR_UNDEFINED(obj)) && |
- !IS_UNDETECTABLE(obj)) |
+ if (!IS_SPEC_OBJECT(obj)) |
throw MakeTypeError("obj_ctor_property_non_object", ["defineProperties"]); |
var props = ToObject(properties); |
var key_values = []; |
@@ -747,8 +739,7 @@ |
// ES5 section 15.2.3.8. |
function ObjectSeal(obj) { |
- if ((!IS_SPEC_OBJECT_OR_NULL(obj) || IS_NULL_OR_UNDEFINED(obj)) && |
- !IS_UNDETECTABLE(obj)) { |
+ if (!IS_SPEC_OBJECT(obj)) { |
throw MakeTypeError("obj_ctor_property_non_object", ["seal"]); |
} |
var names = ObjectGetOwnPropertyNames(obj); |
@@ -764,8 +755,7 @@ |
// ES5 section 15.2.3.9. |
function ObjectFreeze(obj) { |
- if ((!IS_SPEC_OBJECT_OR_NULL(obj) || IS_NULL_OR_UNDEFINED(obj)) && |
- !IS_UNDETECTABLE(obj)) { |
+ if (!IS_SPEC_OBJECT(obj)) { |
throw MakeTypeError("obj_ctor_property_non_object", ["freeze"]); |
} |
var names = ObjectGetOwnPropertyNames(obj); |
@@ -782,8 +772,7 @@ |
// ES5 section 15.2.3.10 |
function ObjectPreventExtension(obj) { |
- if ((!IS_SPEC_OBJECT_OR_NULL(obj) || IS_NULL_OR_UNDEFINED(obj)) && |
- !IS_UNDETECTABLE(obj)) { |
+ if (!IS_SPEC_OBJECT(obj)) { |
throw MakeTypeError("obj_ctor_property_non_object", ["preventExtension"]); |
} |
%PreventExtensions(obj); |
@@ -793,8 +782,7 @@ |
// ES5 section 15.2.3.11 |
function ObjectIsSealed(obj) { |
- if ((!IS_SPEC_OBJECT_OR_NULL(obj) || IS_NULL_OR_UNDEFINED(obj)) && |
- !IS_UNDETECTABLE(obj)) { |
+ if (!IS_SPEC_OBJECT(obj)) { |
throw MakeTypeError("obj_ctor_property_non_object", ["isSealed"]); |
} |
var names = ObjectGetOwnPropertyNames(obj); |
@@ -812,8 +800,7 @@ |
// ES5 section 15.2.3.12 |
function ObjectIsFrozen(obj) { |
- if ((!IS_SPEC_OBJECT_OR_NULL(obj) || IS_NULL_OR_UNDEFINED(obj)) && |
- !IS_UNDETECTABLE(obj)) { |
+ if (!IS_SPEC_OBJECT(obj)) { |
throw MakeTypeError("obj_ctor_property_non_object", ["isFrozen"]); |
} |
var names = ObjectGetOwnPropertyNames(obj); |
@@ -832,8 +819,7 @@ |
// ES5 section 15.2.3.13 |
function ObjectIsExtensible(obj) { |
- if ((!IS_SPEC_OBJECT_OR_NULL(obj) || IS_NULL_OR_UNDEFINED(obj)) && |
- !IS_UNDETECTABLE(obj)) { |
+ if (!IS_SPEC_OBJECT(obj)) { |
throw MakeTypeError("obj_ctor_property_non_object", ["preventExtension"]); |
} |
return %IsExtensible(obj); |