| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // Gets the major key from a code object that is a code stub or binary op IC. | 151 // Gets the major key from a code object that is a code stub or binary op IC. |
| 152 static Major GetMajorKey(Code* code_stub) { | 152 static Major GetMajorKey(Code* code_stub) { |
| 153 return static_cast<Major>(code_stub->major_key()); | 153 return static_cast<Major>(code_stub->major_key()); |
| 154 } | 154 } |
| 155 | 155 |
| 156 static const char* MajorName(Major major_key, bool allow_unknown_keys); | 156 static const char* MajorName(Major major_key, bool allow_unknown_keys); |
| 157 | 157 |
| 158 virtual ~CodeStub() {} | 158 virtual ~CodeStub() {} |
| 159 | 159 |
| 160 bool CompilingCallsToThisStubIsGCSafe(Isolate* isolate) { | 160 bool CompilingCallsToThisStubIsGCSafe(Isolate* isolate) { |
| 161 bool is_pregenerated = IsPregenerated(); | 161 bool is_pregenerated = IsPregenerated(isolate); |
| 162 Code* code = NULL; | 162 Code* code = NULL; |
| 163 CHECK(!is_pregenerated || FindCodeInCache(&code, isolate)); | 163 CHECK(!is_pregenerated || FindCodeInCache(&code, isolate)); |
| 164 return is_pregenerated; | 164 return is_pregenerated; |
| 165 } | 165 } |
| 166 | 166 |
| 167 // See comment above, where Instanceof is defined. | 167 // See comment above, where Instanceof is defined. |
| 168 virtual bool IsPregenerated() { return false; } | 168 virtual bool IsPregenerated(Isolate* isolate) { return false; } |
| 169 | 169 |
| 170 static void GenerateStubsAheadOfTime(Isolate* isolate); | 170 static void GenerateStubsAheadOfTime(Isolate* isolate); |
| 171 static void GenerateFPStubs(Isolate* isolate); | 171 static void GenerateFPStubs(Isolate* isolate); |
| 172 | 172 |
| 173 // Some stubs put untagged junk on the stack that cannot be scanned by the | 173 // Some stubs put untagged junk on the stack that cannot be scanned by the |
| 174 // GC. This means that we must be statically sure that no GC can occur while | 174 // GC. This means that we must be statically sure that no GC can occur while |
| 175 // they are running. If that is the case they should override this to return | 175 // they are running. If that is the case they should override this to return |
| 176 // true, which will cause an assertion if we try to call something that can | 176 // true, which will cause an assertion if we try to call something that can |
| 177 // GC or if we try to put a stack frame on top of the junk, which would not | 177 // GC or if we try to put a stack frame on top of the junk, which would not |
| 178 // result in a traversable stack. | 178 // result in a traversable stack. |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowObjectStub); | 675 DISALLOW_COPY_AND_ASSIGN(FastCloneShallowObjectStub); |
| 676 }; | 676 }; |
| 677 | 677 |
| 678 | 678 |
| 679 class CreateAllocationSiteStub : public HydrogenCodeStub { | 679 class CreateAllocationSiteStub : public HydrogenCodeStub { |
| 680 public: | 680 public: |
| 681 explicit CreateAllocationSiteStub() { } | 681 explicit CreateAllocationSiteStub() { } |
| 682 | 682 |
| 683 virtual Handle<Code> GenerateCode(Isolate* isolate); | 683 virtual Handle<Code> GenerateCode(Isolate* isolate); |
| 684 | 684 |
| 685 virtual bool IsPregenerated() { return true; } | 685 virtual bool IsPregenerated(Isolate* isolate) V8_OVERRIDE { return true; } |
| 686 | 686 |
| 687 static void GenerateAheadOfTime(Isolate* isolate); | 687 static void GenerateAheadOfTime(Isolate* isolate); |
| 688 | 688 |
| 689 virtual void InitializeInterfaceDescriptor( | 689 virtual void InitializeInterfaceDescriptor( |
| 690 Isolate* isolate, | 690 Isolate* isolate, |
| 691 CodeStubInterfaceDescriptor* descriptor); | 691 CodeStubInterfaceDescriptor* descriptor); |
| 692 | 692 |
| 693 private: | 693 private: |
| 694 Major MajorKey() { return CreateAllocationSite; } | 694 Major MajorKey() { return CreateAllocationSite; } |
| 695 int NotMissMinorKey() { return 0; } | 695 int NotMissMinorKey() { return 0; } |
| (...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 explicit CEntryStub(int result_size, | 1298 explicit CEntryStub(int result_size, |
| 1299 SaveFPRegsMode save_doubles = kDontSaveFPRegs) | 1299 SaveFPRegsMode save_doubles = kDontSaveFPRegs) |
| 1300 : result_size_(result_size), save_doubles_(save_doubles) { } | 1300 : result_size_(result_size), save_doubles_(save_doubles) { } |
| 1301 | 1301 |
| 1302 void Generate(MacroAssembler* masm); | 1302 void Generate(MacroAssembler* masm); |
| 1303 | 1303 |
| 1304 // The version of this stub that doesn't save doubles is generated ahead of | 1304 // The version of this stub that doesn't save doubles is generated ahead of |
| 1305 // time, so it's OK to call it from other stubs that can't cope with GC during | 1305 // time, so it's OK to call it from other stubs that can't cope with GC during |
| 1306 // their code generation. On machines that always have gp registers (x64) we | 1306 // their code generation. On machines that always have gp registers (x64) we |
| 1307 // can generate both variants ahead of time. | 1307 // can generate both variants ahead of time. |
| 1308 virtual bool IsPregenerated(); | 1308 virtual bool IsPregenerated(Isolate* isolate) V8_OVERRIDE; |
| 1309 static void GenerateAheadOfTime(Isolate* isolate); | 1309 static void GenerateAheadOfTime(Isolate* isolate); |
| 1310 | 1310 |
| 1311 private: | 1311 private: |
| 1312 void GenerateCore(MacroAssembler* masm, | 1312 void GenerateCore(MacroAssembler* masm, |
| 1313 Label* throw_normal_exception, | 1313 Label* throw_normal_exception, |
| 1314 Label* throw_termination_exception, | 1314 Label* throw_termination_exception, |
| 1315 Label* throw_out_of_memory_exception, | 1315 Label* throw_out_of_memory_exception, |
| 1316 bool do_gc, | 1316 bool do_gc, |
| 1317 bool always_allocate_scope); | 1317 bool always_allocate_scope); |
| 1318 | 1318 |
| 1319 // Number of pointers/values returned. | 1319 // Number of pointers/values returned. |
| 1320 Isolate* isolate_; |
| 1320 const int result_size_; | 1321 const int result_size_; |
| 1321 SaveFPRegsMode save_doubles_; | 1322 SaveFPRegsMode save_doubles_; |
| 1322 | 1323 |
| 1323 Major MajorKey() { return CEntry; } | 1324 Major MajorKey() { return CEntry; } |
| 1324 int MinorKey(); | 1325 int MinorKey(); |
| 1325 | 1326 |
| 1326 bool NeedsImmovableCode(); | 1327 bool NeedsImmovableCode(); |
| 1327 }; | 1328 }; |
| 1328 | 1329 |
| 1329 | 1330 |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1888 } | 1889 } |
| 1889 | 1890 |
| 1890 AllocationSiteOverrideMode override_mode() const { | 1891 AllocationSiteOverrideMode override_mode() const { |
| 1891 return AllocationSiteOverrideModeBits::decode(bit_field_); | 1892 return AllocationSiteOverrideModeBits::decode(bit_field_); |
| 1892 } | 1893 } |
| 1893 | 1894 |
| 1894 ContextCheckMode context_mode() const { | 1895 ContextCheckMode context_mode() const { |
| 1895 return ContextCheckModeBits::decode(bit_field_); | 1896 return ContextCheckModeBits::decode(bit_field_); |
| 1896 } | 1897 } |
| 1897 | 1898 |
| 1898 virtual bool IsPregenerated() { | 1899 virtual bool IsPregenerated(Isolate* isolate) V8_OVERRIDE { |
| 1899 // We only pre-generate stubs that verify correct context | 1900 // We only pre-generate stubs that verify correct context |
| 1900 return context_mode() == CONTEXT_CHECK_REQUIRED; | 1901 return context_mode() == CONTEXT_CHECK_REQUIRED; |
| 1901 } | 1902 } |
| 1902 | 1903 |
| 1903 static void GenerateStubsAheadOfTime(Isolate* isolate); | 1904 static void GenerateStubsAheadOfTime(Isolate* isolate); |
| 1904 static void InstallDescriptors(Isolate* isolate); | 1905 static void InstallDescriptors(Isolate* isolate); |
| 1905 | 1906 |
| 1906 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1907 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 1907 static const int kConstructor = 0; | 1908 static const int kConstructor = 0; |
| 1908 static const int kPropertyCell = 1; | 1909 static const int kPropertyCell = 1; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1989 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); | 1990 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); |
| 1990 }; | 1991 }; |
| 1991 | 1992 |
| 1992 | 1993 |
| 1993 class InternalArrayConstructorStubBase : public HydrogenCodeStub { | 1994 class InternalArrayConstructorStubBase : public HydrogenCodeStub { |
| 1994 public: | 1995 public: |
| 1995 explicit InternalArrayConstructorStubBase(ElementsKind kind) { | 1996 explicit InternalArrayConstructorStubBase(ElementsKind kind) { |
| 1996 kind_ = kind; | 1997 kind_ = kind; |
| 1997 } | 1998 } |
| 1998 | 1999 |
| 1999 virtual bool IsPregenerated() { return true; } | 2000 virtual bool IsPregenerated(Isolate* isolate) V8_OVERRIDE { return true; } |
| 2000 static void GenerateStubsAheadOfTime(Isolate* isolate); | 2001 static void GenerateStubsAheadOfTime(Isolate* isolate); |
| 2001 static void InstallDescriptors(Isolate* isolate); | 2002 static void InstallDescriptors(Isolate* isolate); |
| 2002 | 2003 |
| 2003 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 2004 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 2004 static const int kConstructor = 0; | 2005 static const int kConstructor = 0; |
| 2005 | 2006 |
| 2006 ElementsKind elements_kind() const { return kind_; } | 2007 ElementsKind elements_kind() const { return kind_; } |
| 2007 | 2008 |
| 2008 private: | 2009 private: |
| 2009 int NotMissMinorKey() { return kind_; } | 2010 int NotMissMinorKey() { return kind_; } |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2253 | 2254 |
| 2254 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); | 2255 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); |
| 2255 }; | 2256 }; |
| 2256 | 2257 |
| 2257 | 2258 |
| 2258 class StubFailureTrampolineStub : public PlatformCodeStub { | 2259 class StubFailureTrampolineStub : public PlatformCodeStub { |
| 2259 public: | 2260 public: |
| 2260 explicit StubFailureTrampolineStub(StubFunctionMode function_mode) | 2261 explicit StubFailureTrampolineStub(StubFunctionMode function_mode) |
| 2261 : fp_registers_(CanUseFPRegisters()), function_mode_(function_mode) {} | 2262 : fp_registers_(CanUseFPRegisters()), function_mode_(function_mode) {} |
| 2262 | 2263 |
| 2263 virtual bool IsPregenerated() { return true; } | 2264 virtual bool IsPregenerated(Isolate* isolate) V8_OVERRIDE { return true; } |
| 2264 | 2265 |
| 2265 static void GenerateAheadOfTime(Isolate* isolate); | 2266 static void GenerateAheadOfTime(Isolate* isolate); |
| 2266 | 2267 |
| 2267 private: | 2268 private: |
| 2268 class FPRegisters: public BitField<bool, 0, 1> {}; | 2269 class FPRegisters: public BitField<bool, 0, 1> {}; |
| 2269 class FunctionModeField: public BitField<StubFunctionMode, 1, 1> {}; | 2270 class FunctionModeField: public BitField<StubFunctionMode, 1, 1> {}; |
| 2270 | 2271 |
| 2271 Major MajorKey() { return StubFailureTrampoline; } | 2272 Major MajorKey() { return StubFailureTrampoline; } |
| 2272 int MinorKey() { | 2273 int MinorKey() { |
| 2273 return FPRegisters::encode(fp_registers_) | | 2274 return FPRegisters::encode(fp_registers_) | |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2302 int MinorKey() { return 0; } | 2303 int MinorKey() { return 0; } |
| 2303 | 2304 |
| 2304 void Generate(MacroAssembler* masm); | 2305 void Generate(MacroAssembler* masm); |
| 2305 | 2306 |
| 2306 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2307 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
| 2307 }; | 2308 }; |
| 2308 | 2309 |
| 2309 } } // namespace v8::internal | 2310 } } // namespace v8::internal |
| 2310 | 2311 |
| 2311 #endif // V8_CODE_STUBS_H_ | 2312 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |