| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 if (FLAG_trace_codegen) { | 296 if (FLAG_trace_codegen) { |
| 297 PrintF("Full Compiler - "); | 297 PrintF("Full Compiler - "); |
| 298 } | 298 } |
| 299 CodeGenerator::MakeCodePrologue(info); | 299 CodeGenerator::MakeCodePrologue(info); |
| 300 const int kInitialBufferSize = 4 * KB; | 300 const int kInitialBufferSize = 4 * KB; |
| 301 MacroAssembler masm(info->isolate(), NULL, kInitialBufferSize); | 301 MacroAssembler masm(info->isolate(), NULL, kInitialBufferSize); |
| 302 #ifdef ENABLE_GDB_JIT_INTERFACE | 302 #ifdef ENABLE_GDB_JIT_INTERFACE |
| 303 masm.positions_recorder()->StartGDBJITLineInfoRecording(); | 303 masm.positions_recorder()->StartGDBJITLineInfoRecording(); |
| 304 #endif | 304 #endif |
| 305 | 305 |
| 306 FullCodeGenerator cgen(&masm, info); | 306 FullCodeGenerator cgen(&masm, info, isolate->zone()); |
| 307 cgen.Generate(); | 307 cgen.Generate(); |
| 308 if (cgen.HasStackOverflow()) { | 308 if (cgen.HasStackOverflow()) { |
| 309 ASSERT(!isolate->has_pending_exception()); | 309 ASSERT(!isolate->has_pending_exception()); |
| 310 return false; | 310 return false; |
| 311 } | 311 } |
| 312 unsigned table_offset = cgen.EmitStackCheckTable(); | 312 unsigned table_offset = cgen.EmitStackCheckTable(); |
| 313 | 313 |
| 314 Code::Flags flags = Code::ComputeFlags(Code::FUNCTION); | 314 Code::Flags flags = Code::ComputeFlags(Code::FUNCTION); |
| 315 Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&masm, flags, info); | 315 Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&masm, flags, info); |
| 316 code->set_optimizable(info->IsOptimizable() && | 316 code->set_optimizable(info->IsOptimizable() && |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 // Assert that we don't have multiple bailout entries for the same node. | 433 // Assert that we don't have multiple bailout entries for the same node. |
| 434 for (int i = 0; i < bailout_entries_.length(); i++) { | 434 for (int i = 0; i < bailout_entries_.length(); i++) { |
| 435 if (bailout_entries_.at(i).id == entry.id) { | 435 if (bailout_entries_.at(i).id == entry.id) { |
| 436 AstPrinter printer; | 436 AstPrinter printer; |
| 437 PrintF("%s", printer.PrintProgram(info_->function())); | 437 PrintF("%s", printer.PrintProgram(info_->function())); |
| 438 UNREACHABLE(); | 438 UNREACHABLE(); |
| 439 } | 439 } |
| 440 } | 440 } |
| 441 } | 441 } |
| 442 #endif // DEBUG | 442 #endif // DEBUG |
| 443 bailout_entries_.Add(entry); | 443 bailout_entries_.Add(entry, zone()); |
| 444 } | 444 } |
| 445 | 445 |
| 446 | 446 |
| 447 void FullCodeGenerator::RecordTypeFeedbackCell( | 447 void FullCodeGenerator::RecordTypeFeedbackCell( |
| 448 unsigned id, Handle<JSGlobalPropertyCell> cell) { | 448 unsigned id, Handle<JSGlobalPropertyCell> cell) { |
| 449 TypeFeedbackCellEntry entry = { id, cell }; | 449 TypeFeedbackCellEntry entry = { id, cell }; |
| 450 type_feedback_cells_.Add(entry); | 450 type_feedback_cells_.Add(entry, zone()); |
| 451 } | 451 } |
| 452 | 452 |
| 453 | 453 |
| 454 void FullCodeGenerator::RecordStackCheck(unsigned ast_id) { | 454 void FullCodeGenerator::RecordStackCheck(unsigned ast_id) { |
| 455 // The pc offset does not need to be encoded and packed together with a | 455 // The pc offset does not need to be encoded and packed together with a |
| 456 // state. | 456 // state. |
| 457 ASSERT(masm_->pc_offset() > 0); | 457 ASSERT(masm_->pc_offset() > 0); |
| 458 BailoutEntry entry = { ast_id, static_cast<unsigned>(masm_->pc_offset()) }; | 458 BailoutEntry entry = { ast_id, static_cast<unsigned>(masm_->pc_offset()) }; |
| 459 stack_checks_.Add(entry); | 459 stack_checks_.Add(entry, zone()); |
| 460 } | 460 } |
| 461 | 461 |
| 462 | 462 |
| 463 bool FullCodeGenerator::ShouldInlineSmiCase(Token::Value op) { | 463 bool FullCodeGenerator::ShouldInlineSmiCase(Token::Value op) { |
| 464 // Inline smi case inside loops, but not division and modulo which | 464 // Inline smi case inside loops, but not division and modulo which |
| 465 // are too complicated and take up too much space. | 465 // are too complicated and take up too much space. |
| 466 if (op == Token::DIV ||op == Token::MOD) return false; | 466 if (op == Token::DIV ||op == Token::MOD) return false; |
| 467 if (FLAG_always_inline_smi_code) return true; | 467 if (FLAG_always_inline_smi_code) return true; |
| 468 return loop_depth_ > 0; | 468 return loop_depth_ > 0; |
| 469 } | 469 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 DoTest(context->condition(), | 563 DoTest(context->condition(), |
| 564 context->true_label(), | 564 context->true_label(), |
| 565 context->false_label(), | 565 context->false_label(), |
| 566 context->fall_through()); | 566 context->fall_through()); |
| 567 } | 567 } |
| 568 | 568 |
| 569 | 569 |
| 570 void FullCodeGenerator::VisitDeclarations( | 570 void FullCodeGenerator::VisitDeclarations( |
| 571 ZoneList<Declaration*>* declarations) { | 571 ZoneList<Declaration*>* declarations) { |
| 572 ZoneList<Handle<Object> >* saved_globals = globals_; | 572 ZoneList<Handle<Object> >* saved_globals = globals_; |
| 573 ZoneList<Handle<Object> > inner_globals(10); | 573 ZoneList<Handle<Object> > inner_globals(10, zone()); |
| 574 globals_ = &inner_globals; | 574 globals_ = &inner_globals; |
| 575 | 575 |
| 576 AstVisitor::VisitDeclarations(declarations); | 576 AstVisitor::VisitDeclarations(declarations); |
| 577 if (!globals_->is_empty()) { | 577 if (!globals_->is_empty()) { |
| 578 // Invoke the platform-dependent code generator to do the actual | 578 // Invoke the platform-dependent code generator to do the actual |
| 579 // declaration the global functions and variables. | 579 // declaration the global functions and variables. |
| 580 Handle<FixedArray> array = | 580 Handle<FixedArray> array = |
| 581 isolate()->factory()->NewFixedArray(globals_->length(), TENURED); | 581 isolate()->factory()->NewFixedArray(globals_->length(), TENURED); |
| 582 for (int i = 0; i < globals_->length(); ++i) | 582 for (int i = 0; i < globals_->length(); ++i) |
| 583 array->set(i, *globals_->at(i)); | 583 array->set(i, *globals_->at(i)); |
| (...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1423 } | 1423 } |
| 1424 | 1424 |
| 1425 return false; | 1425 return false; |
| 1426 } | 1426 } |
| 1427 | 1427 |
| 1428 | 1428 |
| 1429 #undef __ | 1429 #undef __ |
| 1430 | 1430 |
| 1431 | 1431 |
| 1432 } } // namespace v8::internal | 1432 } } // namespace v8::internal |
| OLD | NEW |