Index: src/factory.cc |
diff --git a/src/factory.cc b/src/factory.cc |
index fece9a09c91779c6f360d842a7c2b3b9a7a51791..2c0ceb192c9edfbb724f3067e8dda04a9ed0c85e 100644 |
--- a/src/factory.cc |
+++ b/src/factory.cc |
@@ -578,15 +578,22 @@ Handle<JSFunction> Factory::BaseNewFunctionFromSharedFunctionInfo( |
} |
+static Handle<Map> MapForNewFunction(Isolate *isolate, |
+ Handle<SharedFunctionInfo> function_info) { |
+ Context *context = isolate->context()->native_context(); |
+ int map_index = Context::FunctionMapIndex(function_info->language_mode(), |
+ function_info->is_generator()); |
+ return Handle<Map>(Map::cast(context->get(map_index))); |
+} |
+ |
+ |
Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( |
Handle<SharedFunctionInfo> function_info, |
Handle<Context> context, |
PretenureFlag pretenure) { |
Handle<JSFunction> result = BaseNewFunctionFromSharedFunctionInfo( |
function_info, |
- function_info->is_classic_mode() |
- ? isolate()->function_map() |
- : isolate()->strict_mode_function_map(), |
+ MapForNewFunction(isolate(), function_info), |
pretenure); |
if (function_info->ic_age() != isolate()->heap()->global_ic_age()) { |