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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 data->eager_deoptimization_entry_code_ = CreateCode(type); | 444 data->eager_deoptimization_entry_code_ = CreateCode(type); |
445 } | 445 } |
446 base = data->eager_deoptimization_entry_code_; | 446 base = data->eager_deoptimization_entry_code_; |
447 } else { | 447 } else { |
448 if (data->lazy_deoptimization_entry_code_ == NULL) { | 448 if (data->lazy_deoptimization_entry_code_ == NULL) { |
449 data->lazy_deoptimization_entry_code_ = CreateCode(type); | 449 data->lazy_deoptimization_entry_code_ = CreateCode(type); |
450 } | 450 } |
451 base = data->lazy_deoptimization_entry_code_; | 451 base = data->lazy_deoptimization_entry_code_; |
452 } | 452 } |
453 return | 453 return |
454 static_cast<Address>(base->body()) + (id * table_entry_size_); | 454 static_cast<Address>(base->area_start()) + (id * table_entry_size_); |
455 } | 455 } |
456 | 456 |
457 | 457 |
458 int Deoptimizer::GetDeoptimizationId(Address addr, BailoutType type) { | 458 int Deoptimizer::GetDeoptimizationId(Address addr, BailoutType type) { |
459 MemoryChunk* base = NULL; | 459 MemoryChunk* base = NULL; |
460 DeoptimizerData* data = Isolate::Current()->deoptimizer_data(); | 460 DeoptimizerData* data = Isolate::Current()->deoptimizer_data(); |
461 if (type == EAGER) { | 461 if (type == EAGER) { |
462 base = data->eager_deoptimization_entry_code_; | 462 base = data->eager_deoptimization_entry_code_; |
463 } else { | 463 } else { |
464 base = data->lazy_deoptimization_entry_code_; | 464 base = data->lazy_deoptimization_entry_code_; |
465 } | 465 } |
466 if (base == NULL || | 466 if (base == NULL || |
467 addr < base->body() || | 467 addr < base->area_start() || |
468 addr >= base->body() + | 468 addr >= base->area_start() + |
469 (kNumberOfEntries * table_entry_size_)) { | 469 (kNumberOfEntries * table_entry_size_)) { |
470 return kNotDeoptimizationEntry; | 470 return kNotDeoptimizationEntry; |
471 } | 471 } |
472 ASSERT_EQ(0, | 472 ASSERT_EQ(0, |
473 static_cast<int>(addr - base->body()) % table_entry_size_); | 473 static_cast<int>(addr - base->area_start()) % table_entry_size_); |
474 return static_cast<int>(addr - base->body()) / table_entry_size_; | 474 return static_cast<int>(addr - base->area_start()) / table_entry_size_; |
475 } | 475 } |
476 | 476 |
477 | 477 |
478 int Deoptimizer::GetOutputInfo(DeoptimizationOutputData* data, | 478 int Deoptimizer::GetOutputInfo(DeoptimizationOutputData* data, |
479 unsigned id, | 479 unsigned id, |
480 SharedFunctionInfo* shared) { | 480 SharedFunctionInfo* shared) { |
481 // TODO(kasperl): For now, we do a simple linear search for the PC | 481 // TODO(kasperl): For now, we do a simple linear search for the PC |
482 // offset associated with the given node id. This should probably be | 482 // offset associated with the given node id. This should probably be |
483 // changed to a binary search. | 483 // changed to a binary search. |
484 int length = data->DeoptPoints(); | 484 int length = data->DeoptPoints(); |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 masm.set_emit_debug_code(false); | 1145 masm.set_emit_debug_code(false); |
1146 GenerateDeoptimizationEntries(&masm, kNumberOfEntries, type); | 1146 GenerateDeoptimizationEntries(&masm, kNumberOfEntries, type); |
1147 CodeDesc desc; | 1147 CodeDesc desc; |
1148 masm.GetCode(&desc); | 1148 masm.GetCode(&desc); |
1149 ASSERT(desc.reloc_size == 0); | 1149 ASSERT(desc.reloc_size == 0); |
1150 | 1150 |
1151 MemoryChunk* chunk = | 1151 MemoryChunk* chunk = |
1152 Isolate::Current()->memory_allocator()->AllocateChunk(desc.instr_size, | 1152 Isolate::Current()->memory_allocator()->AllocateChunk(desc.instr_size, |
1153 EXECUTABLE, | 1153 EXECUTABLE, |
1154 NULL); | 1154 NULL); |
| 1155 ASSERT(chunk->area_size() >= desc.instr_size); |
1155 if (chunk == NULL) { | 1156 if (chunk == NULL) { |
1156 V8::FatalProcessOutOfMemory("Not enough memory for deoptimization table"); | 1157 V8::FatalProcessOutOfMemory("Not enough memory for deoptimization table"); |
1157 } | 1158 } |
1158 memcpy(chunk->body(), desc.buffer, desc.instr_size); | 1159 memcpy(chunk->area_start(), desc.buffer, desc.instr_size); |
1159 CPU::FlushICache(chunk->body(), desc.instr_size); | 1160 CPU::FlushICache(chunk->area_start(), desc.instr_size); |
1160 return chunk; | 1161 return chunk; |
1161 } | 1162 } |
1162 | 1163 |
1163 | 1164 |
1164 Code* Deoptimizer::FindDeoptimizingCodeFromAddress(Address addr) { | 1165 Code* Deoptimizer::FindDeoptimizingCodeFromAddress(Address addr) { |
1165 DeoptimizingCodeListNode* node = | 1166 DeoptimizingCodeListNode* node = |
1166 Isolate::Current()->deoptimizer_data()->deoptimizing_code_list_; | 1167 Isolate::Current()->deoptimizer_data()->deoptimizing_code_list_; |
1167 while (node != NULL) { | 1168 while (node != NULL) { |
1168 if (node->code()->contains(addr)) return *node->code(); | 1169 if (node->code()->contains(addr)) return *node->code(); |
1169 node = node->next(); | 1170 node = node->next(); |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 | 1634 |
1634 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 1635 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
1635 v->VisitPointer(BitCast<Object**>(&function_)); | 1636 v->VisitPointer(BitCast<Object**>(&function_)); |
1636 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 1637 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
1637 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 1638 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
1638 } | 1639 } |
1639 | 1640 |
1640 #endif // ENABLE_DEBUGGER_SUPPORT | 1641 #endif // ENABLE_DEBUGGER_SUPPORT |
1641 | 1642 |
1642 } } // namespace v8::internal | 1643 } } // namespace v8::internal |
OLD | NEW |