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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 } | 49 } |
50 | 50 |
51 | 51 |
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 { | 55 { |
56 Comment cmnt(masm, "[ EntryNode"); | 56 Comment cmnt(masm, "[ EntryNode"); |
57 __ stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit()); | 57 __ stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit()); |
58 __ add(fp, sp, Operand(2 * kPointerSize)); | 58 __ add(fp, sp, Operand(2 * kPointerSize)); |
59 if (local_count_ > 0) { | 59 int count = CfgGlobals::current()->fun()->scope()->num_stack_slots(); |
| 60 if (count > 0) { |
60 __ mov(ip, Operand(Factory::undefined_value())); | 61 __ mov(ip, Operand(Factory::undefined_value())); |
61 for (int i = 0; i < local_count_; i++) { | 62 for (int i = 0; i < count; i++) { |
62 __ push(ip); | 63 __ push(ip); |
63 } | 64 } |
64 } | 65 } |
65 if (FLAG_trace) { | 66 if (FLAG_trace) { |
66 __ CallRuntime(Runtime::kTraceEnter, 0); | 67 __ CallRuntime(Runtime::kTraceEnter, 0); |
67 } | 68 } |
68 if (FLAG_check_stack) { | 69 if (FLAG_check_stack) { |
69 StackCheckStub stub; | 70 StackCheckStub stub; |
70 __ CallStub(&stub); | 71 __ CallStub(&stub); |
71 } | 72 } |
72 } | 73 } |
73 successor_->Compile(masm); | 74 successor_->Compile(masm); |
74 } | 75 } |
75 | 76 |
76 | 77 |
77 void ExitNode::Compile(MacroAssembler* masm) { | 78 void ExitNode::Compile(MacroAssembler* masm) { |
78 ASSERT(!is_marked()); | 79 ASSERT(!is_marked()); |
79 is_marked_ = true; | 80 is_marked_ = true; |
80 Comment cmnt(masm, "[ ExitNode"); | 81 Comment cmnt(masm, "[ ExitNode"); |
81 if (FLAG_trace) { | 82 if (FLAG_trace) { |
82 __ push(r0); | 83 __ push(r0); |
83 __ CallRuntime(Runtime::kTraceExit, 1); | 84 __ CallRuntime(Runtime::kTraceExit, 1); |
84 } | 85 } |
85 __ mov(sp, fp); | 86 __ mov(sp, fp); |
86 __ ldm(ia_w, sp, fp.bit() | lr.bit()); | 87 __ ldm(ia_w, sp, fp.bit() | lr.bit()); |
87 __ add(sp, sp, Operand((parameter_count_ + 1) * kPointerSize)); | 88 int count = CfgGlobals::current()->fun()->scope()->num_parameters(); |
| 89 __ add(sp, sp, Operand((count + 1) * kPointerSize)); |
88 __ Jump(lr); | 90 __ Jump(lr); |
89 } | 91 } |
90 | 92 |
91 | 93 |
92 void ReturnInstr::Compile(MacroAssembler* masm) { | 94 void ReturnInstr::Compile(MacroAssembler* masm) { |
93 Comment cmnt(masm, "[ ReturnInstr"); | 95 Comment cmnt(masm, "[ ReturnInstr"); |
94 value_->ToRegister(masm, r0); | 96 value_->ToRegister(masm, r0); |
95 } | 97 } |
96 | 98 |
97 | 99 |
98 void Constant::ToRegister(MacroAssembler* masm, Register reg) { | 100 void Constant::ToRegister(MacroAssembler* masm, Register reg) { |
99 __ mov(reg, Operand(handle_)); | 101 __ mov(reg, Operand(handle_)); |
100 } | 102 } |
101 | 103 |
| 104 |
| 105 void SlotLocation::ToRegister(MacroAssembler* masm, Register reg) { |
| 106 switch (type_) { |
| 107 case Slot::PARAMETER: { |
| 108 int count = CfgGlobals::current()->fun()->scope()->num_parameters(); |
| 109 __ ldr(reg, MemOperand(fp, (1 + count - index_) * kPointerSize)); |
| 110 break; |
| 111 } |
| 112 case Slot::LOCAL: { |
| 113 const int kOffset = JavaScriptFrameConstants::kLocal0Offset; |
| 114 __ ldr(reg, MemOperand(fp, kOffset - index_ * kPointerSize)); |
| 115 break; |
| 116 } |
| 117 default: |
| 118 UNREACHABLE(); |
| 119 } |
| 120 } |
| 121 |
102 #undef __ | 122 #undef __ |
103 | 123 |
104 } } // namespace v8::internal | 124 } } // namespace v8::internal |
OLD | NEW |