OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 JsonAstBuilder builder; | 168 JsonAstBuilder builder; |
169 PrintF("%s", builder.BuildProgram(info->function())); | 169 PrintF("%s", builder.BuildProgram(info->function())); |
170 } | 170 } |
171 #endif // DEBUG | 171 #endif // DEBUG |
172 } | 172 } |
173 | 173 |
174 | 174 |
175 Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm, | 175 Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm, |
176 Code::Flags flags, | 176 Code::Flags flags, |
177 CompilationInfo* info) { | 177 CompilationInfo* info) { |
| 178 Isolate* isolate = info->isolate(); |
| 179 |
178 // Allocate and install the code. | 180 // Allocate and install the code. |
179 CodeDesc desc; | 181 CodeDesc desc; |
180 masm->GetCode(&desc); | 182 masm->GetCode(&desc); |
181 Handle<Code> code = FACTORY->NewCode(desc, flags, masm->CodeObject()); | 183 Handle<Code> code = |
| 184 isolate->factory()->NewCode(desc, flags, masm->CodeObject()); |
182 | 185 |
183 if (!code.is_null()) { | 186 if (!code.is_null()) { |
184 COUNTERS->total_compiled_code_size()->Increment(code->instruction_size()); | 187 isolate->counters()->total_compiled_code_size()->Increment( |
| 188 code->instruction_size()); |
185 } | 189 } |
186 return code; | 190 return code; |
187 } | 191 } |
188 | 192 |
189 | 193 |
190 void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) { | 194 void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) { |
191 #ifdef ENABLE_DISASSEMBLER | 195 #ifdef ENABLE_DISASSEMBLER |
192 bool print_code = Isolate::Current()->bootstrapper()->IsActive() | 196 bool print_code = Isolate::Current()->bootstrapper()->IsActive() |
193 ? FLAG_print_builtin_code | 197 ? FLAG_print_builtin_code |
194 : (FLAG_print_code || (info->IsOptimizing() && FLAG_print_opt_code)); | 198 : (FLAG_print_code || (info->IsOptimizing() && FLAG_print_opt_code)); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 232 |
229 | 233 |
230 // Generate the code. Compile the AST and assemble all the pieces into a | 234 // Generate the code. Compile the AST and assemble all the pieces into a |
231 // Code object. | 235 // Code object. |
232 bool CodeGenerator::MakeCode(CompilationInfo* info) { | 236 bool CodeGenerator::MakeCode(CompilationInfo* info) { |
233 // When using Crankshaft the classic backend should never be used. | 237 // When using Crankshaft the classic backend should never be used. |
234 ASSERT(!V8::UseCrankshaft()); | 238 ASSERT(!V8::UseCrankshaft()); |
235 Handle<Script> script = info->script(); | 239 Handle<Script> script = info->script(); |
236 if (!script->IsUndefined() && !script->source()->IsUndefined()) { | 240 if (!script->IsUndefined() && !script->source()->IsUndefined()) { |
237 int len = String::cast(script->source())->length(); | 241 int len = String::cast(script->source())->length(); |
238 COUNTERS->total_old_codegen_source_size()->Increment(len); | 242 Counters* counters = info->isolate()->counters(); |
| 243 counters->total_old_codegen_source_size()->Increment(len); |
239 } | 244 } |
240 if (FLAG_trace_codegen) { | 245 if (FLAG_trace_codegen) { |
241 PrintF("Classic Compiler - "); | 246 PrintF("Classic Compiler - "); |
242 } | 247 } |
243 MakeCodePrologue(info); | 248 MakeCodePrologue(info); |
244 // Generate code. | 249 // Generate code. |
245 const int kInitialBufferSize = 4 * KB; | 250 const int kInitialBufferSize = 4 * KB; |
246 MacroAssembler masm(NULL, kInitialBufferSize); | 251 MacroAssembler masm(NULL, kInitialBufferSize); |
247 #ifdef ENABLE_GDB_JIT_INTERFACE | 252 #ifdef ENABLE_GDB_JIT_INTERFACE |
248 masm.positions_recorder()->StartGDBJITLineInfoRecording(); | 253 masm.positions_recorder()->StartGDBJITLineInfoRecording(); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 int result = save_doubles_ ? 1 : 0; | 496 int result = save_doubles_ ? 1 : 0; |
492 #ifdef _WIN64 | 497 #ifdef _WIN64 |
493 return result | ((result_size_ == 1) ? 0 : 2); | 498 return result | ((result_size_ == 1) ? 0 : 2); |
494 #else | 499 #else |
495 return result; | 500 return result; |
496 #endif | 501 #endif |
497 } | 502 } |
498 | 503 |
499 | 504 |
500 } } // namespace v8::internal | 505 } } // namespace v8::internal |
OLD | NEW |