Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: src/code-stubs.h

Issue 472002: Fix a crash caused by garbage collection during generation of a... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/code-stubs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 #define DEF_ENUM(name) name, 76 #define DEF_ENUM(name) name,
77 CODE_STUB_LIST(DEF_ENUM) 77 CODE_STUB_LIST(DEF_ENUM)
78 #undef DEF_ENUM 78 #undef DEF_ENUM
79 NoCache, // marker for stubs that do custom caching 79 NoCache, // marker for stubs that do custom caching
80 NUMBER_OF_IDS 80 NUMBER_OF_IDS
81 }; 81 };
82 82
83 // Retrieve the code for the stub. Generate the code if needed. 83 // Retrieve the code for the stub. Generate the code if needed.
84 Handle<Code> GetCode(); 84 Handle<Code> GetCode();
85 85
86 // Retrieve the code for the stub if already generated. Do not
87 // generate the code if not already generated and instead return a
88 // retry after GC Failure object.
89 Object* TryGetCode();
90
86 static Major MajorKeyFromKey(uint32_t key) { 91 static Major MajorKeyFromKey(uint32_t key) {
87 return static_cast<Major>(MajorKeyBits::decode(key)); 92 return static_cast<Major>(MajorKeyBits::decode(key));
88 }; 93 };
89 static int MinorKeyFromKey(uint32_t key) { 94 static int MinorKeyFromKey(uint32_t key) {
90 return MinorKeyBits::decode(key); 95 return MinorKeyBits::decode(key);
91 }; 96 };
92 static const char* MajorName(Major major_key); 97 static const char* MajorName(Major major_key);
93 98
94 virtual ~CodeStub() {} 99 virtual ~CodeStub() {}
95 100
96 // Override these methods to provide a custom caching mechanism for 101 // Override these methods to provide a custom caching mechanism for
97 // an individual type of code stub. 102 // an individual type of code stub.
98 virtual bool GetCustomCache(Code** code_out) { return false; } 103 virtual bool GetCustomCache(Code** code_out) { return false; }
99 virtual void SetCustomCache(Code* value) { } 104 virtual void SetCustomCache(Code* value) { }
100 virtual bool has_custom_cache() { return false; } 105 virtual bool has_custom_cache() { return false; }
101 106
102 protected: 107 protected:
103 static const int kMajorBits = 5; 108 static const int kMajorBits = 5;
104 static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits; 109 static const int kMinorBits = kBitsPerInt - kSmiTagSize - kMajorBits;
105 110
106 private: 111 private:
112 // Lookup the code in the (possibly custom) cache.
113 bool FindCodeInCache(Code** code_out);
114
115 // Nonvirtual wrapper around the stub-specific Generate function. Call
116 // this function to set up the macro assembler and generate the code.
117 void GenerateCode(MacroAssembler* masm);
118
107 // Generates the assembler code for the stub. 119 // Generates the assembler code for the stub.
108 virtual void Generate(MacroAssembler* masm) = 0; 120 virtual void Generate(MacroAssembler* masm) = 0;
109 121
122 // Perform bookkeeping required after code generation when stub code is
123 // initially generated.
124 void RecordCodeGeneration(Code* code, MacroAssembler* masm);
125
110 // Returns information for computing the number key. 126 // Returns information for computing the number key.
111 virtual Major MajorKey() = 0; 127 virtual Major MajorKey() = 0;
112 virtual int MinorKey() = 0; 128 virtual int MinorKey() = 0;
113 129
114 // The CallFunctionStub needs to override this so it can encode whether a 130 // The CallFunctionStub needs to override this so it can encode whether a
115 // lazily generated function should be fully optimized or not. 131 // lazily generated function should be fully optimized or not.
116 virtual InLoopFlag InLoop() { return NOT_IN_LOOP; } 132 virtual InLoopFlag InLoop() { return NOT_IN_LOOP; }
117 133
118 // Returns a name for logging/debugging purposes. 134 // Returns a name for logging/debugging purposes.
119 virtual const char* GetName() { return MajorName(MajorKey()); } 135 virtual const char* GetName() { return MajorName(MajorKey()); }
(...skipping 13 matching lines...) Expand all
133 149
134 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {}; 150 class MajorKeyBits: public BitField<uint32_t, 0, kMajorBits> {};
135 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {}; 151 class MinorKeyBits: public BitField<uint32_t, kMajorBits, kMinorBits> {};
136 152
137 friend class BreakPointIterator; 153 friend class BreakPointIterator;
138 }; 154 };
139 155
140 } } // namespace v8::internal 156 } } // namespace v8::internal
141 157
142 #endif // V8_CODE_STUBS_H_ 158 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « no previous file | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698