| 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 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 function_info->is_classic_mode() | 547 function_info->is_classic_mode() |
| 548 ? isolate()->function_map() | 548 ? isolate()->function_map() |
| 549 : isolate()->strict_mode_function_map(), | 549 : isolate()->strict_mode_function_map(), |
| 550 pretenure); | 550 pretenure); |
| 551 | 551 |
| 552 if (function_info->ic_age() != isolate()->heap()->global_ic_age()) { | 552 if (function_info->ic_age() != isolate()->heap()->global_ic_age()) { |
| 553 function_info->ResetForNewContext(isolate()->heap()->global_ic_age()); | 553 function_info->ResetForNewContext(isolate()->heap()->global_ic_age()); |
| 554 } | 554 } |
| 555 | 555 |
| 556 result->set_context(*context); | 556 result->set_context(*context); |
| 557 |
| 558 int index = FLAG_cache_optimized_code |
| 559 ? function_info->SearchOptimizedCodeMap(context->global_context()) |
| 560 : -1; |
| 557 if (!function_info->bound()) { | 561 if (!function_info->bound()) { |
| 558 int number_of_literals = function_info->num_literals(); | 562 if (index > 0) { |
| 559 Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure); | 563 FixedArray* code_map = |
| 560 if (number_of_literals > 0) { | 564 FixedArray::cast(function_info->optimized_code_map()); |
| 561 // Store the object, regexp and array functions in the literals | 565 FixedArray* cached_literals = FixedArray::cast(code_map->get(index + 1)); |
| 562 // array prefix. These functions will be used when creating | 566 ASSERT(cached_literals != NULL); |
| 563 // object, regexp and array literals in this function. | 567 ASSERT(function_info->num_literals() == 0 || |
| 564 literals->set(JSFunction::kLiteralGlobalContextIndex, | 568 (code_map->get(index - 1) == |
| 565 context->global_context()); | 569 cached_literals->get(JSFunction::kLiteralGlobalContextIndex))); |
| 570 result->set_literals(cached_literals); |
| 571 } else { |
| 572 int number_of_literals = function_info->num_literals(); |
| 573 Handle<FixedArray> literals = |
| 574 NewFixedArray(number_of_literals, pretenure); |
| 575 if (number_of_literals > 0) { |
| 576 // Store the object, regexp and array functions in the literals |
| 577 // array prefix. These functions will be used when creating |
| 578 // object, regexp and array literals in this function. |
| 579 literals->set(JSFunction::kLiteralGlobalContextIndex, |
| 580 context->global_context()); |
| 581 } |
| 582 result->set_literals(*literals); |
| 566 } | 583 } |
| 567 result->set_literals(*literals); | |
| 568 } | 584 } |
| 585 |
| 586 if (index > 0) { |
| 587 // Caching of optimized code enabled and optimized code found. |
| 588 Code* code = Code::cast( |
| 589 FixedArray::cast(function_info->optimized_code_map())->get(index)); |
| 590 ASSERT(code != NULL); |
| 591 result->ReplaceCode(code); |
| 592 return result; |
| 593 } |
| 594 |
| 569 if (V8::UseCrankshaft() && | 595 if (V8::UseCrankshaft() && |
| 570 FLAG_always_opt && | 596 FLAG_always_opt && |
| 571 result->is_compiled() && | 597 result->is_compiled() && |
| 572 !function_info->is_toplevel() && | 598 !function_info->is_toplevel() && |
| 573 function_info->allows_lazy_compilation() && | 599 function_info->allows_lazy_compilation() && |
| 574 !function_info->optimization_disabled()) { | 600 !function_info->optimization_disabled()) { |
| 575 result->MarkForLazyRecompilation(); | 601 result->MarkForLazyRecompilation(); |
| 576 } | 602 } |
| 577 return result; | 603 return result; |
| 578 } | 604 } |
| (...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 | 1509 |
| 1484 | 1510 |
| 1485 Handle<Object> Factory::ToBoolean(bool value) { | 1511 Handle<Object> Factory::ToBoolean(bool value) { |
| 1486 return Handle<Object>(value | 1512 return Handle<Object>(value |
| 1487 ? isolate()->heap()->true_value() | 1513 ? isolate()->heap()->true_value() |
| 1488 : isolate()->heap()->false_value()); | 1514 : isolate()->heap()->false_value()); |
| 1489 } | 1515 } |
| 1490 | 1516 |
| 1491 | 1517 |
| 1492 } } // namespace v8::internal | 1518 } } // namespace v8::internal |
| OLD | NEW |