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

Unified Diff: src/factory.cc

Issue 1027283004: [es6] do not add caller/arguments to ES6 function definitions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years, 8 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/factory.h ('k') | src/messages.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index 96b564f432703ca947395682d493615e26be13b5..a6a41650c9a18fd86e52e4df58df4ad8602e3c76 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -6,6 +6,7 @@
#include "src/allocation-site-scopes.h"
#include "src/base/bits.h"
+#include "src/bootstrapper.h"
#include "src/conversions.h"
#include "src/isolate-inl.h"
#include "src/macro-assembler.h"
@@ -1280,7 +1281,8 @@ Handle<JSFunction> Factory::NewFunction(Handle<Map> map,
map.is_identical_to(
isolate()->sloppy_function_without_prototype_map()) ||
map.is_identical_to(
- isolate()->sloppy_function_with_readonly_prototype_map())));
+ isolate()->sloppy_function_with_readonly_prototype_map()) ||
+ map.is_identical_to(isolate()->strict_function_map())));
return NewFunction(map, info, context);
}
@@ -1292,19 +1294,27 @@ Handle<JSFunction> Factory::NewFunction(Handle<String> name) {
Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name,
- Handle<Code> code) {
- return NewFunction(
- isolate()->sloppy_function_without_prototype_map(), name, code);
+ Handle<Code> code,
+ bool is_strict) {
+ Handle<Map> map = is_strict
+ ? isolate()->strict_function_without_prototype_map()
+ : isolate()->sloppy_function_without_prototype_map();
+ return NewFunction(map, name, code);
}
-Handle<JSFunction> Factory::NewFunction(Handle<String> name,
- Handle<Code> code,
+Handle<JSFunction> Factory::NewFunction(Handle<String> name, Handle<Code> code,
Handle<Object> prototype,
- bool read_only_prototype) {
- Handle<Map> map = read_only_prototype
- ? isolate()->sloppy_function_with_readonly_prototype_map()
- : isolate()->sloppy_function_map();
+ bool read_only_prototype,
+ bool is_strict) {
+ // In strict mode, readonly strict map is only available during bootstrap
+ DCHECK(!is_strict || !read_only_prototype ||
+ isolate()->bootstrapper()->IsActive());
+ Handle<Map> map =
+ is_strict ? isolate()->strict_function_map()
+ : read_only_prototype
+ ? isolate()->sloppy_function_with_readonly_prototype_map()
+ : isolate()->sloppy_function_map();
Handle<JSFunction> result = NewFunction(map, name, code);
result->set_prototype_or_initial_map(*prototype);
return result;
@@ -1315,10 +1325,11 @@ Handle<JSFunction> Factory::NewFunction(Handle<String> name, Handle<Code> code,
Handle<Object> prototype,
InstanceType type, int instance_size,
bool read_only_prototype,
- bool install_constructor) {
+ bool install_constructor,
+ bool is_strict) {
// Allocate the function
- Handle<JSFunction> function = NewFunction(
- name, code, prototype, read_only_prototype);
+ Handle<JSFunction> function =
+ NewFunction(name, code, prototype, read_only_prototype, is_strict);
ElementsKind elements_kind =
type == JS_ARRAY_TYPE ? FAST_SMI_ELEMENTS : FAST_HOLEY_SMI_ELEMENTS;
« no previous file with comments | « src/factory.h ('k') | src/messages.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698