| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
| 8 #include "src/deoptimizer.h" | 8 #include "src/deoptimizer.h" |
| 9 #include "src/full-codegen.h" | 9 #include "src/full-codegen.h" |
| 10 #include "src/safepoint-table.h" | 10 #include "src/safepoint-table.h" |
| 11 | 11 |
| 12 namespace v8 { | 12 namespace v8 { |
| 13 namespace internal { | 13 namespace internal { |
| 14 | 14 |
| 15 const int Deoptimizer::table_entry_size_ = 8; | 15 const int Deoptimizer::table_entry_size_ = 8; |
| 16 | 16 |
| 17 | 17 |
| 18 int Deoptimizer::patch_size() { | 18 int Deoptimizer::patch_size() { |
| 19 #if V8_TARGET_ARCH_PPC64 | 19 #if V8_TARGET_ARCH_PPC64 |
| 20 const int kCallInstructionSizeInWords = 7; | 20 const int kCallInstructionSizeInWords = 7; |
| 21 #else | 21 #else |
| 22 const int kCallInstructionSizeInWords = 4; | 22 const int kCallInstructionSizeInWords = 4; |
| 23 #endif | 23 #endif |
| 24 return kCallInstructionSizeInWords * Assembler::kInstrSize; | 24 return kCallInstructionSizeInWords * Assembler::kInstrSize; |
| 25 } | 25 } |
| 26 | 26 |
| 27 | 27 |
| 28 void Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(Handle<Code> code) { |
| 29 // Empty because there is no need for relocation information for the code |
| 30 // patching in Deoptimizer::PatchCodeForDeoptimization below. |
| 31 } |
| 32 |
| 33 |
| 28 void Deoptimizer::PatchCodeForDeoptimization(Isolate* isolate, Code* code) { | 34 void Deoptimizer::PatchCodeForDeoptimization(Isolate* isolate, Code* code) { |
| 29 Address code_start_address = code->instruction_start(); | 35 Address code_start_address = code->instruction_start(); |
| 30 | 36 |
| 31 // Invalidate the relocation information, as it will become invalid by the | 37 // Invalidate the relocation information, as it will become invalid by the |
| 32 // code patching below, and is not needed any more. | 38 // code patching below, and is not needed any more. |
| 33 code->InvalidateRelocation(); | 39 code->InvalidateRelocation(); |
| 34 | 40 |
| 35 if (FLAG_zap_code_space) { | 41 if (FLAG_zap_code_space) { |
| 36 // Fail hard and early if we enter this code object again. | 42 // Fail hard and early if we enter this code object again. |
| 37 byte* pointer = code->FindCodeAgeSequence(); | 43 byte* pointer = code->FindCodeAgeSequence(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 prev_call_address = call_address; | 85 prev_call_address = call_address; |
| 80 #endif | 86 #endif |
| 81 } | 87 } |
| 82 } | 88 } |
| 83 | 89 |
| 84 | 90 |
| 85 void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) { | 91 void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) { |
| 86 // Set the register values. The values are not important as there are no | 92 // Set the register values. The values are not important as there are no |
| 87 // callee saved registers in JavaScript frames, so all registers are | 93 // callee saved registers in JavaScript frames, so all registers are |
| 88 // spilled. Registers fp and sp are set to the correct values though. | 94 // spilled. Registers fp and sp are set to the correct values though. |
| 95 // We ensure the values are Smis to avoid confusing the garbage |
| 96 // collector in the event that any values are retreived and stored |
| 97 // elsewhere. |
| 89 | 98 |
| 90 for (int i = 0; i < Register::kNumRegisters; i++) { | 99 for (int i = 0; i < Register::kNumRegisters; i++) { |
| 91 input_->SetRegister(i, i * 4); | 100 input_->SetRegister(i, reinterpret_cast<intptr_t>(Smi::FromInt(i))); |
| 92 } | 101 } |
| 93 input_->SetRegister(sp.code(), reinterpret_cast<intptr_t>(frame->sp())); | 102 input_->SetRegister(sp.code(), reinterpret_cast<intptr_t>(frame->sp())); |
| 94 input_->SetRegister(fp.code(), reinterpret_cast<intptr_t>(frame->fp())); | 103 input_->SetRegister(fp.code(), reinterpret_cast<intptr_t>(frame->fp())); |
| 95 for (int i = 0; i < DoubleRegister::NumAllocatableRegisters(); i++) { | 104 for (int i = 0; i < DoubleRegister::NumAllocatableRegisters(); i++) { |
| 96 input_->SetDoubleRegister(i, 0.0); | 105 input_->SetDoubleRegister(i, 0.0); |
| 97 } | 106 } |
| 98 | 107 |
| 99 // Fill the frame content from the actual data on the frame. | 108 // Fill the frame content from the actual data on the frame. |
| 100 for (unsigned i = 0; i < input_->GetFrameSize(); i += kPointerSize) { | 109 for (unsigned i = 0; i < input_->GetFrameSize(); i += kPointerSize) { |
| 101 input_->SetFrameSlot( | 110 input_->SetFrameSlot( |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 #else | 359 #else |
| 351 // No out-of-line constant pool support. | 360 // No out-of-line constant pool support. |
| 352 UNREACHABLE(); | 361 UNREACHABLE(); |
| 353 #endif | 362 #endif |
| 354 } | 363 } |
| 355 | 364 |
| 356 | 365 |
| 357 #undef __ | 366 #undef __ |
| 358 } | 367 } |
| 359 } // namespace v8::internal | 368 } // namespace v8::internal |
| OLD | NEW |