Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Side by Side Diff: src/arm/stub-cache-arm.cc

Issue 6713074: Require an isolate parameter for most external reference creation to (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Further cleanup Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/regexp-macro-assembler-arm.cc ('k') | src/assembler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); 446 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded());
447 447
448 // Perform map transition for the receiver if necessary. 448 // Perform map transition for the receiver if necessary.
449 if ((transition != NULL) && (object->map()->unused_property_fields() == 0)) { 449 if ((transition != NULL) && (object->map()->unused_property_fields() == 0)) {
450 // The properties must be extended before we can store the value. 450 // The properties must be extended before we can store the value.
451 // We jump to a runtime call that extends the properties array. 451 // We jump to a runtime call that extends the properties array.
452 __ push(receiver_reg); 452 __ push(receiver_reg);
453 __ mov(r2, Operand(Handle<Map>(transition))); 453 __ mov(r2, Operand(Handle<Map>(transition)));
454 __ Push(r2, r0); 454 __ Push(r2, r0);
455 __ TailCallExternalReference( 455 __ TailCallExternalReference(
456 ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage)), 456 ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage),
457 3, 1); 457 masm->isolate()),
458 3,
459 1);
458 return; 460 return;
459 } 461 }
460 462
461 if (transition != NULL) { 463 if (transition != NULL) {
462 // Update the map of the object; no write barrier updating is 464 // Update the map of the object; no write barrier updating is
463 // needed because the map is never in new space. 465 // needed because the map is never in new space.
464 __ mov(ip, Operand(Handle<Map>(transition))); 466 __ mov(ip, Operand(Handle<Map>(transition)));
465 __ str(ip, FieldMemOperand(receiver_reg, HeapObject::kMapOffset)); 467 __ str(ip, FieldMemOperand(receiver_reg, HeapObject::kMapOffset));
466 } 468 }
467 469
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 565
564 566
565 static void CompileCallLoadPropertyWithInterceptor(MacroAssembler* masm, 567 static void CompileCallLoadPropertyWithInterceptor(MacroAssembler* masm,
566 Register receiver, 568 Register receiver,
567 Register holder, 569 Register holder,
568 Register name, 570 Register name,
569 JSObject* holder_obj) { 571 JSObject* holder_obj) {
570 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); 572 PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
571 573
572 ExternalReference ref = 574 ExternalReference ref =
573 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly)); 575 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly),
576 masm->isolate());
574 __ mov(r0, Operand(5)); 577 __ mov(r0, Operand(5));
575 __ mov(r1, Operand(ref)); 578 __ mov(r1, Operand(ref));
576 579
577 CEntryStub stub(1); 580 CEntryStub stub(1);
578 __ CallStub(&stub); 581 __ CallStub(&stub);
579 } 582 }
580 583
581 static const int kFastApiCallArguments = 3; 584 static const int kFastApiCallArguments = 3;
582 585
583 // Reserves space for the extra arguments to FastHandleApiCall in the 586 // Reserves space for the extra arguments to FastHandleApiCall in the
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 __ str(ip, MemOperand(r0, 2 * kPointerSize)); 655 __ str(ip, MemOperand(r0, 2 * kPointerSize));
653 // v8::Arguments::is_construct_call = 0 656 // v8::Arguments::is_construct_call = 0
654 __ mov(ip, Operand(0)); 657 __ mov(ip, Operand(0));
655 __ str(ip, MemOperand(r0, 3 * kPointerSize)); 658 __ str(ip, MemOperand(r0, 3 * kPointerSize));
656 659
657 // Emitting a stub call may try to allocate (if the code is not 660 // Emitting a stub call may try to allocate (if the code is not
658 // already generated). Do not allow the assembler to perform a 661 // already generated). Do not allow the assembler to perform a
659 // garbage collection but instead return the allocation failure 662 // garbage collection but instead return the allocation failure
660 // object. 663 // object.
661 const int kStackUnwindSpace = argc + kFastApiCallArguments + 1; 664 const int kStackUnwindSpace = argc + kFastApiCallArguments + 1;
662 ExternalReference ref = 665 ExternalReference ref = ExternalReference(&fun,
663 ExternalReference(&fun, ExternalReference::DIRECT_API_CALL); 666 ExternalReference::DIRECT_API_CALL,
667 masm->isolate());
664 return masm->TryCallApiFunctionAndReturn(ref, kStackUnwindSpace); 668 return masm->TryCallApiFunctionAndReturn(ref, kStackUnwindSpace);
665 } 669 }
666 670
667 class CallInterceptorCompiler BASE_EMBEDDED { 671 class CallInterceptorCompiler BASE_EMBEDDED {
668 public: 672 public:
669 CallInterceptorCompiler(StubCompiler* stub_compiler, 673 CallInterceptorCompiler(StubCompiler* stub_compiler,
670 const ParameterCount& arguments, 674 const ParameterCount& arguments,
671 Register name) 675 Register name)
672 : stub_compiler_(stub_compiler), 676 : stub_compiler_(stub_compiler),
673 arguments_(arguments), 677 arguments_(arguments),
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 // Save the name_ register across the call. 840 // Save the name_ register across the call.
837 __ push(name_); 841 __ push(name_);
838 842
839 PushInterceptorArguments(masm, 843 PushInterceptorArguments(masm,
840 receiver, 844 receiver,
841 holder, 845 holder,
842 name_, 846 name_,
843 interceptor_holder); 847 interceptor_holder);
844 848
845 __ CallExternalReference( 849 __ CallExternalReference(
846 ExternalReference( 850 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall),
847 IC_Utility(IC::kLoadPropertyWithInterceptorForCall)), 851 masm->isolate()),
848 5); 852 5);
849 853
850 // Restore the name_ register. 854 // Restore the name_ register.
851 __ pop(name_); 855 __ pop(name_);
852 __ LeaveInternalFrame(); 856 __ LeaveInternalFrame();
853 } 857 }
854 858
855 void LoadWithInterceptor(MacroAssembler* masm, 859 void LoadWithInterceptor(MacroAssembler* masm,
856 Register receiver, 860 Register receiver,
857 Register holder, 861 Register holder,
858 JSObject* holder_obj, 862 JSObject* holder_obj,
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 // scratch2 (internal::Object **args_) as the data. 1273 // scratch2 (internal::Object **args_) as the data.
1270 __ str(scratch2, MemOperand(sp, 1 * kPointerSize)); 1274 __ str(scratch2, MemOperand(sp, 1 * kPointerSize));
1271 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = AccessorInfo& 1275 __ add(r1, sp, Operand(1 * kPointerSize)); // r1 = AccessorInfo&
1272 1276
1273 // Emitting a stub call may try to allocate (if the code is not 1277 // Emitting a stub call may try to allocate (if the code is not
1274 // already generated). Do not allow the assembler to perform a 1278 // already generated). Do not allow the assembler to perform a
1275 // garbage collection but instead return the allocation failure 1279 // garbage collection but instead return the allocation failure
1276 // object. 1280 // object.
1277 const int kStackUnwindSpace = 4; 1281 const int kStackUnwindSpace = 4;
1278 ExternalReference ref = 1282 ExternalReference ref =
1279 ExternalReference(&fun, ExternalReference::DIRECT_GETTER_CALL); 1283 ExternalReference(&fun,
1284 ExternalReference::DIRECT_GETTER_CALL,
1285 masm()->isolate());
1280 return masm()->TryCallApiFunctionAndReturn(ref, kStackUnwindSpace); 1286 return masm()->TryCallApiFunctionAndReturn(ref, kStackUnwindSpace);
1281 } 1287 }
1282 1288
1283 1289
1284 void StubCompiler::GenerateLoadInterceptor(JSObject* object, 1290 void StubCompiler::GenerateLoadInterceptor(JSObject* object,
1285 JSObject* interceptor_holder, 1291 JSObject* interceptor_holder,
1286 LookupResult* lookup, 1292 LookupResult* lookup,
1287 Register receiver, 1293 Register receiver,
1288 Register name_reg, 1294 Register name_reg,
1289 Register scratch1, 1295 Register scratch1,
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 FieldMemOperand(scratch2, AccessorInfo::kDataOffset)); 1404 FieldMemOperand(scratch2, AccessorInfo::kDataOffset));
1399 __ Push(scratch3, scratch2, name_reg); 1405 __ Push(scratch3, scratch2, name_reg);
1400 } else { 1406 } else {
1401 __ push(receiver); 1407 __ push(receiver);
1402 __ ldr(scratch3, 1408 __ ldr(scratch3,
1403 FieldMemOperand(scratch2, AccessorInfo::kDataOffset)); 1409 FieldMemOperand(scratch2, AccessorInfo::kDataOffset));
1404 __ Push(holder_reg, scratch3, scratch2, name_reg); 1410 __ Push(holder_reg, scratch3, scratch2, name_reg);
1405 } 1411 }
1406 1412
1407 ExternalReference ref = 1413 ExternalReference ref =
1408 ExternalReference(IC_Utility(IC::kLoadCallbackProperty)); 1414 ExternalReference(IC_Utility(IC::kLoadCallbackProperty),
1415 masm()->isolate());
1409 __ TailCallExternalReference(ref, 5, 1); 1416 __ TailCallExternalReference(ref, 5, 1);
1410 } 1417 }
1411 } else { // !compile_followup_inline 1418 } else { // !compile_followup_inline
1412 // Call the runtime system to load the interceptor. 1419 // Call the runtime system to load the interceptor.
1413 // Check that the maps haven't changed. 1420 // Check that the maps haven't changed.
1414 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder, 1421 Register holder_reg = CheckPrototypes(object, receiver, interceptor_holder,
1415 scratch1, scratch2, scratch3, 1422 scratch1, scratch2, scratch3,
1416 name, miss); 1423 name, miss);
1417 PushInterceptorArguments(masm(), receiver, holder_reg, 1424 PushInterceptorArguments(masm(), receiver, holder_reg,
1418 name_reg, interceptor_holder); 1425 name_reg, interceptor_holder);
1419 1426
1420 ExternalReference ref = ExternalReference( 1427 ExternalReference ref =
1421 IC_Utility(IC::kLoadPropertyWithInterceptorForLoad)); 1428 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForLoad),
1429 masm()->isolate());
1422 __ TailCallExternalReference(ref, 5, 1); 1430 __ TailCallExternalReference(ref, 5, 1);
1423 } 1431 }
1424 } 1432 }
1425 1433
1426 1434
1427 void CallStubCompiler::GenerateNameCheck(String* name, Label* miss) { 1435 void CallStubCompiler::GenerateNameCheck(String* name, Label* miss) {
1428 if (kind_ == Code::KEYED_CALL_IC) { 1436 if (kind_ == Code::KEYED_CALL_IC) {
1429 __ cmp(r2, Operand(Handle<String>(name))); 1437 __ cmp(r2, Operand(Handle<String>(name)));
1430 __ b(ne, miss); 1438 __ b(ne, miss);
1431 } 1439 }
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 __ Ret(); 1637 __ Ret();
1630 1638
1631 __ bind(&attempt_to_grow_elements); 1639 __ bind(&attempt_to_grow_elements);
1632 // r0: array's length + 1. 1640 // r0: array's length + 1.
1633 // r4: elements' length. 1641 // r4: elements' length.
1634 1642
1635 if (!FLAG_inline_new) { 1643 if (!FLAG_inline_new) {
1636 __ b(&call_builtin); 1644 __ b(&call_builtin);
1637 } 1645 }
1638 1646
1647 Isolate* isolate = masm()->isolate();
1639 ExternalReference new_space_allocation_top = 1648 ExternalReference new_space_allocation_top =
1640 ExternalReference::new_space_allocation_top_address(); 1649 ExternalReference::new_space_allocation_top_address(isolate);
1641 ExternalReference new_space_allocation_limit = 1650 ExternalReference new_space_allocation_limit =
1642 ExternalReference::new_space_allocation_limit_address(); 1651 ExternalReference::new_space_allocation_limit_address(isolate);
1643 1652
1644 const int kAllocationDelta = 4; 1653 const int kAllocationDelta = 4;
1645 // Load top and check if it is the end of elements. 1654 // Load top and check if it is the end of elements.
1646 __ add(end_elements, elements, 1655 __ add(end_elements, elements,
1647 Operand(r0, LSL, kPointerSizeLog2 - kSmiTagSize)); 1656 Operand(r0, LSL, kPointerSizeLog2 - kSmiTagSize));
1648 __ add(end_elements, end_elements, Operand(kEndElementsOffset)); 1657 __ add(end_elements, end_elements, Operand(kEndElementsOffset));
1649 __ mov(r7, Operand(new_space_allocation_top)); 1658 __ mov(r7, Operand(new_space_allocation_top));
1650 __ ldr(r6, MemOperand(r7)); 1659 __ ldr(r6, MemOperand(r7));
1651 __ cmp(end_elements, r6); 1660 __ cmp(end_elements, r6);
1652 __ b(ne, &call_builtin); 1661 __ b(ne, &call_builtin);
(...skipping 19 matching lines...) Expand all
1672 // Update elements' and array's sizes. 1681 // Update elements' and array's sizes.
1673 __ str(r0, FieldMemOperand(receiver, JSArray::kLengthOffset)); 1682 __ str(r0, FieldMemOperand(receiver, JSArray::kLengthOffset));
1674 __ add(r4, r4, Operand(Smi::FromInt(kAllocationDelta))); 1683 __ add(r4, r4, Operand(Smi::FromInt(kAllocationDelta)));
1675 __ str(r4, FieldMemOperand(elements, FixedArray::kLengthOffset)); 1684 __ str(r4, FieldMemOperand(elements, FixedArray::kLengthOffset));
1676 1685
1677 // Elements are in new space, so write barrier is not required. 1686 // Elements are in new space, so write barrier is not required.
1678 __ Drop(argc + 1); 1687 __ Drop(argc + 1);
1679 __ Ret(); 1688 __ Ret();
1680 } 1689 }
1681 __ bind(&call_builtin); 1690 __ bind(&call_builtin);
1682 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), 1691 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush,
1692 masm()->isolate()),
1683 argc + 1, 1693 argc + 1,
1684 1); 1694 1);
1685 } 1695 }
1686 1696
1687 // Handle call cache miss. 1697 // Handle call cache miss.
1688 __ bind(&miss); 1698 __ bind(&miss);
1689 Object* obj; 1699 Object* obj;
1690 { MaybeObject* maybe_obj = GenerateMissBranch(); 1700 { MaybeObject* maybe_obj = GenerateMissBranch();
1691 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 1701 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1692 } 1702 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1759 __ str(r6, MemOperand(elements, FixedArray::kHeaderSize - kHeapObjectTag)); 1769 __ str(r6, MemOperand(elements, FixedArray::kHeaderSize - kHeapObjectTag));
1760 __ Drop(argc + 1); 1770 __ Drop(argc + 1);
1761 __ Ret(); 1771 __ Ret();
1762 1772
1763 __ bind(&return_undefined); 1773 __ bind(&return_undefined);
1764 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); 1774 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
1765 __ Drop(argc + 1); 1775 __ Drop(argc + 1);
1766 __ Ret(); 1776 __ Ret();
1767 1777
1768 __ bind(&call_builtin); 1778 __ bind(&call_builtin);
1769 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), 1779 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop,
1780 masm()->isolate()),
1770 argc + 1, 1781 argc + 1,
1771 1); 1782 1);
1772 1783
1773 // Handle call cache miss. 1784 // Handle call cache miss.
1774 __ bind(&miss); 1785 __ bind(&miss);
1775 Object* obj; 1786 Object* obj;
1776 { MaybeObject* maybe_obj = GenerateMissBranch(); 1787 { MaybeObject* maybe_obj = GenerateMissBranch();
1777 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 1788 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1778 } 1789 }
1779 1790
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
2651 // Stub never generated for non-global objects that require access 2662 // Stub never generated for non-global objects that require access
2652 // checks. 2663 // checks.
2653 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); 2664 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded());
2654 2665
2655 __ push(r1); // receiver 2666 __ push(r1); // receiver
2656 __ mov(ip, Operand(Handle<AccessorInfo>(callback))); // callback info 2667 __ mov(ip, Operand(Handle<AccessorInfo>(callback))); // callback info
2657 __ Push(ip, r2, r0); 2668 __ Push(ip, r2, r0);
2658 2669
2659 // Do tail-call to the runtime system. 2670 // Do tail-call to the runtime system.
2660 ExternalReference store_callback_property = 2671 ExternalReference store_callback_property =
2661 ExternalReference(IC_Utility(IC::kStoreCallbackProperty)); 2672 ExternalReference(IC_Utility(IC::kStoreCallbackProperty),
2673 masm()->isolate());
2662 __ TailCallExternalReference(store_callback_property, 4, 1); 2674 __ TailCallExternalReference(store_callback_property, 4, 1);
2663 2675
2664 // Handle store cache miss. 2676 // Handle store cache miss.
2665 __ bind(&miss); 2677 __ bind(&miss);
2666 Handle<Code> ic(Isolate::Current()->builtins()->builtin( 2678 Handle<Code> ic(Isolate::Current()->builtins()->builtin(
2667 Builtins::StoreIC_Miss)); 2679 Builtins::StoreIC_Miss));
2668 __ Jump(ic, RelocInfo::CODE_TARGET); 2680 __ Jump(ic, RelocInfo::CODE_TARGET);
2669 2681
2670 // Return the generated code. 2682 // Return the generated code.
2671 return GetCode(CALLBACKS, name); 2683 return GetCode(CALLBACKS, name);
(...skipping 28 matching lines...) Expand all
2700 // checks. 2712 // checks.
2701 ASSERT(receiver->IsJSGlobalProxy() || !receiver->IsAccessCheckNeeded()); 2713 ASSERT(receiver->IsJSGlobalProxy() || !receiver->IsAccessCheckNeeded());
2702 2714
2703 __ Push(r1, r2, r0); // Receiver, name, value. 2715 __ Push(r1, r2, r0); // Receiver, name, value.
2704 2716
2705 __ mov(r0, Operand(Smi::FromInt(strict_mode_))); 2717 __ mov(r0, Operand(Smi::FromInt(strict_mode_)));
2706 __ push(r0); // strict mode 2718 __ push(r0); // strict mode
2707 2719
2708 // Do tail-call to the runtime system. 2720 // Do tail-call to the runtime system.
2709 ExternalReference store_ic_property = 2721 ExternalReference store_ic_property =
2710 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty)); 2722 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty),
2723 masm()->isolate());
2711 __ TailCallExternalReference(store_ic_property, 4, 1); 2724 __ TailCallExternalReference(store_ic_property, 4, 1);
2712 2725
2713 // Handle store cache miss. 2726 // Handle store cache miss.
2714 __ bind(&miss); 2727 __ bind(&miss);
2715 Handle<Code> ic(Isolate::Current()->builtins()->builtin( 2728 Handle<Code> ic(Isolate::Current()->builtins()->builtin(
2716 Builtins::StoreIC_Miss)); 2729 Builtins::StoreIC_Miss));
2717 __ Jump(ic, RelocInfo::CODE_TARGET); 2730 __ Jump(ic, RelocInfo::CODE_TARGET);
2718 2731
2719 // Return the generated code. 2732 // Return the generated code.
2720 return GetCode(INTERCEPTOR, name); 2733 return GetCode(INTERCEPTOR, name);
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after
4026 4039
4027 return GetCode(flags); 4040 return GetCode(flags);
4028 } 4041 }
4029 4042
4030 4043
4031 #undef __ 4044 #undef __
4032 4045
4033 } } // namespace v8::internal 4046 } } // namespace v8::internal
4034 4047
4035 #endif // V8_TARGET_ARCH_ARM 4048 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/regexp-macro-assembler-arm.cc ('k') | src/assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698