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/codegen.h" | 5 #include "src/codegen.h" |
6 #include "src/deoptimizer.h" | 6 #include "src/deoptimizer.h" |
7 #include "src/full-codegen/full-codegen.h" | 7 #include "src/full-codegen/full-codegen.h" |
8 #include "src/register-configuration.h" | 8 #include "src/register-configuration.h" |
9 #include "src/safepoint-table.h" | 9 #include "src/safepoint-table.h" |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 DCHECK(prev_call_address == NULL || | 81 DCHECK(prev_call_address == NULL || |
82 call_address >= prev_call_address + patch_size()); | 82 call_address >= prev_call_address + patch_size()); |
83 DCHECK(call_address + patch_size() <= code->instruction_end()); | 83 DCHECK(call_address + patch_size() <= code->instruction_end()); |
84 #ifdef DEBUG | 84 #ifdef DEBUG |
85 prev_call_address = call_address; | 85 prev_call_address = call_address; |
86 #endif | 86 #endif |
87 } | 87 } |
88 } | 88 } |
89 | 89 |
90 | 90 |
91 void Deoptimizer::FillInputFrame(Address tos, JavaScriptFrame* frame) { | |
92 // Set the register values. The values are not important as there are no | |
93 // callee saved registers in JavaScript frames, so all registers are | |
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. | |
98 | |
99 for (int i = 0; i < Register::kNumRegisters; i++) { | |
100 input_->SetRegister(i, reinterpret_cast<intptr_t>(Smi::FromInt(i))); | |
101 } | |
102 input_->SetRegister(sp.code(), reinterpret_cast<intptr_t>(frame->sp())); | |
103 input_->SetRegister(fp.code(), reinterpret_cast<intptr_t>(frame->fp())); | |
104 for (int i = 0; i < DoubleRegister::kNumRegisters; i++) { | |
105 input_->SetDoubleRegister(i, 0.0); | |
106 } | |
107 | |
108 // Fill the frame content from the actual data on the frame. | |
109 for (unsigned i = 0; i < input_->GetFrameSize(); i += kPointerSize) { | |
110 input_->SetFrameSlot( | |
111 i, reinterpret_cast<intptr_t>(Memory::Address_at(tos + i))); | |
112 } | |
113 } | |
114 | |
115 | |
116 void Deoptimizer::SetPlatformCompiledStubRegisters( | 91 void Deoptimizer::SetPlatformCompiledStubRegisters( |
117 FrameDescription* output_frame, CodeStubDescriptor* descriptor) { | 92 FrameDescription* output_frame, CodeStubDescriptor* descriptor) { |
118 ApiFunction function(descriptor->deoptimization_handler()); | 93 ApiFunction function(descriptor->deoptimization_handler()); |
119 ExternalReference xref(&function, ExternalReference::BUILTIN_CALL, isolate_); | 94 ExternalReference xref(&function, ExternalReference::BUILTIN_CALL, isolate_); |
120 intptr_t handler = reinterpret_cast<intptr_t>(xref.address()); | 95 intptr_t handler = reinterpret_cast<intptr_t>(xref.address()); |
121 int params = descriptor->GetHandlerParameterCount(); | 96 int params = descriptor->GetHandlerParameterCount(); |
122 output_frame->SetRegister(r3.code(), params); | 97 output_frame->SetRegister(r3.code(), params); |
123 output_frame->SetRegister(r4.code(), handler); | 98 output_frame->SetRegister(r4.code(), handler); |
124 } | 99 } |
125 | 100 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 | 335 |
361 void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) { | 336 void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) { |
362 DCHECK(FLAG_enable_embedded_constant_pool); | 337 DCHECK(FLAG_enable_embedded_constant_pool); |
363 SetFrameSlot(offset, value); | 338 SetFrameSlot(offset, value); |
364 } | 339 } |
365 | 340 |
366 | 341 |
367 #undef __ | 342 #undef __ |
368 } // namespace internal | 343 } // namespace internal |
369 } // namespace v8 | 344 } // namespace v8 |
OLD | NEW |