Chromium Code Reviews

Side by Side Diff: src/hydrogen-uint32-analysis.cc

Issue 54393002: Fix uint32-to-smi conversion in Lithium (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed Slava's comment Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('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 18 matching lines...)
29 29
30 namespace v8 { 30 namespace v8 {
31 namespace internal { 31 namespace internal {
32 32
33 33
34 bool HUint32AnalysisPhase::IsSafeUint32Use(HValue* val, HValue* use) { 34 bool HUint32AnalysisPhase::IsSafeUint32Use(HValue* val, HValue* use) {
35 // Operations that operate on bits are safe. 35 // Operations that operate on bits are safe.
36 if (use->IsBitwise() || use->IsShl() || use->IsSar() || use->IsShr()) { 36 if (use->IsBitwise() || use->IsShl() || use->IsSar() || use->IsShr()) {
37 return true; 37 return true;
38 } else if (use->IsChange() || use->IsSimulate()) { 38 } else if (use->IsChange() || use->IsSimulate()) {
39 // Conversions and deoptimization have special support for unt32. 39 // Conversions and deoptimization have special support for uint32.
40 // This ASSERT guards that the conversion in question is actually
41 // implemented. Do not extend the whitelist without adding
42 // support to LChunkBuilder::DoChange().
43 ASSERT(!use->IsChange() ||
Vyacheslav Egorov (Google) 2013/10/31 10:05:36 I would make it else if (use->IsSimulate()) {
44 HChange::cast(use)->to().IsDouble() ||
45 HChange::cast(use)->to().IsSmi() ||
46 HChange::cast(use)->to().IsTagged());
40 return true; 47 return true;
41 } else if (use->IsStoreKeyed()) { 48 } else if (use->IsStoreKeyed()) {
42 HStoreKeyed* store = HStoreKeyed::cast(use); 49 HStoreKeyed* store = HStoreKeyed::cast(use);
43 if (store->is_external()) { 50 if (store->is_external()) {
44 // Storing a value into an external integer array is a bit level 51 // Storing a value into an external integer array is a bit level
45 // operation. 52 // operation.
46 if (store->value() == val) { 53 if (store->value() == val) {
47 // Clamping or a conversion to double should have beed inserted. 54 // Clamping or a conversion to double should have beed inserted.
48 ASSERT(store->elements_kind() != EXTERNAL_PIXEL_ELEMENTS); 55 ASSERT(store->elements_kind() != EXTERNAL_PIXEL_ELEMENTS);
49 ASSERT(store->elements_kind() != EXTERNAL_FLOAT_ELEMENTS); 56 ASSERT(store->elements_kind() != EXTERNAL_FLOAT_ELEMENTS);
(...skipping 168 matching lines...)
218 225
219 // Some phis might have been optimistically marked with kUint32 flag. 226 // Some phis might have been optimistically marked with kUint32 flag.
220 // Remove this flag from those phis that are unsafe and propagate 227 // Remove this flag from those phis that are unsafe and propagate
221 // this information transitively potentially clearing kUint32 flag 228 // this information transitively potentially clearing kUint32 flag
222 // from some non-phi operations that are used as operands to unsafe phis. 229 // from some non-phi operations that are used as operands to unsafe phis.
223 UnmarkUnsafePhis(); 230 UnmarkUnsafePhis();
224 } 231 }
225 232
226 233
227 } } // namespace v8::internal 234 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine