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

Side by Side Diff: src/ia32/lithium-codegen-ia32.h

Issue 6541053: Add more generic version of reloc info padding to ensure enough space for rel... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 10 months 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 | « src/assembler.cc ('k') | src/ia32/lithium-codegen-ia32.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 current_block_(-1), 53 current_block_(-1),
54 current_instruction_(-1), 54 current_instruction_(-1),
55 instructions_(chunk->instructions()), 55 instructions_(chunk->instructions()),
56 deoptimizations_(4), 56 deoptimizations_(4),
57 deoptimization_literals_(8), 57 deoptimization_literals_(8),
58 inlined_function_count_(0), 58 inlined_function_count_(0),
59 scope_(chunk->graph()->info()->scope()), 59 scope_(chunk->graph()->info()->scope()),
60 status_(UNUSED), 60 status_(UNUSED),
61 deferred_(8), 61 deferred_(8),
62 osr_pc_offset_(-1), 62 osr_pc_offset_(-1),
63 deoptimization_reloc_size(),
63 resolver_(this) { 64 resolver_(this) {
64 PopulateDeoptimizationLiteralsWithInlinedFunctions(); 65 PopulateDeoptimizationLiteralsWithInlinedFunctions();
65 } 66 }
66 67
67 // Simple accessors. 68 // Simple accessors.
68 MacroAssembler* masm() const { return masm_; } 69 MacroAssembler* masm() const { return masm_; }
69 70
70 // Support for converting LOperands to assembler types. 71 // Support for converting LOperands to assembler types.
71 Operand ToOperand(LOperand* op) const; 72 Operand ToOperand(LOperand* op) const;
72 Register ToRegister(LOperand* op) const; 73 Register ToRegister(LOperand* op) const;
(...skipping 22 matching lines...) Expand all
95 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr); 96 void DoDeferredStringCharCodeAt(LStringCharCodeAt* instr);
96 void DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, 97 void DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
97 Label* map_check); 98 Label* map_check);
98 99
99 // Parallel move support. 100 // Parallel move support.
100 void DoParallelMove(LParallelMove* move); 101 void DoParallelMove(LParallelMove* move);
101 102
102 // Emit frame translation commands for an environment. 103 // Emit frame translation commands for an environment.
103 void WriteTranslation(LEnvironment* environment, Translation* translation); 104 void WriteTranslation(LEnvironment* environment, Translation* translation);
104 105
106 void EnsureRelocSpaceForDeoptimization() {
Søren Thygesen Gjesse 2011/02/22 11:58:33 Do we want this in the .h file (I guess we have no
Rico 2011/02/22 12:06:10 Moved to the cc file
107 // Since we patch the reloc info with RUNTIME_ENTRY calls every patch
108 // site will take up 2 bytes + any pc-jumps.
109 // We are conservative and always reserver 6 bytes in case where a
110 // simple pc-jump is not enough.
111 uint32_t pc_delta =
112 masm()->pc_offset() - deoptimization_reloc_size.last_pc_offset;
113 if (is_uintn(pc_delta, 6)) {
114 deoptimization_reloc_size.min_size += 2;
115 } else {
116 deoptimization_reloc_size.min_size += 6;
117 }
118 deoptimization_reloc_size.last_pc_offset = masm()->pc_offset();
119 }
105 // Declare methods that deal with the individual node types. 120 // Declare methods that deal with the individual node types.
106 #define DECLARE_DO(type) void Do##type(L##type* node); 121 #define DECLARE_DO(type) void Do##type(L##type* node);
107 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_DO) 122 LITHIUM_CONCRETE_INSTRUCTION_LIST(DECLARE_DO)
108 #undef DECLARE_DO 123 #undef DECLARE_DO
109 124
110 private: 125 private:
111 enum Status { 126 enum Status {
112 UNUSED, 127 UNUSED,
113 GENERATING, 128 GENERATING,
114 DONE, 129 DONE,
(...skipping 29 matching lines...) Expand all
144 void Abort(const char* format, ...); 159 void Abort(const char* format, ...);
145 void Comment(const char* format, ...); 160 void Comment(const char* format, ...);
146 161
147 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code); } 162 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code); }
148 163
149 // Code generation passes. Returns true if code generation should 164 // Code generation passes. Returns true if code generation should
150 // continue. 165 // continue.
151 bool GeneratePrologue(); 166 bool GeneratePrologue();
152 bool GenerateBody(); 167 bool GenerateBody();
153 bool GenerateDeferredCode(); 168 bool GenerateDeferredCode();
169 // Pad the reloc info to ensure that we have enough space to patch during
170 // deoptimization.
171 bool GenerateRelocPadding();
154 bool GenerateSafepointTable(); 172 bool GenerateSafepointTable();
155 173
156 void CallCode(Handle<Code> code, RelocInfo::Mode mode, LInstruction* instr, 174 void CallCode(Handle<Code> code, RelocInfo::Mode mode, LInstruction* instr,
157 bool adjusted = true); 175 bool adjusted = true);
158 void CallRuntime(Runtime::Function* fun, int argc, LInstruction* instr, 176 void CallRuntime(Runtime::Function* fun, int argc, LInstruction* instr,
159 bool adjusted = true); 177 bool adjusted = true);
160 void CallRuntime(Runtime::FunctionId id, int argc, LInstruction* instr, 178 void CallRuntime(Runtime::FunctionId id, int argc, LInstruction* instr,
161 bool adjusted = true) { 179 bool adjusted = true) {
162 Runtime::Function* function = Runtime::FunctionForId(id); 180 Runtime::Function* function = Runtime::FunctionForId(id);
163 CallRuntime(function, argc, instr, adjusted); 181 CallRuntime(function, argc, instr, adjusted);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 const ZoneList<LInstruction*>* instructions_; 262 const ZoneList<LInstruction*>* instructions_;
245 ZoneList<LEnvironment*> deoptimizations_; 263 ZoneList<LEnvironment*> deoptimizations_;
246 ZoneList<Handle<Object> > deoptimization_literals_; 264 ZoneList<Handle<Object> > deoptimization_literals_;
247 int inlined_function_count_; 265 int inlined_function_count_;
248 Scope* const scope_; 266 Scope* const scope_;
249 Status status_; 267 Status status_;
250 TranslationBuffer translations_; 268 TranslationBuffer translations_;
251 ZoneList<LDeferredCode*> deferred_; 269 ZoneList<LDeferredCode*> deferred_;
252 int osr_pc_offset_; 270 int osr_pc_offset_;
253 271
272 struct DeoptimizationRelocSize {
273 int min_size;
274 int last_pc_offset;
275 };
276
277 DeoptimizationRelocSize deoptimization_reloc_size;
278
254 // Builder that keeps track of safepoints in the code. The table 279 // Builder that keeps track of safepoints in the code. The table
255 // itself is emitted at the end of the generated code. 280 // itself is emitted at the end of the generated code.
256 SafepointTableBuilder safepoints_; 281 SafepointTableBuilder safepoints_;
257 282
258 // Compiler from a set of parallel moves to a sequential list of moves. 283 // Compiler from a set of parallel moves to a sequential list of moves.
259 LGapResolver resolver_; 284 LGapResolver resolver_;
260 285
261 friend class LDeferredCode; 286 friend class LDeferredCode;
262 friend class LEnvironment; 287 friend class LEnvironment;
263 friend class SafepointGenerator; 288 friend class SafepointGenerator;
(...skipping 22 matching lines...) Expand all
286 private: 311 private:
287 LCodeGen* codegen_; 312 LCodeGen* codegen_;
288 Label entry_; 313 Label entry_;
289 Label exit_; 314 Label exit_;
290 Label* external_exit_; 315 Label* external_exit_;
291 }; 316 };
292 317
293 } } // namespace v8::internal 318 } } // namespace v8::internal
294 319
295 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_ 320 #endif // V8_IA32_LITHIUM_CODEGEN_IA32_H_
OLDNEW
« no previous file with comments | « src/assembler.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698