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

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 8041035: Tighten up assertions checking GC-safety of stub calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 // operation result to the caller of the stub. 979 // operation result to the caller of the stub.
980 __ TailCallExternalReference( 980 __ TailCallExternalReference(
981 ExternalReference(IC_Utility(IC::kBinaryOp_Patch), 981 ExternalReference(IC_Utility(IC::kBinaryOp_Patch),
982 masm->isolate()), 982 masm->isolate()),
983 5, 983 5,
984 1); 984 1);
985 } 985 }
986 986
987 987
988 void BinaryOpStub::Generate(MacroAssembler* masm) { 988 void BinaryOpStub::Generate(MacroAssembler* masm) {
989 // Explicitly allow generation of nested stubs. It is safe here.
990 AllowStubCallsScope allow_stub_calls(masm, true);
991
989 switch (operands_type_) { 992 switch (operands_type_) {
990 case BinaryOpIC::UNINITIALIZED: 993 case BinaryOpIC::UNINITIALIZED:
991 GenerateTypeTransition(masm); 994 GenerateTypeTransition(masm);
992 break; 995 break;
993 case BinaryOpIC::SMI: 996 case BinaryOpIC::SMI:
994 GenerateSmiStub(masm); 997 GenerateSmiStub(masm);
995 break; 998 break;
996 case BinaryOpIC::INT32: 999 case BinaryOpIC::INT32:
997 GenerateInt32Stub(masm); 1000 GenerateInt32Stub(masm);
998 break; 1001 break;
(...skipping 3327 matching lines...) Expand 10 before | Expand all | Expand 10 after
4326 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); 4329 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline();
4327 __ jmp(adaptor, RelocInfo::CODE_TARGET); 4330 __ jmp(adaptor, RelocInfo::CODE_TARGET);
4328 } 4331 }
4329 4332
4330 4333
4331 bool CEntryStub::NeedsImmovableCode() { 4334 bool CEntryStub::NeedsImmovableCode() {
4332 return false; 4335 return false;
4333 } 4336 }
4334 4337
4335 4338
4336 bool CEntryStub::CompilingCallsToThisStubIsGCSafe() { 4339 bool CEntryStub::IsPregenerated() {
4337 return (!save_doubles_ || ISOLATE->fp_stubs_generated()) && 4340 return (!save_doubles_ || ISOLATE->fp_stubs_generated()) &&
4338 result_size_ == 1; 4341 result_size_ == 1;
4339 } 4342 }
4340 4343
4341 4344
4342 void CodeStub::GenerateStubsAheadOfTime() { 4345 void CodeStub::GenerateStubsAheadOfTime() {
4346 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime();
4347 // It is important that the store buffer overflow stubs are generated first.
4348 RecordWriteStub::GenerateFixedRegStubsAheadOfTime();
4343 } 4349 }
4344 4350
4345 4351
4346 void CodeStub::GenerateFPStubs() { 4352 void CodeStub::GenerateFPStubs() {
4347 CEntryStub save_doubles(1, kSaveFPRegs); 4353 CEntryStub save_doubles(1, kSaveFPRegs);
4348 Handle<Code> code = save_doubles.GetCode(); 4354 Handle<Code> code = save_doubles.GetCode();
4349 code->GetIsolate()->set_fp_stubs_generated(true); 4355 code->GetIsolate()->set_fp_stubs_generated(true);
4350 } 4356 }
4351 4357
4352 4358
(...skipping 2229 matching lines...) Expand 10 before | Expand all | Expand 10 after
6582 Register object, value, address; 6588 Register object, value, address;
6583 RememberedSetAction action; 6589 RememberedSetAction action;
6584 }; 6590 };
6585 6591
6586 6592
6587 struct AheadOfTimeWriteBarrierStubList kAheadOfTime[] = { 6593 struct AheadOfTimeWriteBarrierStubList kAheadOfTime[] = {
6588 // Used in RegExpExecStub. 6594 // Used in RegExpExecStub.
6589 { ebx, eax, edi, EMIT_REMEMBERED_SET }, 6595 { ebx, eax, edi, EMIT_REMEMBERED_SET },
6590 // Used in CompileArrayPushCall. 6596 // Used in CompileArrayPushCall.
6591 { ebx, ecx, edx, EMIT_REMEMBERED_SET }, 6597 { ebx, ecx, edx, EMIT_REMEMBERED_SET },
6598 // { ebx, edi, edx, EMIT_REMEMBERED_SET },
Erik Corry 2011/09/26 22:47:26 Commented code
6592 // Used in CompileStoreGlobal. 6599 // Used in CompileStoreGlobal.
6593 { ebx, ecx, edx, OMIT_REMEMBERED_SET }, 6600 { ebx, ecx, edx, OMIT_REMEMBERED_SET },
6594 // Used in StoreStubCompiler::CompileStoreField and 6601 // Used in StoreStubCompiler::CompileStoreField and
6595 // KeyedStoreStubCompiler::CompileStoreField via GenerateStoreField. 6602 // KeyedStoreStubCompiler::CompileStoreField via GenerateStoreField.
6596 { edx, ecx, ebx, EMIT_REMEMBERED_SET }, 6603 { edx, ecx, ebx, EMIT_REMEMBERED_SET },
6597 // GenerateStoreField calls the stub with two different permutations of 6604 // GenerateStoreField calls the stub with two different permutations of
6598 // registers. This is the second. 6605 // registers. This is the second.
6599 { ebx, ecx, edx, EMIT_REMEMBERED_SET }, 6606 { ebx, ecx, edx, EMIT_REMEMBERED_SET },
6600 // StoreIC::GenerateNormal via GenerateDictionaryStore. 6607 // StoreIC::GenerateNormal via GenerateDictionaryStore.
6601 { ebx, edi, edx, EMIT_REMEMBERED_SET }, 6608 { ebx, edi, edx, EMIT_REMEMBERED_SET },
6602 // KeyedStoreIC::GenerateGeneric. 6609 // KeyedStoreIC::GenerateGeneric.
6603 { ebx, edx, ecx, EMIT_REMEMBERED_SET}, 6610 { ebx, edx, ecx, EMIT_REMEMBERED_SET},
6604 // KeyedStoreStubCompiler::GenerateStoreFastElement. 6611 // KeyedStoreStubCompiler::GenerateStoreFastElement.
6605 { edi, edx, ecx, EMIT_REMEMBERED_SET}, 6612 { edi, edx, ecx, EMIT_REMEMBERED_SET},
6606 // Null termination. 6613 // Null termination.
6607 { no_reg, no_reg, no_reg, EMIT_REMEMBERED_SET} 6614 { no_reg, no_reg, no_reg, EMIT_REMEMBERED_SET}
6608 }; 6615 };
6609 6616
6610 6617
6611 bool RecordWriteStub::CompilingCallsToThisStubIsGCSafe() { 6618 bool RecordWriteStub::IsPregenerated() {
6612 for (AheadOfTimeWriteBarrierStubList* entry = kAheadOfTime; 6619 for (AheadOfTimeWriteBarrierStubList* entry = kAheadOfTime;
6613 !entry->object.is(no_reg); 6620 !entry->object.is(no_reg);
6614 entry++) { 6621 entry++) {
6615 if (object_.is(entry->object) && 6622 if (object_.is(entry->object) &&
6616 value_.is(entry->value) && 6623 value_.is(entry->value) &&
6617 address_.is(entry->address) && 6624 address_.is(entry->address) &&
6618 remembered_set_action_ == entry->action && 6625 remembered_set_action_ == entry->action &&
6619 save_fp_regs_mode_ == kDontSaveFPRegs) { 6626 save_fp_regs_mode_ == kDontSaveFPRegs) {
6620 return true; 6627 return true;
6621 } 6628 }
6622 } 6629 }
6623 return false; 6630 return false;
6624 } 6631 }
6625 6632
6626 6633
6627 void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime() { 6634 void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime() {
6628 StoreBufferOverflowStub stub1(kDontSaveFPRegs); 6635 StoreBufferOverflowStub stub1(kDontSaveFPRegs);
6629 stub1.GetCode(); 6636 stub1.GetCode();
6630 StoreBufferOverflowStub stub2(kSaveFPRegs); 6637
6631 stub2.GetCode(); 6638 CpuFeatures::TryForceFeatureScope scope(SSE2);
6639 if (CpuFeatures::IsSupported(SSE2)) {
6640 StoreBufferOverflowStub stub2(kSaveFPRegs);
6641 stub2.GetCode();
6642 }
6632 } 6643 }
6633 6644
6634 6645
6635 void RecordWriteStub::GenerateFixedRegStubsAheadOfTime() { 6646 void RecordWriteStub::GenerateFixedRegStubsAheadOfTime() {
6636 for (AheadOfTimeWriteBarrierStubList* entry = kAheadOfTime; 6647 for (AheadOfTimeWriteBarrierStubList* entry = kAheadOfTime;
6637 !entry->object.is(no_reg); 6648 !entry->object.is(no_reg);
6638 entry++) { 6649 entry++) {
6639 RecordWriteStub stub(entry->object, 6650 RecordWriteStub stub(entry->object,
6640 entry->value, 6651 entry->value,
6641 entry->address, 6652 entry->address,
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
6840 6851
6841 // Fall through when we need to inform the incremental marker. 6852 // Fall through when we need to inform the incremental marker.
6842 } 6853 }
6843 6854
6844 6855
6845 #undef __ 6856 #undef __
6846 6857
6847 } } // namespace v8::internal 6858 } } // namespace v8::internal
6848 6859
6849 #endif // V8_TARGET_ARCH_IA32 6860 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698