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 1892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1903 return NULL; | 1903 return NULL; |
1904 } | 1904 } |
1905 | 1905 |
1906 | 1906 |
1907 LInstruction* LChunkBuilder::DoChange(HChange* instr) { | 1907 LInstruction* LChunkBuilder::DoChange(HChange* instr) { |
1908 Representation from = instr->from(); | 1908 Representation from = instr->from(); |
1909 Representation to = instr->to(); | 1909 Representation to = instr->to(); |
1910 if (from.IsSmi()) { | 1910 if (from.IsSmi()) { |
1911 if (to.IsTagged()) { | 1911 if (to.IsTagged()) { |
1912 LOperand* value = UseRegister(instr->value()); | 1912 LOperand* value = UseRegister(instr->value()); |
1913 return DefineSameAsFirst(new(zone()) LDummyUse(value)); | 1913 // For now, always deopt on hole. |
| 1914 if (instr->value()->IsLoadKeyed() && |
| 1915 HLoadKeyed::cast(instr->value())->UsesMustHandleHole()) { |
| 1916 return AssignEnvironment( |
| 1917 DefineSameAsFirst(new(zone()) LCheckSmiAndReturn(value))); |
| 1918 } else { |
| 1919 return DefineSameAsFirst(new(zone()) LDummyUse(value)); |
| 1920 } |
1914 } | 1921 } |
1915 from = Representation::Tagged(); | 1922 from = Representation::Tagged(); |
1916 } | 1923 } |
1917 // Only mark conversions that might need to allocate as calling rather than | 1924 // Only mark conversions that might need to allocate as calling rather than |
1918 // all changes. This makes simple, non-allocating conversion not have to force | 1925 // all changes. This makes simple, non-allocating conversion not have to force |
1919 // building a stack frame. | 1926 // building a stack frame. |
1920 if (from.IsTagged()) { | 1927 if (from.IsTagged()) { |
1921 if (to.IsDouble()) { | 1928 if (to.IsDouble()) { |
1922 info()->MarkAsDeferredCalling(); | 1929 info()->MarkAsDeferredCalling(); |
1923 LOperand* value = UseRegister(instr->value()); | 1930 LOperand* value = UseRegister(instr->value()); |
1924 // Temp register only necessary for minus zero check. | 1931 // Temp register only necessary for minus zero check. |
1925 LOperand* temp = instr->deoptimize_on_minus_zero() | 1932 LOperand* temp = instr->deoptimize_on_minus_zero() |
1926 ? TempRegister() | 1933 ? TempRegister() |
1927 : NULL; | 1934 : NULL; |
1928 LNumberUntagD* res = new(zone()) LNumberUntagD(value, temp); | 1935 LNumberUntagD* res = new(zone()) LNumberUntagD(value, temp); |
1929 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { | 1936 if (CpuFeatures::IsSafeForSnapshot(SSE2)) { |
1930 return AssignEnvironment(DefineAsRegister(res)); | 1937 return AssignEnvironment(DefineAsRegister(res)); |
1931 } else { | 1938 } else { |
1932 return AssignEnvironment(DefineX87TOS(res)); | 1939 return AssignEnvironment(DefineX87TOS(res)); |
1933 } | 1940 } |
1934 } else if (to.IsSmi()) { | 1941 } else if (to.IsSmi()) { |
1935 HValue* val = instr->value(); | 1942 HValue* val = instr->value(); |
1936 LOperand* value = UseRegisterAtStart(val); | 1943 LOperand* value = UseRegister(val); |
1937 return AssignEnvironment( | 1944 return AssignEnvironment( |
1938 DefineSameAsFirst(new(zone()) LCheckSmi(value))); | 1945 DefineSameAsFirst(new(zone()) LCheckSmiAndReturn(value))); |
1939 } else { | 1946 } else { |
1940 ASSERT(to.IsInteger32()); | 1947 ASSERT(to.IsInteger32()); |
1941 if (instr->value()->type().IsSmi()) { | 1948 if (instr->value()->type().IsSmi()) { |
1942 LOperand* value = UseRegister(instr->value()); | 1949 LOperand* value = UseRegister(instr->value()); |
1943 LInstruction* result = | 1950 LInstruction* result = |
1944 DefineSameAsFirst(new(zone()) LSmiUntag(value, false)); | 1951 DefineSameAsFirst(new(zone()) LSmiUntag(value, false)); |
1945 if (instr->value()->IsLoadKeyed()) { | 1952 if (instr->value()->IsLoadKeyed()) { |
1946 HLoadKeyed* load_keyed = HLoadKeyed::cast(instr->value()); | 1953 HLoadKeyed* load_keyed = HLoadKeyed::cast(instr->value()); |
1947 if (load_keyed->UsesMustHandleHole() && | 1954 if (load_keyed->UsesMustHandleHole() && |
1948 load_keyed->hole_mode() == NEVER_RETURN_HOLE) { | 1955 load_keyed->hole_mode() == NEVER_RETURN_HOLE) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2051 | 2058 |
2052 LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) { | 2059 LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) { |
2053 LUnallocated* temp = TempRegister(); | 2060 LUnallocated* temp = TempRegister(); |
2054 LCheckPrototypeMaps* result = new(zone()) LCheckPrototypeMaps(temp); | 2061 LCheckPrototypeMaps* result = new(zone()) LCheckPrototypeMaps(temp); |
2055 return AssignEnvironment(result); | 2062 return AssignEnvironment(result); |
2056 } | 2063 } |
2057 | 2064 |
2058 | 2065 |
2059 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) { | 2066 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) { |
2060 LOperand* value = UseAtStart(instr->value()); | 2067 LOperand* value = UseAtStart(instr->value()); |
2061 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); | 2068 return AssignEnvironment(new(zone()) LCheckSmi(value)); |
2062 } | 2069 } |
2063 | 2070 |
2064 | 2071 |
2065 LInstruction* LChunkBuilder::DoCheckSmiOrInt32(HCheckSmiOrInt32* instr) { | 2072 LInstruction* LChunkBuilder::DoCheckSmiOrInt32(HCheckSmiOrInt32* instr) { |
2066 LOperand* value = UseAtStart(instr->value()); | 2073 LOperand* value = UseAtStart(instr->value()); |
2067 return AssignEnvironment(DefineSameAsFirst(new(zone()) LCheckSmi(value))); | 2074 return AssignEnvironment(new(zone()) LCheckSmi(value)); |
2068 } | 2075 } |
2069 | 2076 |
2070 | 2077 |
2071 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) { | 2078 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) { |
2072 // If the target is in new space, we'll emit a global cell compare and so | 2079 // If the target is in new space, we'll emit a global cell compare and so |
2073 // want the value in a register. If the target gets promoted before we | 2080 // want the value in a register. If the target gets promoted before we |
2074 // emit code, we will still get the register but will do an immediate | 2081 // emit code, we will still get the register but will do an immediate |
2075 // compare instead of the cell compare. This is safe. | 2082 // compare instead of the cell compare. This is safe. |
2076 LOperand* value = instr->target_in_new_space() | 2083 LOperand* value = instr->target_in_new_space() |
2077 ? UseRegisterAtStart(instr->value()) : UseAtStart(instr->value()); | 2084 ? UseRegisterAtStart(instr->value()) : UseAtStart(instr->value()); |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2792 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2799 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2793 LOperand* object = UseRegister(instr->object()); | 2800 LOperand* object = UseRegister(instr->object()); |
2794 LOperand* index = UseTempRegister(instr->index()); | 2801 LOperand* index = UseTempRegister(instr->index()); |
2795 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2802 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
2796 } | 2803 } |
2797 | 2804 |
2798 | 2805 |
2799 } } // namespace v8::internal | 2806 } } // namespace v8::internal |
2800 | 2807 |
2801 #endif // V8_TARGET_ARCH_IA32 | 2808 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |