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

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

Issue 179773002: [x64] Improve key value sign-extension of dehoisted LoadKeyed/StoreKeyed (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: support result in the stack slot Created 6 years, 9 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
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 return NULL; 168 return NULL;
169 } 169 }
170 } 170 }
171 171
172 172
173 bool LGoto::HasInterestingComment(LCodeGen* gen) const { 173 bool LGoto::HasInterestingComment(LCodeGen* gen) const {
174 return !gen->IsNextEmittedBlock(block_id()); 174 return !gen->IsNextEmittedBlock(block_id());
175 } 175 }
176 176
177 177
178 template<int R>
179 bool LTemplateResultInstruction<R>::MustSignExtendResult(
180 LPlatformChunk* chunk) const {
181 HValue* hvalue = this->hydrogen_value();
182
183 if (hvalue == NULL) return false;
184 if (!hvalue->representation().IsInteger32()) return false;
185 if (hvalue->HasRange() && !hvalue->range()->CanBeNegative()) return false;
186
187 return chunk->GetDehoistedKeyIds()->Contains(hvalue->id());
188 }
189
190
178 void LGoto::PrintDataTo(StringStream* stream) { 191 void LGoto::PrintDataTo(StringStream* stream) {
179 stream->Add("B%d", block_id()); 192 stream->Add("B%d", block_id());
180 } 193 }
181 194
182 195
183 void LBranch::PrintDataTo(StringStream* stream) { 196 void LBranch::PrintDataTo(StringStream* stream) {
184 stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); 197 stream->Add("B%d | B%d on ", true_block_id(), false_block_id());
185 value()->PrintTo(stream); 198 value()->PrintTo(stream);
186 } 199 }
187 200
(...skipping 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 return AssignEnvironment(DefineAsRegister( 1970 return AssignEnvironment(DefineAsRegister(
1958 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function())))); 1971 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function()))));
1959 } 1972 }
1960 1973
1961 1974
1962 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) { 1975 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) {
1963 return DefineAsRegister(new(zone()) LLoadRoot); 1976 return DefineAsRegister(new(zone()) LLoadRoot);
1964 } 1977 }
1965 1978
1966 1979
1980 void LChunkBuilder::FindDehoistedKeyDefinitions(HValue* candidate) {
1981 BitVector* dehoisted_key_ids = chunk_->GetDehoistedKeyIds();
1982 if (dehoisted_key_ids->Contains(candidate->id())) return;
1983 dehoisted_key_ids->Add(candidate->id());
1984 if (!candidate->IsPhi()) return;
1985 for (int i = 0; i < candidate->OperandCount(); ++i) {
1986 FindDehoistedKeyDefinitions(candidate->OperandAt(i));
1987 }
1988 }
1989
1990
1967 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { 1991 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
1968 ASSERT(instr->key()->representation().IsInteger32()); 1992 ASSERT(instr->key()->representation().IsInteger32());
1969 ElementsKind elements_kind = instr->elements_kind(); 1993 ElementsKind elements_kind = instr->elements_kind();
1970 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); 1994 LOperand* key = UseRegisterOrConstantAtStart(instr->key());
1971 LLoadKeyed* result = NULL; 1995 LLoadKeyed* result = NULL;
1972 1996
1997 if (instr->IsDehoisted()) {
1998 FindDehoistedKeyDefinitions(instr->key());
1999 }
2000
1973 if (!instr->is_typed_elements()) { 2001 if (!instr->is_typed_elements()) {
1974 LOperand* obj = UseRegisterAtStart(instr->elements()); 2002 LOperand* obj = UseRegisterAtStart(instr->elements());
1975 result = new(zone()) LLoadKeyed(obj, key); 2003 result = new(zone()) LLoadKeyed(obj, key);
1976 } else { 2004 } else {
1977 ASSERT( 2005 ASSERT(
1978 (instr->representation().IsInteger32() && 2006 (instr->representation().IsInteger32() &&
1979 !(IsDoubleOrFloatElementsKind(instr->elements_kind()))) || 2007 !(IsDoubleOrFloatElementsKind(instr->elements_kind()))) ||
1980 (instr->representation().IsDouble() && 2008 (instr->representation().IsDouble() &&
1981 (IsDoubleOrFloatElementsKind(instr->elements_kind())))); 2009 (IsDoubleOrFloatElementsKind(instr->elements_kind()))));
1982 LOperand* backing_store = UseRegister(instr->elements()); 2010 LOperand* backing_store = UseRegister(instr->elements());
(...skipping 17 matching lines...) Expand all
2000 2028
2001 LLoadKeyedGeneric* result = 2029 LLoadKeyedGeneric* result =
2002 new(zone()) LLoadKeyedGeneric(context, object, key); 2030 new(zone()) LLoadKeyedGeneric(context, object, key);
2003 return MarkAsCall(DefineFixed(result, rax), instr); 2031 return MarkAsCall(DefineFixed(result, rax), instr);
2004 } 2032 }
2005 2033
2006 2034
2007 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { 2035 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
2008 ElementsKind elements_kind = instr->elements_kind(); 2036 ElementsKind elements_kind = instr->elements_kind();
2009 2037
2038 if (instr->IsDehoisted()) {
2039 FindDehoistedKeyDefinitions(instr->key());
2040 }
2041
2010 if (!instr->is_typed_elements()) { 2042 if (!instr->is_typed_elements()) {
2011 ASSERT(instr->elements()->representation().IsTagged()); 2043 ASSERT(instr->elements()->representation().IsTagged());
2012 bool needs_write_barrier = instr->NeedsWriteBarrier(); 2044 bool needs_write_barrier = instr->NeedsWriteBarrier();
2013 LOperand* object = NULL; 2045 LOperand* object = NULL;
2014 LOperand* key = NULL; 2046 LOperand* key = NULL;
2015 LOperand* val = NULL; 2047 LOperand* val = NULL;
2016 2048
2017 Representation value_representation = instr->value()->representation(); 2049 Representation value_representation = instr->value()->representation();
2018 if (value_representation.IsDouble()) { 2050 if (value_representation.IsDouble()) {
2019 object = UseRegisterAtStart(instr->elements()); 2051 object = UseRegisterAtStart(instr->elements());
2020 val = UseTempRegister(instr->value()); 2052 val = UseRegisterAtStart(instr->value());
2021 key = UseRegisterOrConstantAtStart(instr->key()); 2053 key = UseRegisterOrConstantAtStart(instr->key());
2022 } else { 2054 } else {
2023 ASSERT(value_representation.IsSmiOrTagged() || 2055 ASSERT(value_representation.IsSmiOrTagged() ||
2024 value_representation.IsInteger32()); 2056 value_representation.IsInteger32());
2025 if (needs_write_barrier) { 2057 if (needs_write_barrier) {
2026 object = UseTempRegister(instr->elements()); 2058 object = UseTempRegister(instr->elements());
2027 val = UseTempRegister(instr->value()); 2059 val = UseTempRegister(instr->value());
2028 key = UseTempRegister(instr->key()); 2060 key = UseTempRegister(instr->key());
2029 } else { 2061 } else {
2030 object = UseRegisterAtStart(instr->elements()); 2062 object = UseRegisterAtStart(instr->elements());
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
2436 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { 2468 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) {
2437 LOperand* object = UseRegister(instr->object()); 2469 LOperand* object = UseRegister(instr->object());
2438 LOperand* index = UseTempRegister(instr->index()); 2470 LOperand* index = UseTempRegister(instr->index());
2439 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); 2471 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index));
2440 } 2472 }
2441 2473
2442 2474
2443 } } // namespace v8::internal 2475 } } // namespace v8::internal
2444 2476
2445 #endif // V8_TARGET_ARCH_X64 2477 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698