| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 | 920 |
| 921 | 921 |
| 922 void Deoptimizer::AddDoubleValue(int frame_index, | 922 void Deoptimizer::AddDoubleValue(int frame_index, |
| 923 int slot_index, | 923 int slot_index, |
| 924 double value) { | 924 double value) { |
| 925 ValueDescriptionDouble value_desc(slot_index, value); | 925 ValueDescriptionDouble value_desc(slot_index, value); |
| 926 double_values_[frame_index].Add(value_desc); | 926 double_values_[frame_index].Add(value_desc); |
| 927 } | 927 } |
| 928 | 928 |
| 929 | 929 |
| 930 static Mutex* flag_mutex = OS::CreateMutex(); | |
| 931 | |
| 932 | |
| 933 LargeObjectChunk* Deoptimizer::CreateCode(BailoutType type) { | 930 LargeObjectChunk* Deoptimizer::CreateCode(BailoutType type) { |
| 934 // We cannot run this if the serializer is enabled because this will | 931 // We cannot run this if the serializer is enabled because this will |
| 935 // cause us to emit relocation information for the external | 932 // cause us to emit relocation information for the external |
| 936 // references. This is fine because the deoptimizer's code section | 933 // references. This is fine because the deoptimizer's code section |
| 937 // isn't meant to be serialized at all. | 934 // isn't meant to be serialized at all. |
| 938 ASSERT(!Serializer::enabled()); | 935 ASSERT(!Serializer::enabled()); |
| 939 // Grab a mutex because we're changing a global flag. | |
| 940 ScopedLock lock(flag_mutex); | |
| 941 bool old_debug_code = FLAG_debug_code; | |
| 942 FLAG_debug_code = false; | |
| 943 | 936 |
| 944 MacroAssembler masm(NULL, 16 * KB); | 937 MacroAssembler masm(NULL, 16 * KB); |
| 938 masm.set_emit_debug_code(false); |
| 945 GenerateDeoptimizationEntries(&masm, kNumberOfEntries, type); | 939 GenerateDeoptimizationEntries(&masm, kNumberOfEntries, type); |
| 946 CodeDesc desc; | 940 CodeDesc desc; |
| 947 masm.GetCode(&desc); | 941 masm.GetCode(&desc); |
| 948 ASSERT(desc.reloc_size == 0); | 942 ASSERT(desc.reloc_size == 0); |
| 949 | 943 |
| 950 LargeObjectChunk* chunk = LargeObjectChunk::New(desc.instr_size, EXECUTABLE); | 944 LargeObjectChunk* chunk = LargeObjectChunk::New(desc.instr_size, EXECUTABLE); |
| 951 memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size); | 945 memcpy(chunk->GetStartAddress(), desc.buffer, desc.instr_size); |
| 952 CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size); | 946 CPU::FlushICache(chunk->GetStartAddress(), desc.instr_size); |
| 953 FLAG_debug_code = old_debug_code; | |
| 954 return chunk; | 947 return chunk; |
| 955 } | 948 } |
| 956 | 949 |
| 957 | 950 |
| 958 Code* Deoptimizer::FindDeoptimizingCodeFromAddress(Address addr) { | 951 Code* Deoptimizer::FindDeoptimizingCodeFromAddress(Address addr) { |
| 959 DeoptimizingCodeListNode* node = | 952 DeoptimizingCodeListNode* node = |
| 960 Isolate::Current()->deoptimizer_data()->deoptimizing_code_list_; | 953 Isolate::Current()->deoptimizer_data()->deoptimizing_code_list_; |
| 961 while (node != NULL) { | 954 while (node != NULL) { |
| 962 if (node->code()->contains(addr)) return *node->code(); | 955 if (node->code()->contains(addr)) return *node->code(); |
| 963 node = node->next(); | 956 node = node->next(); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 } | 1189 } |
| 1197 | 1190 |
| 1198 | 1191 |
| 1199 DeoptimizingCodeListNode::~DeoptimizingCodeListNode() { | 1192 DeoptimizingCodeListNode::~DeoptimizingCodeListNode() { |
| 1200 GlobalHandles* global_handles = Isolate::Current()->global_handles(); | 1193 GlobalHandles* global_handles = Isolate::Current()->global_handles(); |
| 1201 global_handles->Destroy(reinterpret_cast<Object**>(code_.location())); | 1194 global_handles->Destroy(reinterpret_cast<Object**>(code_.location())); |
| 1202 } | 1195 } |
| 1203 | 1196 |
| 1204 | 1197 |
| 1205 } } // namespace v8::internal | 1198 } } // namespace v8::internal |
| OLD | NEW |