| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 void EntryNode::Compile(MacroAssembler* masm) { | 52 void EntryNode::Compile(MacroAssembler* masm) { |
| 53 ASSERT(!is_marked()); | 53 ASSERT(!is_marked()); |
| 54 is_marked_ = true; | 54 is_marked_ = true; |
| 55 Label deferred_enter, deferred_exit; | 55 Label deferred_enter, deferred_exit; |
| 56 { | 56 { |
| 57 Comment cmnt(masm, "[ EntryNode"); | 57 Comment cmnt(masm, "[ EntryNode"); |
| 58 __ push(ebp); | 58 __ push(ebp); |
| 59 __ mov(ebp, esp); | 59 __ mov(ebp, esp); |
| 60 __ push(esi); | 60 __ push(esi); |
| 61 __ push(edi); | 61 __ push(edi); |
| 62 if (local_count_ > 0) { | 62 int count = CfgGlobals::current()->fun()->scope()->num_stack_slots(); |
| 63 if (count > 0) { |
| 63 __ Set(eax, Immediate(Factory::undefined_value())); | 64 __ Set(eax, Immediate(Factory::undefined_value())); |
| 64 for (int i = 0; i < local_count_; i++) { | 65 for (int i = 0; i < count; i++) { |
| 65 __ push(eax); | 66 __ push(eax); |
| 66 } | 67 } |
| 67 } | 68 } |
| 68 if (FLAG_trace) { | 69 if (FLAG_trace) { |
| 69 __ CallRuntime(Runtime::kTraceEnter, 0); | 70 __ CallRuntime(Runtime::kTraceEnter, 0); |
| 70 } | 71 } |
| 71 if (FLAG_check_stack) { | 72 if (FLAG_check_stack) { |
| 72 ExternalReference stack_limit = | 73 ExternalReference stack_limit = |
| 73 ExternalReference::address_of_stack_guard_limit(); | 74 ExternalReference::address_of_stack_guard_limit(); |
| 74 __ cmp(esp, Operand::StaticVariable(stack_limit)); | 75 __ cmp(esp, Operand::StaticVariable(stack_limit)); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 90 ASSERT(!is_marked()); | 91 ASSERT(!is_marked()); |
| 91 is_marked_ = true; | 92 is_marked_ = true; |
| 92 Comment cmnt(masm, "[ ExitNode"); | 93 Comment cmnt(masm, "[ ExitNode"); |
| 93 if (FLAG_trace) { | 94 if (FLAG_trace) { |
| 94 __ push(eax); | 95 __ push(eax); |
| 95 __ CallRuntime(Runtime::kTraceExit, 1); | 96 __ CallRuntime(Runtime::kTraceExit, 1); |
| 96 } | 97 } |
| 97 __ RecordJSReturn(); | 98 __ RecordJSReturn(); |
| 98 __ mov(esp, ebp); | 99 __ mov(esp, ebp); |
| 99 __ pop(ebp); | 100 __ pop(ebp); |
| 100 __ ret((parameter_count_ + 1) * kPointerSize); | 101 int count = CfgGlobals::current()->fun()->scope()->num_parameters(); |
| 102 __ ret((count + 1) * kPointerSize); |
| 101 } | 103 } |
| 102 | 104 |
| 103 | 105 |
| 104 void ReturnInstr::Compile(MacroAssembler* masm) { | 106 void ReturnInstr::Compile(MacroAssembler* masm) { |
| 105 Comment cmnt(masm, "[ ReturnInstr"); | 107 Comment cmnt(masm, "[ ReturnInstr"); |
| 106 value_->ToRegister(masm, eax); | 108 value_->ToRegister(masm, eax); |
| 107 } | 109 } |
| 108 | 110 |
| 109 | 111 |
| 110 void Constant::ToRegister(MacroAssembler* masm, Register reg) { | 112 void Constant::ToRegister(MacroAssembler* masm, Register reg) { |
| 111 __ mov(reg, Immediate(handle_)); | 113 __ mov(reg, Immediate(handle_)); |
| 112 } | 114 } |
| 113 | 115 |
| 116 |
| 117 void SlotLocation::ToRegister(MacroAssembler* masm, Register reg) { |
| 118 switch (type_) { |
| 119 case Slot::PARAMETER: { |
| 120 int count = CfgGlobals::current()->fun()->scope()->num_parameters(); |
| 121 __ mov(reg, Operand(ebp, (1 + count - index_) * kPointerSize)); |
| 122 break; |
| 123 } |
| 124 case Slot::LOCAL: { |
| 125 const int kOffset = JavaScriptFrameConstants::kLocal0Offset; |
| 126 __ mov(reg, Operand(ebp, kOffset - index_ * kPointerSize)); |
| 127 break; |
| 128 } |
| 129 default: |
| 130 UNREACHABLE(); |
| 131 } |
| 132 } |
| 133 |
| 134 |
| 114 #undef __ | 135 #undef __ |
| 115 | 136 |
| 116 } } // namespace v8::internal | 137 } } // namespace v8::internal |
| OLD | NEW |