| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 if (!script->IsUndefined() && !script->source()->IsUndefined()) { | 280 if (!script->IsUndefined() && !script->source()->IsUndefined()) { |
| 281 int len = String::cast(script->source())->length(); | 281 int len = String::cast(script->source())->length(); |
| 282 isolate->counters()->total_full_codegen_source_size()->Increment(len); | 282 isolate->counters()->total_full_codegen_source_size()->Increment(len); |
| 283 } | 283 } |
| 284 if (FLAG_trace_codegen) { | 284 if (FLAG_trace_codegen) { |
| 285 PrintF("Full Compiler - "); | 285 PrintF("Full Compiler - "); |
| 286 } | 286 } |
| 287 CodeGenerator::MakeCodePrologue(info); | 287 CodeGenerator::MakeCodePrologue(info); |
| 288 const int kInitialBufferSize = 4 * KB; | 288 const int kInitialBufferSize = 4 * KB; |
| 289 MacroAssembler masm(NULL, kInitialBufferSize); | 289 MacroAssembler masm(NULL, kInitialBufferSize); |
| 290 #ifdef ENABLE_GDB_JIT_INTERFACE |
| 291 masm.positions_recorder()->StartGDBJITLineInfoRecording(); |
| 292 #endif |
| 290 | 293 |
| 291 FullCodeGenerator cgen(&masm); | 294 FullCodeGenerator cgen(&masm); |
| 292 cgen.Generate(info); | 295 cgen.Generate(info); |
| 293 if (cgen.HasStackOverflow()) { | 296 if (cgen.HasStackOverflow()) { |
| 294 ASSERT(!isolate->has_pending_exception()); | 297 ASSERT(!isolate->has_pending_exception()); |
| 295 return false; | 298 return false; |
| 296 } | 299 } |
| 297 unsigned table_offset = cgen.EmitStackCheckTable(); | 300 unsigned table_offset = cgen.EmitStackCheckTable(); |
| 298 | 301 |
| 299 Code::Flags flags = Code::ComputeFlags(Code::FUNCTION, NOT_IN_LOOP); | 302 Code::Flags flags = Code::ComputeFlags(Code::FUNCTION, NOT_IN_LOOP); |
| 300 Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&masm, flags, info); | 303 Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&masm, flags, info); |
| 301 code->set_optimizable(info->IsOptimizable()); | 304 code->set_optimizable(info->IsOptimizable()); |
| 302 cgen.PopulateDeoptimizationData(code); | 305 cgen.PopulateDeoptimizationData(code); |
| 303 code->set_has_deoptimization_support(info->HasDeoptimizationSupport()); | 306 code->set_has_deoptimization_support(info->HasDeoptimizationSupport()); |
| 304 code->set_allow_osr_at_loop_nesting_level(0); | 307 code->set_allow_osr_at_loop_nesting_level(0); |
| 305 code->set_stack_check_table_start(table_offset); | 308 code->set_stack_check_table_start(table_offset); |
| 306 CodeGenerator::PrintCode(code, info); | 309 CodeGenerator::PrintCode(code, info); |
| 307 info->SetCode(code); // may be an empty handle. | 310 info->SetCode(code); // may be an empty handle. |
| 311 #ifdef ENABLE_GDB_JIT_INTERFACE |
| 312 if (FLAG_gdbjit && !code.is_null()) { |
| 313 GDBJITLineInfo* lineinfo = |
| 314 masm.positions_recorder()->DetachGDBJITLineInfo(); |
| 315 |
| 316 GDBJIT(RegisterDetailedLineInfo(*code, lineinfo)); |
| 317 } |
| 318 #endif |
| 308 return !code.is_null(); | 319 return !code.is_null(); |
| 309 } | 320 } |
| 310 | 321 |
| 311 | 322 |
| 312 unsigned FullCodeGenerator::EmitStackCheckTable() { | 323 unsigned FullCodeGenerator::EmitStackCheckTable() { |
| 313 // The stack check table consists of a length (in number of entries) | 324 // The stack check table consists of a length (in number of entries) |
| 314 // field, and then a sequence of entries. Each entry is a pair of AST id | 325 // field, and then a sequence of entries. Each entry is a pair of AST id |
| 315 // and code-relative pc offset. | 326 // and code-relative pc offset. |
| 316 masm()->Align(kIntSize); | 327 masm()->Align(kIntSize); |
| 317 masm()->RecordComment("[ Stack check table"); | 328 masm()->RecordComment("[ Stack check table"); |
| (...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1377 __ Drop(stack_depth); | 1388 __ Drop(stack_depth); |
| 1378 __ PopTryHandler(); | 1389 __ PopTryHandler(); |
| 1379 return 0; | 1390 return 0; |
| 1380 } | 1391 } |
| 1381 | 1392 |
| 1382 | 1393 |
| 1383 #undef __ | 1394 #undef __ |
| 1384 | 1395 |
| 1385 | 1396 |
| 1386 } } // namespace v8::internal | 1397 } } // namespace v8::internal |
| OLD | NEW |