| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 /* IC Handler stubs */ \ | 95 /* IC Handler stubs */ \ |
| 96 V(LoadField) \ | 96 V(LoadField) \ |
| 97 V(KeyedLoadField) | 97 V(KeyedLoadField) |
| 98 | 98 |
| 99 // List of code stubs only used on ARM platforms. | 99 // List of code stubs only used on ARM platforms. |
| 100 #if V8_TARGET_ARCH_ARM | 100 #if V8_TARGET_ARCH_ARM |
| 101 #define CODE_STUB_LIST_ARM(V) \ | 101 #define CODE_STUB_LIST_ARM(V) \ |
| 102 V(GetProperty) \ | 102 V(GetProperty) \ |
| 103 V(SetProperty) \ | 103 V(SetProperty) \ |
| 104 V(InvokeBuiltin) \ | 104 V(InvokeBuiltin) \ |
| 105 V(RegExpCEntry) \ | |
| 106 V(DirectCEntry) | 105 V(DirectCEntry) |
| 107 #elif V8_TARGET_ARCH_A64 | 106 #elif V8_TARGET_ARCH_A64 |
| 108 #define CODE_STUB_LIST_ARM(V) \ | 107 #define CODE_STUB_LIST_ARM(V) \ |
| 109 V(GetProperty) \ | 108 V(GetProperty) \ |
| 110 V(SetProperty) \ | 109 V(SetProperty) \ |
| 111 V(InvokeBuiltin) \ | 110 V(InvokeBuiltin) \ |
| 112 V(DirectCEntry) | 111 V(DirectCEntry) |
| 113 #else | 112 #else |
| 114 #define CODE_STUB_LIST_ARM(V) | 113 #define CODE_STUB_LIST_ARM(V) |
| 115 #endif | 114 #endif |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // Gets the major key from a code object that is a code stub or binary op IC. | 157 // Gets the major key from a code object that is a code stub or binary op IC. |
| 159 static Major GetMajorKey(Code* code_stub) { | 158 static Major GetMajorKey(Code* code_stub) { |
| 160 return static_cast<Major>(code_stub->major_key()); | 159 return static_cast<Major>(code_stub->major_key()); |
| 161 } | 160 } |
| 162 | 161 |
| 163 static const char* MajorName(Major major_key, bool allow_unknown_keys); | 162 static const char* MajorName(Major major_key, bool allow_unknown_keys); |
| 164 | 163 |
| 165 virtual ~CodeStub() {} | 164 virtual ~CodeStub() {} |
| 166 | 165 |
| 167 bool CompilingCallsToThisStubIsGCSafe(Isolate* isolate) { | 166 bool CompilingCallsToThisStubIsGCSafe(Isolate* isolate) { |
| 168 bool is_pregenerated = IsPregenerated(); | 167 bool is_pregenerated = IsPregenerated(isolate); |
| 169 Code* code = NULL; | 168 Code* code = NULL; |
| 170 CHECK(!is_pregenerated || FindCodeInCache(&code, isolate)); | 169 CHECK(!is_pregenerated || FindCodeInCache(&code, isolate)); |
| 171 return is_pregenerated; | 170 return is_pregenerated; |
| 172 } | 171 } |
| 173 | 172 |
| 174 // See comment above, where Instanceof is defined. | 173 // See comment above, where Instanceof is defined. |
| 175 virtual bool IsPregenerated() { return false; } | 174 virtual bool IsPregenerated(Isolate* isolate) { return false; } |
| 176 | 175 |
| 177 static void GenerateStubsAheadOfTime(Isolate* isolate); | 176 static void GenerateStubsAheadOfTime(Isolate* isolate); |
| 178 static void GenerateFPStubs(Isolate* isolate); | 177 static void GenerateFPStubs(Isolate* isolate); |
| 179 | 178 |
| 180 // Some stubs put untagged junk on the stack that cannot be scanned by the | 179 // Some stubs put untagged junk on the stack that cannot be scanned by the |
| 181 // GC. This means that we must be statically sure that no GC can occur while | 180 // GC. This means that we must be statically sure that no GC can occur while |
| 182 // they are running. If that is the case they should override this to return | 181 // they are running. If that is the case they should override this to return |
| 183 // true, which will cause an assertion if we try to call something that can | 182 // true, which will cause an assertion if we try to call something that can |
| 184 // GC or if we try to put a stack frame on top of the junk, which would not | 183 // GC or if we try to put a stack frame on top of the junk, which would not |
| 185 // result in a traversable stack. | 184 // result in a traversable stack. |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowObjectStub); | 683 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowObjectStub); |
| 685 }; | 684 }; |
| 686 | 685 |
| 687 | 686 |
| 688 class CreateAllocationSiteStub : public HydrogenCodeStub { | 687 class CreateAllocationSiteStub : public HydrogenCodeStub { |
| 689 public: | 688 public: |
| 690 explicit CreateAllocationSiteStub() { } | 689 explicit CreateAllocationSiteStub() { } |
| 691 | 690 |
| 692 virtual Handle<Code> GenerateCode(Isolate* isolate); | 691 virtual Handle<Code> GenerateCode(Isolate* isolate); |
| 693 | 692 |
| 694 virtual bool IsPregenerated() { return true; } | 693 virtual bool IsPregenerated(Isolate* isolate) V8_OVERRIDE { return true; } |
| 695 | 694 |
| 696 static void GenerateAheadOfTime(Isolate* isolate); | 695 static void GenerateAheadOfTime(Isolate* isolate); |
| 697 | 696 |
| 698 virtual void InitializeInterfaceDescriptor( | 697 virtual void InitializeInterfaceDescriptor( |
| 699 Isolate* isolate, | 698 Isolate* isolate, |
| 700 CodeStubInterfaceDescriptor* descriptor); | 699 CodeStubInterfaceDescriptor* descriptor); |
| 701 | 700 |
| 702 private: | 701 private: |
| 703 Major MajorKey() { return CreateAllocationSite; } | 702 Major MajorKey() { return CreateAllocationSite; } |
| 704 int NotMissMinorKey() { return 0; } | 703 int NotMissMinorKey() { return 0; } |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 explicit CEntryStub(int result_size, | 1306 explicit CEntryStub(int result_size, |
| 1308 SaveFPRegsMode save_doubles = kDontSaveFPRegs) | 1307 SaveFPRegsMode save_doubles = kDontSaveFPRegs) |
| 1309 : result_size_(result_size), save_doubles_(save_doubles) { } | 1308 : result_size_(result_size), save_doubles_(save_doubles) { } |
| 1310 | 1309 |
| 1311 void Generate(MacroAssembler* masm); | 1310 void Generate(MacroAssembler* masm); |
| 1312 | 1311 |
| 1313 // The version of this stub that doesn't save doubles is generated ahead of | 1312 // The version of this stub that doesn't save doubles is generated ahead of |
| 1314 // time, so it's OK to call it from other stubs that can't cope with GC during | 1313 // time, so it's OK to call it from other stubs that can't cope with GC during |
| 1315 // their code generation. On machines that always have gp registers (x64) we | 1314 // their code generation. On machines that always have gp registers (x64) we |
| 1316 // can generate both variants ahead of time. | 1315 // can generate both variants ahead of time. |
| 1317 virtual bool IsPregenerated(); | 1316 virtual bool IsPregenerated(Isolate* isolate) V8_OVERRIDE; |
| 1318 static void GenerateAheadOfTime(Isolate* isolate); | 1317 static void GenerateAheadOfTime(Isolate* isolate); |
| 1319 | 1318 |
| 1320 private: | 1319 private: |
| 1321 void GenerateCore(MacroAssembler* masm, | 1320 void GenerateCore(MacroAssembler* masm, |
| 1322 Label* throw_normal_exception, | 1321 Label* throw_normal_exception, |
| 1323 Label* throw_termination_exception, | 1322 Label* throw_termination_exception, |
| 1324 Label* throw_out_of_memory_exception, | 1323 Label* throw_out_of_memory_exception, |
| 1325 bool do_gc, | 1324 bool do_gc, |
| 1326 bool always_allocate_scope); | 1325 bool always_allocate_scope); |
| 1327 | 1326 |
| 1328 // Number of pointers/values returned. | 1327 // Number of pointers/values returned. |
| 1328 Isolate* isolate_; |
| 1329 const int result_size_; | 1329 const int result_size_; |
| 1330 SaveFPRegsMode save_doubles_; | 1330 SaveFPRegsMode save_doubles_; |
| 1331 | 1331 |
| 1332 Major MajorKey() { return CEntry; } | 1332 Major MajorKey() { return CEntry; } |
| 1333 int MinorKey(); | 1333 int MinorKey(); |
| 1334 | 1334 |
| 1335 bool NeedsImmovableCode(); | 1335 bool NeedsImmovableCode(); |
| 1336 }; | 1336 }; |
| 1337 | 1337 |
| 1338 | 1338 |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1919 } | 1919 } |
| 1920 | 1920 |
| 1921 AllocationSiteOverrideMode override_mode() const { | 1921 AllocationSiteOverrideMode override_mode() const { |
| 1922 return AllocationSiteOverrideModeBits::decode(bit_field_); | 1922 return AllocationSiteOverrideModeBits::decode(bit_field_); |
| 1923 } | 1923 } |
| 1924 | 1924 |
| 1925 ContextCheckMode context_mode() const { | 1925 ContextCheckMode context_mode() const { |
| 1926 return ContextCheckModeBits::decode(bit_field_); | 1926 return ContextCheckModeBits::decode(bit_field_); |
| 1927 } | 1927 } |
| 1928 | 1928 |
| 1929 virtual bool IsPregenerated() { | 1929 virtual bool IsPregenerated(Isolate* isolate) V8_OVERRIDE { |
| 1930 // We only pre-generate stubs that verify correct context | 1930 // We only pre-generate stubs that verify correct context |
| 1931 return context_mode() == CONTEXT_CHECK_REQUIRED; | 1931 return context_mode() == CONTEXT_CHECK_REQUIRED; |
| 1932 } | 1932 } |
| 1933 | 1933 |
| 1934 static void GenerateStubsAheadOfTime(Isolate* isolate); | 1934 static void GenerateStubsAheadOfTime(Isolate* isolate); |
| 1935 static void InstallDescriptors(Isolate* isolate); | 1935 static void InstallDescriptors(Isolate* isolate); |
| 1936 | 1936 |
| 1937 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1937 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 1938 static const int kConstructor = 0; | 1938 static const int kConstructor = 0; |
| 1939 static const int kPropertyCell = 1; | 1939 static const int kPropertyCell = 1; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2020 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); | 2020 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); |
| 2021 }; | 2021 }; |
| 2022 | 2022 |
| 2023 | 2023 |
| 2024 class InternalArrayConstructorStubBase : public HydrogenCodeStub { | 2024 class InternalArrayConstructorStubBase : public HydrogenCodeStub { |
| 2025 public: | 2025 public: |
| 2026 explicit InternalArrayConstructorStubBase(ElementsKind kind) { | 2026 explicit InternalArrayConstructorStubBase(ElementsKind kind) { |
| 2027 kind_ = kind; | 2027 kind_ = kind; |
| 2028 } | 2028 } |
| 2029 | 2029 |
| 2030 virtual bool IsPregenerated() { return true; } | 2030 virtual bool IsPregenerated(Isolate* isolate) V8_OVERRIDE { return true; } |
| 2031 static void GenerateStubsAheadOfTime(Isolate* isolate); | 2031 static void GenerateStubsAheadOfTime(Isolate* isolate); |
| 2032 static void InstallDescriptors(Isolate* isolate); | 2032 static void InstallDescriptors(Isolate* isolate); |
| 2033 | 2033 |
| 2034 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 2034 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 2035 static const int kConstructor = 0; | 2035 static const int kConstructor = 0; |
| 2036 | 2036 |
| 2037 ElementsKind elements_kind() const { return kind_; } | 2037 ElementsKind elements_kind() const { return kind_; } |
| 2038 | 2038 |
| 2039 private: | 2039 private: |
| 2040 int NotMissMinorKey() { return kind_; } | 2040 int NotMissMinorKey() { return kind_; } |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2284 | 2284 |
| 2285 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); | 2285 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); |
| 2286 }; | 2286 }; |
| 2287 | 2287 |
| 2288 | 2288 |
| 2289 class StubFailureTrampolineStub : public PlatformCodeStub { | 2289 class StubFailureTrampolineStub : public PlatformCodeStub { |
| 2290 public: | 2290 public: |
| 2291 explicit StubFailureTrampolineStub(StubFunctionMode function_mode) | 2291 explicit StubFailureTrampolineStub(StubFunctionMode function_mode) |
| 2292 : fp_registers_(CanUseFPRegisters()), function_mode_(function_mode) {} | 2292 : fp_registers_(CanUseFPRegisters()), function_mode_(function_mode) {} |
| 2293 | 2293 |
| 2294 virtual bool IsPregenerated() { return true; } | 2294 virtual bool IsPregenerated(Isolate* isolate) V8_OVERRIDE { return true; } |
| 2295 | 2295 |
| 2296 static void GenerateAheadOfTime(Isolate* isolate); | 2296 static void GenerateAheadOfTime(Isolate* isolate); |
| 2297 | 2297 |
| 2298 private: | 2298 private: |
| 2299 class FPRegisters: public BitField<bool, 0, 1> {}; | 2299 class FPRegisters: public BitField<bool, 0, 1> {}; |
| 2300 class FunctionModeField: public BitField<StubFunctionMode, 1, 1> {}; | 2300 class FunctionModeField: public BitField<StubFunctionMode, 1, 1> {}; |
| 2301 | 2301 |
| 2302 Major MajorKey() { return StubFailureTrampoline; } | 2302 Major MajorKey() { return StubFailureTrampoline; } |
| 2303 int MinorKey() { | 2303 int MinorKey() { |
| 2304 return FPRegisters::encode(fp_registers_) | | 2304 return FPRegisters::encode(fp_registers_) | |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2319 explicit ProfileEntryHookStub() {} | 2319 explicit ProfileEntryHookStub() {} |
| 2320 | 2320 |
| 2321 // The profile entry hook function is not allowed to cause a GC. | 2321 // The profile entry hook function is not allowed to cause a GC. |
| 2322 virtual bool SometimesSetsUpAFrame() { return false; } | 2322 virtual bool SometimesSetsUpAFrame() { return false; } |
| 2323 | 2323 |
| 2324 // Generates a call to the entry hook if it's enabled. | 2324 // Generates a call to the entry hook if it's enabled. |
| 2325 static void MaybeCallEntryHook(MacroAssembler* masm); | 2325 static void MaybeCallEntryHook(MacroAssembler* masm); |
| 2326 | 2326 |
| 2327 private: | 2327 private: |
| 2328 static void EntryHookTrampoline(intptr_t function, | 2328 static void EntryHookTrampoline(intptr_t function, |
| 2329 intptr_t stack_pointer); | 2329 intptr_t stack_pointer, |
| 2330 Isolate* isolate); |
| 2330 | 2331 |
| 2331 Major MajorKey() { return ProfileEntryHook; } | 2332 Major MajorKey() { return ProfileEntryHook; } |
| 2332 int MinorKey() { return 0; } | 2333 int MinorKey() { return 0; } |
| 2333 | 2334 |
| 2334 void Generate(MacroAssembler* masm); | 2335 void Generate(MacroAssembler* masm); |
| 2335 | 2336 |
| 2336 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2337 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
| 2337 }; | 2338 }; |
| 2338 | 2339 |
| 2339 } } // namespace v8::internal | 2340 } } // namespace v8::internal |
| 2340 | 2341 |
| 2341 #endif // V8_CODE_STUBS_H_ | 2342 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |