Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index 5dac6a1ada3454980e348caf6a76b8268d51ee0d..1514a3a67e1889bc03d40daa74678918db41f308 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -1256,7 +1256,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); |
} |
@@ -1267,20 +1268,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<JSFunction> Factory::NewFunctionWithoutPrototype( |
+ Handle<String> name, 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 |
arv (Not doing code reviews)
2015/03/26 13:59:14
I still find this confusing :-)
strict map with r
caitp (gmail)
2015/03/26 14:08:46
That seems to happen in Runtime_DefineClass --- th
|
+ 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; |
@@ -1291,10 +1299,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); |
+ name, code, prototype, read_only_prototype, is_strict); |
ElementsKind elements_kind = |
type == JS_ARRAY_TYPE ? FAST_SMI_ELEMENTS : FAST_HOLEY_SMI_ELEMENTS; |