Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index 5dac6a1ada3454980e348caf6a76b8268d51ee0d..8c23e39d3082decd121e462e861cb4abdb1e1de0 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,25 @@ 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 use_empty_function_map) { |
+ Handle<Map> map = use_empty_function_map |
arv (Not doing code reviews)
2015/03/26 12:46:43
What does "empty function" mean here? It does not
caitp (gmail)
2015/03/26 13:00:17
originally I was saving the map of the empty funct
arv (Not doing code reviews)
2015/03/26 13:03:30
strict sounds more correct here.
|
+ ? 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 use_empty_function_map) { |
+ DCHECK(!use_empty_function_map || !read_only_prototype); |
+ Handle<Map> map = use_empty_function_map |
+ ? isolate()->strict_function_map() |
arv (Not doing code reviews)
2015/03/26 12:46:43
Is there no strict function with readonly prototyp
caitp (gmail)
2015/03/26 13:00:17
well, technically strict_function_map() IS a reado
caitp (gmail)
2015/03/26 13:03:02
wait, I'm wrong --- it's readonly during bootstrap
arv (Not doing code reviews)
2015/03/26 13:03:30
Maybe add a DCHECK to make sure we don't get the i
caitp (gmail)
2015/03/26 13:46:01
Done --- the DCHECK is now "!strict || !readonly_p
|
+ : 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 +1297,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 use_empty_function_map) { |
// Allocate the function |
Handle<JSFunction> function = NewFunction( |
- name, code, prototype, read_only_prototype); |
+ name, code, prototype, read_only_prototype, use_empty_function_map); |
ElementsKind elements_kind = |
type == JS_ARRAY_TYPE ? FAST_SMI_ELEMENTS : FAST_HOLEY_SMI_ELEMENTS; |