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

Side by Side Diff: src/hydrogen.cc

Issue 7012010: Don't use environment values at certain deoptimize-instructions. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 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/hydrogen.h ('k') | src/hydrogen-instructions.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 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 if (first_ == NULL) { 108 if (first_ == NULL) {
109 HBlockEntry* entry = new(zone()) HBlockEntry(); 109 HBlockEntry* entry = new(zone()) HBlockEntry();
110 entry->InitializeAsFirst(this); 110 entry->InitializeAsFirst(this);
111 first_ = last_ = entry; 111 first_ = last_ = entry;
112 } 112 }
113 instr->InsertAfter(last_); 113 instr->InsertAfter(last_);
114 last_ = instr; 114 last_ = instr;
115 } 115 }
116 116
117 117
118 HDeoptimize* HBasicBlock::CreateDeoptimize() { 118 HDeoptimize* HBasicBlock::CreateDeoptimize(
119 HDeoptimize::UseEnvironment has_uses) {
119 ASSERT(HasEnvironment()); 120 ASSERT(HasEnvironment());
121 if (has_uses == HDeoptimize::kNoUses) return new(zone()) HDeoptimize(0);
122
120 HEnvironment* environment = last_environment(); 123 HEnvironment* environment = last_environment();
121
122 HDeoptimize* instr = new(zone()) HDeoptimize(environment->length()); 124 HDeoptimize* instr = new(zone()) HDeoptimize(environment->length());
123
124 for (int i = 0; i < environment->length(); i++) { 125 for (int i = 0; i < environment->length(); i++) {
125 HValue* val = environment->values()->at(i); 126 HValue* val = environment->values()->at(i);
126 instr->AddEnvironmentValue(val); 127 instr->AddEnvironmentValue(val);
127 } 128 }
128 129
129 return instr; 130 return instr;
130 } 131 }
131 132
132 133
133 HSimulate* HBasicBlock::CreateSimulate(int id) { 134 HSimulate* HBasicBlock::CreateSimulate(int id) {
(...skipping 2349 matching lines...) Expand 10 before | Expand all | Expand 10 after
2483 for (int i = 0; i < clause_count; ++i) { 2484 for (int i = 0; i < clause_count; ++i) {
2484 CaseClause* clause = clauses->at(i); 2485 CaseClause* clause = clauses->at(i);
2485 if (clause->is_default()) continue; 2486 if (clause->is_default()) continue;
2486 if (!clause->label()->IsSmiLiteral()) { 2487 if (!clause->label()->IsSmiLiteral()) {
2487 return Bailout("SwitchStatement: non-literal switch label"); 2488 return Bailout("SwitchStatement: non-literal switch label");
2488 } 2489 }
2489 2490
2490 // Unconditionally deoptimize on the first non-smi compare. 2491 // Unconditionally deoptimize on the first non-smi compare.
2491 clause->RecordTypeFeedback(oracle()); 2492 clause->RecordTypeFeedback(oracle());
2492 if (!clause->IsSmiCompare()) { 2493 if (!clause->IsSmiCompare()) {
2493 current_block()->FinishExitWithDeoptimization(); 2494 // Finish with deoptimize and add uses of enviroment values to
2495 // account for invisible uses.
2496 current_block()->FinishExitWithDeoptimization(HDeoptimize::kUseAll);
2494 set_current_block(NULL); 2497 set_current_block(NULL);
2495 break; 2498 break;
2496 } 2499 }
2497 2500
2498 // Otherwise generate a compare and branch. 2501 // Otherwise generate a compare and branch.
2499 CHECK_ALIVE(VisitForValue(clause->label())); 2502 CHECK_ALIVE(VisitForValue(clause->label()));
2500 HValue* label_value = Pop(); 2503 HValue* label_value = Pop();
2501 HCompare* compare = 2504 HCompare* compare =
2502 new(zone()) HCompare(tag_value, label_value, Token::EQ_STRICT); 2505 new(zone()) HCompare(tag_value, label_value, Token::EQ_STRICT);
2503 compare->SetInputRepresentation(Representation::Integer32()); 2506 compare->SetInputRepresentation(Representation::Integer32());
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
3230 current_block()->Goto(join); 3233 current_block()->Goto(join);
3231 3234
3232 set_current_block(if_false); 3235 set_current_block(if_false);
3233 } 3236 }
3234 } 3237 }
3235 3238
3236 // Finish up. Unconditionally deoptimize if we've handled all the maps we 3239 // Finish up. Unconditionally deoptimize if we've handled all the maps we
3237 // know about and do not want to handle ones we've never seen. Otherwise 3240 // know about and do not want to handle ones we've never seen. Otherwise
3238 // use a generic IC. 3241 // use a generic IC.
3239 if (count == types->length() && FLAG_deoptimize_uncommon_cases) { 3242 if (count == types->length() && FLAG_deoptimize_uncommon_cases) {
3240 current_block()->FinishExitWithDeoptimization(); 3243 current_block()->FinishExitWithDeoptimization(HDeoptimize::kNoUses);
3241 } else { 3244 } else {
3242 HInstruction* instr = BuildStoreNamedGeneric(object, name, value); 3245 HInstruction* instr = BuildStoreNamedGeneric(object, name, value);
3243 instr->set_position(expr->position()); 3246 instr->set_position(expr->position());
3244 AddInstruction(instr); 3247 AddInstruction(instr);
3245 3248
3246 if (join != NULL) { 3249 if (join != NULL) {
3247 if (!ast_context()->IsEffect()) Push(value); 3250 if (!ast_context()->IsEffect()) Push(value);
3248 current_block()->Goto(join); 3251 current_block()->Goto(join);
3249 } else { 3252 } else {
3250 // The HSimulate for the store should not see the stored value in 3253 // The HSimulate for the store should not see the stored value in
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
3909 3912
3910 if (current_block() != NULL) current_block()->Goto(join); 3913 if (current_block() != NULL) current_block()->Goto(join);
3911 set_current_block(if_false); 3914 set_current_block(if_false);
3912 } 3915 }
3913 } 3916 }
3914 3917
3915 // Finish up. Unconditionally deoptimize if we've handled all the maps we 3918 // Finish up. Unconditionally deoptimize if we've handled all the maps we
3916 // know about and do not want to handle ones we've never seen. Otherwise 3919 // know about and do not want to handle ones we've never seen. Otherwise
3917 // use a generic IC. 3920 // use a generic IC.
3918 if (count == types->length() && FLAG_deoptimize_uncommon_cases) { 3921 if (count == types->length() && FLAG_deoptimize_uncommon_cases) {
3919 current_block()->FinishExitWithDeoptimization(); 3922 current_block()->FinishExitWithDeoptimization(HDeoptimize::kNoUses);
3920 } else { 3923 } else {
3921 HValue* context = environment()->LookupContext(); 3924 HValue* context = environment()->LookupContext();
3922 HCallNamed* call = new(zone()) HCallNamed(context, name, argument_count); 3925 HCallNamed* call = new(zone()) HCallNamed(context, name, argument_count);
3923 call->set_position(expr->position()); 3926 call->set_position(expr->position());
3924 PreProcessCall(call); 3927 PreProcessCall(call);
3925 3928
3926 if (join != NULL) { 3929 if (join != NULL) {
3927 AddInstruction(call); 3930 AddInstruction(call);
3928 if (!ast_context()->IsEffect()) Push(call); 3931 if (!ast_context()->IsEffect()) Push(call);
3929 current_block()->Goto(join); 3932 current_block()->Goto(join);
(...skipping 2190 matching lines...) Expand 10 before | Expand all | Expand 10 after
6120 } 6123 }
6121 } 6124 }
6122 6125
6123 #ifdef DEBUG 6126 #ifdef DEBUG
6124 if (graph_ != NULL) graph_->Verify(); 6127 if (graph_ != NULL) graph_->Verify();
6125 if (allocator_ != NULL) allocator_->Verify(); 6128 if (allocator_ != NULL) allocator_->Verify();
6126 #endif 6129 #endif
6127 } 6130 }
6128 6131
6129 } } // namespace v8::internal 6132 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698