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

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

Issue 7112010: Plumbing changes to merge various element kind implementaions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback Created 9 years, 6 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
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 = UseRegisterAtStart(instr->key()); 1960 LOperand* key = UseRegisterAtStart(instr->key());
1961 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key); 1961 LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key);
1962 return AssignEnvironment(DefineSameAsFirst(result)); 1962 return AssignEnvironment(DefineSameAsFirst(result));
1963 } 1963 }
1964 1964
1965 1965
1966 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement( 1966 LInstruction* LChunkBuilder::DoLoadKeyedSpecializedArrayElement(
1967 HLoadKeyedSpecializedArrayElement* instr) { 1967 HLoadKeyedSpecializedArrayElement* instr) {
1968 ExternalArrayType array_type = instr->array_type(); 1968 JSObject::ElementsKind elements_kind = instr->elements_kind();
1969 Representation representation(instr->representation()); 1969 Representation representation(instr->representation());
1970 ASSERT( 1970 ASSERT(
1971 (representation.IsInteger32() && (array_type != kExternalFloatArray && 1971 (representation.IsInteger32() &&
1972 array_type != kExternalDoubleArray)) || 1972 (elements_kind != JSObject::EXTERNAL_FLOAT_ELEMENTS) &&
1973 (representation.IsDouble() && (array_type == kExternalFloatArray || 1973 (elements_kind != JSObject::EXTERNAL_DOUBLE_ELEMENTS)) ||
1974 array_type == kExternalDoubleArray))); 1974 (representation.IsDouble() &&
1975 ((elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) ||
1976 (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS))));
1975 ASSERT(instr->key()->representation().IsInteger32()); 1977 ASSERT(instr->key()->representation().IsInteger32());
1976 LOperand* external_pointer = UseRegister(instr->external_pointer()); 1978 LOperand* external_pointer = UseRegister(instr->external_pointer());
1977 LOperand* key = UseRegisterOrConstant(instr->key()); 1979 LOperand* key = UseRegisterOrConstant(instr->key());
1978 LLoadKeyedSpecializedArrayElement* result = 1980 LLoadKeyedSpecializedArrayElement* result =
1979 new LLoadKeyedSpecializedArrayElement(external_pointer, 1981 new LLoadKeyedSpecializedArrayElement(external_pointer,
1980 key); 1982 key);
1981 LInstruction* load_instr = DefineAsRegister(result); 1983 LInstruction* load_instr = DefineAsRegister(result);
1982 // An unsigned int array load might overflow and cause a deopt, make sure it 1984 // An unsigned int array load might overflow and cause a deopt, make sure it
1983 // has an environment. 1985 // has an environment.
1984 return (array_type == kExternalUnsignedIntArray) 1986 return (elements_kind == JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS)
1985 ? AssignEnvironment(load_instr) 1987 ? AssignEnvironment(load_instr)
1986 : load_instr; 1988 : load_instr;
1987 } 1989 }
1988 1990
1989 1991
1990 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { 1992 LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
1991 LOperand* context = UseFixed(instr->context(), esi); 1993 LOperand* context = UseFixed(instr->context(), esi);
1992 LOperand* object = UseFixed(instr->object(), edx); 1994 LOperand* object = UseFixed(instr->object(), edx);
1993 LOperand* key = UseFixed(instr->key(), eax); 1995 LOperand* key = UseFixed(instr->key(), eax);
1994 1996
(...skipping 17 matching lines...) Expand all
2012 ? UseTempRegister(instr->key()) 2014 ? UseTempRegister(instr->key())
2013 : UseRegisterOrConstantAtStart(instr->key()); 2015 : UseRegisterOrConstantAtStart(instr->key());
2014 2016
2015 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val)); 2017 return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val));
2016 } 2018 }
2017 2019
2018 2020
2019 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement( 2021 LInstruction* LChunkBuilder::DoStoreKeyedSpecializedArrayElement(
2020 HStoreKeyedSpecializedArrayElement* instr) { 2022 HStoreKeyedSpecializedArrayElement* instr) {
2021 Representation representation(instr->value()->representation()); 2023 Representation representation(instr->value()->representation());
2022 ExternalArrayType array_type = instr->array_type(); 2024 JSObject::ElementsKind elements_kind = instr->elements_kind();
2023 ASSERT( 2025 ASSERT(
2024 (representation.IsInteger32() && (array_type != kExternalFloatArray && 2026 (representation.IsInteger32() &&
2025 array_type != kExternalDoubleArray)) || 2027 (elements_kind != JSObject::EXTERNAL_FLOAT_ELEMENTS) &&
2026 (representation.IsDouble() && (array_type == kExternalFloatArray || 2028 (elements_kind != JSObject::EXTERNAL_DOUBLE_ELEMENTS)) ||
2027 array_type == kExternalDoubleArray))); 2029 (representation.IsDouble() &&
2030 ((elements_kind == JSObject::EXTERNAL_FLOAT_ELEMENTS) ||
2031 (elements_kind == JSObject::EXTERNAL_DOUBLE_ELEMENTS))));
2028 ASSERT(instr->external_pointer()->representation().IsExternal()); 2032 ASSERT(instr->external_pointer()->representation().IsExternal());
2029 ASSERT(instr->key()->representation().IsInteger32()); 2033 ASSERT(instr->key()->representation().IsInteger32());
2030 2034
2031 LOperand* external_pointer = UseRegister(instr->external_pointer()); 2035 LOperand* external_pointer = UseRegister(instr->external_pointer());
2032 LOperand* key = UseRegisterOrConstant(instr->key()); 2036 LOperand* key = UseRegisterOrConstant(instr->key());
2033 LOperand* val = NULL; 2037 LOperand* val = NULL;
2034 if (array_type == kExternalByteArray || 2038 if (elements_kind == JSObject::EXTERNAL_BYTE_ELEMENTS ||
2035 array_type == kExternalUnsignedByteArray || 2039 elements_kind == JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS ||
2036 array_type == kExternalPixelArray) { 2040 elements_kind == JSObject::EXTERNAL_PIXEL_ELEMENTS) {
2037 // We need a byte register in this case for the value. 2041 // We need a byte register in this case for the value.
2038 val = UseFixed(instr->value(), eax); 2042 val = UseFixed(instr->value(), eax);
2039 } else { 2043 } else {
2040 val = UseRegister(instr->value()); 2044 val = UseRegister(instr->value());
2041 } 2045 }
2042 2046
2043 return new LStoreKeyedSpecializedArrayElement(external_pointer, 2047 return new LStoreKeyedSpecializedArrayElement(external_pointer,
2044 key, 2048 key,
2045 val); 2049 val);
2046 } 2050 }
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
2280 LOperand* key = UseOrConstantAtStart(instr->key()); 2284 LOperand* key = UseOrConstantAtStart(instr->key());
2281 LOperand* object = UseOrConstantAtStart(instr->object()); 2285 LOperand* object = UseOrConstantAtStart(instr->object());
2282 LIn* result = new LIn(key, object); 2286 LIn* result = new LIn(key, object);
2283 return MarkAsCall(DefineFixed(result, eax), instr); 2287 return MarkAsCall(DefineFixed(result, eax), instr);
2284 } 2288 }
2285 2289
2286 2290
2287 } } // namespace v8::internal 2291 } } // namespace v8::internal
2288 2292
2289 #endif // V8_TARGET_ARCH_IA32 2293 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698