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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 return static_cast<Major>(code_stub->major_key()); | 134 return static_cast<Major>(code_stub->major_key()); |
135 } | 135 } |
136 | 136 |
137 static const char* MajorName(Major major_key, bool allow_unknown_keys); | 137 static const char* MajorName(Major major_key, bool allow_unknown_keys); |
138 | 138 |
139 virtual ~CodeStub() {} | 139 virtual ~CodeStub() {} |
140 | 140 |
141 bool CompilingCallsToThisStubIsGCSafe() { | 141 bool CompilingCallsToThisStubIsGCSafe() { |
142 bool is_pregenerated = IsPregenerated(); | 142 bool is_pregenerated = IsPregenerated(); |
143 Code* code = NULL; | 143 Code* code = NULL; |
144 CHECK(!is_pregenerated || FindCodeInCache(&code)); | 144 CHECK(!is_pregenerated || FindCodeInCache(&code, Isolate::Current())); |
145 return is_pregenerated; | 145 return is_pregenerated; |
146 } | 146 } |
147 | 147 |
148 // See comment above, where Instanceof is defined. | 148 // See comment above, where Instanceof is defined. |
149 virtual bool IsPregenerated() { return false; } | 149 virtual bool IsPregenerated() { return false; } |
150 | 150 |
151 static void GenerateStubsAheadOfTime(); | 151 static void GenerateStubsAheadOfTime(); |
152 static void GenerateFPStubs(); | 152 static void GenerateFPStubs(); |
153 | 153 |
154 // Some stubs put untagged junk on the stack that cannot be scanned by the | 154 // Some stubs put untagged junk on the stack that cannot be scanned by the |
155 // GC. This means that we must be statically sure that no GC can occur while | 155 // GC. This means that we must be statically sure that no GC can occur while |
156 // they are running. If that is the case they should override this to return | 156 // they are running. If that is the case they should override this to return |
157 // true, which will cause an assertion if we try to call something that can | 157 // true, which will cause an assertion if we try to call something that can |
158 // GC or if we try to put a stack frame on top of the junk, which would not | 158 // GC or if we try to put a stack frame on top of the junk, which would not |
159 // result in a traversable stack. | 159 // result in a traversable stack. |
160 virtual bool SometimesSetsUpAFrame() { return true; } | 160 virtual bool SometimesSetsUpAFrame() { return true; } |
161 | 161 |
162 // Lookup the code in the (possibly custom) cache. | 162 // Lookup the code in the (possibly custom) cache. |
163 bool FindCodeInCache(Code** code_out); | 163 bool FindCodeInCache(Code** code_out, Isolate* isolate); |
164 | 164 |
165 protected: | 165 protected: |
166 static bool CanUseFPRegisters(); | 166 static bool CanUseFPRegisters(); |
167 | 167 |
168 private: | 168 private: |
169 // Nonvirtual wrapper around the stub-specific Generate function. Call | 169 // Nonvirtual wrapper around the stub-specific Generate function. Call |
170 // this function to set up the macro assembler and generate the code. | 170 // this function to set up the macro assembler and generate the code. |
171 void GenerateCode(MacroAssembler* masm); | 171 void GenerateCode(MacroAssembler* masm); |
172 | 172 |
173 // Generates the assembler code for the stub. | 173 // Generates the assembler code for the stub. |
(...skipping 21 matching lines...) Expand all Loading... |
195 virtual InlineCacheState GetICState() { | 195 virtual InlineCacheState GetICState() { |
196 return UNINITIALIZED; | 196 return UNINITIALIZED; |
197 } | 197 } |
198 | 198 |
199 // Add the code to a specialized cache, specific to an individual | 199 // Add the code to a specialized cache, specific to an individual |
200 // stub type. Please note, this method must add the code object to a | 200 // stub type. Please note, this method must add the code object to a |
201 // roots object, otherwise we will remove the code during GC. | 201 // roots object, otherwise we will remove the code during GC. |
202 virtual void AddToSpecialCache(Handle<Code> new_object) { } | 202 virtual void AddToSpecialCache(Handle<Code> new_object) { } |
203 | 203 |
204 // Find code in a specialized cache, work is delegated to the specific stub. | 204 // Find code in a specialized cache, work is delegated to the specific stub. |
205 virtual bool FindCodeInSpecialCache(Code** code_out) { return false; } | 205 virtual bool FindCodeInSpecialCache(Code** code_out, Isolate* isolate) { |
| 206 return false; |
| 207 } |
206 | 208 |
207 // If a stub uses a special cache override this. | 209 // If a stub uses a special cache override this. |
208 virtual bool UseSpecialCache() { return false; } | 210 virtual bool UseSpecialCache() { return false; } |
209 | 211 |
210 // Returns a name for logging/debugging purposes. | 212 // Returns a name for logging/debugging purposes. |
211 SmartArrayPointer<const char> GetName(); | 213 SmartArrayPointer<const char> GetName(); |
212 virtual void PrintName(StringStream* stream); | 214 virtual void PrintName(StringStream* stream); |
213 | 215 |
214 // Returns whether the code generated for this stub needs to be allocated as | 216 // Returns whether the code generated for this stub needs to be allocated as |
215 // a fixed (non-moveable) code object. | 217 // a fixed (non-moveable) code object. |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 void GenerateStrings(MacroAssembler* masm); | 648 void GenerateStrings(MacroAssembler* masm); |
647 void GenerateObjects(MacroAssembler* masm); | 649 void GenerateObjects(MacroAssembler* masm); |
648 void GenerateMiss(MacroAssembler* masm); | 650 void GenerateMiss(MacroAssembler* masm); |
649 void GenerateKnownObjects(MacroAssembler* masm); | 651 void GenerateKnownObjects(MacroAssembler* masm); |
650 void GenerateGeneric(MacroAssembler* masm); | 652 void GenerateGeneric(MacroAssembler* masm); |
651 | 653 |
652 bool strict() const { return op_ == Token::EQ_STRICT; } | 654 bool strict() const { return op_ == Token::EQ_STRICT; } |
653 Condition GetCondition() const { return CompareIC::ComputeCondition(op_); } | 655 Condition GetCondition() const { return CompareIC::ComputeCondition(op_); } |
654 | 656 |
655 virtual void AddToSpecialCache(Handle<Code> new_object); | 657 virtual void AddToSpecialCache(Handle<Code> new_object); |
656 virtual bool FindCodeInSpecialCache(Code** code_out); | 658 virtual bool FindCodeInSpecialCache(Code** code_out, Isolate* isolate); |
657 virtual bool UseSpecialCache() { return state_ == CompareIC::KNOWN_OBJECTS; } | 659 virtual bool UseSpecialCache() { return state_ == CompareIC::KNOWN_OBJECTS; } |
658 | 660 |
659 Token::Value op_; | 661 Token::Value op_; |
660 CompareIC::State left_; | 662 CompareIC::State left_; |
661 CompareIC::State right_; | 663 CompareIC::State right_; |
662 CompareIC::State state_; | 664 CompareIC::State state_; |
663 Handle<Map> known_map_; | 665 Handle<Map> known_map_; |
664 }; | 666 }; |
665 | 667 |
666 | 668 |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 | 1228 |
1227 // The current function entry hook. | 1229 // The current function entry hook. |
1228 static FunctionEntryHook entry_hook_; | 1230 static FunctionEntryHook entry_hook_; |
1229 | 1231 |
1230 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1232 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
1231 }; | 1233 }; |
1232 | 1234 |
1233 } } // namespace v8::internal | 1235 } } // namespace v8::internal |
1234 | 1236 |
1235 #endif // V8_CODE_STUBS_H_ | 1237 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |