| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 #endif // DEBUG | 61 #endif // DEBUG |
| 62 | 62 |
| 63 #undef __ | 63 #undef __ |
| 64 | 64 |
| 65 | 65 |
| 66 CodeGenerator* CodeGeneratorScope::top_ = NULL; | 66 CodeGenerator* CodeGeneratorScope::top_ = NULL; |
| 67 | 67 |
| 68 | 68 |
| 69 DeferredCode::DeferredCode() | |
| 70 : masm_(CodeGeneratorScope::Current()->masm()), | |
| 71 statement_position_(masm_->current_statement_position()), | |
| 72 position_(masm_->current_position()) { | |
| 73 ASSERT(statement_position_ != RelocInfo::kNoPosition); | |
| 74 ASSERT(position_ != RelocInfo::kNoPosition); | |
| 75 | |
| 76 CodeGeneratorScope::Current()->AddDeferred(this); | |
| 77 #ifdef DEBUG | |
| 78 comment_ = ""; | |
| 79 #endif | |
| 80 | |
| 81 // Copy the register locations from the code generator's frame. | |
| 82 // These are the registers that will be spilled on entry to the | |
| 83 // deferred code and restored on exit. | |
| 84 VirtualFrame* frame = CodeGeneratorScope::Current()->frame(); | |
| 85 int sp_offset = frame->fp_relative(frame->stack_pointer_); | |
| 86 for (int i = 0; i < RegisterAllocator::kNumRegisters; i++) { | |
| 87 int loc = frame->register_location(i); | |
| 88 if (loc == VirtualFrame::kIllegalIndex) { | |
| 89 registers_[i] = kIgnore; | |
| 90 } else if (frame->elements_[loc].is_synced()) { | |
| 91 // Needs to be restored on exit but not saved on entry. | |
| 92 registers_[i] = frame->fp_relative(loc) | kSyncedFlag; | |
| 93 } else { | |
| 94 int offset = frame->fp_relative(loc); | |
| 95 registers_[i] = (offset < sp_offset) ? kPush : offset; | |
| 96 } | |
| 97 } | |
| 98 } | |
| 99 | |
| 100 | |
| 101 void CodeGenerator::ProcessDeferred() { | 69 void CodeGenerator::ProcessDeferred() { |
| 102 while (!deferred_.is_empty()) { | 70 while (!deferred_.is_empty()) { |
| 103 DeferredCode* code = deferred_.RemoveLast(); | 71 DeferredCode* code = deferred_.RemoveLast(); |
| 104 ASSERT(masm_ == code->masm()); | 72 ASSERT(masm_ == code->masm()); |
| 105 // Record position of deferred code stub. | 73 // Record position of deferred code stub. |
| 106 masm_->RecordStatementPosition(code->statement_position()); | 74 masm_->RecordStatementPosition(code->statement_position()); |
| 107 if (code->position() != RelocInfo::kNoPosition) { | 75 if (code->position() != RelocInfo::kNoPosition) { |
| 108 masm_->RecordPosition(code->position()); | 76 masm_->RecordPosition(code->position()); |
| 109 } | 77 } |
| 110 // Generate the code. | 78 // Generate the code. |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 } | 482 } |
| 515 } | 483 } |
| 516 | 484 |
| 517 | 485 |
| 518 void ApiGetterEntryStub::SetCustomCache(Code* value) { | 486 void ApiGetterEntryStub::SetCustomCache(Code* value) { |
| 519 info()->set_load_stub_cache(value); | 487 info()->set_load_stub_cache(value); |
| 520 } | 488 } |
| 521 | 489 |
| 522 | 490 |
| 523 } } // namespace v8::internal | 491 } } // namespace v8::internal |
| OLD | NEW |