OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1895 LOperand* elements = UseRegisterAtStart(instr->elements()); | 1895 LOperand* elements = UseRegisterAtStart(instr->elements()); |
1896 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 1896 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
1897 LLoadKeyedFastDoubleElement* result = | 1897 LLoadKeyedFastDoubleElement* result = |
1898 new LLoadKeyedFastDoubleElement(elements, key); | 1898 new LLoadKeyedFastDoubleElement(elements, key); |
1899 return AssignEnvironment(DefineAsRegister(result)); | 1899 return AssignEnvironment(DefineAsRegister(result)); |
1900 } | 1900 } |
1901 | 1901 |
1902 | 1902 |
1903 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( | 1903 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( |
1904 HLoadKeyedSpecializedArrayElement* instr) { | 1904 HLoadKeyedSpecializedArrayElement* instr) { |
1905 JSObject::ElementsKind elements_kind = instr->elements_kind(); | 1905 ElementsKind elements_kind = instr->elements_kind(); |
1906 Representation representation(instr->representation()); | 1906 Representation representation(instr->representation()); |
1907 ASSERT( | 1907 ASSERT( |
1908 (representation.IsInteger32() && | 1908 (representation.IsInteger32() && |
1909 (elements_kind != JSObject::EXTERNAL_FLOAT_ELEMENTS) && | 1909 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
1910 (elements_kind != JSObject::EXTERNAL_DOUBLE_ELEMENTS)) || | 1910 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || |
1911 (representation.IsDouble() && | 1911 (representation.IsDouble() && |
1912 ((elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) || | 1912 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || |
1913 (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS)))); | 1913 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); |
1914 ASSERT(instr->key()->representation().IsInteger32()); | 1914 ASSERT(instr->key()->representation().IsInteger32()); |
1915 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 1915 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
1916 LOperand* key = UseRegisterOrConstant(instr->key()); | 1916 LOperand* key = UseRegisterOrConstant(instr->key()); |
1917 LLoadKeyedSpecializedArrayElement* result = | 1917 LLoadKeyedSpecializedArrayElement* result = |
1918 new LLoadKeyedSpecializedArrayElement(external_pointer, | 1918 new LLoadKeyedSpecializedArrayElement(external_pointer, |
1919 key); | 1919 key); |
1920 LInstruction* load_instr = DefineAsRegister(result); | 1920 LInstruction* load_instr = DefineAsRegister(result); |
1921 // An unsigned int array load might overflow and cause a deopt, make sure it | 1921 // An unsigned int array load might overflow and cause a deopt, make sure it |
1922 // has an environment. | 1922 // has an environment. |
1923 return (elements_kind == JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS) | 1923 return (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) |
1924 ? AssignEnvironment(load_instr) | 1924 ? AssignEnvironment(load_instr) |
1925 : load_instr; | 1925 : load_instr; |
1926 } | 1926 } |
1927 | 1927 |
1928 | 1928 |
1929 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 1929 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
1930 LOperand* context = UseFixed(instr->context(), esi); | 1930 LOperand* context = UseFixed(instr->context(), esi); |
1931 LOperand* object = UseFixed(instr->object(), edx); | 1931 LOperand* object = UseFixed(instr->object(), edx); |
1932 LOperand* key = UseFixed(instr->key(), eax); | 1932 LOperand* key = UseFixed(instr->key(), eax); |
1933 | 1933 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1965 LOperand* val = UseTempRegister(instr->value()); | 1965 LOperand* val = UseTempRegister(instr->value()); |
1966 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 1966 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
1967 | 1967 |
1968 return new LStoreKeyedFastDoubleElement(elements, key, val); | 1968 return new LStoreKeyedFastDoubleElement(elements, key, val); |
1969 } | 1969 } |
1970 | 1970 |
1971 | 1971 |
1972 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( | 1972 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( |
1973 HStoreKeyedSpecializedArrayElement* instr) { | 1973 HStoreKeyedSpecializedArrayElement* instr) { |
1974 Representation representation(instr->value()->representation()); | 1974 Representation representation(instr->value()->representation()); |
1975 JSObject::ElementsKind elements_kind = instr->elements_kind(); | 1975 ElementsKind elements_kind = instr->elements_kind(); |
1976 ASSERT( | 1976 ASSERT( |
1977 (representation.IsInteger32() && | 1977 (representation.IsInteger32() && |
1978 (elements_kind != JSObject::EXTERNAL_FLOAT_ELEMENTS) && | 1978 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
1979 (elements_kind != JSObject::EXTERNAL_DOUBLE_ELEMENTS)) || | 1979 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || |
1980 (representation.IsDouble() && | 1980 (representation.IsDouble() && |
1981 ((elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) || | 1981 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || |
1982 (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS)))); | 1982 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); |
1983 ASSERT(instr->external_pointer()->representation().IsExternal()); | 1983 ASSERT(instr->external_pointer()->representation().IsExternal()); |
1984 ASSERT(instr->key()->representation().IsInteger32()); | 1984 ASSERT(instr->key()->representation().IsInteger32()); |
1985 | 1985 |
1986 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 1986 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
1987 LOperand* key = UseRegisterOrConstant(instr->key()); | 1987 LOperand* key = UseRegisterOrConstant(instr->key()); |
1988 LOperand* val = NULL; | 1988 LOperand* val = NULL; |
1989 if (elements_kind == JSObject::EXTERNAL_BYTE_ELEMENTS || | 1989 if (elements_kind == EXTERNAL_BYTE_ELEMENTS || |
1990 elements_kind == JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS || | 1990 elements_kind == EXTERNAL_UNSIGNED_BYTE_ELEMENTS || |
1991 elements_kind == JSObject::EXTERNAL_PIXEL_ELEMENTS) { | 1991 elements_kind == EXTERNAL_PIXEL_ELEMENTS) { |
1992 // We need a byte register in this case for the value. | 1992 // We need a byte register in this case for the value. |
1993 val = UseFixed(instr->value(), eax); | 1993 val = UseFixed(instr->value(), eax); |
1994 } else { | 1994 } else { |
1995 val = UseRegister(instr->value()); | 1995 val = UseRegister(instr->value()); |
1996 } | 1996 } |
1997 | 1997 |
1998 return new LStoreKeyedSpecializedArrayElement(external_pointer, | 1998 return new LStoreKeyedSpecializedArrayElement(external_pointer, |
1999 key, | 1999 key, |
2000 val); | 2000 val); |
2001 } | 2001 } |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2257 LOperand* key = UseOrConstantAtStart(instr->key()); | 2257 LOperand* key = UseOrConstantAtStart(instr->key()); |
2258 LOperand* object = UseOrConstantAtStart(instr->object()); | 2258 LOperand* object = UseOrConstantAtStart(instr->object()); |
2259 LIn* result = new LIn(context, key, object); | 2259 LIn* result = new LIn(context, key, object); |
2260 return MarkAsCall(DefineFixed(result, eax), instr); | 2260 return MarkAsCall(DefineFixed(result, eax), instr); |
2261 } | 2261 } |
2262 | 2262 |
2263 | 2263 |
2264 } } // namespace v8::internal | 2264 } } // namespace v8::internal |
2265 | 2265 |
2266 #endif // V8_TARGET_ARCH_IA32 | 2266 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |