| 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 1958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1969 LOperand* object = UseFixed(instr->object(), edx); | 1969 LOperand* object = UseFixed(instr->object(), edx); |
| 1970 LOperand* key = UseFixed(instr->key(), ecx); | 1970 LOperand* key = UseFixed(instr->key(), ecx); |
| 1971 | 1971 |
| 1972 LLoadKeyedGeneric* result = | 1972 LLoadKeyedGeneric* result = |
| 1973 new(zone()) LLoadKeyedGeneric(context, object, key); | 1973 new(zone()) LLoadKeyedGeneric(context, object, key); |
| 1974 return MarkAsCall(DefineFixed(result, eax), instr); | 1974 return MarkAsCall(DefineFixed(result, eax), instr); |
| 1975 } | 1975 } |
| 1976 | 1976 |
| 1977 | 1977 |
| 1978 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 1978 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
| 1979 LStoreKeyed* result = NULL; | |
| 1980 | |
| 1981 if (!instr->is_external()) { | 1979 if (!instr->is_external()) { |
| 1982 ASSERT(instr->elements()->representation().IsTagged()); | 1980 ASSERT(instr->elements()->representation().IsTagged()); |
| 1983 ASSERT(instr->key()->representation().IsInteger32() || | 1981 ASSERT(instr->key()->representation().IsInteger32() || |
| 1984 instr->key()->representation().IsTagged()); | 1982 instr->key()->representation().IsTagged()); |
| 1985 | 1983 |
| 1986 if (instr->value()->representation().IsDouble()) { | 1984 if (instr->value()->representation().IsDouble()) { |
| 1987 LOperand* object = UseRegisterAtStart(instr->elements()); | 1985 LOperand* object = UseRegisterAtStart(instr->elements()); |
| 1988 LOperand* val = UseTempRegister(instr->value()); | 1986 LOperand* val = UseTempRegister(instr->value()); |
| 1989 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 1987 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 1990 | 1988 |
| 1991 result = new(zone()) LStoreKeyed(object, key, val); | 1989 return new(zone()) LStoreKeyed(object, key, val); |
| 1992 } else { | 1990 } else { |
| 1993 ASSERT(instr->value()->representation().IsTagged()); | 1991 ASSERT(instr->value()->representation().IsTagged()); |
| 1994 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 1992 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 1995 | 1993 |
| 1996 LOperand* obj = UseRegister(instr->elements()); | 1994 LOperand* obj = UseRegister(instr->elements()); |
| 1997 LOperand* val = needs_write_barrier | 1995 LOperand* val = needs_write_barrier |
| 1998 ? UseTempRegister(instr->value()) | 1996 ? UseTempRegister(instr->value()) |
| 1999 : UseRegisterAtStart(instr->value()); | 1997 : UseRegisterAtStart(instr->value()); |
| 2000 LOperand* key = needs_write_barrier | 1998 LOperand* key = needs_write_barrier |
| 2001 ? UseTempRegister(instr->key()) | 1999 ? UseTempRegister(instr->key()) |
| 2002 : UseRegisterOrConstantAtStart(instr->key()); | 2000 : UseRegisterOrConstantAtStart(instr->key()); |
| 2003 result = new(zone()) LStoreKeyed(obj, key, val); | 2001 return new(zone()) LStoreKeyed(obj, key, val); |
| 2004 } | 2002 } |
| 2005 } else { | |
| 2006 ElementsKind elements_kind = instr->elements_kind(); | |
| 2007 ASSERT( | |
| 2008 (instr->value()->representation().IsInteger32() && | |
| 2009 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | |
| 2010 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | |
| 2011 (instr->value()->representation().IsDouble() && | |
| 2012 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | |
| 2013 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | |
| 2014 ASSERT(instr->elements()->representation().IsExternal()); | |
| 2015 | |
| 2016 LOperand* external_pointer = UseRegister(instr->elements()); | |
| 2017 // Determine if we need a byte register in this case for the value. | |
| 2018 bool val_is_fixed_register = | |
| 2019 elements_kind == EXTERNAL_BYTE_ELEMENTS || | |
| 2020 elements_kind == EXTERNAL_UNSIGNED_BYTE_ELEMENTS || | |
| 2021 elements_kind == EXTERNAL_PIXEL_ELEMENTS; | |
| 2022 | |
| 2023 LOperand* val = val_is_fixed_register | |
| 2024 ? UseFixed(instr->value(), eax) | |
| 2025 : UseRegister(instr->value()); | |
| 2026 bool clobbers_key = ExternalArrayOpRequiresTemp( | |
| 2027 instr->key()->representation(), elements_kind); | |
| 2028 LOperand* key = clobbers_key | |
| 2029 ? UseTempRegister(instr->key()) | |
| 2030 : UseRegisterOrConstantAtStart(instr->key()); | |
| 2031 result = new(zone()) LStoreKeyed(external_pointer, | |
| 2032 key, | |
| 2033 val); | |
| 2034 } | 2003 } |
| 2035 | 2004 |
| 2036 ASSERT(result != NULL); | 2005 ElementsKind elements_kind = instr->elements_kind(); |
| 2037 return result; | 2006 ASSERT( |
| 2007 (instr->value()->representation().IsInteger32() && |
| 2008 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
| 2009 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || |
| 2010 (instr->value()->representation().IsDouble() && |
| 2011 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || |
| 2012 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); |
| 2013 ASSERT(instr->elements()->representation().IsExternal()); |
| 2014 |
| 2015 LOperand* external_pointer = UseRegister(instr->elements()); |
| 2016 // Determine if we need a byte register in this case for the value. |
| 2017 bool val_is_fixed_register = |
| 2018 elements_kind == EXTERNAL_BYTE_ELEMENTS || |
| 2019 elements_kind == EXTERNAL_UNSIGNED_BYTE_ELEMENTS || |
| 2020 elements_kind == EXTERNAL_PIXEL_ELEMENTS; |
| 2021 |
| 2022 LOperand* val = val_is_fixed_register |
| 2023 ? UseFixed(instr->value(), eax) |
| 2024 : UseRegister(instr->value()); |
| 2025 bool clobbers_key = ExternalArrayOpRequiresTemp( |
| 2026 instr->key()->representation(), elements_kind); |
| 2027 LOperand* key = clobbers_key |
| 2028 ? UseTempRegister(instr->key()) |
| 2029 : UseRegisterOrConstantAtStart(instr->key()); |
| 2030 return new(zone()) LStoreKeyed(external_pointer, |
| 2031 key, |
| 2032 val); |
| 2038 } | 2033 } |
| 2039 | 2034 |
| 2040 | 2035 |
| 2041 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2036 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
| 2042 LOperand* context = UseFixed(instr->context(), esi); | 2037 LOperand* context = UseFixed(instr->context(), esi); |
| 2043 LOperand* object = UseFixed(instr->object(), edx); | 2038 LOperand* object = UseFixed(instr->object(), edx); |
| 2044 LOperand* key = UseFixed(instr->key(), ecx); | 2039 LOperand* key = UseFixed(instr->key(), ecx); |
| 2045 LOperand* value = UseFixed(instr->value(), eax); | 2040 LOperand* value = UseFixed(instr->value(), eax); |
| 2046 | 2041 |
| 2047 ASSERT(instr->object()->representation().IsTagged()); | 2042 ASSERT(instr->object()->representation().IsTagged()); |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2401 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2396 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2402 LOperand* object = UseRegister(instr->object()); | 2397 LOperand* object = UseRegister(instr->object()); |
| 2403 LOperand* index = UseTempRegister(instr->index()); | 2398 LOperand* index = UseTempRegister(instr->index()); |
| 2404 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2399 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2405 } | 2400 } |
| 2406 | 2401 |
| 2407 | 2402 |
| 2408 } } // namespace v8::internal | 2403 } } // namespace v8::internal |
| 2409 | 2404 |
| 2410 #endif // V8_TARGET_ARCH_IA32 | 2405 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |