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 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 return prototype; | 1311 return prototype; |
1312 } | 1312 } |
1313 | 1313 |
1314 | 1314 |
1315 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( | 1315 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( |
1316 Handle<SharedFunctionInfo> info, | 1316 Handle<SharedFunctionInfo> info, |
1317 Handle<Context> context, | 1317 Handle<Context> context, |
1318 PretenureFlag pretenure) { | 1318 PretenureFlag pretenure) { |
1319 int map_index = | 1319 int map_index = |
1320 Context::FunctionMapIndex(info->language_mode(), info->kind()); | 1320 Context::FunctionMapIndex(info->language_mode(), info->kind()); |
1321 Handle<Map> map(Map::cast(context->native_context()->get(map_index))); | 1321 Handle<Map> initial_map(Map::cast(context->native_context()->get(map_index))); |
1322 Handle<JSFunction> result = NewFunction(map, info, context, pretenure); | 1322 |
| 1323 return NewFunctionFromSharedFunctionInfo(initial_map, info, context, |
| 1324 pretenure); |
| 1325 } |
| 1326 |
| 1327 |
| 1328 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( |
| 1329 Handle<Map> initial_map, Handle<SharedFunctionInfo> info, |
| 1330 Handle<Context> context, PretenureFlag pretenure) { |
| 1331 DCHECK_EQ(JS_FUNCTION_TYPE, initial_map->instance_type()); |
| 1332 Handle<JSFunction> result = |
| 1333 NewFunction(initial_map, info, context, pretenure); |
1323 | 1334 |
1324 if (info->ic_age() != isolate()->heap()->global_ic_age()) { | 1335 if (info->ic_age() != isolate()->heap()->global_ic_age()) { |
1325 info->ResetForNewContext(isolate()->heap()->global_ic_age()); | 1336 info->ResetForNewContext(isolate()->heap()->global_ic_age()); |
1326 } | 1337 } |
1327 | 1338 |
1328 if (FLAG_always_opt && info->allows_lazy_compilation()) { | 1339 if (FLAG_always_opt && info->allows_lazy_compilation()) { |
1329 result->MarkForOptimization(); | 1340 result->MarkForOptimization(); |
1330 } | 1341 } |
1331 | 1342 |
1332 CodeAndLiterals cached = info->SearchOptimizedCodeMap( | 1343 CodeAndLiterals cached = info->SearchOptimizedCodeMap( |
(...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2391 } | 2402 } |
2392 | 2403 |
2393 | 2404 |
2394 Handle<Object> Factory::ToBoolean(bool value) { | 2405 Handle<Object> Factory::ToBoolean(bool value) { |
2395 return value ? true_value() : false_value(); | 2406 return value ? true_value() : false_value(); |
2396 } | 2407 } |
2397 | 2408 |
2398 | 2409 |
2399 } // namespace internal | 2410 } // namespace internal |
2400 } // namespace v8 | 2411 } // namespace v8 |
OLD | NEW |