Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: src/v8natives.js

Issue 7356013: Implement Object.prototype.hasOwnProperty in generated code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 225
226 226
227 // ECMA-262 - 15.2.4.4 227 // ECMA-262 - 15.2.4.4
228 function ObjectValueOf() { 228 function ObjectValueOf() {
229 return ToObject(this); 229 return ToObject(this);
230 } 230 }
231 231
232 232
233 // ECMA-262 - 15.2.4.5 233 // ECMA-262 - 15.2.4.5
234 function ObjectHasOwnProperty(V) { 234 function ObjectHasOwnProperty(V) {
235 return %HasLocalProperty(TO_OBJECT_INLINE(this), TO_STRING_INLINE(V)); 235 return %_HasOwnProperty(TO_OBJECT_INLINE(this), TO_STRING_INLINE(V));
236 } 236 }
237 237
238 238
239 // ECMA-262 - 15.2.4.6 239 // ECMA-262 - 15.2.4.6
240 function ObjectIsPrototypeOf(V) { 240 function ObjectIsPrototypeOf(V) {
241 if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) { 241 if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
242 throw MakeTypeError("called_on_null_or_undefined", 242 throw MakeTypeError("called_on_null_or_undefined",
243 ["Object.prototype.isPrototypeOf"]); 243 ["Object.prototype.isPrototypeOf"]);
244 } 244 }
245 if (!IS_SPEC_OBJECT(V)) return false; 245 if (!IS_SPEC_OBJECT(V)) return false;
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 } 972 }
973 973
974 974
975 // ES5 section 15.2.3.7. 975 // ES5 section 15.2.3.7.
976 function ObjectDefineProperties(obj, properties) { 976 function ObjectDefineProperties(obj, properties) {
977 if (!IS_SPEC_OBJECT(obj)) 977 if (!IS_SPEC_OBJECT(obj))
978 throw MakeTypeError("obj_ctor_property_non_object", ["defineProperties"]); 978 throw MakeTypeError("obj_ctor_property_non_object", ["defineProperties"]);
979 var props = ToObject(properties); 979 var props = ToObject(properties);
980 var key_values = []; 980 var key_values = [];
981 for (var key in props) { 981 for (var key in props) {
982 if (%HasLocalProperty(props, key)) { 982 if (%HasOwnProperty(props, key)) {
983 key_values.push(key); 983 key_values.push(key);
984 var value = props[key]; 984 var value = props[key];
985 var desc = ToPropertyDescriptor(value); 985 var desc = ToPropertyDescriptor(value);
986 key_values.push(desc); 986 key_values.push(desc);
987 } 987 }
988 } 988 }
989 for (var i = 0; i < key_values.length; i += 2) { 989 for (var i = 0; i < key_values.length; i += 2) {
990 var key = key_values[i]; 990 var key = key_values[i];
991 var desc = key_values[i + 1]; 991 var desc = key_values[i + 1];
992 DefineOwnProperty(obj, key, desc, true); 992 DefineOwnProperty(obj, key, desc, true);
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 // ---------------------------------------------------------------------------- 1457 // ----------------------------------------------------------------------------
1458 1458
1459 function SetupFunction() { 1459 function SetupFunction() {
1460 InstallFunctions($Function.prototype, DONT_ENUM, $Array( 1460 InstallFunctions($Function.prototype, DONT_ENUM, $Array(
1461 "bind", FunctionBind, 1461 "bind", FunctionBind,
1462 "toString", FunctionToString 1462 "toString", FunctionToString
1463 )); 1463 ));
1464 } 1464 }
1465 1465
1466 SetupFunction(); 1466 SetupFunction();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698