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

Side by Side Diff: src/hydrogen-canonicalize.cc

Issue 20070005: Adding Smi support to Add, Sub, Mul, and Bitwise (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed nit Created 7 years, 5 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.cc ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 20 matching lines...) Expand all
31 namespace internal { 31 namespace internal {
32 32
33 void HCanonicalizePhase::Run() { 33 void HCanonicalizePhase::Run() {
34 const ZoneList<HBasicBlock*>* blocks(graph()->blocks()); 34 const ZoneList<HBasicBlock*>* blocks(graph()->blocks());
35 // Before removing no-op instructions, save their semantic value. 35 // Before removing no-op instructions, save their semantic value.
36 // We must be careful not to set the flag unnecessarily, because GVN 36 // We must be careful not to set the flag unnecessarily, because GVN
37 // cannot identify two instructions when their flag value differs. 37 // cannot identify two instructions when their flag value differs.
38 for (int i = 0; i < blocks->length(); ++i) { 38 for (int i = 0; i < blocks->length(); ++i) {
39 for (HInstructionIterator it(blocks->at(i)); !it.Done(); it.Advance()) { 39 for (HInstructionIterator it(blocks->at(i)); !it.Done(); it.Advance()) {
40 HInstruction* instr = it.Current(); 40 HInstruction* instr = it.Current();
41 if (instr->IsArithmeticBinaryOperation() && 41 if (instr->IsArithmeticBinaryOperation()) {
42 instr->representation().IsInteger32() && 42 if (instr->representation().IsInteger32()) {
43 instr->HasAtLeastOneUseWithFlagAndNoneWithout( 43 if (instr->HasAtLeastOneUseWithFlagAndNoneWithout(
44 HInstruction::kTruncatingToInt32)) { 44 HInstruction::kTruncatingToInt32)) {
45 instr->SetFlag(HInstruction::kAllUsesTruncatingToInt32); 45 instr->SetFlag(HInstruction::kAllUsesTruncatingToInt32);
46 }
47 } else if (instr->representation().IsSmi()) {
48 if (instr->HasAtLeastOneUseWithFlagAndNoneWithout(
49 HInstruction::kTruncatingToSmi)) {
50 instr->SetFlag(HInstruction::kAllUsesTruncatingToSmi);
51 }
52 }
46 } 53 }
47 } 54 }
48 } 55 }
49 // Perform actual Canonicalization pass. 56 // Perform actual Canonicalization pass.
50 for (int i = 0; i < blocks->length(); ++i) { 57 for (int i = 0; i < blocks->length(); ++i) {
51 for (HInstructionIterator it(blocks->at(i)); !it.Done(); it.Advance()) { 58 for (HInstructionIterator it(blocks->at(i)); !it.Done(); it.Advance()) {
52 HInstruction* instr = it.Current(); 59 HInstruction* instr = it.Current();
53 HValue* value = instr->Canonicalize(); 60 HValue* value = instr->Canonicalize();
54 if (value != instr) instr->DeleteAndReplaceWith(value); 61 if (value != instr) instr->DeleteAndReplaceWith(value);
55 } 62 }
56 } 63 }
57 } 64 }
58 65
59 } } // namespace v8::internal 66 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698