| 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 1902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 ASSERT(instr->key()->representation().IsInteger32()); | 1913 ASSERT(instr->key()->representation().IsInteger32()); |
| 1914 LOperand* obj = UseRegisterAtStart(instr->object()); | 1914 LOperand* obj = UseRegisterAtStart(instr->object()); |
| 1915 LOperand* key = UseRegisterAtStart(instr->key()); | 1915 LOperand* key = UseRegisterAtStart(instr->key()); |
| 1916 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); | 1916 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); |
| 1917 return AssignEnvironment(DefineSameAsFirst(result)); | 1917 return AssignEnvironment(DefineSameAsFirst(result)); |
| 1918 } | 1918 } |
| 1919 | 1919 |
| 1920 | 1920 |
| 1921 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( | 1921 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( |
| 1922 HLoadKeyedSpecializedArrayElement* instr) { | 1922 HLoadKeyedSpecializedArrayElement* instr) { |
| 1923 ExternalArrayType array_type = instr->array_type(); | 1923 JSObject::ElementsKind elements_kind = instr->elements_kind(); |
| 1924 Representation representation(instr->representation()); | 1924 Representation representation(instr->representation()); |
| 1925 ASSERT( | 1925 ASSERT( |
| 1926 (representation.IsInteger32() && (array_type != kExternalFloatArray && | 1926 (representation.IsInteger32() && |
| 1927 array_type != kExternalDoubleArray)) || | 1927 (elements_kind != JSObject::EXTERNAL_FLOAT_ELEMENTS) && |
| 1928 (representation.IsDouble() && (array_type == kExternalFloatArray || | 1928 (elements_kind != JSObject::EXTERNAL_DOUBLE_ELEMENTS)) || |
| 1929 array_type == kExternalDoubleArray))); | 1929 (representation.IsDouble() && |
| 1930 ((elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) || |
| 1931 (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS)))); |
| 1930 ASSERT(instr->key()->representation().IsInteger32()); | 1932 ASSERT(instr->key()->representation().IsInteger32()); |
| 1931 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 1933 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
| 1932 LOperand* key = UseRegisterOrConstant(instr->key()); | 1934 LOperand* key = UseRegisterOrConstant(instr->key()); |
| 1933 LLoadKeyedSpecializedArrayElement* result = | 1935 LLoadKeyedSpecializedArrayElement* result = |
| 1934 new LLoadKeyedSpecializedArrayElement(external_pointer, key); | 1936 new LLoadKeyedSpecializedArrayElement(external_pointer, key); |
| 1935 LInstruction* load_instr = DefineAsRegister(result); | 1937 LInstruction* load_instr = DefineAsRegister(result); |
| 1936 // An unsigned int array load might overflow and cause a deopt, make sure it | 1938 // An unsigned int array load might overflow and cause a deopt, make sure it |
| 1937 // has an environment. | 1939 // has an environment. |
| 1938 return (array_type == kExternalUnsignedIntArray) ? | 1940 return (elements_kind == JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS) ? |
| 1939 AssignEnvironment(load_instr) : load_instr; | 1941 AssignEnvironment(load_instr) : load_instr; |
| 1940 } | 1942 } |
| 1941 | 1943 |
| 1942 | 1944 |
| 1943 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 1945 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
| 1944 LOperand* object = UseFixed(instr->object(), rdx); | 1946 LOperand* object = UseFixed(instr->object(), rdx); |
| 1945 LOperand* key = UseFixed(instr->key(), rax); | 1947 LOperand* key = UseFixed(instr->key(), rax); |
| 1946 | 1948 |
| 1947 LLoadKeyedGeneric* result = new LLoadKeyedGeneric(object, key); | 1949 LLoadKeyedGeneric* result = new LLoadKeyedGeneric(object, key); |
| 1948 return MarkAsCall(DefineFixed(result, rax), instr); | 1950 return MarkAsCall(DefineFixed(result, rax), instr); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1964 ? UseTempRegister(instr->key()) | 1966 ? UseTempRegister(instr->key()) |
| 1965 : UseRegisterOrConstantAtStart(instr->key()); | 1967 : UseRegisterOrConstantAtStart(instr->key()); |
| 1966 | 1968 |
| 1967 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); | 1969 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); |
| 1968 } | 1970 } |
| 1969 | 1971 |
| 1970 | 1972 |
| 1971 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( | 1973 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( |
| 1972 HStoreKeyedSpecializedArrayElement* instr) { | 1974 HStoreKeyedSpecializedArrayElement* instr) { |
| 1973 Representation representation(instr->value()->representation()); | 1975 Representation representation(instr->value()->representation()); |
| 1974 ExternalArrayType array_type = instr->array_type(); | 1976 JSObject::ElementsKind elements_kind = instr->elements_kind(); |
| 1975 ASSERT( | 1977 ASSERT( |
| 1976 (representation.IsInteger32() && (array_type != kExternalFloatArray && | 1978 (representation.IsInteger32() && |
| 1977 array_type != kExternalDoubleArray)) || | 1979 (elements_kind != JSObject::EXTERNAL_FLOAT_ELEMENTS) && |
| 1978 (representation.IsDouble() && (array_type == kExternalFloatArray || | 1980 (elements_kind != JSObject::EXTERNAL_DOUBLE_ELEMENTS)) || |
| 1979 array_type == kExternalDoubleArray))); | 1981 (representation.IsDouble() && |
| 1982 ((elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) || |
| 1983 (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS)))); |
| 1980 ASSERT(instr->external_pointer()->representation().IsExternal()); | 1984 ASSERT(instr->external_pointer()->representation().IsExternal()); |
| 1981 ASSERT(instr->key()->representation().IsInteger32()); | 1985 ASSERT(instr->key()->representation().IsInteger32()); |
| 1982 | 1986 |
| 1983 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 1987 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
| 1984 bool val_is_temp_register = array_type == kExternalPixelArray || | 1988 bool val_is_temp_register = |
| 1985 array_type == kExternalFloatArray; | 1989 elements_kind == JSObject::EXTERNAL_PIXEL_ELEMENTS || |
| 1990 elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS; |
| 1986 LOperand* val = val_is_temp_register | 1991 LOperand* val = val_is_temp_register |
| 1987 ? UseTempRegister(instr->value()) | 1992 ? UseTempRegister(instr->value()) |
| 1988 : UseRegister(instr->value()); | 1993 : UseRegister(instr->value()); |
| 1989 LOperand* key = UseRegisterOrConstant(instr->key()); | 1994 LOperand* key = UseRegisterOrConstant(instr->key()); |
| 1990 | 1995 |
| 1991 return new LStoreKeyedSpecializedArrayElement(external_pointer, | 1996 return new LStoreKeyedSpecializedArrayElement(external_pointer, |
| 1992 key, | 1997 key, |
| 1993 val); | 1998 val); |
| 1994 } | 1999 } |
| 1995 | 2000 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2220 LOperand* key = UseOrConstantAtStart(instr->key()); | 2225 LOperand* key = UseOrConstantAtStart(instr->key()); |
| 2221 LOperand* object = UseOrConstantAtStart(instr->object()); | 2226 LOperand* object = UseOrConstantAtStart(instr->object()); |
| 2222 LIn* result = new LIn(key, object); | 2227 LIn* result = new LIn(key, object); |
| 2223 return MarkAsCall(DefineFixed(result, rax), instr); | 2228 return MarkAsCall(DefineFixed(result, rax), instr); |
| 2224 } | 2229 } |
| 2225 | 2230 |
| 2226 | 2231 |
| 2227 } } // namespace v8::internal | 2232 } } // namespace v8::internal |
| 2228 | 2233 |
| 2229 #endif // V8_TARGET_ARCH_X64 | 2234 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |