Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1897 // representation change phase of Hydrogen. | 1897 // representation change phase of Hydrogen. |
| 1898 UNREACHABLE(); | 1898 UNREACHABLE(); |
| 1899 return NULL; | 1899 return NULL; |
| 1900 } | 1900 } |
| 1901 | 1901 |
| 1902 | 1902 |
| 1903 LInstruction* LChunkBuilder::DoChange(HChange* instr) { | 1903 LInstruction* LChunkBuilder::DoChange(HChange* instr) { |
| 1904 Representation from = instr->from(); | 1904 Representation from = instr->from(); |
| 1905 Representation to = instr->to(); | 1905 Representation to = instr->to(); |
| 1906 if (from.IsSmi()) { | 1906 if (from.IsSmi()) { |
| 1907 if (to.IsTagged()) { | 1907 if (to.IsSmiOrTagged()) { |
|
Toon Verwaest
2013/08/12 14:53:42
Smi -> Smi doesn't happen, so this is superfluous.
weiliang.lin2
2013/08/13 02:36:57
Done.
| |
| 1908 LOperand* value = UseRegister(instr->value()); | 1908 LOperand* value = UseRegister(instr->value()); |
| 1909 return DefineSameAsFirst(new(zone()) LDummyUse(value)); | 1909 return DefineSameAsFirst(new(zone()) LDummyUse(value)); |
| 1910 } | 1910 } |
| 1911 if (to.IsInteger32()) { | |
| 1912 LOperand* value = UseRegister(instr->value()); | |
| 1913 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false)); | |
| 1914 } | |
| 1911 from = Representation::Tagged(); | 1915 from = Representation::Tagged(); |
| 1912 } | 1916 } |
| 1913 // Only mark conversions that might need to allocate as calling rather than | 1917 // Only mark conversions that might need to allocate as calling rather than |
| 1914 // all changes. This makes simple, non-allocating conversion not have to force | 1918 // all changes. This makes simple, non-allocating conversion not have to force |
| 1915 // building a stack frame. | 1919 // building a stack frame. |
| 1916 if (from.IsTagged()) { | 1920 if (from.IsTagged()) { |
| 1917 if (to.IsDouble()) { | 1921 if (to.IsDouble()) { |
| 1918 info()->MarkAsDeferredCalling(); | 1922 info()->MarkAsDeferredCalling(); |
| 1919 LOperand* value = UseRegister(instr->value()); | 1923 LOperand* value = UseRegister(instr->value()); |
| 1920 // Temp register only necessary for minus zero check. | 1924 // Temp register only necessary for minus zero check. |
| 1921 LOperand* temp = instr->deoptimize_on_minus_zero() | 1925 LOperand* temp = instr->deoptimize_on_minus_zero() |
| 1922 ? TempRegister() | 1926 ? TempRegister() |
| 1923 : NULL; | 1927 : NULL; |
| 1924 LNumberUntagD* res = new(zone()) LNumberUntagD(value, temp); | 1928 LNumberUntagD* res = new(zone()) LNumberUntagD(value, temp); |
|
Toon Verwaest
2013/08/12 14:53:42
We should probably check the value representation
weiliang.lin2
2013/08/13 02:36:57
Done.
I found that NumberUntagD has already check
| |
| 1925 return AssignEnvironment(DefineAsRegister(res)); | 1929 return AssignEnvironment(DefineAsRegister(res)); |
| 1926 } else if (to.IsSmi()) { | 1930 } else if (to.IsSmi()) { |
| 1927 HValue* val = instr->value(); | 1931 HValue* val = instr->value(); |
| 1928 LOperand* value = UseRegister(val); | 1932 LOperand* value = UseRegister(val); |
| 1929 if (val->type().IsSmi()) { | 1933 if (val->type().IsSmi()) { |
| 1930 return DefineSameAsFirst(new(zone()) LDummyUse(value)); | 1934 return DefineSameAsFirst(new(zone()) LDummyUse(value)); |
| 1931 } | 1935 } |
| 1932 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); | 1936 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); |
| 1933 } else { | 1937 } else { |
| 1934 ASSERT(to.IsInteger32()); | 1938 ASSERT(to.IsInteger32()); |
| 1935 if (instr->value()->type().IsSmi()) { | 1939 if (instr->value()->type().IsSmi()) { |
|
Toon Verwaest
2013/08/12 14:53:42
What about val->type().IsSmi() || val->representat
weiliang.lin2
2013/08/13 02:36:57
Yes, that is another way to fix
Done.
| |
| 1936 LOperand* value = UseRegister(instr->value()); | 1940 LOperand* value = UseRegister(instr->value()); |
| 1937 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false)); | 1941 return DefineSameAsFirst(new(zone()) LSmiUntag(value, false)); |
| 1938 } else { | 1942 } else { |
| 1939 bool truncating = instr->CanTruncateToInt32(); | 1943 bool truncating = instr->CanTruncateToInt32(); |
| 1940 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { | 1944 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { |
| 1941 LOperand* value = UseRegister(instr->value()); | 1945 LOperand* value = UseRegister(instr->value()); |
| 1942 LOperand* xmm_temp = | 1946 LOperand* xmm_temp = |
| 1943 (truncating && CpuFeatures::IsSupported(SSE3)) | 1947 (truncating && CpuFeatures::IsSupported(SSE3)) |
| 1944 ? NULL | 1948 ? NULL |
| 1945 : FixedTemp(xmm1); | 1949 : FixedTemp(xmm1); |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2726 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2730 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2727 LOperand* object = UseRegister(instr->object()); | 2731 LOperand* object = UseRegister(instr->object()); |
| 2728 LOperand* index = UseTempRegister(instr->index()); | 2732 LOperand* index = UseTempRegister(instr->index()); |
| 2729 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2733 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2730 } | 2734 } |
| 2731 | 2735 |
| 2732 | 2736 |
| 2733 } } // namespace v8::internal | 2737 } } // namespace v8::internal |
| 2734 | 2738 |
| 2735 #endif // V8_TARGET_ARCH_IA32 | 2739 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |