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