| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 CALL_HEAP_FUNCTION( | 571 CALL_HEAP_FUNCTION( |
| 572 isolate(), | 572 isolate(), |
| 573 isolate()->heap()->AllocateFunction(*function_map, | 573 isolate()->heap()->AllocateFunction(*function_map, |
| 574 *function_info, | 574 *function_info, |
| 575 isolate()->heap()->the_hole_value(), | 575 isolate()->heap()->the_hole_value(), |
| 576 pretenure), | 576 pretenure), |
| 577 JSFunction); | 577 JSFunction); |
| 578 } | 578 } |
| 579 | 579 |
| 580 | 580 |
| 581 static Handle<Map> MapForNewFunction(Isolate *isolate, |
| 582 Handle<SharedFunctionInfo> function_info) { |
| 583 Context *context = isolate->context()->native_context(); |
| 584 int map_index = Context::FunctionMapIndex(function_info->language_mode(), |
| 585 function_info->is_generator()); |
| 586 return Handle<Map>(Map::cast(context->get(map_index))); |
| 587 } |
| 588 |
| 589 |
| 581 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( | 590 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( |
| 582 Handle<SharedFunctionInfo> function_info, | 591 Handle<SharedFunctionInfo> function_info, |
| 583 Handle<Context> context, | 592 Handle<Context> context, |
| 584 PretenureFlag pretenure) { | 593 PretenureFlag pretenure) { |
| 585 Handle<JSFunction> result = BaseNewFunctionFromSharedFunctionInfo( | 594 Handle<JSFunction> result = BaseNewFunctionFromSharedFunctionInfo( |
| 586 function_info, | 595 function_info, |
| 587 function_info->is_classic_mode() | 596 MapForNewFunction(isolate(), function_info), |
| 588 ? isolate()->function_map() | |
| 589 : isolate()->strict_mode_function_map(), | |
| 590 pretenure); | 597 pretenure); |
| 591 | 598 |
| 592 if (function_info->ic_age() != isolate()->heap()->global_ic_age()) { | 599 if (function_info->ic_age() != isolate()->heap()->global_ic_age()) { |
| 593 function_info->ResetForNewContext(isolate()->heap()->global_ic_age()); | 600 function_info->ResetForNewContext(isolate()->heap()->global_ic_age()); |
| 594 } | 601 } |
| 595 | 602 |
| 596 result->set_context(*context); | 603 result->set_context(*context); |
| 597 | 604 |
| 598 int index = function_info->SearchOptimizedCodeMap(context->native_context()); | 605 int index = function_info->SearchOptimizedCodeMap(context->native_context()); |
| 599 if (!function_info->bound() && index < 0) { | 606 if (!function_info->bound() && index < 0) { |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1479 return Handle<Object>::null(); | 1486 return Handle<Object>::null(); |
| 1480 } | 1487 } |
| 1481 | 1488 |
| 1482 | 1489 |
| 1483 Handle<Object> Factory::ToBoolean(bool value) { | 1490 Handle<Object> Factory::ToBoolean(bool value) { |
| 1484 return value ? true_value() : false_value(); | 1491 return value ? true_value() : false_value(); |
| 1485 } | 1492 } |
| 1486 | 1493 |
| 1487 | 1494 |
| 1488 } } // namespace v8::internal | 1495 } } // namespace v8::internal |
| OLD | NEW |