Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index 4d2c6b4ceaa8bcddcf796e033e98e507319da528..4d2f37ab741c0645f080993b044ae01df6e10148 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -351,7 +351,12 @@ Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( |
Handle<Context> context, |
PretenureFlag pretenure) { |
Handle<JSFunction> result = BaseNewFunctionFromSharedFunctionInfo( |
- function_info, Top::function_map(), pretenure); |
+ function_info, |
+ function_info->strict_mode() |
+ ? Top::strict_mode_function_map() |
+ : Top::function_map(), |
+ pretenure); |
+ |
result->set_context(*context); |
int number_of_literals = function_info->num_literals(); |
Handle<FixedArray> literals = |
@@ -584,7 +589,8 @@ Handle<JSFunction> Factory::NewFunctionWithPrototype(Handle<String> name, |
Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name, |
Handle<Code> code) { |
- Handle<JSFunction> function = NewFunctionWithoutPrototype(name); |
+ Handle<JSFunction> function = NewFunctionWithoutPrototype(name, |
+ kNonStrictMode); |
function->shared()->set_code(*code); |
function->set_code(*code); |
ASSERT(!function->has_initial_map()); |
@@ -809,18 +815,24 @@ Handle<JSFunction> Factory::NewFunction(Handle<String> name, |
Handle<JSFunction> Factory::NewFunctionWithoutPrototypeHelper( |
- Handle<String> name) { |
+ Handle<String> name, |
+ StrictModeFlag strict_mode) { |
Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name); |
+ Handle<Map> map = strict_mode == kStrictMode |
+ ? Top::strict_mode_function_without_prototype_map() |
+ : Top::function_without_prototype_map(); |
CALL_HEAP_FUNCTION(Heap::AllocateFunction( |
- *Top::function_without_prototype_map(), |
+ *map, |
*function_share, |
*the_hole_value()), |
JSFunction); |
} |
-Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name) { |
- Handle<JSFunction> fun = NewFunctionWithoutPrototypeHelper(name); |
+Handle<JSFunction> Factory::NewFunctionWithoutPrototype( |
+ Handle<String> name, |
+ StrictModeFlag strict_mode) { |
+ Handle<JSFunction> fun = NewFunctionWithoutPrototypeHelper(name, strict_mode); |
fun->set_context(Top::context()->global_context()); |
return fun; |
} |