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

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 + test262 exceptions 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
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index de4da94d4efe35697a91149c0d0c21fab2fffad9..03d5fde835e6333155c1e7a007ea22ef64f4e725 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;

Powered by Google App Engine
This is Rietveld 408576698