| 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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 Property* property = var->AsProperty(); | 693 Property* property = var->AsProperty(); |
| 694 | 694 |
| 695 if (var->is_global() && !var->is_this()) { | 695 if (var->is_global() && !var->is_this()) { |
| 696 Comment cmnt(masm_, "Global variable"); | 696 Comment cmnt(masm_, "Global variable"); |
| 697 // Use inline caching. Variable name is passed in r2 and the global | 697 // Use inline caching. Variable name is passed in r2 and the global |
| 698 // object on the stack. | 698 // object on the stack. |
| 699 __ ldr(ip, CodeGenerator::GlobalObject()); | 699 __ ldr(ip, CodeGenerator::GlobalObject()); |
| 700 __ push(ip); | 700 __ push(ip); |
| 701 __ mov(r2, Operand(var->name())); | 701 __ mov(r2, Operand(var->name())); |
| 702 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 702 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); |
| 703 { Assembler::BlockConstPoolScope block_const_pool(masm_); | 703 __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT); |
| 704 __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT); | |
| 705 // A B instruction following the call signals that the load was inlined. | |
| 706 // Ensure that there is not a B instruction here. | |
| 707 __ nop(); | |
| 708 } | |
| 709 DropAndApply(1, context, r0); | 704 DropAndApply(1, context, r0); |
| 710 | 705 |
| 711 } else if (slot != NULL && slot->type() == Slot::LOOKUP) { | 706 } else if (slot != NULL && slot->type() == Slot::LOOKUP) { |
| 712 Comment cmnt(masm_, "Lookup slot"); | 707 Comment cmnt(masm_, "Lookup slot"); |
| 713 __ mov(r1, Operand(var->name())); | 708 __ mov(r1, Operand(var->name())); |
| 714 __ stm(db_w, sp, cp.bit() | r1.bit()); // Context and name. | 709 __ stm(db_w, sp, cp.bit() | r1.bit()); // Context and name. |
| 715 __ CallRuntime(Runtime::kLoadContextSlot, 2); | 710 __ CallRuntime(Runtime::kLoadContextSlot, 2); |
| 716 Apply(context, r0); | 711 Apply(context, r0); |
| 717 | 712 |
| 718 } else if (slot != NULL) { | 713 } else if (slot != NULL) { |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 break; | 991 break; |
| 997 } | 992 } |
| 998 } | 993 } |
| 999 | 994 |
| 1000 | 995 |
| 1001 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 996 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| 1002 SetSourcePosition(prop->position()); | 997 SetSourcePosition(prop->position()); |
| 1003 Literal* key = prop->key()->AsLiteral(); | 998 Literal* key = prop->key()->AsLiteral(); |
| 1004 __ mov(r2, Operand(key->handle())); | 999 __ mov(r2, Operand(key->handle())); |
| 1005 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 1000 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); |
| 1006 { Assembler::BlockConstPoolScope block_const_pool(masm_); | 1001 __ Call(ic, RelocInfo::CODE_TARGET); |
| 1007 __ Call(ic, RelocInfo::CODE_TARGET); | |
| 1008 // A B instruction following the call signals that the load was inlined. | |
| 1009 // Ensure that there is not a B instruction here. | |
| 1010 __ nop(); | |
| 1011 } | |
| 1012 } | 1002 } |
| 1013 | 1003 |
| 1014 | 1004 |
| 1015 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 1005 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
| 1016 SetSourcePosition(prop->position()); | 1006 SetSourcePosition(prop->position()); |
| 1017 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 1007 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); |
| 1018 __ Call(ic, RelocInfo::CODE_TARGET); | 1008 __ Call(ic, RelocInfo::CODE_TARGET); |
| 1019 } | 1009 } |
| 1020 | 1010 |
| 1021 | 1011 |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1438 if (proxy != NULL && | 1428 if (proxy != NULL && |
| 1439 !proxy->var()->is_this() && | 1429 !proxy->var()->is_this() && |
| 1440 proxy->var()->is_global()) { | 1430 proxy->var()->is_global()) { |
| 1441 Comment cmnt(masm_, "Global variable"); | 1431 Comment cmnt(masm_, "Global variable"); |
| 1442 __ ldr(r0, CodeGenerator::GlobalObject()); | 1432 __ ldr(r0, CodeGenerator::GlobalObject()); |
| 1443 __ push(r0); | 1433 __ push(r0); |
| 1444 __ mov(r2, Operand(proxy->name())); | 1434 __ mov(r2, Operand(proxy->name())); |
| 1445 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 1435 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); |
| 1446 // Use a regular load, not a contextual load, to avoid a reference | 1436 // Use a regular load, not a contextual load, to avoid a reference |
| 1447 // error. | 1437 // error. |
| 1448 { Assembler::BlockConstPoolScope block_const_pool(masm_); | 1438 __ Call(ic, RelocInfo::CODE_TARGET); |
| 1449 __ Call(ic, RelocInfo::CODE_TARGET); | |
| 1450 // A B instruction following the call signals that the load was | |
| 1451 // inlined. Ensure that there is not a B instruction here. | |
| 1452 __ nop(); | |
| 1453 } | |
| 1454 __ str(r0, MemOperand(sp)); | 1439 __ str(r0, MemOperand(sp)); |
| 1455 } else if (proxy != NULL && | 1440 } else if (proxy != NULL && |
| 1456 proxy->var()->slot() != NULL && | 1441 proxy->var()->slot() != NULL && |
| 1457 proxy->var()->slot()->type() == Slot::LOOKUP) { | 1442 proxy->var()->slot()->type() == Slot::LOOKUP) { |
| 1458 __ mov(r0, Operand(proxy->name())); | 1443 __ mov(r0, Operand(proxy->name())); |
| 1459 __ stm(db_w, sp, cp.bit() | r0.bit()); | 1444 __ stm(db_w, sp, cp.bit() | r0.bit()); |
| 1460 __ CallRuntime(Runtime::kLoadContextSlotNoReferenceError, 2); | 1445 __ CallRuntime(Runtime::kLoadContextSlotNoReferenceError, 2); |
| 1461 __ push(r0); | 1446 __ push(r0); |
| 1462 } else { | 1447 } else { |
| 1463 // This expression cannot throw a reference error at the top level. | 1448 // This expression cannot throw a reference error at the top level. |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1871 __ pop(result_register()); | 1856 __ pop(result_register()); |
| 1872 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); | 1857 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); |
| 1873 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 1858 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
| 1874 __ add(pc, r1, Operand(masm_->CodeObject())); | 1859 __ add(pc, r1, Operand(masm_->CodeObject())); |
| 1875 } | 1860 } |
| 1876 | 1861 |
| 1877 | 1862 |
| 1878 #undef __ | 1863 #undef __ |
| 1879 | 1864 |
| 1880 } } // namespace v8::internal | 1865 } } // namespace v8::internal |
| OLD | NEW |