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 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1926 ASSERT(instr->key()->representation().IsInteger32()); | 1926 ASSERT(instr->key()->representation().IsInteger32()); |
1927 LOperand* obj = UseRegisterAtStart(instr->object()); | 1927 LOperand* obj = UseRegisterAtStart(instr->object()); |
1928 LOperand* key = UseRegisterAtStart(instr->key()); | 1928 LOperand* key = UseRegisterAtStart(instr->key()); |
1929 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); | 1929 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); |
1930 return AssignEnvironment(DefineSameAsFirst(result)); | 1930 return AssignEnvironment(DefineSameAsFirst(result)); |
1931 } | 1931 } |
1932 | 1932 |
1933 | 1933 |
1934 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( | 1934 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( |
1935 HLoadKeyedSpecializedArrayElement* instr) { | 1935 HLoadKeyedSpecializedArrayElement* instr) { |
1936 ExternalArrayType array_type = instr->array_type(); | 1936 JSObject::ElementsKind elements_kind = instr->elements_kind(); |
1937 Representation representation(instr->representation()); | 1937 Representation representation(instr->representation()); |
1938 ASSERT( | 1938 ASSERT( |
1939 (representation.IsInteger32() && (array_type != kExternalFloatArray && | 1939 (representation.IsInteger32() && |
1940 array_type != kExternalDoubleArray)) || | 1940 (elements_kind != JSObject::EXTERNAL_FLOAT_ELEMENTS) && |
1941 (representation.IsDouble() && (array_type == kExternalFloatArray || | 1941 (elements_kind != JSObject::EXTERNAL_DOUBLE_ELEMENTS)) || |
1942 array_type == kExternalDoubleArray))); | 1942 (representation.IsDouble() && |
| 1943 ((elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) || |
| 1944 (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS)))); |
1943 ASSERT(instr->key()->representation().IsInteger32()); | 1945 ASSERT(instr->key()->representation().IsInteger32()); |
1944 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 1946 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
1945 LOperand* key = UseRegisterOrConstant(instr->key()); | 1947 LOperand* key = UseRegisterOrConstant(instr->key()); |
1946 LLoadKeyedSpecializedArrayElement* result = | 1948 LLoadKeyedSpecializedArrayElement* result = |
1947 new LLoadKeyedSpecializedArrayElement(external_pointer, key); | 1949 new LLoadKeyedSpecializedArrayElement(external_pointer, key); |
1948 LInstruction* load_instr = DefineAsRegister(result); | 1950 LInstruction* load_instr = DefineAsRegister(result); |
1949 // An unsigned int array load might overflow and cause a deopt, make sure it | 1951 // An unsigned int array load might overflow and cause a deopt, make sure it |
1950 // has an environment. | 1952 // has an environment. |
1951 return (array_type == kExternalUnsignedIntArray) ? | 1953 return (elements_kind == JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS) ? |
1952 AssignEnvironment(load_instr) : load_instr; | 1954 AssignEnvironment(load_instr) : load_instr; |
1953 } | 1955 } |
1954 | 1956 |
1955 | 1957 |
1956 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { | 1958 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { |
1957 LOperand* object = UseFixed(instr->object(), r1); | 1959 LOperand* object = UseFixed(instr->object(), r1); |
1958 LOperand* key = UseFixed(instr->key(), r0); | 1960 LOperand* key = UseFixed(instr->key(), r0); |
1959 | 1961 |
1960 LInstruction* result = | 1962 LInstruction* result = |
1961 DefineFixed(new LLoadKeyedGeneric(object, key), r0); | 1963 DefineFixed(new LLoadKeyedGeneric(object, key), r0); |
(...skipping 16 matching lines...) Expand all Loading... |
1978 ? UseTempRegister(instr->key()) | 1980 ? UseTempRegister(instr->key()) |
1979 : UseRegisterOrConstantAtStart(instr->key()); | 1981 : UseRegisterOrConstantAtStart(instr->key()); |
1980 | 1982 |
1981 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); | 1983 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); |
1982 } | 1984 } |
1983 | 1985 |
1984 | 1986 |
1985 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( | 1987 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( |
1986 HStoreKeyedSpecializedArrayElement* instr) { | 1988 HStoreKeyedSpecializedArrayElement* instr) { |
1987 Representation representation(instr->value()->representation()); | 1989 Representation representation(instr->value()->representation()); |
1988 ExternalArrayType array_type = instr->array_type(); | 1990 JSObject::ElementsKind elements_kind = instr->elements_kind(); |
1989 ASSERT( | 1991 ASSERT( |
1990 (representation.IsInteger32() && (array_type != kExternalFloatArray && | 1992 (representation.IsInteger32() && |
1991 array_type != kExternalDoubleArray)) || | 1993 (elements_kind != JSObject::EXTERNAL_FLOAT_ELEMENTS) && |
1992 (representation.IsDouble() && (array_type == kExternalFloatArray || | 1994 (elements_kind != JSObject::EXTERNAL_DOUBLE_ELEMENTS)) || |
1993 array_type == kExternalDoubleArray))); | 1995 (representation.IsDouble() && |
| 1996 ((elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) || |
| 1997 (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS)))); |
1994 ASSERT(instr->external_pointer()->representation().IsExternal()); | 1998 ASSERT(instr->external_pointer()->representation().IsExternal()); |
1995 ASSERT(instr->key()->representation().IsInteger32()); | 1999 ASSERT(instr->key()->representation().IsInteger32()); |
1996 | 2000 |
1997 LOperand* external_pointer = UseRegister(instr->external_pointer()); | 2001 LOperand* external_pointer = UseRegister(instr->external_pointer()); |
1998 bool val_is_temp_register = array_type == kExternalPixelArray || | 2002 bool val_is_temp_register = |
1999 array_type == kExternalFloatArray; | 2003 elements_kind == JSObject::EXTERNAL_PIXEL_ELEMENTS || |
| 2004 elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS; |
2000 LOperand* val = val_is_temp_register | 2005 LOperand* val = val_is_temp_register |
2001 ? UseTempRegister(instr->value()) | 2006 ? UseTempRegister(instr->value()) |
2002 : UseRegister(instr->value()); | 2007 : UseRegister(instr->value()); |
2003 LOperand* key = UseRegisterOrConstant(instr->key()); | 2008 LOperand* key = UseRegisterOrConstant(instr->key()); |
2004 | 2009 |
2005 return new LStoreKeyedSpecializedArrayElement(external_pointer, | 2010 return new LStoreKeyedSpecializedArrayElement(external_pointer, |
2006 key, | 2011 key, |
2007 val); | 2012 val); |
2008 } | 2013 } |
2009 | 2014 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2226 | 2231 |
2227 LInstruction* LChunkBuilder::DoIn(HIn* instr) { | 2232 LInstruction* LChunkBuilder::DoIn(HIn* instr) { |
2228 LOperand* key = UseRegisterAtStart(instr->key()); | 2233 LOperand* key = UseRegisterAtStart(instr->key()); |
2229 LOperand* object = UseRegisterAtStart(instr->object()); | 2234 LOperand* object = UseRegisterAtStart(instr->object()); |
2230 LIn* result = new LIn(key, object); | 2235 LIn* result = new LIn(key, object); |
2231 return MarkAsCall(DefineFixed(result, r0), instr); | 2236 return MarkAsCall(DefineFixed(result, r0), instr); |
2232 } | 2237 } |
2233 | 2238 |
2234 | 2239 |
2235 } } // namespace v8::internal | 2240 } } // namespace v8::internal |
OLD | NEW |