Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: src/ia32/lithium-ia32.cc

Issue 10382055: Array index computation dehoisting. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after
1951 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input)); 1951 return DefineAsRegister(new(zone()) LLoadExternalArrayPointer(input));
1952 } 1952 }
1953 1953
1954 1954
1955 LInstruction* LChunkBuilder::DoLoadKeyedFastElement( 1955 LInstruction* LChunkBuilder::DoLoadKeyedFastElement(
1956 HLoadKeyedFastElement* instr) { 1956 HLoadKeyedFastElement* instr) {
1957 ASSERT(instr->representation().IsTagged()); 1957 ASSERT(instr->representation().IsTagged());
1958 ASSERT(instr->key()->representation().IsInteger32()); 1958 ASSERT(instr->key()->representation().IsInteger32());
1959 LOperand* obj = UseRegisterAtStart(instr->object()); 1959 LOperand* obj = UseRegisterAtStart(instr->object());
1960 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); 1960 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
1961 LLoadKeyedFastElement* result = new(zone()) LLoadKeyedFastElement(obj, key); 1961 LLoadKeyedFastElement* result =
1962 new(zone()) LLoadKeyedFastElement(obj,
1963 key,
1964 instr->index_offset());
Jakob Kummerow 2012/05/08 13:46:26 Again, I think you don't need any of the changes t
Massi 2012/05/14 13:48:52 Well, I decided to add an accessor just for conven
1962 if (instr->RequiresHoleCheck()) AssignEnvironment(result); 1965 if (instr->RequiresHoleCheck()) AssignEnvironment(result);
1963 return DefineAsRegister(result); 1966 return DefineAsRegister(result);
1964 } 1967 }
1965 1968
1966 1969
1967 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement( 1970 LInstruction* LChunkBuilder::DoLoadKeyedFastDoubleElement(
1968 HLoadKeyedFastDoubleElement* instr) { 1971 HLoadKeyedFastDoubleElement* instr) {
1969 ASSERT(instr->representation().IsDouble()); 1972 ASSERT(instr->representation().IsDouble());
1970 ASSERT(instr->key()->representation().IsInteger32()); 1973 ASSERT(instr->key()->representation().IsInteger32());
1971 LOperand* elements = UseRegisterAtStart(instr->elements()); 1974 LOperand* elements = UseRegisterAtStart(instr->elements());
1972 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); 1975 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
1973 LLoadKeyedFastDoubleElement* result = 1976 LLoadKeyedFastDoubleElement* result =
1974 new(zone()) LLoadKeyedFastDoubleElement(elements, key); 1977 new(zone()) LLoadKeyedFastDoubleElement(elements,
1978 key,
1979 instr->index_offset());
1975 return AssignEnvironment(DefineAsRegister(result)); 1980 return AssignEnvironment(DefineAsRegister(result));
1976 } 1981 }
1977 1982
1978 1983
1979 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( 1984 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement(
1980 HLoadKeyedSpecializedArrayElement* instr) { 1985 HLoadKeyedSpecializedArrayElement* instr) {
1981 ElementsKind elements_kind = instr->elements_kind(); 1986 ElementsKind elements_kind = instr->elements_kind();
1982 ASSERT( 1987 ASSERT(
1983 (instr->representation().IsInteger32() && 1988 (instr->representation().IsInteger32() &&
1984 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && 1989 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
1985 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || 1990 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
1986 (instr->representation().IsDouble() && 1991 (instr->representation().IsDouble() &&
1987 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) || 1992 ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
1988 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS)))); 1993 (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
1989 ASSERT(instr->key()->representation().IsInteger32()); 1994 ASSERT(instr->key()->representation().IsInteger32());
1990 LOperand* external_pointer = UseRegister(instr->external_pointer()); 1995 LOperand* external_pointer = UseRegister(instr->external_pointer());
1991 LOperand* key = UseRegisterOrConstant(instr->key()); 1996 LOperand* key = UseRegisterOrConstant(instr->key());
1992 LLoadKeyedSpecializedArrayElement* result = 1997 LLoadKeyedSpecializedArrayElement* result =
1993 new(zone()) LLoadKeyedSpecializedArrayElement(external_pointer, 1998 new(zone()) LLoadKeyedSpecializedArrayElement(external_pointer,
1994 key); 1999 key,
2000 instr->index_offset());
1995 LInstruction* load_instr = DefineAsRegister(result); 2001 LInstruction* load_instr = DefineAsRegister(result);
1996 // An unsigned int array load might overflow and cause a deopt, make sure it 2002 // An unsigned int array load might overflow and cause a deopt, make sure it
1997 // has an environment. 2003 // has an environment.
1998 return (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS) 2004 return (elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS)
1999 ? AssignEnvironment(load_instr) 2005 ? AssignEnvironment(load_instr)
2000 : load_instr; 2006 : load_instr;
2001 } 2007 }
2002 2008
2003 2009
2004 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { 2010 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
(...skipping 14 matching lines...) Expand all
2019 ASSERT(instr->object()->representation().IsTagged()); 2025 ASSERT(instr->object()->representation().IsTagged());
2020 ASSERT(instr->key()->representation().IsInteger32()); 2026 ASSERT(instr->key()->representation().IsInteger32());
2021 2027
2022 LOperand* obj = UseRegister(instr->object()); 2028 LOperand* obj = UseRegister(instr->object());
2023 LOperand* val = needs_write_barrier 2029 LOperand* val = needs_write_barrier
2024 ? UseTempRegister(instr->value()) 2030 ? UseTempRegister(instr->value())
2025 : UseRegisterAtStart(instr->value()); 2031 : UseRegisterAtStart(instr->value());
2026 LOperand* key = needs_write_barrier 2032 LOperand* key = needs_write_barrier
2027 ? UseTempRegister(instr->key()) 2033 ? UseTempRegister(instr->key())
2028 : UseRegisterOrConstantAtStart(instr->key()); 2034 : UseRegisterOrConstantAtStart(instr->key());
2029 return new(zone()) LStoreKeyedFastElement(obj, key, val); 2035 return new(zone()) LStoreKeyedFastElement(obj,
2036 key,
2037 val,
2038 instr->index_offset());
2030 } 2039 }
2031 2040
2032 2041
2033 LInstruction* LChunkBuilder::DoStoreKeyedFastDoubleElement( 2042 LInstruction* LChunkBuilder::DoStoreKeyedFastDoubleElement(
2034 HStoreKeyedFastDoubleElement* instr) { 2043 HStoreKeyedFastDoubleElement* instr) {
2035 ASSERT(instr->value()->representation().IsDouble()); 2044 ASSERT(instr->value()->representation().IsDouble());
2036 ASSERT(instr->elements()->representation().IsTagged()); 2045 ASSERT(instr->elements()->representation().IsTagged());
2037 ASSERT(instr->key()->representation().IsInteger32()); 2046 ASSERT(instr->key()->representation().IsInteger32());
2038 2047
2039 LOperand* elements = UseRegisterAtStart(instr->elements()); 2048 LOperand* elements = UseRegisterAtStart(instr->elements());
2040 LOperand* val = UseTempRegister(instr->value()); 2049 LOperand* val = UseTempRegister(instr->value());
2041 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); 2050 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
2042 2051
2043 return new(zone()) LStoreKeyedFastDoubleElement(elements, key, val); 2052 return new(zone()) LStoreKeyedFastDoubleElement(elements,
2053 key,
2054 val,
2055 instr->index_offset());
2044 } 2056 }
2045 2057
2046 2058
2047 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( 2059 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement(
2048 HStoreKeyedSpecializedArrayElement* instr) { 2060 HStoreKeyedSpecializedArrayElement* instr) {
2049 ElementsKind elements_kind = instr->elements_kind(); 2061 ElementsKind elements_kind = instr->elements_kind();
2050 ASSERT( 2062 ASSERT(
2051 (instr->value()->representation().IsInteger32() && 2063 (instr->value()->representation().IsInteger32() &&
2052 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) && 2064 (elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
2053 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) || 2065 (elements_kind != EXTERNAL_DOUBLE_ELEMENTS)) ||
(...skipping 10 matching lines...) Expand all
2064 elements_kind == EXTERNAL_UNSIGNED_BYTE_ELEMENTS || 2076 elements_kind == EXTERNAL_UNSIGNED_BYTE_ELEMENTS ||
2065 elements_kind == EXTERNAL_PIXEL_ELEMENTS) { 2077 elements_kind == EXTERNAL_PIXEL_ELEMENTS) {
2066 // We need a byte register in this case for the value. 2078 // We need a byte register in this case for the value.
2067 val = UseFixed(instr->value(), eax); 2079 val = UseFixed(instr->value(), eax);
2068 } else { 2080 } else {
2069 val = UseRegister(instr->value()); 2081 val = UseRegister(instr->value());
2070 } 2082 }
2071 2083
2072 return new(zone()) LStoreKeyedSpecializedArrayElement(external_pointer, 2084 return new(zone()) LStoreKeyedSpecializedArrayElement(external_pointer,
2073 key, 2085 key,
2074 val); 2086 val,
2087 instr->index_offset());
2075 } 2088 }
2076 2089
2077 2090
2078 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { 2091 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
2079 LOperand* context = UseFixed(instr->context(), esi); 2092 LOperand* context = UseFixed(instr->context(), esi);
2080 LOperand* object = UseFixed(instr->object(), edx); 2093 LOperand* object = UseFixed(instr->object(), edx);
2081 LOperand* key = UseFixed(instr->key(), ecx); 2094 LOperand* key = UseFixed(instr->key(), ecx);
2082 LOperand* value = UseFixed(instr->value(), eax); 2095 LOperand* value = UseFixed(instr->value(), eax);
2083 2096
2084 ASSERT(instr->object()->representation().IsTagged()); 2097 ASSERT(instr->object()->representation().IsTagged());
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
2431 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2444 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2432 LOperand* object = UseRegister(instr->object()); 2445 LOperand* object = UseRegister(instr->object());
2433 LOperand* index = UseTempRegister(instr->index()); 2446 LOperand* index = UseTempRegister(instr->index());
2434 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2447 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2435 } 2448 }
2436 2449
2437 2450
2438 } } // namespace v8::internal 2451 } } // namespace v8::internal
2439 2452
2440 #endif // V8_TARGET_ARCH_IA32 2453 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« src/ia32/lithium-ia32.h ('K') | « src/ia32/lithium-ia32.h ('k') | src/v8-counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698