| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 __ j(zero, miss, not_taken); | 463 __ j(zero, miss, not_taken); |
| 443 | 464 |
| 444 // Check that the maps haven't changed. | 465 // Check that the maps haven't changed. |
| 445 Register reg = | 466 Register reg = |
| 446 CheckPrototypes(object, receiver, holder, | 467 CheckPrototypes(object, receiver, holder, |
| 447 scratch1, scratch2, name, miss); | 468 scratch1, scratch2, name, miss); |
| 448 | 469 |
| 449 // Push the arguments on the JS stack of the caller. | 470 // Push the arguments on the JS stack of the caller. |
| 450 __ pop(scratch2); // remove return address | 471 __ pop(scratch2); // remove return address |
| 451 __ push(receiver); // receiver | 472 __ push(receiver); // receiver |
| 452 __ push(Immediate(Handle<AccessorInfo>(callback))); // callback data | 473 __ push(reg); // holder |
| 474 __ mov(reg, Immediate(Handle<AccessorInfo>(callback))); // callback data |
| 475 __ push(reg); |
| 476 __ push(FieldOperand(reg, AccessorInfo::kDataOffset)); |
| 453 __ push(name_reg); // name | 477 __ push(name_reg); // name |
| 454 __ push(reg); // holder | |
| 455 __ push(scratch2); // restore return address | 478 __ push(scratch2); // restore return address |
| 456 | 479 |
| 457 // Do tail-call to the runtime system. | 480 // Do tail-call to the runtime system. |
| 458 ExternalReference load_callback_property = | 481 ExternalReference load_callback_property = |
| 459 ExternalReference(IC_Utility(IC::kLoadCallbackProperty)); | 482 ExternalReference(IC_Utility(IC::kLoadCallbackProperty)); |
| 460 __ TailCallRuntime(load_callback_property, 4); | 483 __ TailCallRuntime(load_callback_property, 5); |
| 461 } | 484 } |
| 462 | 485 |
| 463 | 486 |
| 464 void StubCompiler::GenerateLoadConstant(JSObject* object, | 487 void StubCompiler::GenerateLoadConstant(JSObject* object, |
| 465 JSObject* holder, | 488 JSObject* holder, |
| 466 Register receiver, | 489 Register receiver, |
| 467 Register scratch1, | 490 Register scratch1, |
| 468 Register scratch2, | 491 Register scratch2, |
| 469 Object* value, | 492 Object* value, |
| 470 String* name, | 493 String* name, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 497 __ test(receiver, Immediate(kSmiTagMask)); | 520 __ test(receiver, Immediate(kSmiTagMask)); |
| 498 __ j(zero, miss, not_taken); | 521 __ j(zero, miss, not_taken); |
| 499 | 522 |
| 500 // Check that the maps haven't changed. | 523 // Check that the maps haven't changed. |
| 501 Register reg = | 524 Register reg = |
| 502 CheckPrototypes(object, receiver, holder, | 525 CheckPrototypes(object, receiver, holder, |
| 503 scratch1, scratch2, name, miss); | 526 scratch1, scratch2, name, miss); |
| 504 | 527 |
| 505 // Push the arguments on the JS stack of the caller. | 528 // Push the arguments on the JS stack of the caller. |
| 506 __ pop(scratch2); // remove return address | 529 __ pop(scratch2); // remove return address |
| 507 __ push(receiver); // receiver | 530 PushInterceptorArguments(masm(), |
| 508 __ push(reg); // holder | 531 receiver, |
| 509 __ push(name_reg); // name | 532 reg, |
| 510 // TODO(367): Maybe don't push lookup_hint for LOOKUP_IN_HOLDER and/or | 533 name_reg, |
| 511 // LOOKUP_IN_PROTOTYPE, but use a special version of lookup method? | 534 holder, |
| 512 __ push(Immediate(lookup_hint)); | 535 lookup_hint); |
| 513 __ push(scratch2); // restore return address | 536 __ push(scratch2); // restore return address |
| 514 | 537 |
| 515 // Do tail-call to the runtime system. | 538 // Do tail-call to the runtime system. |
| 516 ExternalReference load_ic_property = | 539 ExternalReference load_ic_property = |
| 517 ExternalReference(IC_Utility(IC::kLoadInterceptorProperty)); | 540 ExternalReference(IC_Utility(IC::kLoadInterceptorProperty)); |
| 518 __ TailCallRuntime(load_ic_property, 4); | 541 __ TailCallRuntime(load_ic_property, 6); |
| 519 } | 542 } |
| 520 | 543 |
| 521 | 544 |
| 522 // TODO(1241006): Avoid having lazy compile stubs specialized by the | 545 // TODO(1241006): Avoid having lazy compile stubs specialized by the |
| 523 // number of arguments. It is not needed anymore. | 546 // number of arguments. It is not needed anymore. |
| 524 Object* StubCompiler::CompileLazyCompile(Code::Flags flags) { | 547 Object* StubCompiler::CompileLazyCompile(Code::Flags flags) { |
| 525 // Enter an internal frame. | 548 // Enter an internal frame. |
| 526 __ EnterInternalFrame(); | 549 __ EnterInternalFrame(); |
| 527 | 550 |
| 528 // Push a copy of the function onto the stack. | 551 // Push a copy of the function onto the stack. |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 737 | 760 |
| 738 // Check that maps have not changed and compute the holder register. | 761 // Check that maps have not changed and compute the holder register. |
| 739 Register reg = | 762 Register reg = |
| 740 CheckPrototypes(JSObject::cast(object), edx, holder, | 763 CheckPrototypes(JSObject::cast(object), edx, holder, |
| 741 ebx, ecx, name, &miss); | 764 ebx, ecx, name, &miss); |
| 742 | 765 |
| 743 // Enter an internal frame. | 766 // Enter an internal frame. |
| 744 __ EnterInternalFrame(); | 767 __ EnterInternalFrame(); |
| 745 | 768 |
| 746 // Push arguments on the expression stack. | 769 // Push arguments on the expression stack. |
| 747 __ push(edx); // receiver | 770 PushInterceptorArguments(masm(), |
| 748 __ push(reg); // holder | 771 edx, |
| 749 __ push(Operand(ebp, (argc + 3) * kPointerSize)); // name | 772 reg, |
| 750 __ push(Immediate(holder->InterceptorPropertyLookupHint(name))); | 773 Operand(ebp, (argc + 3) * kPointerSize), |
| 774 holder, |
| 775 holder->InterceptorPropertyLookupHint(name)); |
| 751 | 776 |
| 752 // Perform call. | 777 // Perform call. |
| 753 ExternalReference load_interceptor = | 778 ExternalReference load_interceptor = |
| 754 ExternalReference(IC_Utility(IC::kLoadInterceptorProperty)); | 779 ExternalReference(IC_Utility(IC::kLoadInterceptorProperty)); |
| 755 __ mov(eax, Immediate(4)); | 780 __ mov(eax, Immediate(6)); |
| 756 __ mov(ebx, Immediate(load_interceptor)); | 781 __ mov(ebx, Immediate(load_interceptor)); |
| 757 | 782 |
| 758 CEntryStub stub; | 783 CEntryStub stub; |
| 759 __ CallStub(&stub); | 784 __ CallStub(&stub); |
| 760 | 785 |
| 761 // Move result to edi and restore receiver. | 786 // Move result to edi and restore receiver. |
| 762 __ mov(edi, eax); | 787 __ mov(edi, eax); |
| 763 __ mov(edx, Operand(ebp, (argc + 2) * kPointerSize)); // receiver | 788 __ mov(edx, Operand(ebp, (argc + 2) * kPointerSize)); // receiver |
| 764 | 789 |
| 765 // Exit frame. | 790 // Exit frame. |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1430 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1455 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
| 1431 | 1456 |
| 1432 // Return the generated code. | 1457 // Return the generated code. |
| 1433 return GetCode(CALLBACKS, name); | 1458 return GetCode(CALLBACKS, name); |
| 1434 } | 1459 } |
| 1435 | 1460 |
| 1436 | 1461 |
| 1437 #undef __ | 1462 #undef __ |
| 1438 | 1463 |
| 1439 } } // namespace v8::internal | 1464 } } // namespace v8::internal |
| OLD | NEW |