OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 // Probe the secondary table. | 146 // Probe the secondary table. |
147 ProbeTable(masm, flags, kSecondary, name, scratch, extra); | 147 ProbeTable(masm, flags, kSecondary, name, scratch, extra); |
148 | 148 |
149 // Cache miss: Fall-through and let caller handle the miss by | 149 // Cache miss: Fall-through and let caller handle the miss by |
150 // entering the runtime system. | 150 // entering the runtime system. |
151 __ bind(&miss); | 151 __ bind(&miss); |
152 } | 152 } |
153 | 153 |
154 | 154 |
| 155 template <typename Pushable> |
| 156 static void PushInterceptorArguments(MacroAssembler* masm, |
| 157 Register receiver, |
| 158 Register holder, |
| 159 Pushable name, |
| 160 JSObject* holder_obj, |
| 161 Smi* lookup_hint) { |
| 162 __ push(receiver); |
| 163 __ push(holder); |
| 164 __ push(name); |
| 165 // TODO(367): Maybe don't push lookup_hint for LOOKUP_IN_HOLDER and/or |
| 166 // LOOKUP_IN_PROTOTYPE, but use a special version of lookup method? |
| 167 __ push(Immediate(lookup_hint)); |
| 168 |
| 169 InterceptorInfo* interceptor = holder_obj->GetNamedInterceptor(); |
| 170 __ mov(receiver, Immediate(Handle<Object>(interceptor))); |
| 171 __ push(receiver); |
| 172 __ push(FieldOperand(receiver, InterceptorInfo::kDataOffset)); |
| 173 } |
| 174 |
| 175 |
155 void StubCompiler::GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm, | 176 void StubCompiler::GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm, |
156 int index, | 177 int index, |
157 Register prototype) { | 178 Register prototype) { |
158 // Load the global or builtins object from the current context. | 179 // Load the global or builtins object from the current context. |
159 __ mov(prototype, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 180 __ mov(prototype, Operand(esi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
160 // Load the global context from the global or builtins object. | 181 // Load the global context from the global or builtins object. |
161 __ mov(prototype, | 182 __ mov(prototype, |
162 FieldOperand(prototype, GlobalObject::kGlobalContextOffset)); | 183 FieldOperand(prototype, GlobalObject::kGlobalContextOffset)); |
163 // Load the function from the global context. | 184 // Load the function from the global context. |
164 __ mov(prototype, Operand(prototype, Context::SlotOffset(index))); | 185 __ mov(prototype, Operand(prototype, Context::SlotOffset(index))); |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 __ test(receiver, Immediate(kSmiTagMask)); | 518 __ test(receiver, Immediate(kSmiTagMask)); |
498 __ j(zero, miss, not_taken); | 519 __ j(zero, miss, not_taken); |
499 | 520 |
500 // Check that the maps haven't changed. | 521 // Check that the maps haven't changed. |
501 Register reg = | 522 Register reg = |
502 CheckPrototypes(object, receiver, holder, | 523 CheckPrototypes(object, receiver, holder, |
503 scratch1, scratch2, name, miss); | 524 scratch1, scratch2, name, miss); |
504 | 525 |
505 // Push the arguments on the JS stack of the caller. | 526 // Push the arguments on the JS stack of the caller. |
506 __ pop(scratch2); // remove return address | 527 __ pop(scratch2); // remove return address |
507 __ push(receiver); // receiver | 528 PushInterceptorArguments(masm(), |
508 __ push(reg); // holder | 529 receiver, |
509 __ push(name_reg); // name | 530 reg, |
510 // TODO(367): Maybe don't push lookup_hint for LOOKUP_IN_HOLDER and/or | 531 name_reg, |
511 // LOOKUP_IN_PROTOTYPE, but use a special version of lookup method? | 532 holder, |
512 __ push(Immediate(lookup_hint)); | 533 lookup_hint); |
513 __ push(scratch2); // restore return address | 534 __ push(scratch2); // restore return address |
514 | 535 |
515 // Do tail-call to the runtime system. | 536 // Do tail-call to the runtime system. |
516 ExternalReference load_ic_property = | 537 ExternalReference load_ic_property = |
517 ExternalReference(IC_Utility(IC::kLoadInterceptorProperty)); | 538 ExternalReference(IC_Utility(IC::kLoadInterceptorProperty)); |
518 __ TailCallRuntime(load_ic_property, 4); | 539 __ TailCallRuntime(load_ic_property, 6); |
519 } | 540 } |
520 | 541 |
521 | 542 |
522 // TODO(1241006): Avoid having lazy compile stubs specialized by the | 543 // TODO(1241006): Avoid having lazy compile stubs specialized by the |
523 // number of arguments. It is not needed anymore. | 544 // number of arguments. It is not needed anymore. |
524 Object* StubCompiler::CompileLazyCompile(Code::Flags flags) { | 545 Object* StubCompiler::CompileLazyCompile(Code::Flags flags) { |
525 // Enter an internal frame. | 546 // Enter an internal frame. |
526 __ EnterInternalFrame(); | 547 __ EnterInternalFrame(); |
527 | 548 |
528 // Push a copy of the function onto the stack. | 549 // Push a copy of the function onto the stack. |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 | 758 |
738 // Check that maps have not changed and compute the holder register. | 759 // Check that maps have not changed and compute the holder register. |
739 Register reg = | 760 Register reg = |
740 CheckPrototypes(JSObject::cast(object), edx, holder, | 761 CheckPrototypes(JSObject::cast(object), edx, holder, |
741 ebx, ecx, name, &miss); | 762 ebx, ecx, name, &miss); |
742 | 763 |
743 // Enter an internal frame. | 764 // Enter an internal frame. |
744 __ EnterInternalFrame(); | 765 __ EnterInternalFrame(); |
745 | 766 |
746 // Push arguments on the expression stack. | 767 // Push arguments on the expression stack. |
747 __ push(edx); // receiver | 768 PushInterceptorArguments(masm(), |
748 __ push(reg); // holder | 769 edx, |
749 __ push(Operand(ebp, (argc + 3) * kPointerSize)); // name | 770 reg, |
750 __ push(Immediate(holder->InterceptorPropertyLookupHint(name))); | 771 Operand(ebp, (argc + 3) * kPointerSize), |
| 772 holder, |
| 773 holder->InterceptorPropertyLookupHint(name)); |
751 | 774 |
752 // Perform call. | 775 // Perform call. |
753 ExternalReference load_interceptor = | 776 ExternalReference load_interceptor = |
754 ExternalReference(IC_Utility(IC::kLoadInterceptorProperty)); | 777 ExternalReference(IC_Utility(IC::kLoadInterceptorProperty)); |
755 __ mov(eax, Immediate(4)); | 778 __ mov(eax, Immediate(6)); |
756 __ mov(ebx, Immediate(load_interceptor)); | 779 __ mov(ebx, Immediate(load_interceptor)); |
757 | 780 |
758 CEntryStub stub; | 781 CEntryStub stub; |
759 __ CallStub(&stub); | 782 __ CallStub(&stub); |
760 | 783 |
761 // Move result to edi and restore receiver. | 784 // Move result to edi and restore receiver. |
762 __ mov(edi, eax); | 785 __ mov(edi, eax); |
763 __ mov(edx, Operand(ebp, (argc + 2) * kPointerSize)); // receiver | 786 __ mov(edx, Operand(ebp, (argc + 2) * kPointerSize)); // receiver |
764 | 787 |
765 // Exit frame. | 788 // Exit frame. |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1430 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1453 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
1431 | 1454 |
1432 // Return the generated code. | 1455 // Return the generated code. |
1433 return GetCode(CALLBACKS, name); | 1456 return GetCode(CALLBACKS, name); |
1434 } | 1457 } |
1435 | 1458 |
1436 | 1459 |
1437 #undef __ | 1460 #undef __ |
1438 | 1461 |
1439 } } // namespace v8::internal | 1462 } } // namespace v8::internal |
OLD | NEW |