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

Unified Diff: src/factory.cc

Issue 358363003: Only create arguments-maps in the bootstrapper, remove now obsolete ValueType flag. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index 8e903f16516fc4db91310ccd28cabc2505fee3f5..efe14493ccbe6c9b8c392615986b4a1f49dfd407 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"
@@ -2084,11 +2085,26 @@ 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->IsJSFunction() &&
+ Handle<JSFunction>::cast(callee)->shared()->strict_mode() == STRICT;
Igor Sheludko 2014/07/02 14:17:14 I think you can now avoid IsJSFunction() and casti
+ 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;
}

Powered by Google App Engine
This is Rietveld 408576698