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

Powered by Google App Engine
This is Rietveld 408576698