Chromium Code Reviews| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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->HasRange() && !hvalue->range()->CanBeNegative()) return false; | |
| 185 | |
| 186 return chunk->GetKeyValues()->Contains(hvalue->id()); | |
| 187 } | |
| 188 | |
| 189 | |
| 178 void LGoto::PrintDataTo(StringStream* stream) { | 190 void LGoto::PrintDataTo(StringStream* stream) { |
| 179 stream->Add("B%d", block_id()); | 191 stream->Add("B%d", block_id()); |
| 180 } | 192 } |
| 181 | 193 |
| 182 | 194 |
| 183 void LBranch::PrintDataTo(StringStream* stream) { | 195 void LBranch::PrintDataTo(StringStream* stream) { |
| 184 stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); | 196 stream->Add("B%d | B%d on ", true_block_id(), false_block_id()); |
| 185 value()->PrintTo(stream); | 197 value()->PrintTo(stream); |
| 186 } | 198 } |
| 187 | 199 |
| (...skipping 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1957 return AssignEnvironment(DefineAsRegister( | 1969 return AssignEnvironment(DefineAsRegister( |
| 1958 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function())))); | 1970 new(zone()) LLoadFunctionPrototype(UseRegister(instr->function())))); |
| 1959 } | 1971 } |
| 1960 | 1972 |
| 1961 | 1973 |
| 1962 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) { | 1974 LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) { |
| 1963 return DefineAsRegister(new(zone()) LLoadRoot); | 1975 return DefineAsRegister(new(zone()) LLoadRoot); |
| 1964 } | 1976 } |
| 1965 | 1977 |
| 1966 | 1978 |
| 1979 void RecordKeyValueThroughPhi(HValue* phi, BitVector* key_values) { | |
|
danno
2014/03/18 08:20:20
This should be called FindDehoistedKeyDefinitions,
Weiliang
2014/03/19 08:55:31
The BitVector belongs to LChunk instead of LChunkB
| |
| 1980 ASSERT(phi->IsPhi()); | |
| 1981 for (int i = 0; i < phi->OperandCount(); ++i) { | |
| 1982 HValue* value = phi->OperandAt(i); | |
| 1983 if (key_values->Contains(value->id())) continue; | |
| 1984 key_values->Add(value->id()); | |
| 1985 if (value->IsPhi()) { | |
| 1986 RecordKeyValueThroughPhi(value, key_values); | |
| 1987 } | |
| 1988 } | |
| 1989 } | |
| 1990 | |
| 1991 | |
| 1967 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { | 1992 LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { |
| 1968 ASSERT(instr->key()->representation().IsInteger32()); | 1993 ASSERT(instr->key()->representation().IsInteger32()); |
| 1969 ElementsKind elements_kind = instr->elements_kind(); | 1994 ElementsKind elements_kind = instr->elements_kind(); |
| 1970 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); | 1995 LOperand* key = UseRegisterOrConstantAtStart(instr->key()); |
| 1971 LLoadKeyed* result = NULL; | 1996 LLoadKeyed* result = NULL; |
| 1972 | 1997 |
| 1998 if (instr->IsDehoisted()) { | |
| 1999 BitVector* key_values = chunk()->GetKeyValues(); | |
| 2000 if (!key_values->Contains(instr->key()->id())) { | |
|
danno
2014/03/18 08:20:20
Move most of the logic here into RecordKeyValueThr
Weiliang
2014/03/19 08:55:31
Done.
| |
| 2001 key_values->Add(instr->key()->id()); | |
| 2002 if (instr->key()->IsPhi()) { | |
| 2003 RecordKeyValueThroughPhi(instr->key(), key_values); | |
| 2004 } | |
| 2005 } | |
| 2006 } | |
| 2007 | |
| 1973 if (!instr->is_typed_elements()) { | 2008 if (!instr->is_typed_elements()) { |
| 1974 LOperand* obj = UseRegisterAtStart(instr->elements()); | 2009 LOperand* obj = UseRegisterAtStart(instr->elements()); |
| 1975 result = new(zone()) LLoadKeyed(obj, key); | 2010 result = new(zone()) LLoadKeyed(obj, key); |
| 1976 } else { | 2011 } else { |
| 1977 ASSERT( | 2012 ASSERT( |
| 1978 (instr->representation().IsInteger32() && | 2013 (instr->representation().IsInteger32() && |
| 1979 !(IsDoubleOrFloatElementsKind(instr->elements_kind()))) || | 2014 !(IsDoubleOrFloatElementsKind(instr->elements_kind()))) || |
| 1980 (instr->representation().IsDouble() && | 2015 (instr->representation().IsDouble() && |
| 1981 (IsDoubleOrFloatElementsKind(instr->elements_kind())))); | 2016 (IsDoubleOrFloatElementsKind(instr->elements_kind())))); |
| 1982 LOperand* backing_store = UseRegister(instr->elements()); | 2017 LOperand* backing_store = UseRegister(instr->elements()); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 2000 | 2035 |
| 2001 LLoadKeyedGeneric* result = | 2036 LLoadKeyedGeneric* result = |
| 2002 new(zone()) LLoadKeyedGeneric(context, object, key); | 2037 new(zone()) LLoadKeyedGeneric(context, object, key); |
| 2003 return MarkAsCall(DefineFixed(result, rax), instr); | 2038 return MarkAsCall(DefineFixed(result, rax), instr); |
| 2004 } | 2039 } |
| 2005 | 2040 |
| 2006 | 2041 |
| 2007 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { | 2042 LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { |
| 2008 ElementsKind elements_kind = instr->elements_kind(); | 2043 ElementsKind elements_kind = instr->elements_kind(); |
| 2009 | 2044 |
| 2045 if (instr->IsDehoisted()) { | |
| 2046 BitVector* key_values = chunk()->GetKeyValues(); | |
|
danno
2014/03/18 08:20:20
See comment above.
Weiliang
2014/03/19 08:55:31
Done.
| |
| 2047 if (!key_values->Contains(instr->key()->id())) { | |
| 2048 key_values->Add(instr->key()->id()); | |
| 2049 if (instr->key()->IsPhi()) { | |
| 2050 RecordKeyValueThroughPhi(instr->key(), key_values); | |
| 2051 } | |
| 2052 } | |
| 2053 } | |
| 2054 | |
| 2010 if (!instr->is_typed_elements()) { | 2055 if (!instr->is_typed_elements()) { |
| 2011 ASSERT(instr->elements()->representation().IsTagged()); | 2056 ASSERT(instr->elements()->representation().IsTagged()); |
| 2012 bool needs_write_barrier = instr->NeedsWriteBarrier(); | 2057 bool needs_write_barrier = instr->NeedsWriteBarrier(); |
| 2013 LOperand* object = NULL; | 2058 LOperand* object = NULL; |
| 2014 LOperand* key = NULL; | 2059 LOperand* key = NULL; |
| 2015 LOperand* val = NULL; | 2060 LOperand* val = NULL; |
| 2016 | 2061 |
| 2017 Representation value_representation = instr->value()->representation(); | 2062 Representation value_representation = instr->value()->representation(); |
| 2018 if (value_representation.IsDouble()) { | 2063 if (value_representation.IsDouble()) { |
| 2019 object = UseRegisterAtStart(instr->elements()); | 2064 object = UseRegisterAtStart(instr->elements()); |
| 2020 val = UseTempRegister(instr->value()); | 2065 val = UseRegisterAtStart(instr->value()); |
| 2021 key = UseRegisterOrConstantAtStart(instr->key()); | 2066 key = UseRegisterOrConstantAtStart(instr->key()); |
| 2022 } else { | 2067 } else { |
| 2023 ASSERT(value_representation.IsSmiOrTagged() || | 2068 ASSERT(value_representation.IsSmiOrTagged() || |
| 2024 value_representation.IsInteger32()); | 2069 value_representation.IsInteger32()); |
| 2025 if (needs_write_barrier) { | 2070 if (needs_write_barrier) { |
| 2026 object = UseTempRegister(instr->elements()); | 2071 object = UseTempRegister(instr->elements()); |
| 2027 val = UseTempRegister(instr->value()); | 2072 val = UseTempRegister(instr->value()); |
| 2028 key = UseTempRegister(instr->key()); | 2073 key = UseTempRegister(instr->key()); |
| 2029 } else { | 2074 } else { |
| 2030 object = UseRegisterAtStart(instr->elements()); | 2075 object = UseRegisterAtStart(instr->elements()); |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2436 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { | 2481 LInstruction* LChunkBuilder::DoLoadFieldByIndex(HLoadFieldByIndex* instr) { |
| 2437 LOperand* object = UseRegister(instr->object()); | 2482 LOperand* object = UseRegister(instr->object()); |
| 2438 LOperand* index = UseTempRegister(instr->index()); | 2483 LOperand* index = UseTempRegister(instr->index()); |
| 2439 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); | 2484 return DefineSameAsFirst(new(zone()) LLoadFieldByIndex(object, index)); |
| 2440 } | 2485 } |
| 2441 | 2486 |
| 2442 | 2487 |
| 2443 } } // namespace v8::internal | 2488 } } // namespace v8::internal |
| 2444 | 2489 |
| 2445 #endif // V8_TARGET_ARCH_X64 | 2490 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |