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 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1467 | 1467 |
1468 | 1468 |
1469 void Deoptimizer::AddDoubleValue(intptr_t slot_address, double value) { | 1469 void Deoptimizer::AddDoubleValue(intptr_t slot_address, double value) { |
1470 HeapNumberMaterializationDescriptor value_desc( | 1470 HeapNumberMaterializationDescriptor value_desc( |
1471 reinterpret_cast<Address>(slot_address), value); | 1471 reinterpret_cast<Address>(slot_address), value); |
1472 deferred_heap_numbers_.Add(value_desc); | 1472 deferred_heap_numbers_.Add(value_desc); |
1473 } | 1473 } |
1474 | 1474 |
1475 | 1475 |
1476 void Deoptimizer::EnsureCodeForDeoptimizationEntry(BailoutType type, | 1476 void Deoptimizer::EnsureCodeForDeoptimizationEntry(BailoutType type, |
1477 int max_entry_id) { | 1477 int max_entry_id) { |
palmer
2012/12/18 20:33:41
max_entry_id should be unsigned int (or, better, s
Sven Panne
2012/12/19 07:34:58
To be exact, neither of them: What we should reall
| |
1478 // We cannot run this if the serializer is enabled because this will | 1478 // We cannot run this if the serializer is enabled because this will |
1479 // cause us to emit relocation information for the external | 1479 // cause us to emit relocation information for the external |
1480 // references. This is fine because the deoptimizer's code section | 1480 // references. This is fine because the deoptimizer's code section |
1481 // isn't meant to be serialized at all. | 1481 // isn't meant to be serialized at all. |
1482 ASSERT(!Serializer::enabled()); | 1482 ASSERT(!Serializer::enabled()); |
1483 | 1483 |
1484 ASSERT(type == EAGER || type == LAZY); | 1484 ASSERT(type == EAGER || type == LAZY); |
1485 DeoptimizerData* data = Isolate::Current()->deoptimizer_data(); | 1485 DeoptimizerData* data = Isolate::Current()->deoptimizer_data(); |
1486 int entry_count = (type == EAGER) | 1486 int entry_count = (type == EAGER) |
1487 ? data->eager_deoptimization_entry_code_entries_ | 1487 ? data->eager_deoptimization_entry_code_entries_ |
1488 : data->lazy_deoptimization_entry_code_entries_; | 1488 : data->lazy_deoptimization_entry_code_entries_; |
1489 if (max_entry_id < entry_count) return; | 1489 if (max_entry_id < entry_count) return; |
1490 entry_count = Min(Max(entry_count * 2, Deoptimizer::kMinNumberOfEntries), | 1490 entry_count = Max(entry_count, Deoptimizer::kMinNumberOfEntries); |
1491 Deoptimizer::kMaxNumberOfEntries); | 1491 while (max_entry_id >= entry_count) entry_count *= 2; |
palmer
2012/12/18 20:33:41
Risk of integer overflow? And why not use unsigned
Sven Panne
2012/12/19 07:34:58
Regarding typing: See above. Regarding overflow: C
| |
1492 ASSERT(entry_count <= Deoptimizer::kMaxNumberOfEntries); | |
1492 | 1493 |
1493 MacroAssembler masm(Isolate::Current(), NULL, 16 * KB); | 1494 MacroAssembler masm(Isolate::Current(), NULL, 16 * KB); |
1494 masm.set_emit_debug_code(false); | 1495 masm.set_emit_debug_code(false); |
1495 GenerateDeoptimizationEntries(&masm, entry_count, type); | 1496 GenerateDeoptimizationEntries(&masm, entry_count, type); |
1496 CodeDesc desc; | 1497 CodeDesc desc; |
1497 masm.GetCode(&desc); | 1498 masm.GetCode(&desc); |
1498 ASSERT(desc.reloc_size == 0); | 1499 ASSERT(desc.reloc_size == 0); |
1499 | 1500 |
1500 VirtualMemory* memory = type == EAGER | 1501 VirtualMemory* memory = type == EAGER |
1501 ? data->eager_deoptimization_entry_code_ | 1502 ? data->eager_deoptimization_entry_code_ |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2065 | 2066 |
2066 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 2067 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
2067 v->VisitPointer(BitCast<Object**>(&function_)); | 2068 v->VisitPointer(BitCast<Object**>(&function_)); |
2068 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 2069 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
2069 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 2070 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
2070 } | 2071 } |
2071 | 2072 |
2072 #endif // ENABLE_DEBUGGER_SUPPORT | 2073 #endif // ENABLE_DEBUGGER_SUPPORT |
2073 | 2074 |
2074 } } // namespace v8::internal | 2075 } } // namespace v8::internal |
OLD | NEW |