Disable function.arguments
https://bugs.webkit.org/show_bug.cgi?id=137167

Source/JavaScriptCore:

Rubber stamped by Geoffrey Garen.
        
Add an option to disable function.arguments. Add a test for disabling it.
        
Disabling function.arguments means that it returns an Arguments object that claims that
there were zero arguments. All other Arguments functionality still works, so any code
that tries to inspect this object will still think that it is looking at a perfectly
valid Arguments object.
        
This also makes function.arguments disabled by default. Note that the RJST harness will
enable them by default, to continue to get test coverage for the code that implements
the feature.
        
We will rip out that code once we're confident that it's really safe to remove this
feature. Only once we rip out that support will we be able to do optimizations to
leverage the lack of this feature. It's important to keep the support code, and the test
infrastructure, in place before we are confident. The logic to keep this working touches
the entire compiler and a large chunk of the runtime, so reimplementing it - or even
merging it back in - would be a nightmare. That's also basically the reason why we want
to rip it out if at all possible. It's a lot of terrible code.

* interpreter/StackVisitor.cpp:
(JSC::StackVisitor::Frame::createArguments):
* runtime/Arguments.h:
(JSC::Arguments::create):
(JSC::Arguments::finishCreation):
* runtime/Options.h:
* tests/stress/disable-function-dot-arguments.js: Added.
(foo):
(bar):

Tools:

Rubber stamped by Geoffrey Garen
        
Enable the feature by default during tests.

* Scripts/run-jsc-stress-tests:

LayoutTests:

Rubber stamped by Geoffrey Garen.
        
Don't remove the tests for this, yet - but mark them as failing. We will rebase these,
or remove them entirely, once we know that it's safe to rip out this feature entirely.

* TestExpectations:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@174036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/JavaScriptCore/interpreter/StackVisitor.cpp b/Source/JavaScriptCore/interpreter/StackVisitor.cpp
index 995ab6b..29dc967 100644
--- a/Source/JavaScriptCore/interpreter/StackVisitor.cpp
+++ b/Source/JavaScriptCore/interpreter/StackVisitor.cpp
@@ -261,15 +261,20 @@
     CallFrame* physicalFrame = m_callFrame;
     VM& vm = physicalFrame->vm();
     Arguments* arguments;
+    ArgumentsMode mode;
+    if (Options::enableFunctionDotArguments())
+        mode = NormalArgumentsCreationMode;
+    else
+        mode = FakeArgumentValuesCreationMode;
 #if ENABLE(DFG_JIT)
     if (isInlinedFrame()) {
         ASSERT(m_inlineCallFrame);
-        arguments = Arguments::create(vm, physicalFrame, m_inlineCallFrame);
+        arguments = Arguments::create(vm, physicalFrame, m_inlineCallFrame, mode);
         arguments->tearOff(physicalFrame, m_inlineCallFrame);
     } else 
 #endif
     {
-        arguments = Arguments::create(vm, physicalFrame);
+        arguments = Arguments::create(vm, physicalFrame, mode);
         arguments->tearOff(physicalFrame);
     }
     return arguments;