Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index a09c7841e37655e6572f5be9a42b6a15a3e96676..8c08ba1587f6d5fc4600fa716bfed0997d5b356d 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -4,6 +4,7 @@ |
#include "src/factory.h" |
+#include "src/allocation-site-scopes.h" |
#include "src/conversions.h" |
#include "src/isolate-inl.h" |
#include "src/macro-assembler.h" |
@@ -2086,11 +2087,24 @@ Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) { |
} |
-Handle<JSObject> Factory::NewArgumentsObject(Handle<Object> callee, |
+Handle<JSObject> Factory::NewArgumentsObject(Handle<JSFunction> callee, |
int length) { |
- CALL_HEAP_FUNCTION( |
- isolate(), |
- isolate()->heap()->AllocateArgumentsObject(*callee, length), JSObject); |
+ bool strict_mode_callee = callee->shared()->strict_mode() == STRICT; |
+ Handle<Map> map = strict_mode_callee ? isolate()->strict_arguments_map() |
+ : isolate()->sloppy_arguments_map(); |
+ |
+ AllocationSiteUsageContext context(isolate(), Handle<AllocationSite>(), |
+ false); |
+ ASSERT(!isolate()->has_pending_exception()); |
+ Handle<JSObject> result = NewJSObjectFromMap(map); |
+ Handle<Smi> value(Smi::FromInt(length), isolate()); |
+ JSReceiver::SetProperty(result, length_string(), value, NONE, STRICT) |
+ .Assert(); |
+ if (!strict_mode_callee) { |
+ JSReceiver::SetProperty(result, callee_string(), callee, NONE, STRICT) |
+ .Assert(); |
+ } |
+ return result; |
} |