Fix map space explosion from changing the arguments and caller properties on native...
authorricow@chromium.org <ricow@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 6 Sep 2011 14:03:32 +0000 (14:03 +0000)
committerricow@chromium.org <ricow@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 6 Sep 2011 14:03:32 +0000 (14:03 +0000)
Adding these local properties on all native functions made us do a
ConvertDescriptorToField on the callback on each and every native
functions, resulting in us creating an extra map for each of these.
Review URL: http://codereview.chromium.org/7779046

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9152 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/accessors.cc
src/v8natives.js

index e7d6aa0..f02efa5 100644 (file)
@@ -599,6 +599,7 @@ MaybeObject* Accessors::FunctionGetArguments(Object* object, void*) {
   if (!found_it) return isolate->heap()->undefined_value();
   Handle<JSFunction> function(holder, isolate);
 
+  if (function->shared()->native()) return isolate->heap()->null_value();
   // Find the top invocation of the function by traversing frames.
   List<JSFunction*> functions(2);
   for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) {
@@ -732,6 +733,7 @@ MaybeObject* Accessors::FunctionGetCaller(Object* object, void*) {
   bool found_it = false;
   JSFunction* holder = FindInPrototypeChain<JSFunction>(object, &found_it);
   if (!found_it) return isolate->heap()->undefined_value();
+  if (holder->shared()->native()) return isolate->heap()->null_value();
   Handle<JSFunction> function(holder, isolate);
 
   FrameFunctionIterator it(isolate, no_alloc);
index b13f3f1..829d719 100644 (file)
@@ -54,15 +54,6 @@ function InstallFunctions(object, attributes, functions) {
     var f = functions[i + 1];
     %FunctionSetName(f, key);
     %FunctionRemovePrototype(f);
-    // We match firefox on this, but not Safari (which does not have the
-    // property at all).
-    %IgnoreAttributesAndSetProperty(f, "caller",
-                                    null,
-                                    DONT_ENUM | DONT_DELETE);
-    %IgnoreAttributesAndSetProperty(f, "arguments",
-                                    null,
-                                    DONT_ENUM | DONT_DELETE);
-
     %SetProperty(object, key, f, attributes);
     %SetNativeFlag(f);
   }