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

Side by Side Diff: src/hydrogen.cc

Issue 11088026: Make sure that the context argument of HAdd is never NULL. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added comment Created 8 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
« no previous file with comments | « no previous file | 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 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 3549 matching lines...) Expand 10 before | Expand all | Expand 10 after
3560 void BuildOffsetAdd(HBoundsCheck* check, 3560 void BuildOffsetAdd(HBoundsCheck* check,
3561 HAdd** add, 3561 HAdd** add,
3562 HConstant** constant, 3562 HConstant** constant,
3563 HValue* original_value, 3563 HValue* original_value,
3564 Representation representation, 3564 Representation representation,
3565 int32_t new_offset) { 3565 int32_t new_offset) {
3566 HConstant* new_constant = new(BasicBlock()->zone()) 3566 HConstant* new_constant = new(BasicBlock()->zone())
3567 HConstant(new_offset, Representation::Integer32()); 3567 HConstant(new_offset, Representation::Integer32());
3568 if (*add == NULL) { 3568 if (*add == NULL) {
3569 new_constant->InsertBefore(check); 3569 new_constant->InsertBefore(check);
3570 *add = new(BasicBlock()->zone()) HAdd(NULL, 3570 // Because of the bounds checks elimination algorithm, the index is always
3571 // an HAdd or an HSub here, so we can safely cast to an HBinaryOperation.
3572 HValue* context = HBinaryOperation::cast(check->index())->context();
3573 *add = new(BasicBlock()->zone()) HAdd(context,
3571 original_value, 3574 original_value,
3572 new_constant); 3575 new_constant);
3573 (*add)->AssumeRepresentation(representation); 3576 (*add)->AssumeRepresentation(representation);
3574 (*add)->InsertBefore(check); 3577 (*add)->InsertBefore(check);
3575 } else { 3578 } else {
3576 new_constant->InsertBefore(*add); 3579 new_constant->InsertBefore(*add);
3577 (*constant)->DeleteAndReplaceWith(new_constant); 3580 (*constant)->DeleteAndReplaceWith(new_constant);
3578 } 3581 }
3579 *constant = new_constant; 3582 *constant = new_constant;
3580 } 3583 }
(...skipping 6356 matching lines...) Expand 10 before | Expand all | Expand 10 after
9937 } 9940 }
9938 } 9941 }
9939 9942
9940 #ifdef DEBUG 9943 #ifdef DEBUG
9941 if (graph_ != NULL) graph_->Verify(false); // No full verify. 9944 if (graph_ != NULL) graph_->Verify(false); // No full verify.
9942 if (allocator_ != NULL) allocator_->Verify(); 9945 if (allocator_ != NULL) allocator_->Verify();
9943 #endif 9946 #endif
9944 } 9947 }
9945 9948
9946 } } // namespace v8::internal 9949 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698