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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 // temporary on the stack. | 499 // temporary on the stack. |
500 __ movq(kScratchRegister, Operand(rsp, 0)); | 500 __ movq(kScratchRegister, Operand(rsp, 0)); |
501 __ movq(Operand(rbp, SlotOffset(var->slot())), kScratchRegister); | 501 __ movq(Operand(rbp, SlotOffset(var->slot())), kScratchRegister); |
502 break; | 502 break; |
503 } | 503 } |
504 } | 504 } |
505 } | 505 } |
506 } | 506 } |
507 | 507 |
508 | 508 |
| 509 void FastCodeGenerator::VisitProperty(Property* expr) { |
| 510 Comment cmnt(masm_, "[ Property"); |
| 511 Expression* key = expr->key(); |
| 512 uint32_t dummy; |
| 513 |
| 514 // Evaluate receiver. |
| 515 Visit(expr->obj()); |
| 516 |
| 517 if (key->AsLiteral() != NULL && key->AsLiteral()->handle()->IsSymbol() && |
| 518 !String::cast(*(key->AsLiteral()->handle()))->AsArrayIndex(&dummy)) { |
| 519 // Do a NAMED property load. |
| 520 // The IC expects the property name in rcx and the receiver on the stack. |
| 521 __ Move(rcx, key->AsLiteral()->handle()); |
| 522 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); |
| 523 __ call(ic, RelocInfo::CODE_TARGET); |
| 524 // By emitting a nop we make sure that we do not have a "test eax,..." |
| 525 // instruction after the call it is treated specially by the LoadIC code. |
| 526 __ nop(); |
| 527 } else { |
| 528 // Do a KEYED property load. |
| 529 Visit(expr->key()); |
| 530 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); |
| 531 __ call(ic, RelocInfo::CODE_TARGET); |
| 532 // By emitting a nop we make sure that we do not have a "test ..." |
| 533 // instruction after the call it is treated specially by the LoadIC code. |
| 534 __ nop(); |
| 535 // Drop key left on the stack by IC. |
| 536 __ addq(rsp, Immediate(kPointerSize)); |
| 537 } |
| 538 switch (expr->location().type()) { |
| 539 case Location::TEMP: |
| 540 __ movq(Operand(rsp, 0), rax); |
| 541 break; |
| 542 case Location::NOWHERE: |
| 543 __ addq(rsp, Immediate(kPointerSize)); |
| 544 break; |
| 545 } |
| 546 } |
| 547 |
| 548 |
509 void FastCodeGenerator::VisitCall(Call* expr) { | 549 void FastCodeGenerator::VisitCall(Call* expr) { |
510 Expression* fun = expr->expression(); | 550 Expression* fun = expr->expression(); |
511 ZoneList<Expression*>* args = expr->arguments(); | 551 ZoneList<Expression*>* args = expr->arguments(); |
512 Variable* var = fun->AsVariableProxy()->AsVariable(); | 552 Variable* var = fun->AsVariableProxy()->AsVariable(); |
513 ASSERT(var != NULL && !var->is_this() && var->is_global()); | 553 ASSERT(var != NULL && !var->is_this() && var->is_global()); |
514 ASSERT(!var->is_possibly_eval()); | 554 ASSERT(!var->is_possibly_eval()); |
515 | 555 |
516 __ Push(var->name()); | 556 __ Push(var->name()); |
517 // Push global object (receiver). | 557 // Push global object (receiver). |
518 __ push(CodeGenerator::GlobalObject()); | 558 __ push(CodeGenerator::GlobalObject()); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 } else { | 672 } else { |
633 Visit(right); | 673 Visit(right); |
634 Move(destination, right->location()); | 674 Move(destination, right->location()); |
635 } | 675 } |
636 | 676 |
637 __ bind(&done); | 677 __ bind(&done); |
638 } | 678 } |
639 | 679 |
640 | 680 |
641 } } // namespace v8::internal | 681 } } // namespace v8::internal |
OLD | NEW |