Reviewers: Mads Ager,
Description:
Micro-optimize passing of args to HasLocalProperty.
Please review this at http://codereview.chromium.org/7018001/
Affected files:
M src/macros.py
M src/v8natives.js
Index: src/macros.py
diff --git a/src/macros.py b/src/macros.py
index
69f36c09c050a7f7ddd4c81d969b9901f6c96786..f112994d3fd030041c59aa08b189b9b9f4eba18f
100644
--- a/src/macros.py
+++ b/src/macros.py
@@ -127,7 +127,7 @@ macro TO_INT32(arg) = (%_IsSmi(%IS_VAR(arg)) ? arg :
(arg >> 0));
macro TO_UINT32(arg) = (arg >>> 0);
macro TO_STRING_INLINE(arg) = (IS_STRING(%IS_VAR(arg)) ? arg :
NonStringToString(arg));
macro TO_NUMBER_INLINE(arg) = (IS_NUMBER(%IS_VAR(arg)) ? arg :
NonNumberToNumber(arg));
-
+macro TO_OBJECT_INLINE(arg) = ((IS_OBJECT(%IS_VAR(arg))
&& !IS_NULL_OR_UNDEFINED(arg)) ? arg : ToObject(arg));
# Macros implemented in Python.
python macro CHAR_CODE(str) = ord(str[1]);
Index: src/v8natives.js
diff --git a/src/v8natives.js b/src/v8natives.js
index
7a4be276d72f1af93e4c2cfa95e8956acfb429db..f5c251ee033988be9c57514ca8f988b9a302231f
100644
--- a/src/v8natives.js
+++ b/src/v8natives.js
@@ -234,7 +234,7 @@ function ObjectValueOf() {
// ECMA-262 - 15.2.4.5
function ObjectHasOwnProperty(V) {
- return %HasLocalProperty(ToObject(this), ToString(V));
+ return %HasLocalProperty(TO_OBJECT_INLINE(this), TO_STRING_INLINE(V));
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev