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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 __ mov(esp, ebp); | 88 __ mov(esp, ebp); |
89 __ pop(ebp); | 89 __ pop(ebp); |
90 __ ret((fun->scope()->num_parameters() + 1) * kPointerSize); | 90 __ ret((fun->scope()->num_parameters() + 1) * kPointerSize); |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
94 | 94 |
95 void FastCodeGenerator::VisitExpressionStatement(ExpressionStatement* stmt) { | 95 void FastCodeGenerator::VisitExpressionStatement(ExpressionStatement* stmt) { |
96 Comment cmnt(masm_, "[ ExpressionStatement"); | 96 Comment cmnt(masm_, "[ ExpressionStatement"); |
97 Visit(stmt->expression()); | 97 Visit(stmt->expression()); |
98 __ pop(eax); | |
99 } | 98 } |
100 | 99 |
101 | 100 |
102 void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) { | 101 void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) { |
103 Comment cmnt(masm_, "[ ReturnStatement"); | 102 Comment cmnt(masm_, "[ ReturnStatement"); |
104 Visit(stmt->expression()); | 103 Visit(stmt->expression()); |
105 __ pop(eax); | 104 __ pop(eax); |
106 __ RecordJSReturn(); | 105 __ RecordJSReturn(); |
107 // Do not use the leave instruction here because it is too short to | 106 // Do not use the leave instruction here because it is too short to |
108 // patch with the code required by the debugger. | 107 // patch with the code required by the debugger. |
109 __ mov(esp, ebp); | 108 __ mov(esp, ebp); |
110 __ pop(ebp); | 109 __ pop(ebp); |
111 __ ret((function_->scope()->num_parameters() + 1) * kPointerSize); | 110 __ ret((function_->scope()->num_parameters() + 1) * kPointerSize); |
112 } | 111 } |
113 | 112 |
114 | 113 |
115 void FastCodeGenerator::VisitSlot(Slot* expr) { | 114 void FastCodeGenerator::VisitSlot(Slot* expr) { |
116 Comment cmnt(masm_, "[ Slot"); | 115 Comment cmnt(masm_, "[ Slot"); |
117 __ push(Operand(ebp, SlotOffset(expr))); | 116 if (expr->location().is_temporary()) { |
| 117 __ push(Operand(ebp, SlotOffset(expr))); |
| 118 } else { |
| 119 ASSERT(expr->location().is_nowhere()); |
| 120 } |
118 } | 121 } |
119 | 122 |
120 | 123 |
121 void FastCodeGenerator::VisitLiteral(Literal* expr) { | 124 void FastCodeGenerator::VisitLiteral(Literal* expr) { |
122 Comment cmnt(masm_, "[ Literal"); | 125 Comment cmnt(masm_, "[ Literal"); |
123 __ push(Immediate(expr->handle())); | 126 if (expr->location().is_temporary()) { |
| 127 __ push(Immediate(expr->handle())); |
| 128 } else { |
| 129 ASSERT(expr->location().is_nowhere()); |
| 130 } |
124 } | 131 } |
125 | 132 |
126 | 133 |
127 void FastCodeGenerator::VisitAssignment(Assignment* expr) { | 134 void FastCodeGenerator::VisitAssignment(Assignment* expr) { |
128 Comment cmnt(masm_, "[ Assignment"); | 135 Comment cmnt(masm_, "[ Assignment"); |
129 ASSERT(expr->op() == Token::ASSIGN || expr->op() == Token::INIT_VAR); | 136 ASSERT(expr->op() == Token::ASSIGN || expr->op() == Token::INIT_VAR); |
130 | 137 |
131 Visit(expr->value()); | 138 Visit(expr->value()); |
132 | 139 |
133 Variable* var = expr->target()->AsVariableProxy()->AsVariable(); | 140 Variable* var = expr->target()->AsVariableProxy()->AsVariable(); |
134 ASSERT(var != NULL && var->slot() != NULL); | 141 ASSERT(var != NULL && var->slot() != NULL); |
135 __ mov(eax, Operand(esp, 0)); | 142 |
136 __ mov(Operand(ebp, SlotOffset(var->slot())), eax); | 143 if (expr->location().is_temporary()) { |
| 144 __ mov(eax, Operand(esp, 0)); |
| 145 __ mov(Operand(ebp, SlotOffset(var->slot())), eax); |
| 146 } else { |
| 147 ASSERT(expr->location().is_nowhere()); |
| 148 __ pop(Operand(ebp, SlotOffset(var->slot()))); |
| 149 } |
137 } | 150 } |
138 | 151 |
139 | 152 |
140 } } // namespace v8::internal | 153 } } // namespace v8::internal |
OLD | NEW |