| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 break; | 233 break; |
| 234 } | 234 } |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 | 237 |
| 238 | 238 |
| 239 template <> | 239 template <> |
| 240 Operand FastCodeGenerator::CreateSlotOperand<Operand>(Slot* source, | 240 Operand FastCodeGenerator::CreateSlotOperand<Operand>(Slot* source, |
| 241 Register scratch) { | 241 Register scratch) { |
| 242 switch (source->type()) { | 242 switch (source->type()) { |
| 243 case Slot::PARAMETER: | 243 case Slot::PARAMETER: // Fall through. |
| 244 case Slot::LOCAL: | 244 case Slot::LOCAL: |
| 245 return Operand(rbp, SlotOffset(source)); | 245 return Operand(rbp, SlotOffset(source)); |
| 246 case Slot::CONTEXT: { | 246 case Slot::CONTEXT: { |
| 247 int context_chain_length = | 247 int context_chain_length = |
| 248 function_->scope()->ContextChainLength(source->var()->scope()); | 248 function_->scope()->ContextChainLength(source->var()->scope()); |
| 249 __ LoadContext(scratch, context_chain_length); | 249 __ LoadContext(scratch, context_chain_length); |
| 250 return CodeGenerator::ContextOperand(scratch, source->index()); | 250 return CodeGenerator::ContextOperand(scratch, source->index()); |
| 251 break; | |
| 252 } | 251 } |
| 253 case Slot::LOOKUP: | 252 case Slot::LOOKUP: |
| 254 UNIMPLEMENTED(); | 253 UNIMPLEMENTED(); |
| 255 // Fall-through. | |
| 256 default: | |
| 257 UNREACHABLE(); | |
| 258 return Operand(rax, 0); // Dead code to make the compiler happy. | |
| 259 } | 254 } |
| 255 UNREACHABLE(); |
| 256 return Operand(rax, 0); |
| 260 } | 257 } |
| 261 | 258 |
| 262 | 259 |
| 263 void FastCodeGenerator::Move(Register dst, Slot* source) { | 260 void FastCodeGenerator::Move(Register dst, Slot* source) { |
| 264 Operand location = CreateSlotOperand<Operand>(source, dst); | 261 Operand location = CreateSlotOperand<Operand>(source, dst); |
| 265 __ movq(dst, location); | 262 __ movq(dst, location); |
| 266 } | 263 } |
| 267 | 264 |
| 268 | 265 |
| 269 void FastCodeGenerator::Move(Expression::Context context, | 266 void FastCodeGenerator::Move(Expression::Context context, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 int context_chain_length = | 321 int context_chain_length = |
| 325 function_->scope()->ContextChainLength(dst->var()->scope()); | 322 function_->scope()->ContextChainLength(dst->var()->scope()); |
| 326 __ LoadContext(scratch1, context_chain_length); | 323 __ LoadContext(scratch1, context_chain_length); |
| 327 __ movq(Operand(scratch1, Context::SlotOffset(dst->index())), src); | 324 __ movq(Operand(scratch1, Context::SlotOffset(dst->index())), src); |
| 328 int offset = FixedArray::kHeaderSize + dst->index() * kPointerSize; | 325 int offset = FixedArray::kHeaderSize + dst->index() * kPointerSize; |
| 329 __ RecordWrite(scratch1, offset, src, scratch2); | 326 __ RecordWrite(scratch1, offset, src, scratch2); |
| 330 break; | 327 break; |
| 331 } | 328 } |
| 332 case Slot::LOOKUP: | 329 case Slot::LOOKUP: |
| 333 UNIMPLEMENTED(); | 330 UNIMPLEMENTED(); |
| 334 default: | |
| 335 UNREACHABLE(); | |
| 336 } | 331 } |
| 337 } | 332 } |
| 338 | 333 |
| 339 | 334 |
| 340 void FastCodeGenerator::DropAndMove(Expression::Context context, | 335 void FastCodeGenerator::DropAndMove(Expression::Context context, |
| 341 Register source, | 336 Register source, |
| 342 int drop_count) { | 337 int drop_count) { |
| 343 ASSERT(drop_count > 0); | 338 ASSERT(drop_count > 0); |
| 344 switch (context) { | 339 switch (context) { |
| 345 case Expression::kUninitialized: | 340 case Expression::kUninitialized: |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 Comment cmnt(masm_, "Stack slot"); | 571 Comment cmnt(masm_, "Stack slot"); |
| 577 break; | 572 break; |
| 578 } | 573 } |
| 579 case Slot::CONTEXT: { | 574 case Slot::CONTEXT: { |
| 580 Comment cmnt(masm_, "Context slot"); | 575 Comment cmnt(masm_, "Context slot"); |
| 581 break; | 576 break; |
| 582 } | 577 } |
| 583 case Slot::LOOKUP: | 578 case Slot::LOOKUP: |
| 584 UNIMPLEMENTED(); | 579 UNIMPLEMENTED(); |
| 585 break; | 580 break; |
| 586 default: | |
| 587 UNREACHABLE(); | |
| 588 } | 581 } |
| 589 } | 582 } |
| 590 Move(context, slot, rax); | 583 Move(context, slot, rax); |
| 591 } else { | 584 } else { |
| 592 // A variable has been rewritten into an explicit access to | 585 // A variable has been rewritten into an explicit access to |
| 593 // an object property. | 586 // an object property. |
| 594 Property* property = rewrite->AsProperty(); | 587 Property* property = rewrite->AsProperty(); |
| 595 ASSERT_NOT_NULL(property); | 588 ASSERT_NOT_NULL(property); |
| 596 | 589 |
| 597 // Currently the only parameter expressions that can occur are | 590 // Currently the only parameter expressions that can occur are |
| (...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1719 __ movq(Operand(rsp, 0), rdx); | 1712 __ movq(Operand(rsp, 0), rdx); |
| 1720 // And return. | 1713 // And return. |
| 1721 __ ret(0); | 1714 __ ret(0); |
| 1722 } | 1715 } |
| 1723 | 1716 |
| 1724 | 1717 |
| 1725 #undef __ | 1718 #undef __ |
| 1726 | 1719 |
| 1727 | 1720 |
| 1728 } } // namespace v8::internal | 1721 } } // namespace v8::internal |
| OLD | NEW |