• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "src/api/api.h"
6 #include "src/deoptimizer/deoptimizer.h"
7 #include "src/execution/pointer-authentication.h"
8 
9 namespace v8 {
10 namespace internal {
11 
12 const bool Deoptimizer::kSupportsFixedDeoptExitSizes = true;
13 const int Deoptimizer::kNonLazyDeoptExitSize = kInstrSize;
14 #ifdef V8_ENABLE_CONTROL_FLOW_INTEGRITY
15 const int Deoptimizer::kLazyDeoptExitSize = 2 * kInstrSize;
16 #else
17 const int Deoptimizer::kLazyDeoptExitSize = 1 * kInstrSize;
18 #endif
19 
GetFloatRegister(unsigned n) const20 Float32 RegisterValues::GetFloatRegister(unsigned n) const {
21   return Float32::FromBits(
22       static_cast<uint32_t>(double_registers_[n].get_bits()));
23 }
24 
SetCallerPc(unsigned offset,intptr_t value)25 void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) {
26   Address new_context =
27       static_cast<Address>(GetTop()) + offset + kPCOnStackSize;
28   value = PointerAuthentication::SignAndCheckPC(value, new_context);
29   SetFrameSlot(offset, value);
30 }
31 
SetCallerFp(unsigned offset,intptr_t value)32 void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) {
33   SetFrameSlot(offset, value);
34 }
35 
SetCallerConstantPool(unsigned offset,intptr_t value)36 void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) {
37   // No embedded constant pool support.
38   UNREACHABLE();
39 }
40 
SetPc(intptr_t pc)41 void FrameDescription::SetPc(intptr_t pc) {
42   if (ENABLE_CONTROL_FLOW_INTEGRITY_BOOL) {
43     CHECK(
44         Deoptimizer::IsValidReturnAddress(PointerAuthentication::StripPAC(pc)));
45   }
46   pc_ = pc;
47 }
48 
49 }  // namespace internal
50 }  // namespace v8
51