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

Unified Diff: src/v8natives.js

Issue 214051: Pushed 1.3.12 to trunk. (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 11 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/v8-counters.h ('k') | src/version.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/v8natives.js
===================================================================
--- src/v8natives.js (revision 2947)
+++ src/v8natives.js (working copy)
@@ -276,6 +276,13 @@
}
+function ObjectKeys(obj) {
+ if ((!IS_OBJECT(obj) || IS_NULL_OR_UNDEFINED(obj)) && !IS_FUNCTION(obj))
+ throw MakeTypeError('object_keys_non_object', [obj]);
+ return %LocalKeys(obj);
+}
+
+
%SetCode($Object, function(x) {
if (%_IsConstructCall()) {
if (x == null) return this;
@@ -304,6 +311,9 @@
"__defineSetter__", ObjectDefineSetter,
"__lookupSetter__", ObjectLookupSetter
));
+ InstallFunctions($Object, DONT_ENUM, $Array(
+ "keys", ObjectKeys
+ ));
}
SetupObject();
@@ -514,7 +524,7 @@
}
var source = %FunctionGetSourceCode(func);
- if (!IS_STRING(source)) {
+ if (!IS_STRING(source) || %FunctionIsBuiltin(func)) {
var name = %FunctionGetName(func);
if (name) {
// Mimic what KJS does.
@@ -524,12 +534,6 @@
}
}
- // Censor occurrences of internal calls. We do that for all
- // functions and don't cache under the assumption that people rarly
- // convert functions to strings. Note that we (apparently) can't
- // use regular expression literals in natives files.
- var regexp = ORIGINAL_REGEXP("%(\\w+\\()", "gm");
- if (source.match(regexp)) source = source.replace(regexp, "$1");
var name = %FunctionGetName(func);
return 'function ' + name + source;
}
« no previous file with comments | « src/v8-counters.h ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698