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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 __ jmp(true_label_); | 224 __ jmp(true_label_); |
225 } | 225 } |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 | 229 |
230 template <> | 230 template <> |
231 Operand FastCodeGenerator::CreateSlotOperand<Operand>(Slot* source, | 231 Operand FastCodeGenerator::CreateSlotOperand<Operand>(Slot* source, |
232 Register scratch) { | 232 Register scratch) { |
233 switch (source->type()) { | 233 switch (source->type()) { |
234 case Slot::PARAMETER: | 234 case Slot::PARAMETER: // Fall through. |
235 case Slot::LOCAL: | 235 case Slot::LOCAL: |
236 return Operand(ebp, SlotOffset(source)); | 236 return Operand(ebp, SlotOffset(source)); |
237 case Slot::CONTEXT: { | 237 case Slot::CONTEXT: { |
238 int context_chain_length = | 238 int context_chain_length = |
239 function_->scope()->ContextChainLength(source->var()->scope()); | 239 function_->scope()->ContextChainLength(source->var()->scope()); |
240 __ LoadContext(scratch, context_chain_length); | 240 __ LoadContext(scratch, context_chain_length); |
241 return CodeGenerator::ContextOperand(scratch, source->index()); | 241 return CodeGenerator::ContextOperand(scratch, source->index()); |
242 break; | |
243 } | 242 } |
244 case Slot::LOOKUP: | 243 case Slot::LOOKUP: |
245 UNIMPLEMENTED(); | 244 UNIMPLEMENTED(); |
246 // Fall-through. | |
247 default: | |
248 UNREACHABLE(); | |
249 return Operand(eax, 0); // Dead code to make the compiler happy. | |
250 } | 245 } |
| 246 UNREACHABLE(); |
| 247 return Operand(eax, 0); |
251 } | 248 } |
252 | 249 |
253 | 250 |
254 void FastCodeGenerator::Move(Register dst, Slot* source) { | 251 void FastCodeGenerator::Move(Register dst, Slot* source) { |
255 Operand location = CreateSlotOperand<Operand>(source, dst); | 252 Operand location = CreateSlotOperand<Operand>(source, dst); |
256 __ mov(dst, location); | 253 __ mov(dst, location); |
257 } | 254 } |
258 | 255 |
259 | 256 |
260 void FastCodeGenerator::Move(Expression::Context context, | 257 void FastCodeGenerator::Move(Expression::Context context, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 int context_chain_length = | 312 int context_chain_length = |
316 function_->scope()->ContextChainLength(dst->var()->scope()); | 313 function_->scope()->ContextChainLength(dst->var()->scope()); |
317 __ LoadContext(scratch1, context_chain_length); | 314 __ LoadContext(scratch1, context_chain_length); |
318 __ mov(Operand(scratch1, Context::SlotOffset(dst->index())), src); | 315 __ mov(Operand(scratch1, Context::SlotOffset(dst->index())), src); |
319 int offset = FixedArray::kHeaderSize + dst->index() * kPointerSize; | 316 int offset = FixedArray::kHeaderSize + dst->index() * kPointerSize; |
320 __ RecordWrite(scratch1, offset, src, scratch2); | 317 __ RecordWrite(scratch1, offset, src, scratch2); |
321 break; | 318 break; |
322 } | 319 } |
323 case Slot::LOOKUP: | 320 case Slot::LOOKUP: |
324 UNIMPLEMENTED(); | 321 UNIMPLEMENTED(); |
325 default: | |
326 UNREACHABLE(); | |
327 } | 322 } |
328 } | 323 } |
329 | 324 |
330 | 325 |
331 void FastCodeGenerator::DropAndMove(Expression::Context context, | 326 void FastCodeGenerator::DropAndMove(Expression::Context context, |
332 Register source, | 327 Register source, |
333 int count) { | 328 int count) { |
334 ASSERT(count > 0); | 329 ASSERT(count > 0); |
335 switch (context) { | 330 switch (context) { |
336 case Expression::kUninitialized: | 331 case Expression::kUninitialized: |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 Comment cmnt(masm_, "Stack slot"); | 561 Comment cmnt(masm_, "Stack slot"); |
567 break; | 562 break; |
568 } | 563 } |
569 case Slot::CONTEXT: { | 564 case Slot::CONTEXT: { |
570 Comment cmnt(masm_, "Context slot"); | 565 Comment cmnt(masm_, "Context slot"); |
571 break; | 566 break; |
572 } | 567 } |
573 case Slot::LOOKUP: | 568 case Slot::LOOKUP: |
574 UNIMPLEMENTED(); | 569 UNIMPLEMENTED(); |
575 break; | 570 break; |
576 default: | |
577 UNREACHABLE(); | |
578 } | 571 } |
579 } | 572 } |
580 Move(context, slot, eax); | 573 Move(context, slot, eax); |
581 } else { | 574 } else { |
582 Comment cmnt(masm_, "Variable rewritten to Property"); | 575 Comment cmnt(masm_, "Variable rewritten to Property"); |
583 // A variable has been rewritten into an explicit access to | 576 // A variable has been rewritten into an explicit access to |
584 // an object property. | 577 // an object property. |
585 Property* property = rewrite->AsProperty(); | 578 Property* property = rewrite->AsProperty(); |
586 ASSERT_NOT_NULL(property); | 579 ASSERT_NOT_NULL(property); |
587 | 580 |
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1702 __ add(Operand(edx), Immediate(masm_->CodeObject())); | 1695 __ add(Operand(edx), Immediate(masm_->CodeObject())); |
1703 __ mov(Operand(esp, 0), edx); | 1696 __ mov(Operand(esp, 0), edx); |
1704 // And return. | 1697 // And return. |
1705 __ ret(0); | 1698 __ ret(0); |
1706 } | 1699 } |
1707 | 1700 |
1708 | 1701 |
1709 #undef __ | 1702 #undef __ |
1710 | 1703 |
1711 } } // namespace v8::internal | 1704 } } // namespace v8::internal |
OLD | NEW |