| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 27 matching lines...) Expand all Loading... |
| 38 #include "scopeinfo.h" | 38 #include "scopeinfo.h" |
| 39 #include "stub-cache.h" | 39 #include "stub-cache.h" |
| 40 | 40 |
| 41 namespace v8 { | 41 namespace v8 { |
| 42 namespace internal { | 42 namespace internal { |
| 43 | 43 |
| 44 | 44 |
| 45 CodeGenerator* CodeGeneratorScope::top_ = NULL; | 45 CodeGenerator* CodeGeneratorScope::top_ = NULL; |
| 46 | 46 |
| 47 | 47 |
| 48 DeferredCode::DeferredCode(CodeGenerator* generator) | 48 DeferredCode::DeferredCode() : exit_(JumpTarget::BIDIRECTIONAL) { |
| 49 : generator_(generator), | 49 MacroAssembler* masm = cgen()->masm(); |
| 50 masm_(generator->masm()), | 50 statement_position_ = masm->current_statement_position(); |
| 51 exit_(JumpTarget::BIDIRECTIONAL), | 51 position_ = masm->current_position(); |
| 52 statement_position_(masm_->current_statement_position()), | |
| 53 position_(masm_->current_position()) { | |
| 54 generator->AddDeferred(this); | |
| 55 ASSERT(statement_position_ != RelocInfo::kNoPosition); | 52 ASSERT(statement_position_ != RelocInfo::kNoPosition); |
| 56 ASSERT(position_ != RelocInfo::kNoPosition); | 53 ASSERT(position_ != RelocInfo::kNoPosition); |
| 54 |
| 55 cgen()->AddDeferred(this); |
| 57 #ifdef DEBUG | 56 #ifdef DEBUG |
| 58 comment_ = ""; | 57 comment_ = ""; |
| 59 #endif | 58 #endif |
| 60 } | 59 } |
| 61 | 60 |
| 62 | 61 |
| 63 void CodeGenerator::ClearDeferred() { | |
| 64 for (int i = 0; i < deferred_.length(); i++) { | |
| 65 deferred_[i]->Clear(); | |
| 66 } | |
| 67 } | |
| 68 | |
| 69 | |
| 70 void CodeGenerator::ProcessDeferred() { | 62 void CodeGenerator::ProcessDeferred() { |
| 71 while (!deferred_.is_empty()) { | 63 while (!deferred_.is_empty()) { |
| 72 DeferredCode* code = deferred_.RemoveLast(); | 64 DeferredCode* code = deferred_.RemoveLast(); |
| 73 MacroAssembler* masm = code->masm(); | 65 MacroAssembler* masm = code->cgen()->masm(); |
| 74 // Record position of deferred code stub. | 66 // Record position of deferred code stub. |
| 75 masm->RecordStatementPosition(code->statement_position()); | 67 masm->RecordStatementPosition(code->statement_position()); |
| 76 if (code->position() != RelocInfo::kNoPosition) { | 68 if (code->position() != RelocInfo::kNoPosition) { |
| 77 masm->RecordPosition(code->position()); | 69 masm->RecordPosition(code->position()); |
| 78 } | 70 } |
| 79 // Generate the code. | 71 // Generate the code. |
| 80 Comment cmnt(masm, code->comment()); | 72 Comment cmnt(masm, code->comment()); |
| 81 code->Generate(); | 73 code->Generate(); |
| 82 ASSERT(code->enter()->is_bound()); | 74 ASSERT(code->enter()->is_bound()); |
| 83 code->Clear(); | |
| 84 } | 75 } |
| 85 } | 76 } |
| 86 | 77 |
| 87 | 78 |
| 88 void CodeGenerator::SetFrame(VirtualFrame* new_frame, | 79 void CodeGenerator::SetFrame(VirtualFrame* new_frame, |
| 89 RegisterFile* non_frame_registers) { | 80 RegisterFile* non_frame_registers) { |
| 90 RegisterFile saved_counts; | 81 RegisterFile saved_counts; |
| 91 if (has_valid_frame()) { | 82 if (has_valid_frame()) { |
| 92 frame_->DetachFromCodeGenerator(); | 83 frame_->DetachFromCodeGenerator(); |
| 93 // The remaining register reference counts are the non-frame ones. | 84 // The remaining register reference counts are the non-frame ones. |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 void ArgumentsAccessStub::Generate(MacroAssembler* masm) { | 626 void ArgumentsAccessStub::Generate(MacroAssembler* masm) { |
| 636 switch (type_) { | 627 switch (type_) { |
| 637 case READ_LENGTH: GenerateReadLength(masm); break; | 628 case READ_LENGTH: GenerateReadLength(masm); break; |
| 638 case READ_ELEMENT: GenerateReadElement(masm); break; | 629 case READ_ELEMENT: GenerateReadElement(masm); break; |
| 639 case NEW_OBJECT: GenerateNewObject(masm); break; | 630 case NEW_OBJECT: GenerateNewObject(masm); break; |
| 640 } | 631 } |
| 641 } | 632 } |
| 642 | 633 |
| 643 | 634 |
| 644 } } // namespace v8::internal | 635 } } // namespace v8::internal |
| OLD | NEW |