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 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1952 LOperand* key = UseFixed(instr->key(), r0); | 1952 LOperand* key = UseFixed(instr->key(), r0); |
1953 | 1953 |
1954 LInstruction* result = | 1954 LInstruction* result = |
1955 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0); | 1955 DefineFixed(new(zone()) LLoadKeyedGeneric(object, key), r0); |
1956 return MarkAsCall(result, instr); | 1956 return MarkAsCall(result, instr); |
1957 } | 1957 } |
1958 | 1958 |
1959 | 1959 |
1960 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 1960 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
1961 ElementsKind elements_kind = instr->elements_kind(); | 1961 ElementsKind elements_kind = instr->elements_kind(); |
1962 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 1962 |
1963 LOperand* key = needs_write_barrier | 1963 if (!instr->is_external()) { |
1964 ? UseTempRegister(instr->key()) | 1964 ASSERT(instr->elements()->representation().IsTagged()); |
1965 : UseRegisterOrConstantAtStart(instr->key()); | 1965 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 1966 LOperand* object = NULL; |
| 1967 LOperand* key = NULL; |
| 1968 LOperand* val = NULL; |
| 1969 |
| 1970 if (instr->value()->representation().IsDouble()) { |
| 1971 object = UseRegisterAtStart(instr->elements()); |
| 1972 val = UseTempRegister(instr->value()); |
| 1973 key = UseRegisterOrConstantAtStart(instr->key()); |
| 1974 } else { |
| 1975 ASSERT(instr->value()->representation().IsTagged()); |
| 1976 object = UseTempRegister(instr->elements()); |
| 1977 val = needs_write_barrier ? UseTempRegister(instr->value()) |
| 1978 : UseRegisterAtStart(instr->value()); |
| 1979 key = needs_write_barrier ? UseTempRegister(instr->key()) |
| 1980 : UseRegisterOrConstantAtStart(instr->key()); |
| 1981 } |
| 1982 |
| 1983 return new(zone()) LStoreKeyed(object, key, val); |
| 1984 } |
| 1985 |
| 1986 ASSERT( |
| 1987 (instr->value()->representation().IsInteger32() && |
| 1988 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && |
| 1989 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || |
| 1990 (instr->value()->representation().IsDouble() && |
| 1991 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || |
| 1992 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); |
| 1993 ASSERT(instr->elements()->representation().IsExternal()); |
1966 bool val_is_temp_register = | 1994 bool val_is_temp_register = |
1967 elements_kind == EXTERNAL_PIXEL_ELEMENTS || | 1995 elements_kind == EXTERNAL_PIXEL_ELEMENTS || |
1968 elements_kind == EXTERNAL_FLOAT_ELEMENTS; | 1996 elements_kind == EXTERNAL_FLOAT_ELEMENTS; |
1969 LOperand* val = val_is_temp_register || needs_write_barrier | 1997 LOperand* val = val_is_temp_register ? UseTempRegister(instr->value()) |
1970 ? UseTempRegister(instr->value()) | |
1971 : UseRegister(instr->value()); | 1998 : UseRegister(instr->value()); |
1972 | 1999 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
1973 LStoreKeyed* result = NULL; | 2000 LOperand* external_pointer = UseRegister(instr->elements()); |
1974 if (!instr->is_external()) { | 2001 return new(zone()) LStoreKeyed(external_pointer, key, val); |
1975 ASSERT(instr->elements()->representation().IsTagged()); | |
1976 | |
1977 LOperand* object = NULL; | |
1978 if (instr->value()->representation().IsDouble()) { | |
1979 object = UseRegisterAtStart(instr->elements()); | |
1980 } else { | |
1981 ASSERT(instr->value()->representation().IsTagged()); | |
1982 object = UseTempRegister(instr->elements()); | |
1983 } | |
1984 | |
1985 result = new(zone()) LStoreKeyed(object, key, val); | |
1986 } else { | |
1987 ASSERT( | |
1988 (instr->value()->representation().IsInteger32() && | |
1989 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && | |
1990 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || | |
1991 (instr->value()->representation().IsDouble() && | |
1992 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || | |
1993 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); | |
1994 ASSERT(instr->elements()->representation().IsExternal()); | |
1995 | |
1996 LOperand* external_pointer = UseRegister(instr->elements()); | |
1997 result = new(zone()) LStoreKeyed(external_pointer, key, val); | |
1998 } | |
1999 | |
2000 ASSERT(result != NULL); | |
2001 return result; | |
2002 } | 2002 } |
2003 | 2003 |
2004 | 2004 |
2005 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { | 2005 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { |
2006 LOperand* obj = UseFixed(instr->object(), r2); | 2006 LOperand* obj = UseFixed(instr->object(), r2); |
2007 LOperand* key = UseFixed(instr->key(), r1); | 2007 LOperand* key = UseFixed(instr->key(), r1); |
2008 LOperand* val = UseFixed(instr->value(), r0); | 2008 LOperand* val = UseFixed(instr->value(), r0); |
2009 | 2009 |
2010 ASSERT(instr->object()->representation().IsTagged()); | 2010 ASSERT(instr->object()->representation().IsTagged()); |
2011 ASSERT(instr->key()->representation().IsTagged()); | 2011 ASSERT(instr->key()->representation().IsTagged()); |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2325 | 2325 |
2326 | 2326 |
2327 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2327 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
2328 LOperand* object = UseRegister(instr->object()); | 2328 LOperand* object = UseRegister(instr->object()); |
2329 LOperand* index = UseRegister(instr->index()); | 2329 LOperand* index = UseRegister(instr->index()); |
2330 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); | 2330 return DefineAsRegister(new(zone()) LLoadFieldByIndex(object, index)); |
2331 } | 2331 } |
2332 | 2332 |
2333 | 2333 |
2334 } } // namespace v8::internal | 2334 } } // namespace v8::internal |
OLD | NEW |