OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/factory.h" | 5 #include "src/factory.h" |
6 | 6 |
7 #include "src/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 return prototype; | 1310 return prototype; |
1311 } | 1311 } |
1312 | 1312 |
1313 | 1313 |
1314 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( | 1314 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( |
1315 Handle<SharedFunctionInfo> info, | 1315 Handle<SharedFunctionInfo> info, |
1316 Handle<Context> context, | 1316 Handle<Context> context, |
1317 PretenureFlag pretenure) { | 1317 PretenureFlag pretenure) { |
1318 int map_index = | 1318 int map_index = |
1319 Context::FunctionMapIndex(info->language_mode(), info->kind()); | 1319 Context::FunctionMapIndex(info->language_mode(), info->kind()); |
1320 Handle<Map> initial_map(Map::cast(context->native_context()->get(map_index))); | 1320 Handle<Map> map(Map::cast(context->native_context()->get(map_index))); |
1321 | 1321 Handle<JSFunction> result = NewFunction(map, info, context, pretenure); |
1322 return NewFunctionFromSharedFunctionInfo(initial_map, info, context, | |
1323 pretenure); | |
1324 } | |
1325 | |
1326 | |
1327 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( | |
1328 Handle<Map> initial_map, Handle<SharedFunctionInfo> info, | |
1329 Handle<Context> context, PretenureFlag pretenure) { | |
1330 DCHECK_EQ(JS_FUNCTION_TYPE, initial_map->instance_type()); | |
1331 Handle<JSFunction> result = | |
1332 NewFunction(initial_map, info, context, pretenure); | |
1333 | 1322 |
1334 if (info->ic_age() != isolate()->heap()->global_ic_age()) { | 1323 if (info->ic_age() != isolate()->heap()->global_ic_age()) { |
1335 info->ResetForNewContext(isolate()->heap()->global_ic_age()); | 1324 info->ResetForNewContext(isolate()->heap()->global_ic_age()); |
1336 } | 1325 } |
1337 | 1326 |
1338 if (FLAG_always_opt && info->allows_lazy_compilation()) { | 1327 if (FLAG_always_opt && info->allows_lazy_compilation()) { |
1339 result->MarkForOptimization(); | 1328 result->MarkForOptimization(); |
1340 } | 1329 } |
1341 | 1330 |
1342 CodeAndLiterals cached = info->SearchOptimizedCodeMap( | 1331 CodeAndLiterals cached = info->SearchOptimizedCodeMap( |
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2400 } | 2389 } |
2401 | 2390 |
2402 | 2391 |
2403 Handle<Object> Factory::ToBoolean(bool value) { | 2392 Handle<Object> Factory::ToBoolean(bool value) { |
2404 return value ? true_value() : false_value(); | 2393 return value ? true_value() : false_value(); |
2405 } | 2394 } |
2406 | 2395 |
2407 | 2396 |
2408 } // namespace internal | 2397 } // namespace internal |
2409 } // namespace v8 | 2398 } // namespace v8 |
OLD | NEW |