OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_CODE_STUBS_H_ | 5 #ifndef V8_CODE_STUBS_H_ |
6 #define V8_CODE_STUBS_H_ | 6 #define V8_CODE_STUBS_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
10 #include "src/code-stub-assembler.h" | 10 #include "src/code-stub-assembler.h" |
(...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 | 2021 |
2022 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); | 2022 DEFINE_CALL_INTERFACE_DESCRIPTOR(BinaryOp); |
2023 DEFINE_PLATFORM_CODE_STUB(CompareIC, PlatformCodeStub); | 2023 DEFINE_PLATFORM_CODE_STUB(CompareIC, PlatformCodeStub); |
2024 }; | 2024 }; |
2025 | 2025 |
2026 | 2026 |
2027 class CEntryStub : public PlatformCodeStub { | 2027 class CEntryStub : public PlatformCodeStub { |
2028 public: | 2028 public: |
2029 CEntryStub(Isolate* isolate, int result_size, | 2029 CEntryStub(Isolate* isolate, int result_size, |
2030 SaveFPRegsMode save_doubles = kDontSaveFPRegs, | 2030 SaveFPRegsMode save_doubles = kDontSaveFPRegs, |
2031 ArgvMode argv_mode = kArgvOnStack, bool builtin_exit_frame = false) | 2031 ArgvMode argv_mode = kArgvOnStack) |
2032 : PlatformCodeStub(isolate) { | 2032 : PlatformCodeStub(isolate) { |
2033 minor_key_ = SaveDoublesBits::encode(save_doubles == kSaveFPRegs) | | 2033 minor_key_ = SaveDoublesBits::encode(save_doubles == kSaveFPRegs) | |
2034 FrameTypeBits::encode(builtin_exit_frame) | | |
2035 ArgvMode::encode(argv_mode == kArgvInRegister); | 2034 ArgvMode::encode(argv_mode == kArgvInRegister); |
2036 DCHECK(result_size == 1 || result_size == 2 || result_size == 3); | 2035 DCHECK(result_size == 1 || result_size == 2 || result_size == 3); |
2037 minor_key_ = ResultSizeBits::update(minor_key_, result_size); | 2036 minor_key_ = ResultSizeBits::update(minor_key_, result_size); |
2038 } | 2037 } |
2039 | 2038 |
2040 // The version of this stub that doesn't save doubles is generated ahead of | 2039 // The version of this stub that doesn't save doubles is generated ahead of |
2041 // time, so it's OK to call it from other stubs that can't cope with GC during | 2040 // time, so it's OK to call it from other stubs that can't cope with GC during |
2042 // their code generation. On machines that always have gp registers (x64) we | 2041 // their code generation. On machines that always have gp registers (x64) we |
2043 // can generate both variants ahead of time. | 2042 // can generate both variants ahead of time. |
2044 static void GenerateAheadOfTime(Isolate* isolate); | 2043 static void GenerateAheadOfTime(Isolate* isolate); |
2045 | 2044 |
2046 private: | 2045 private: |
2047 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); } | 2046 bool save_doubles() const { return SaveDoublesBits::decode(minor_key_); } |
2048 bool argv_in_register() const { return ArgvMode::decode(minor_key_); } | 2047 bool argv_in_register() const { return ArgvMode::decode(minor_key_); } |
2049 bool is_builtin_exit() const { return FrameTypeBits::decode(minor_key_); } | |
2050 int result_size() const { return ResultSizeBits::decode(minor_key_); } | 2048 int result_size() const { return ResultSizeBits::decode(minor_key_); } |
2051 | 2049 |
2052 bool NeedsImmovableCode() override; | 2050 bool NeedsImmovableCode() override; |
2053 | 2051 |
2054 class SaveDoublesBits : public BitField<bool, 0, 1> {}; | 2052 class SaveDoublesBits : public BitField<bool, 0, 1> {}; |
2055 class ArgvMode : public BitField<bool, 1, 1> {}; | 2053 class ArgvMode : public BitField<bool, 1, 1> {}; |
2056 class FrameTypeBits : public BitField<bool, 2, 1> {}; | 2054 class ResultSizeBits : public BitField<int, 2, 3> {}; |
2057 class ResultSizeBits : public BitField<int, 3, 3> {}; | |
2058 | 2055 |
2059 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); | 2056 DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR(); |
2060 DEFINE_PLATFORM_CODE_STUB(CEntry, PlatformCodeStub); | 2057 DEFINE_PLATFORM_CODE_STUB(CEntry, PlatformCodeStub); |
2061 }; | 2058 }; |
2062 | 2059 |
2063 | 2060 |
2064 class JSEntryStub : public PlatformCodeStub { | 2061 class JSEntryStub : public PlatformCodeStub { |
2065 public: | 2062 public: |
2066 JSEntryStub(Isolate* isolate, StackFrame::Type type) | 2063 JSEntryStub(Isolate* isolate, StackFrame::Type type) |
2067 : PlatformCodeStub(isolate) { | 2064 : PlatformCodeStub(isolate) { |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3114 #undef DEFINE_HYDROGEN_CODE_STUB | 3111 #undef DEFINE_HYDROGEN_CODE_STUB |
3115 #undef DEFINE_CODE_STUB | 3112 #undef DEFINE_CODE_STUB |
3116 #undef DEFINE_CODE_STUB_BASE | 3113 #undef DEFINE_CODE_STUB_BASE |
3117 | 3114 |
3118 extern Representation RepresentationFromType(Type* type); | 3115 extern Representation RepresentationFromType(Type* type); |
3119 | 3116 |
3120 } // namespace internal | 3117 } // namespace internal |
3121 } // namespace v8 | 3118 } // namespace v8 |
3122 | 3119 |
3123 #endif // V8_CODE_STUBS_H_ | 3120 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |