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

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

Issue 472002: Fix a crash caused by garbage collection during generation of a... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years 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/ia32/macro-assembler-ia32.cc ('k') | src/stub-cache.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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 Register reg = 747 Register reg =
748 CheckPrototypes(object, receiver, holder, 748 CheckPrototypes(object, receiver, holder,
749 scratch1, scratch2, name, miss); 749 scratch1, scratch2, name, miss);
750 750
751 // Get the value from the properties. 751 // Get the value from the properties.
752 GenerateFastPropertyLoad(masm(), eax, reg, holder, index); 752 GenerateFastPropertyLoad(masm(), eax, reg, holder, index);
753 __ ret(0); 753 __ ret(0);
754 } 754 }
755 755
756 756
757 void StubCompiler::GenerateLoadCallback(JSObject* object, 757 bool StubCompiler::GenerateLoadCallback(JSObject* object,
758 JSObject* holder, 758 JSObject* holder,
759 Register receiver, 759 Register receiver,
760 Register name_reg, 760 Register name_reg,
761 Register scratch1, 761 Register scratch1,
762 Register scratch2, 762 Register scratch2,
763 AccessorInfo* callback, 763 AccessorInfo* callback,
764 String* name, 764 String* name,
765 Label* miss) { 765 Label* miss,
766 Failure** failure) {
766 // Check that the receiver isn't a smi. 767 // Check that the receiver isn't a smi.
767 __ test(receiver, Immediate(kSmiTagMask)); 768 __ test(receiver, Immediate(kSmiTagMask));
768 __ j(zero, miss, not_taken); 769 __ j(zero, miss, not_taken);
769 770
770 // Check that the maps haven't changed. 771 // Check that the maps haven't changed.
771 Register reg = 772 Register reg =
772 CheckPrototypes(object, receiver, holder, 773 CheckPrototypes(object, receiver, holder,
773 scratch1, scratch2, name, miss); 774 scratch1, scratch2, name, miss);
774 775
775 Handle<AccessorInfo> callback_handle(callback); 776 Handle<AccessorInfo> callback_handle(callback);
(...skipping 15 matching lines...) Expand all
791 // This will be passed as the const Arguments& to the C++ callback. 792 // This will be passed as the const Arguments& to the C++ callback.
792 __ mov(eax, esp); 793 __ mov(eax, esp);
793 __ add(Operand(eax), Immediate(5 * kPointerSize)); 794 __ add(Operand(eax), Immediate(5 * kPointerSize));
794 __ mov(ebx, esp); 795 __ mov(ebx, esp);
795 796
796 // Do call through the api. 797 // Do call through the api.
797 ASSERT_EQ(6, ApiGetterEntryStub::kStackSpace); 798 ASSERT_EQ(6, ApiGetterEntryStub::kStackSpace);
798 Address getter_address = v8::ToCData<Address>(callback->getter()); 799 Address getter_address = v8::ToCData<Address>(callback->getter());
799 ApiFunction fun(getter_address); 800 ApiFunction fun(getter_address);
800 ApiGetterEntryStub stub(callback_handle, &fun); 801 ApiGetterEntryStub stub(callback_handle, &fun);
801 __ CallStub(&stub); 802 // Calling the stub may try to allocate (if the code is not already
803 // generated). Do not allow the call to perform a garbage
804 // collection but instead return the allocation failure object.
805 Object* result = masm()->TryCallStub(&stub);
806 if (result->IsFailure()) {
807 *failure = Failure::cast(result);
808 return false;
809 }
802 810
803 // We need to avoid using eax since that now holds the result. 811 // We need to avoid using eax since that now holds the result.
804 Register tmp = other.is(eax) ? reg : other; 812 Register tmp = other.is(eax) ? reg : other;
805 __ PopHandleScope(eax, tmp); 813 __ PopHandleScope(eax, tmp);
806 __ LeaveInternalFrame(); 814 __ LeaveInternalFrame();
807 815
808 __ ret(0); 816 __ ret(0);
817 return true;
809 } 818 }
810 819
811 820
812 void StubCompiler::GenerateLoadConstant(JSObject* object, 821 void StubCompiler::GenerateLoadConstant(JSObject* object,
813 JSObject* holder, 822 JSObject* holder,
814 Register receiver, 823 Register receiver,
815 Register scratch1, 824 Register scratch1,
816 Register scratch2, 825 Register scratch2,
817 Object* value, 826 Object* value,
818 String* name, 827 String* name,
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 __ mov(eax, Operand(esp, kPointerSize)); 1422 __ mov(eax, Operand(esp, kPointerSize));
1414 GenerateLoadField(object, holder, eax, ebx, edx, index, name, &miss); 1423 GenerateLoadField(object, holder, eax, ebx, edx, index, name, &miss);
1415 __ bind(&miss); 1424 __ bind(&miss);
1416 GenerateLoadMiss(masm(), Code::LOAD_IC); 1425 GenerateLoadMiss(masm(), Code::LOAD_IC);
1417 1426
1418 // Return the generated code. 1427 // Return the generated code.
1419 return GetCode(FIELD, name); 1428 return GetCode(FIELD, name);
1420 } 1429 }
1421 1430
1422 1431
1423 Object* LoadStubCompiler::CompileLoadCallback(JSObject* object, 1432 Object* LoadStubCompiler::CompileLoadCallback(String* name,
1433 JSObject* object,
1424 JSObject* holder, 1434 JSObject* holder,
1425 AccessorInfo* callback, 1435 AccessorInfo* callback) {
1426 String* name) {
1427 // ----------- S t a t e ------------- 1436 // ----------- S t a t e -------------
1428 // -- ecx : name 1437 // -- ecx : name
1429 // -- esp[0] : return address 1438 // -- esp[0] : return address
1430 // -- esp[4] : receiver 1439 // -- esp[4] : receiver
1431 // ----------------------------------- 1440 // -----------------------------------
1432 Label miss; 1441 Label miss;
1433 1442
1434 __ mov(eax, Operand(esp, kPointerSize)); 1443 __ mov(eax, Operand(esp, kPointerSize));
1435 GenerateLoadCallback(object, holder, eax, ecx, ebx, edx, 1444 Failure* failure;
1436 callback, name, &miss); 1445 bool success = GenerateLoadCallback(object, holder, eax, ecx, ebx, edx,
1446 callback, name, &miss, &failure);
1447 if (!success) return failure;
1448
1437 __ bind(&miss); 1449 __ bind(&miss);
1438 GenerateLoadMiss(masm(), Code::LOAD_IC); 1450 GenerateLoadMiss(masm(), Code::LOAD_IC);
1439 1451
1440 // Return the generated code. 1452 // Return the generated code.
1441 return GetCode(CALLBACKS, name); 1453 return GetCode(CALLBACKS, name);
1442 } 1454 }
1443 1455
1444 1456
1445 Object* LoadStubCompiler::CompileLoadConstant(JSObject* object, 1457 Object* LoadStubCompiler::CompileLoadConstant(JSObject* object,
1446 JSObject* holder, 1458 JSObject* holder,
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 Label miss; 1602 Label miss;
1591 1603
1592 __ mov(eax, Operand(esp, kPointerSize)); 1604 __ mov(eax, Operand(esp, kPointerSize));
1593 __ mov(ecx, Operand(esp, 2 * kPointerSize)); 1605 __ mov(ecx, Operand(esp, 2 * kPointerSize));
1594 __ IncrementCounter(&Counters::keyed_load_callback, 1); 1606 __ IncrementCounter(&Counters::keyed_load_callback, 1);
1595 1607
1596 // Check that the name has not changed. 1608 // Check that the name has not changed.
1597 __ cmp(Operand(eax), Immediate(Handle<String>(name))); 1609 __ cmp(Operand(eax), Immediate(Handle<String>(name)));
1598 __ j(not_equal, &miss, not_taken); 1610 __ j(not_equal, &miss, not_taken);
1599 1611
1600 GenerateLoadCallback(receiver, holder, ecx, eax, ebx, edx, 1612 Failure* failure;
1601 callback, name, &miss); 1613 bool success = GenerateLoadCallback(receiver, holder, ecx, eax, ebx, edx,
1614 callback, name, &miss, &failure);
1615 if (!success) return failure;
1616
1602 __ bind(&miss); 1617 __ bind(&miss);
1603 __ DecrementCounter(&Counters::keyed_load_callback, 1); 1618 __ DecrementCounter(&Counters::keyed_load_callback, 1);
1604 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 1619 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
1605 1620
1606 // Return the generated code. 1621 // Return the generated code.
1607 return GetCode(CALLBACKS, name); 1622 return GetCode(CALLBACKS, name);
1608 } 1623 }
1609 1624
1610 1625
1611 Object* KeyedLoadStubCompiler::CompileLoadConstant(String* name, 1626 Object* KeyedLoadStubCompiler::CompileLoadConstant(String* name,
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1883 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); 1898 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET);
1884 1899
1885 // Return the generated code. 1900 // Return the generated code.
1886 return GetCode(); 1901 return GetCode();
1887 } 1902 }
1888 1903
1889 1904
1890 #undef __ 1905 #undef __
1891 1906
1892 } } // namespace v8::internal 1907 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698