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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
544 ? isolate()->function_map() | 544 ? isolate()->function_map() |
545 : isolate()->strict_mode_function_map(), | 545 : isolate()->strict_mode_function_map(), |
546 pretenure); | 546 pretenure); |
547 | 547 |
548 if (function_info->ic_age() != isolate()->heap()->global_ic_age()) { | 548 if (function_info->ic_age() != isolate()->heap()->global_ic_age()) { |
549 function_info->ResetForNewContext(isolate()->heap()->global_ic_age()); | 549 function_info->ResetForNewContext(isolate()->heap()->global_ic_age()); |
550 } | 550 } |
551 | 551 |
552 result->set_context(*context); | 552 result->set_context(*context); |
553 if (!function_info->bound()) { | 553 if (!function_info->bound()) { |
554 int number_of_literals = function_info->num_literals(); | 554 int index = FLAG_cache_optimized_code |
555 Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure); | 555 ? function_info->SearchOptimizedCodeMap(context->global_context()) |
Michael Starzinger
2012/06/14 13:51:32
We need to do this search anyways, even if the fun
Florian Schneider
2012/06/14 14:02:41
Good point. Done.
| |
556 if (number_of_literals > 0) { | 556 : -1; |
557 // Store the object, regexp and array functions in the literals | 557 if (index > 0) { |
558 // array prefix. These functions will be used when creating | 558 FixedArray* code_map = |
559 // object, regexp and array literals in this function. | 559 FixedArray::cast(function_info->optimized_code_map()); |
560 literals->set(JSFunction::kLiteralGlobalContextIndex, | 560 FixedArray* cached_literals = FixedArray::cast(code_map->get(index + 1)); |
561 context->global_context()); | 561 ASSERT(cached_literals != NULL); |
562 ASSERT(function_info->num_literals() == 0 || | |
563 (code_map->get(index - 1) == | |
564 cached_literals->get(JSFunction::kLiteralGlobalContextIndex))); | |
565 result->set_literals(cached_literals); | |
566 } else { | |
567 int number_of_literals = function_info->num_literals(); | |
568 Handle<FixedArray> literals = | |
569 NewFixedArray(number_of_literals, pretenure); | |
570 if (number_of_literals > 0) { | |
571 // Store the object, regexp and array functions in the literals | |
572 // array prefix. These functions will be used when creating | |
573 // object, regexp and array literals in this function. | |
574 literals->set(JSFunction::kLiteralGlobalContextIndex, | |
575 context->global_context()); | |
576 } | |
577 result->set_literals(*literals); | |
562 } | 578 } |
563 result->set_literals(*literals); | |
564 } | 579 } |
580 | |
581 if (FLAG_cache_optimized_code) { | |
582 int index = | |
583 function_info->SearchOptimizedCodeMap(context->global_context()); | |
Michael Starzinger
2012/06/14 13:51:32
Drop this search and the outer flag check.
Florian Schneider
2012/06/14 14:02:41
Done.
| |
584 if (index > 0) { | |
585 Code* code = Code::cast( | |
586 FixedArray::cast(function_info->optimized_code_map())->get(index)); | |
587 ASSERT(code != NULL); | |
588 result->ReplaceCode(code); | |
589 return result; | |
590 } | |
591 } | |
592 | |
565 if (V8::UseCrankshaft() && | 593 if (V8::UseCrankshaft() && |
566 FLAG_always_opt && | 594 FLAG_always_opt && |
567 result->is_compiled() && | 595 result->is_compiled() && |
568 !function_info->is_toplevel() && | 596 !function_info->is_toplevel() && |
569 function_info->allows_lazy_compilation() && | 597 function_info->allows_lazy_compilation() && |
570 !function_info->optimization_disabled()) { | 598 !function_info->optimization_disabled()) { |
571 result->MarkForLazyRecompilation(); | 599 result->MarkForLazyRecompilation(); |
572 } | 600 } |
573 return result; | 601 return result; |
574 } | 602 } |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1440 | 1468 |
1441 | 1469 |
1442 Handle<Object> Factory::ToBoolean(bool value) { | 1470 Handle<Object> Factory::ToBoolean(bool value) { |
1443 return Handle<Object>(value | 1471 return Handle<Object>(value |
1444 ? isolate()->heap()->true_value() | 1472 ? isolate()->heap()->true_value() |
1445 : isolate()->heap()->false_value()); | 1473 : isolate()->heap()->false_value()); |
1446 } | 1474 } |
1447 | 1475 |
1448 | 1476 |
1449 } } // namespace v8::internal | 1477 } } // namespace v8::internal |
OLD | NEW |