| 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 13 matching lines...) Expand all Loading... |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "bootstrapper.h" | 30 #include "bootstrapper.h" |
| 31 #include "codegen-inl.h" | 31 #include "codegen-inl.h" |
| 32 #include "compiler.h" | 32 #include "compiler.h" |
| 33 #include "debug.h" | 33 #include "debug.h" |
| 34 #include "oprofile-agent.h" | |
| 35 #include "prettyprinter.h" | 34 #include "prettyprinter.h" |
| 36 #include "register-allocator-inl.h" | 35 #include "register-allocator-inl.h" |
| 37 #include "rewriter.h" | 36 #include "rewriter.h" |
| 38 #include "runtime.h" | 37 #include "runtime.h" |
| 39 #include "scopeinfo.h" | 38 #include "scopeinfo.h" |
| 40 #include "stub-cache.h" | 39 #include "stub-cache.h" |
| 41 #include "virtual-frame-inl.h" | 40 #include "virtual-frame-inl.h" |
| 42 | 41 |
| 43 namespace v8 { | 42 namespace v8 { |
| 44 namespace internal { | 43 namespace internal { |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 int len = String::cast(script->source())->length(); | 240 int len = String::cast(script->source())->length(); |
| 242 Counters::total_old_codegen_source_size.Increment(len); | 241 Counters::total_old_codegen_source_size.Increment(len); |
| 243 } | 242 } |
| 244 if (FLAG_trace_codegen) { | 243 if (FLAG_trace_codegen) { |
| 245 PrintF("Classic Compiler - "); | 244 PrintF("Classic Compiler - "); |
| 246 } | 245 } |
| 247 MakeCodePrologue(info); | 246 MakeCodePrologue(info); |
| 248 // Generate code. | 247 // Generate code. |
| 249 const int kInitialBufferSize = 4 * KB; | 248 const int kInitialBufferSize = 4 * KB; |
| 250 MacroAssembler masm(NULL, kInitialBufferSize); | 249 MacroAssembler masm(NULL, kInitialBufferSize); |
| 250 #ifdef ENABLE_GDB_JIT_INTERFACE |
| 251 masm.positions_recorder()->StartGDBJITLineInfoRecording(); |
| 252 #endif |
| 251 CodeGenerator cgen(&masm); | 253 CodeGenerator cgen(&masm); |
| 252 CodeGeneratorScope scope(&cgen); | 254 CodeGeneratorScope scope(&cgen); |
| 253 cgen.Generate(info); | 255 cgen.Generate(info); |
| 254 if (cgen.HasStackOverflow()) { | 256 if (cgen.HasStackOverflow()) { |
| 255 ASSERT(!Top::has_pending_exception()); | 257 ASSERT(!Top::has_pending_exception()); |
| 256 return false; | 258 return false; |
| 257 } | 259 } |
| 258 | 260 |
| 259 InLoopFlag in_loop = info->is_in_loop() ? IN_LOOP : NOT_IN_LOOP; | 261 InLoopFlag in_loop = info->is_in_loop() ? IN_LOOP : NOT_IN_LOOP; |
| 260 Code::Flags flags = Code::ComputeFlags(Code::FUNCTION, in_loop); | 262 Code::Flags flags = Code::ComputeFlags(Code::FUNCTION, in_loop); |
| 261 Handle<Code> code = MakeCodeEpilogue(cgen.masm(), flags, info); | 263 Handle<Code> code = MakeCodeEpilogue(cgen.masm(), flags, info); |
| 262 // There is no stack check table in code generated by the classic backend. | 264 // There is no stack check table in code generated by the classic backend. |
| 263 code->SetNoStackCheckTable(); | 265 code->SetNoStackCheckTable(); |
| 264 CodeGenerator::PrintCode(code, info); | 266 CodeGenerator::PrintCode(code, info); |
| 265 info->SetCode(code); // May be an empty handle. | 267 info->SetCode(code); // May be an empty handle. |
| 268 #ifdef ENABLE_GDB_JIT_INTERFACE |
| 269 if (FLAG_gdbjit && !code.is_null()) { |
| 270 GDBJITLineInfo* lineinfo = |
| 271 masm.positions_recorder()->DetachGDBJITLineInfo(); |
| 272 |
| 273 GDBJIT(RegisterDetailedLineInfo(*code, lineinfo)); |
| 274 } |
| 275 #endif |
| 266 return !code.is_null(); | 276 return !code.is_null(); |
| 267 } | 277 } |
| 268 | 278 |
| 269 | 279 |
| 270 #ifdef ENABLE_LOGGING_AND_PROFILING | 280 #ifdef ENABLE_LOGGING_AND_PROFILING |
| 271 | 281 |
| 272 bool CodeGenerator::ShouldGenerateLog(Expression* type) { | 282 bool CodeGenerator::ShouldGenerateLog(Expression* type) { |
| 273 ASSERT(type != NULL); | 283 ASSERT(type != NULL); |
| 274 if (!Logger::is_logging() && !CpuProfiler::is_profiling()) return false; | 284 if (!Logger::is_logging() && !CpuProfiler::is_profiling()) return false; |
| 275 Handle<String> name = Handle<String>::cast(type->AsLiteral()->handle()); | 285 Handle<String> name = Handle<String>::cast(type->AsLiteral()->handle()); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 ASSERT(result_size_ == 1 || result_size_ == 2); | 486 ASSERT(result_size_ == 1 || result_size_ == 2); |
| 477 #ifdef _WIN64 | 487 #ifdef _WIN64 |
| 478 return result | ((result_size_ == 1) ? 0 : 2); | 488 return result | ((result_size_ == 1) ? 0 : 2); |
| 479 #else | 489 #else |
| 480 return result; | 490 return result; |
| 481 #endif | 491 #endif |
| 482 } | 492 } |
| 483 | 493 |
| 484 | 494 |
| 485 } } // namespace v8::internal | 495 } } // namespace v8::internal |
| OLD | NEW |