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

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

Issue 6597029: [Isolates] Merge r 6300:6500 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
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/x64/ic-x64.cc ('k') | src/x64/lithium-codegen-x64.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 16 matching lines...) Expand all
27 27
28 #ifndef V8_X64_LITHIUM_CODEGEN_X64_H_ 28 #ifndef V8_X64_LITHIUM_CODEGEN_X64_H_
29 #define V8_X64_LITHIUM_CODEGEN_X64_H_ 29 #define V8_X64_LITHIUM_CODEGEN_X64_H_
30 30
31 #include "x64/lithium-x64.h" 31 #include "x64/lithium-x64.h"
32 32
33 #include "checks.h" 33 #include "checks.h"
34 #include "deoptimizer.h" 34 #include "deoptimizer.h"
35 #include "safepoint-table.h" 35 #include "safepoint-table.h"
36 #include "scopes.h" 36 #include "scopes.h"
37 #include "x64/lithium-gap-resolver-x64.h"
37 38
38 namespace v8 { 39 namespace v8 {
39 namespace internal { 40 namespace internal {
40 41
41 // Forward declarations. 42 // Forward declarations.
42 class LDeferredCode; 43 class LDeferredCode;
43 class SafepointGenerator; 44 class SafepointGenerator;
44 45
45 class LCodeGen BASE_EMBEDDED { 46 class LCodeGen BASE_EMBEDDED {
46 public: 47 public:
47 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info) 48 LCodeGen(LChunk* chunk, MacroAssembler* assembler, CompilationInfo* info)
48 : chunk_(chunk), 49 : chunk_(chunk),
49 masm_(assembler), 50 masm_(assembler),
50 info_(info), 51 info_(info),
51 current_block_(-1), 52 current_block_(-1),
52 current_instruction_(-1), 53 current_instruction_(-1),
53 instructions_(chunk->instructions()), 54 instructions_(chunk->instructions()),
54 deoptimizations_(4), 55 deoptimizations_(4),
55 deoptimization_literals_(8), 56 deoptimization_literals_(8),
56 inlined_function_count_(0), 57 inlined_function_count_(0),
57 scope_(chunk->graph()->info()->scope()), 58 scope_(chunk->graph()->info()->scope()),
58 status_(UNUSED), 59 status_(UNUSED),
59 deferred_(8), 60 deferred_(8),
60 osr_pc_offset_(-1) { 61 osr_pc_offset_(-1),
62 resolver_(this) {
61 PopulateDeoptimizationLiteralsWithInlinedFunctions(); 63 PopulateDeoptimizationLiteralsWithInlinedFunctions();
62 } 64 }
63 65
66 // Simple accessors.
67 MacroAssembler* masm() const { return masm_; }
68
69 // Support for converting LOperands to assembler types.
70 Register ToRegister(LOperand* op) const;
71 XMMRegister ToDoubleRegister(LOperand* op) const;
72 bool IsInteger32Constant(LConstantOperand* op) const;
73 int ToInteger32(LConstantOperand* op) const;
74 bool IsTaggedConstant(LConstantOperand* op) const;
75 Handle<Object> ToHandle(LConstantOperand* op) const;
76 Operand ToOperand(LOperand* op) const;
77
78
64 // Try to generate code for the entire chunk, but it may fail if the 79 // Try to generate code for the entire chunk, but it may fail if the
65 // chunk contains constructs we cannot handle. Returns true if the 80 // chunk contains constructs we cannot handle. Returns true if the
66 // code generation attempt succeeded. 81 // code generation attempt succeeded.
67 bool GenerateCode(); 82 bool GenerateCode();
68 83
69 // Finish the code by setting stack height, safepoint, and bailout 84 // Finish the code by setting stack height, safepoint, and bailout
70 // information on it. 85 // information on it.
71 void FinishCode(Handle<Code> code); 86 void FinishCode(Handle<Code> code);
72 87
73 // Deferred code support. 88 // Deferred code support.
74 void DoDeferredNumberTagD(LNumberTagD* instr); 89 void DoDeferredNumberTagD(LNumberTagD* instr);
75 void DoDeferredNumberTagI(LNumberTagI* instr);
76 void DoDeferredTaggedToI(LTaggedToI* instr); 90 void DoDeferredTaggedToI(LTaggedToI* instr);
77 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr); 91 void DoDeferredMathAbsTaggedHeapNumber(LUnaryMathOperation* instr);
78 void DoDeferredStackCheck(LGoto* instr); 92 void DoDeferredStackCheck(LGoto* instr);
79 void DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, 93 void DoDeferredLInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
80 Label* map_check); 94 Label* map_check);
81 95
82 // Parallel move support. 96 // Parallel move support.
83 void DoParallelMove(LParallelMove* move); 97 void DoParallelMove(LParallelMove* move);
84 98
85 // Emit frame translation commands for an environment. 99 // Emit frame translation commands for an environment.
(...skipping 13 matching lines...) Expand all
99 }; 113 };
100 114
101 bool is_unused() const { return status_ == UNUSED; } 115 bool is_unused() const { return status_ == UNUSED; }
102 bool is_generating() const { return status_ == GENERATING; } 116 bool is_generating() const { return status_ == GENERATING; }
103 bool is_done() const { return status_ == DONE; } 117 bool is_done() const { return status_ == DONE; }
104 bool is_aborted() const { return status_ == ABORTED; } 118 bool is_aborted() const { return status_ == ABORTED; }
105 119
106 LChunk* chunk() const { return chunk_; } 120 LChunk* chunk() const { return chunk_; }
107 Scope* scope() const { return scope_; } 121 Scope* scope() const { return scope_; }
108 HGraph* graph() const { return chunk_->graph(); } 122 HGraph* graph() const { return chunk_->graph(); }
109 MacroAssembler* masm() const { return masm_; }
110 123
111 int GetNextEmittedBlock(int block); 124 int GetNextEmittedBlock(int block);
112 LInstruction* GetNextInstruction(); 125 LInstruction* GetNextInstruction();
113 126
114 void EmitClassOfTest(Label* if_true, 127 void EmitClassOfTest(Label* if_true,
115 Label* if_false, 128 Label* if_false,
116 Handle<String> class_name, 129 Handle<String> class_name,
117 Register input, 130 Register input,
118 Register temporary, 131 Register temporary);
119 Register temporary2);
120 132
121 int StackSlotCount() const { return chunk()->spill_slot_count(); } 133 int StackSlotCount() const { return chunk()->spill_slot_count(); }
122 int ParameterCount() const { return scope()->num_parameters(); } 134 int ParameterCount() const { return scope()->num_parameters(); }
123 135
124 void Abort(const char* format, ...); 136 void Abort(const char* format, ...);
125 void Comment(const char* format, ...); 137 void Comment(const char* format, ...);
126 138
127 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code); } 139 void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code); }
128 140
129 // Code generation passes. Returns true if code generation should 141 // Code generation passes. Returns true if code generation should
(...skipping 15 matching lines...) Expand all
145 const Runtime::Function* function = Runtime::FunctionForId(id); 157 const Runtime::Function* function = Runtime::FunctionForId(id);
146 CallRuntime(function, num_arguments, instr); 158 CallRuntime(function, num_arguments, instr);
147 } 159 }
148 160
149 // Generate a direct call to a known function. Expects the function 161 // Generate a direct call to a known function. Expects the function
150 // to be in edi. 162 // to be in edi.
151 void CallKnownFunction(Handle<JSFunction> function, 163 void CallKnownFunction(Handle<JSFunction> function,
152 int arity, 164 int arity,
153 LInstruction* instr); 165 LInstruction* instr);
154 166
155 void LoadPrototype(Register result, Handle<JSObject> prototype); 167 void LoadHeapObject(Register result, Handle<HeapObject> object);
156 168
157 void RegisterLazyDeoptimization(LInstruction* instr); 169 void RegisterLazyDeoptimization(LInstruction* instr);
158 void RegisterEnvironmentForDeoptimization(LEnvironment* environment); 170 void RegisterEnvironmentForDeoptimization(LEnvironment* environment);
159 void DeoptimizeIf(Condition cc, LEnvironment* environment); 171 void DeoptimizeIf(Condition cc, LEnvironment* environment);
160 172
161 void AddToTranslation(Translation* translation, 173 void AddToTranslation(Translation* translation,
162 LOperand* op, 174 LOperand* op,
163 bool is_tagged); 175 bool is_tagged);
164 void PopulateDeoptimizationData(Handle<Code> code); 176 void PopulateDeoptimizationData(Handle<Code> code);
165 int DefineDeoptimizationLiteral(Handle<Object> literal); 177 int DefineDeoptimizationLiteral(Handle<Object> literal);
166 178
167 void PopulateDeoptimizationLiteralsWithInlinedFunctions(); 179 void PopulateDeoptimizationLiteralsWithInlinedFunctions();
168 180
169 Register ToRegister(int index) const; 181 Register ToRegister(int index) const;
170 XMMRegister ToDoubleRegister(int index) const; 182 XMMRegister ToDoubleRegister(int index) const;
171 Register ToRegister(LOperand* op) const;
172 XMMRegister ToDoubleRegister(LOperand* op) const;
173 int ToInteger32(LConstantOperand* op) const;
174 Operand ToOperand(LOperand* op) const;
175 183
176 // Specific math operations - used from DoUnaryMathOperation. 184 // Specific math operations - used from DoUnaryMathOperation.
177 void DoMathAbs(LUnaryMathOperation* instr); 185 void DoMathAbs(LUnaryMathOperation* instr);
178 void DoMathFloor(LUnaryMathOperation* instr); 186 void DoMathFloor(LUnaryMathOperation* instr);
179 void DoMathRound(LUnaryMathOperation* instr); 187 void DoMathRound(LUnaryMathOperation* instr);
180 void DoMathSqrt(LUnaryMathOperation* instr); 188 void DoMathSqrt(LUnaryMathOperation* instr);
181 void DoMathPowHalf(LUnaryMathOperation* instr); 189 void DoMathPowHalf(LUnaryMathOperation* instr);
182 void DoMathLog(LUnaryMathOperation* instr); 190 void DoMathLog(LUnaryMathOperation* instr);
183 void DoMathCos(LUnaryMathOperation* instr); 191 void DoMathCos(LUnaryMathOperation* instr);
184 void DoMathSin(LUnaryMathOperation* instr); 192 void DoMathSin(LUnaryMathOperation* instr);
(...skipping 14 matching lines...) Expand all
199 // Emits optimized code for typeof x == "y". Modifies input register. 207 // Emits optimized code for typeof x == "y". Modifies input register.
200 // Returns the condition on which a final split to 208 // Returns the condition on which a final split to
201 // true and false label should be made, to optimize fallthrough. 209 // true and false label should be made, to optimize fallthrough.
202 Condition EmitTypeofIs(Label* true_label, Label* false_label, 210 Condition EmitTypeofIs(Label* true_label, Label* false_label,
203 Register input, Handle<String> type_name); 211 Register input, Handle<String> type_name);
204 212
205 // Emits optimized code for %_IsObject(x). Preserves input register. 213 // Emits optimized code for %_IsObject(x). Preserves input register.
206 // Returns the condition on which a final split to 214 // Returns the condition on which a final split to
207 // true and false label should be made, to optimize fallthrough. 215 // true and false label should be made, to optimize fallthrough.
208 Condition EmitIsObject(Register input, 216 Condition EmitIsObject(Register input,
209 Register temp1,
210 Register temp2,
211 Label* is_not_object, 217 Label* is_not_object,
212 Label* is_object); 218 Label* is_object);
213 219
214 LChunk* const chunk_; 220 LChunk* const chunk_;
215 MacroAssembler* const masm_; 221 MacroAssembler* const masm_;
216 CompilationInfo* const info_; 222 CompilationInfo* const info_;
217 223
218 int current_block_; 224 int current_block_;
219 int current_instruction_; 225 int current_instruction_;
220 const ZoneList<LInstruction*>* instructions_; 226 const ZoneList<LInstruction*>* instructions_;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 private: 268 private:
263 LCodeGen* codegen_; 269 LCodeGen* codegen_;
264 Label entry_; 270 Label entry_;
265 Label exit_; 271 Label exit_;
266 Label* external_exit_; 272 Label* external_exit_;
267 }; 273 };
268 274
269 } } // namespace v8::internal 275 } } // namespace v8::internal
270 276
271 #endif // V8_X64_LITHIUM_CODEGEN_X64_H_ 277 #endif // V8_X64_LITHIUM_CODEGEN_X64_H_
OLDNEW
« no previous file with comments | « src/x64/ic-x64.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698