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

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 14791014: Deoptimized by soft deoptimize should not affect the opt count (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 7 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/ia32/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 int deoptimization_index = deoptimizations_.length(); 880 int deoptimization_index = deoptimizations_.length();
881 int pc_offset = masm()->pc_offset(); 881 int pc_offset = masm()->pc_offset();
882 environment->Register(deoptimization_index, 882 environment->Register(deoptimization_index,
883 translation.index(), 883 translation.index(),
884 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); 884 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1);
885 deoptimizations_.Add(environment, zone()); 885 deoptimizations_.Add(environment, zone());
886 } 886 }
887 } 887 }
888 888
889 889
890 void LCodeGen::DeoptimizeIf(Condition cc, LEnvironment* environment) { 890 void LCodeGen::DeoptimizeIf(Condition cc, LEnvironment* environment,
891 bool soft_deopt) {
891 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); 892 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
892 ASSERT(environment->HasBeenRegistered()); 893 ASSERT(environment->HasBeenRegistered());
893 // It's an error to deoptimize with the x87 fp stack in use. 894 // It's an error to deoptimize with the x87 fp stack in use.
894 ASSERT(x87_stack_depth_ == 0); 895 ASSERT(x87_stack_depth_ == 0);
895 int id = environment->deoptimization_index(); 896 int id = environment->deoptimization_index();
896 ASSERT(info()->IsOptimizing() || info()->IsStub()); 897 ASSERT(info()->IsOptimizing() || info()->IsStub());
897 Deoptimizer::BailoutType bailout_type = info()->IsStub() 898 Deoptimizer::BailoutType bailout_type = info()->IsStub()
898 ? Deoptimizer::LAZY 899 ? Deoptimizer::LAZY
899 : Deoptimizer::EAGER; 900 : Deoptimizer::EAGER;
900 Address entry = 901 Address entry =
901 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); 902 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type);
902 if (entry == NULL) { 903 if (entry == NULL) {
903 Abort("bailout was not prepared"); 904 Abort("bailout was not prepared");
904 return; 905 return;
905 } 906 }
906 907
908 if (soft_deopt) {
909 // It's better soft deopt does not waste the opt count
910 Handle<SharedFunctionInfo> shared(info()->shared_info());
911 __ pushfd();
912 __ push(eax);
913 __ push(ebx);
914 __ mov(ebx, shared);
915 __ mov(eax,
916 FieldOperand(ebx, SharedFunctionInfo::kOptCountOffset));
917 __ sub(Operand(eax), Immediate(Smi::FromInt(1)));
918 __ mov(FieldOperand(ebx, SharedFunctionInfo::kOptCountOffset),
919 eax);
920 __ pop(ebx);
921 __ pop(eax);
922 __ popfd();
923 }
924
907 if (FLAG_deopt_every_n_times != 0 && !info()->IsStub()) { 925 if (FLAG_deopt_every_n_times != 0 && !info()->IsStub()) {
908 Handle<SharedFunctionInfo> shared(info()->shared_info()); 926 Handle<SharedFunctionInfo> shared(info()->shared_info());
909 Label no_deopt; 927 Label no_deopt;
910 __ pushfd(); 928 __ pushfd();
911 __ push(eax); 929 __ push(eax);
912 __ push(ebx); 930 __ push(ebx);
913 __ mov(ebx, shared); 931 __ mov(ebx, shared);
914 __ mov(eax, 932 __ mov(eax,
915 FieldOperand(ebx, SharedFunctionInfo::kStressDeoptCounterOffset)); 933 FieldOperand(ebx, SharedFunctionInfo::kStressDeoptCounterOffset));
916 __ sub(Operand(eax), Immediate(Smi::FromInt(1))); 934 __ sub(Operand(eax), Immediate(Smi::FromInt(1)));
(...skipping 5475 matching lines...) Expand 10 before | Expand all | Expand 10 after
6392 void LCodeGen::DoLazyBailout(LLazyBailout* instr) { 6410 void LCodeGen::DoLazyBailout(LLazyBailout* instr) {
6393 EnsureSpaceForLazyDeopt(); 6411 EnsureSpaceForLazyDeopt();
6394 ASSERT(instr->HasEnvironment()); 6412 ASSERT(instr->HasEnvironment());
6395 LEnvironment* env = instr->environment(); 6413 LEnvironment* env = instr->environment();
6396 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); 6414 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt);
6397 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); 6415 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index());
6398 } 6416 }
6399 6417
6400 6418
6401 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { 6419 void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
6402 DeoptimizeIf(no_condition, instr->environment()); 6420 DeoptimizeIf(no_condition, instr->environment(), instr->is_soft_deopt());
6403 } 6421 }
6404 6422
6405 6423
6406 void LCodeGen::DoDummyUse(LDummyUse* instr) { 6424 void LCodeGen::DoDummyUse(LDummyUse* instr) {
6407 // Nothing to see here, move on! 6425 // Nothing to see here, move on!
6408 } 6426 }
6409 6427
6410 6428
6411 void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) { 6429 void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) {
6412 LOperand* obj = instr->object(); 6430 LOperand* obj = instr->object();
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
6605 FixedArray::kHeaderSize - kPointerSize)); 6623 FixedArray::kHeaderSize - kPointerSize));
6606 __ bind(&done); 6624 __ bind(&done);
6607 } 6625 }
6608 6626
6609 6627
6610 #undef __ 6628 #undef __
6611 6629
6612 } } // namespace v8::internal 6630 } } // namespace v8::internal
6613 6631
6614 #endif // V8_TARGET_ARCH_IA32 6632 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698