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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 __ ldr(ip, MemOperand(sp)); | 493 __ ldr(ip, MemOperand(sp)); |
494 break; | 494 break; |
495 } | 495 } |
496 // Do the slot assignment. | 496 // Do the slot assignment. |
497 __ str(ip, MemOperand(fp, SlotOffset(var->slot()))); | 497 __ str(ip, MemOperand(fp, SlotOffset(var->slot()))); |
498 } | 498 } |
499 } | 499 } |
500 } | 500 } |
501 | 501 |
502 | 502 |
| 503 void FastCodeGenerator::VisitProperty(Property* expr) { |
| 504 Comment cmnt(masm_, "[ Property"); |
| 505 Expression* key = expr->key(); |
| 506 uint32_t dummy; |
| 507 |
| 508 // Evaluate receiver. |
| 509 Visit(expr->obj()); |
| 510 |
| 511 if (key->AsLiteral() != NULL && key->AsLiteral()->handle()->IsSymbol() && |
| 512 !String::cast(*(key->AsLiteral()->handle()))->AsArrayIndex(&dummy)) { |
| 513 // Do a NAMED property load. |
| 514 // The IC expects the property name in ecx and the receiver on the stack. |
| 515 __ mov(r2, Operand(key->AsLiteral()->handle())); |
| 516 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); |
| 517 __ Call(ic, RelocInfo::CODE_TARGET); |
| 518 // By emitting a nop we make sure that we do not have a "test eax,..." |
| 519 // instruction after the call it is treated specially by the LoadIC code. |
| 520 __ nop(); |
| 521 } else { |
| 522 // Do a KEYED property load. |
| 523 Visit(expr->key()); |
| 524 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); |
| 525 __ Call(ic, RelocInfo::CODE_TARGET); |
| 526 // By emitting a nop we make sure that we do not have a "test eax,..." |
| 527 // instruction after the call it is treated specially by the LoadIC code. |
| 528 __ nop(); |
| 529 // Drop key and receiver left on the stack by IC. |
| 530 __ pop(); |
| 531 } |
| 532 switch (expr->location().type()) { |
| 533 case Location::TEMP: |
| 534 __ str(r0, MemOperand(sp)); |
| 535 break; |
| 536 case Location::NOWHERE: |
| 537 __ pop(); |
| 538 } |
| 539 } |
| 540 |
| 541 |
503 void FastCodeGenerator::VisitCall(Call* expr) { | 542 void FastCodeGenerator::VisitCall(Call* expr) { |
504 Comment cmnt(masm_, "[ Call"); | 543 Comment cmnt(masm_, "[ Call"); |
505 Expression* fun = expr->expression(); | 544 Expression* fun = expr->expression(); |
506 ZoneList<Expression*>* args = expr->arguments(); | 545 ZoneList<Expression*>* args = expr->arguments(); |
507 Variable* var = fun->AsVariableProxy()->AsVariable(); | 546 Variable* var = fun->AsVariableProxy()->AsVariable(); |
508 ASSERT(var != NULL && !var->is_this() && var->is_global()); | 547 ASSERT(var != NULL && !var->is_this() && var->is_global()); |
509 ASSERT(!var->is_possibly_eval()); | 548 ASSERT(!var->is_possibly_eval()); |
510 | 549 |
511 __ mov(r1, Operand(var->name())); | 550 __ mov(r1, Operand(var->name())); |
512 // Push global object as receiver. | 551 // Push global object as receiver. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 Move(destination, right->AsLiteral()); | 635 Move(destination, right->AsLiteral()); |
597 } else { | 636 } else { |
598 Visit(right); | 637 Visit(right); |
599 Move(destination, right->location()); | 638 Move(destination, right->location()); |
600 } | 639 } |
601 | 640 |
602 __ bind(&done); | 641 __ bind(&done); |
603 } | 642 } |
604 | 643 |
605 } } // namespace v8::internal | 644 } } // namespace v8::internal |
OLD | NEW |