OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 219 |
220 | 220 |
221 void VirtualFrame::EmitPush(Heap::RootListIndex index, TypeInfo info) { | 221 void VirtualFrame::EmitPush(Heap::RootListIndex index, TypeInfo info) { |
222 ASSERT(stack_pointer_ == element_count() - 1); | 222 ASSERT(stack_pointer_ == element_count() - 1); |
223 elements_.Add(FrameElement::MemoryElement(info)); | 223 elements_.Add(FrameElement::MemoryElement(info)); |
224 stack_pointer_++; | 224 stack_pointer_++; |
225 __ PushRoot(index); | 225 __ PushRoot(index); |
226 } | 226 } |
227 | 227 |
228 | 228 |
| 229 void VirtualFrame::Push(Expression* expr) { |
| 230 ASSERT(expr->IsTrivial()); |
| 231 |
| 232 Literal* lit = expr->AsLiteral(); |
| 233 if (lit != NULL) { |
| 234 Push(lit->handle()); |
| 235 return; |
| 236 } |
| 237 |
| 238 VariableProxy* proxy = expr->AsVariableProxy(); |
| 239 if (proxy != NULL) { |
| 240 Slot* slot = proxy->var()->slot(); |
| 241 if (slot->type() == Slot::LOCAL) { |
| 242 PushLocalAt(slot->index()); |
| 243 return; |
| 244 } |
| 245 if (slot->type() == Slot::PARAMETER) { |
| 246 PushParameterAt(slot->index()); |
| 247 return; |
| 248 } |
| 249 } |
| 250 UNREACHABLE(); |
| 251 } |
| 252 |
| 253 |
229 void VirtualFrame::Drop(int count) { | 254 void VirtualFrame::Drop(int count) { |
230 ASSERT(count >= 0); | 255 ASSERT(count >= 0); |
231 ASSERT(height() >= count); | 256 ASSERT(height() >= count); |
232 int num_virtual_elements = (element_count() - 1) - stack_pointer_; | 257 int num_virtual_elements = (element_count() - 1) - stack_pointer_; |
233 | 258 |
234 // Emit code to lower the stack pointer if necessary. | 259 // Emit code to lower the stack pointer if necessary. |
235 if (num_virtual_elements < count) { | 260 if (num_virtual_elements < count) { |
236 int num_dropped = count - num_virtual_elements; | 261 int num_dropped = count - num_virtual_elements; |
237 stack_pointer_ -= num_dropped; | 262 stack_pointer_ -= num_dropped; |
238 __ addq(rsp, Immediate(num_dropped * kPointerSize)); | 263 __ addq(rsp, Immediate(num_dropped * kPointerSize)); |
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 // Grow the expression stack by handler size less one (the return | 1156 // Grow the expression stack by handler size less one (the return |
1132 // address is already pushed by a call instruction). | 1157 // address is already pushed by a call instruction). |
1133 Adjust(kHandlerSize - 1); | 1158 Adjust(kHandlerSize - 1); |
1134 __ PushTryHandler(IN_JAVASCRIPT, type); | 1159 __ PushTryHandler(IN_JAVASCRIPT, type); |
1135 } | 1160 } |
1136 | 1161 |
1137 | 1162 |
1138 #undef __ | 1163 #undef __ |
1139 | 1164 |
1140 } } // namespace v8::internal | 1165 } } // namespace v8::internal |
OLD | NEW |