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 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 ASSERT_NOT_NULL(property); | 721 ASSERT_NOT_NULL(property); |
722 // Rewritten parameter accesses are of the form "slot[literal]". | 722 // Rewritten parameter accesses are of the form "slot[literal]". |
723 | 723 |
724 // Assert that the object is in a slot. | 724 // Assert that the object is in a slot. |
725 Variable* object_var = property->obj()->AsVariableProxy()->AsVariable(); | 725 Variable* object_var = property->obj()->AsVariableProxy()->AsVariable(); |
726 ASSERT_NOT_NULL(object_var); | 726 ASSERT_NOT_NULL(object_var); |
727 Slot* object_slot = object_var->slot(); | 727 Slot* object_slot = object_var->slot(); |
728 ASSERT_NOT_NULL(object_slot); | 728 ASSERT_NOT_NULL(object_slot); |
729 | 729 |
730 // Load the object. | 730 // Load the object. |
731 Move(r2, object_slot); | 731 Move(r1, object_slot); |
732 | 732 |
733 // Assert that the key is a smi. | 733 // Assert that the key is a smi. |
734 Literal* key_literal = property->key()->AsLiteral(); | 734 Literal* key_literal = property->key()->AsLiteral(); |
735 ASSERT_NOT_NULL(key_literal); | 735 ASSERT_NOT_NULL(key_literal); |
736 ASSERT(key_literal->handle()->IsSmi()); | 736 ASSERT(key_literal->handle()->IsSmi()); |
737 | 737 |
738 // Load the key. | 738 // Load the key. |
739 __ mov(r1, Operand(key_literal->handle())); | 739 __ mov(r0, Operand(key_literal->handle())); |
740 | 740 |
741 // Push both as arguments to ic. | 741 // Push both as arguments to ic. |
742 __ Push(r2, r1); | 742 __ Push(r1, r0); |
743 | 743 |
744 // Do a keyed property load. | 744 // Call keyed load IC. It has all arguments on the stack and the key in r0. |
745 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 745 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); |
746 __ Call(ic, RelocInfo::CODE_TARGET); | 746 __ Call(ic, RelocInfo::CODE_TARGET); |
747 | 747 |
748 // Drop key and object left on the stack by IC, and push the result. | 748 // Drop key and object left on the stack by IC, and push the result. |
749 DropAndApply(2, context, r0); | 749 DropAndApply(2, context, r0); |
750 } | 750 } |
751 } | 751 } |
752 | 752 |
753 | 753 |
754 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { | 754 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 Literal* key = prop->key()->AsLiteral(); | 998 Literal* key = prop->key()->AsLiteral(); |
999 __ mov(r2, Operand(key->handle())); | 999 __ mov(r2, Operand(key->handle())); |
1000 __ ldr(r0, MemOperand(sp, 0)); | 1000 __ ldr(r0, MemOperand(sp, 0)); |
1001 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 1001 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); |
1002 __ Call(ic, RelocInfo::CODE_TARGET); | 1002 __ Call(ic, RelocInfo::CODE_TARGET); |
1003 } | 1003 } |
1004 | 1004 |
1005 | 1005 |
1006 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 1006 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
1007 SetSourcePosition(prop->position()); | 1007 SetSourcePosition(prop->position()); |
| 1008 // Call keyed load IC. It has all arguments on the stack and the key in r0. |
| 1009 __ ldr(r0, MemOperand(sp, 0)); |
1008 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 1010 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); |
1009 __ Call(ic, RelocInfo::CODE_TARGET); | 1011 __ Call(ic, RelocInfo::CODE_TARGET); |
1010 } | 1012 } |
1011 | 1013 |
1012 | 1014 |
1013 void FullCodeGenerator::EmitBinaryOp(Token::Value op, | 1015 void FullCodeGenerator::EmitBinaryOp(Token::Value op, |
1014 Expression::Context context) { | 1016 Expression::Context context) { |
1015 __ pop(r1); | 1017 __ pop(r1); |
1016 GenericBinaryOpStub stub(op, NO_OVERWRITE, r1, r0); | 1018 GenericBinaryOpStub stub(op, NO_OVERWRITE, r1, r0); |
1017 __ CallStub(&stub); | 1019 __ CallStub(&stub); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1240 // Call to a named property, use call IC. | 1242 // Call to a named property, use call IC. |
1241 VisitForValue(prop->obj(), kStack); | 1243 VisitForValue(prop->obj(), kStack); |
1242 EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET); | 1244 EmitCallWithIC(expr, key->handle(), RelocInfo::CODE_TARGET); |
1243 } else { | 1245 } else { |
1244 // Call to a keyed property, use keyed load IC followed by function | 1246 // Call to a keyed property, use keyed load IC followed by function |
1245 // call. | 1247 // call. |
1246 VisitForValue(prop->obj(), kStack); | 1248 VisitForValue(prop->obj(), kStack); |
1247 VisitForValue(prop->key(), kStack); | 1249 VisitForValue(prop->key(), kStack); |
1248 // Record source code position for IC call. | 1250 // Record source code position for IC call. |
1249 SetSourcePosition(prop->position()); | 1251 SetSourcePosition(prop->position()); |
| 1252 // Call keyed load IC. It has all arguments on the stack and the key in |
| 1253 // r0. |
| 1254 __ ldr(r0, MemOperand(sp, 0)); |
1250 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 1255 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); |
1251 __ Call(ic, RelocInfo::CODE_TARGET); | 1256 __ Call(ic, RelocInfo::CODE_TARGET); |
1252 // Load receiver object into r1. | 1257 // Load receiver object into r1. |
1253 if (prop->is_synthetic()) { | 1258 if (prop->is_synthetic()) { |
1254 __ ldr(r1, CodeGenerator::GlobalObject()); | 1259 __ ldr(r1, CodeGenerator::GlobalObject()); |
1255 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); | 1260 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); |
1256 } else { | 1261 } else { |
1257 __ ldr(r1, MemOperand(sp, kPointerSize)); | 1262 __ ldr(r1, MemOperand(sp, kPointerSize)); |
1258 } | 1263 } |
1259 // Overwrite (object, key) with (function, receiver). | 1264 // Overwrite (object, key) with (function, receiver). |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1854 __ pop(result_register()); | 1859 __ pop(result_register()); |
1855 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); | 1860 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); |
1856 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 1861 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
1857 __ add(pc, r1, Operand(masm_->CodeObject())); | 1862 __ add(pc, r1, Operand(masm_->CodeObject())); |
1858 } | 1863 } |
1859 | 1864 |
1860 | 1865 |
1861 #undef __ | 1866 #undef __ |
1862 | 1867 |
1863 } } // namespace v8::internal | 1868 } } // namespace v8::internal |
OLD | NEW |