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

Side by Side Diff: src/hydrogen.cc

Issue 14365014: Switch elements access to use IfBuilder instead of CheckBuilder. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Daniel Clifford. Created 7 years, 8 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') | 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 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 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 did_else_ = true; 863 did_else_ = true;
864 } 864 }
865 865
866 866
867 void HGraphBuilder::IfBuilder::Deopt() { 867 void HGraphBuilder::IfBuilder::Deopt() {
868 ASSERT(!(did_then_ ^ did_else_)); 868 ASSERT(!(did_then_ ^ did_else_));
869 HBasicBlock* block = builder_->current_block(); 869 HBasicBlock* block = builder_->current_block();
870 block->FinishExitWithDeoptimization(HDeoptimize::kUseAll); 870 block->FinishExitWithDeoptimization(HDeoptimize::kUseAll);
871 if (did_else_) { 871 if (did_else_) {
872 first_false_block_ = NULL; 872 first_false_block_ = NULL;
873 did_else_ = false;
874 } else { 873 } else {
875 first_true_block_ = NULL; 874 first_true_block_ = NULL;
876 } 875 }
877 } 876 }
878 877
879 878
880 void HGraphBuilder::IfBuilder::End() { 879 void HGraphBuilder::IfBuilder::End() {
881 if (!captured_) { 880 if (!captured_) {
882 ASSERT(did_then_); 881 ASSERT(did_then_);
883 if (!did_else_) { 882 if (!did_else_) {
884 last_true_block_ = builder_->current_block(); 883 last_true_block_ = builder_->current_block();
885 } 884 }
886 if (first_true_block_ == NULL) { 885 if (first_true_block_ == NULL) {
887 // Deopt on true. Nothing to do, just continue the else block. 886 // Deopt on true. Nothing to do, just continue the false block.
888 } else if (first_false_block_ == NULL) { 887 } else if (first_false_block_ == NULL) {
888 // Deopt on false. Nothing to do except switching to the true block.
889 builder_->set_current_block(last_true_block_); 889 builder_->set_current_block(last_true_block_);
890 } else { 890 } else {
891 HEnvironment* merge_env = last_true_block_->last_environment()->Copy(); 891 HEnvironment* merge_env = last_true_block_->last_environment()->Copy();
892 merge_block_ = builder_->CreateBasicBlock(merge_env); 892 merge_block_ = builder_->CreateBasicBlock(merge_env);
893 ASSERT(!finished_); 893 ASSERT(!finished_);
894 if (!did_else_) Else(); 894 if (!did_else_) Else();
895 ASSERT(!last_true_block_->IsFinished()); 895 ASSERT(!last_true_block_->IsFinished());
896 HBasicBlock* last_false_block = builder_->current_block(); 896 HBasicBlock* last_false_block = builder_->current_block();
897 ASSERT(!last_false_block->IsFinished()); 897 ASSERT(!last_false_block->IsFinished());
898 last_true_block_->GotoNoSimulate(merge_block_); 898 last_true_block_->GotoNoSimulate(merge_block_);
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 HValue* checked_key = NULL; 1308 HValue* checked_key = NULL;
1309 if (IsExternalArrayElementsKind(elements_kind)) { 1309 if (IsExternalArrayElementsKind(elements_kind)) {
1310 if (store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) { 1310 if (store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) {
1311 NoObservableSideEffectsScope no_effects(this); 1311 NoObservableSideEffectsScope no_effects(this);
1312 HLoadExternalArrayPointer* external_elements = 1312 HLoadExternalArrayPointer* external_elements =
1313 new(zone) HLoadExternalArrayPointer(elements); 1313 new(zone) HLoadExternalArrayPointer(elements);
1314 AddInstruction(external_elements); 1314 AddInstruction(external_elements);
1315 IfBuilder length_checker(this); 1315 IfBuilder length_checker(this);
1316 length_checker.IfCompare(key, length, Token::LT); 1316 length_checker.IfCompare(key, length, Token::LT);
1317 length_checker.Then(); 1317 length_checker.Then();
1318 CheckBuilder negative_checker(this); 1318 IfBuilder negative_checker(this);
1319 HValue* bounds_check = negative_checker.CheckIntegerCompare( 1319 HValue* bounds_check = negative_checker.IfCompare(
1320 key, graph()->GetConstant0(), Token::GTE); 1320 key, graph()->GetConstant0(), Token::GTE);
1321 negative_checker.End(); 1321 negative_checker.Then();
1322 HInstruction* result = BuildExternalArrayElementAccess( 1322 HInstruction* result = BuildExternalArrayElementAccess(
1323 external_elements, key, val, bounds_check, 1323 external_elements, key, val, bounds_check,
1324 elements_kind, is_store); 1324 elements_kind, is_store);
1325 AddInstruction(result); 1325 AddInstruction(result);
1326 negative_checker.Else();
1327 negative_checker.Deopt();
1328 negative_checker.End();
1326 length_checker.End(); 1329 length_checker.End();
1327 return result; 1330 return result;
1328 } else { 1331 } else {
1329 ASSERT(store_mode == STANDARD_STORE); 1332 ASSERT(store_mode == STANDARD_STORE);
1330 checked_key = AddBoundsCheck( 1333 checked_key = AddBoundsCheck(
1331 key, length, ALLOW_SMI_KEY, checked_index_representation); 1334 key, length, ALLOW_SMI_KEY, checked_index_representation);
1332 HLoadExternalArrayPointer* external_elements = 1335 HLoadExternalArrayPointer* external_elements =
1333 new(zone) HLoadExternalArrayPointer(elements); 1336 new(zone) HLoadExternalArrayPointer(elements);
1334 AddInstruction(external_elements); 1337 AddInstruction(external_elements);
1335 return AddInstruction(BuildExternalArrayElementAccess( 1338 return AddInstruction(BuildExternalArrayElementAccess(
(...skipping 10534 matching lines...) Expand 10 before | Expand all | Expand 10 after
11870 } 11873 }
11871 } 11874 }
11872 11875
11873 #ifdef DEBUG 11876 #ifdef DEBUG
11874 if (graph_ != NULL) graph_->Verify(false); // No full verify. 11877 if (graph_ != NULL) graph_->Verify(false); // No full verify.
11875 if (allocator_ != NULL) allocator_->Verify(); 11878 if (allocator_ != NULL) allocator_->Verify();
11876 #endif 11879 #endif
11877 } 11880 }
11878 11881
11879 } } // namespace v8::internal 11882 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698