| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 1992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2003 LOperand* temp = TempRegister(); | 2003 LOperand* temp = TempRegister(); |
| 2004 LSeqStringSetChar* result = | 2004 LSeqStringSetChar* result = |
| 2005 new(zone()) LSeqStringSetChar(instr->encoding(), | 2005 new(zone()) LSeqStringSetChar(instr->encoding(), |
| 2006 string, index, value, temp); | 2006 string, index, value, temp); |
| 2007 return DefineAsRegister(result); | 2007 return DefineAsRegister(result); |
| 2008 } | 2008 } |
| 2009 | 2009 |
| 2010 | 2010 |
| 2011 LInstruction* LChunkBuilder::DoShift(Token::Value op, | 2011 LInstruction* LChunkBuilder::DoShift(Token::Value op, |
| 2012 HBitwiseBinaryOperation* instr) { | 2012 HBitwiseBinaryOperation* instr) { |
| 2013 // TODO(jbramley): Support smis inline, like integers. | 2013 if (instr->representation().IsTagged()) { |
| 2014 if (instr->representation().IsSmiOrTagged()) { | |
| 2015 return DoArithmeticT(op, instr); | 2014 return DoArithmeticT(op, instr); |
| 2016 } | 2015 } |
| 2017 | 2016 |
| 2018 ASSERT(instr->representation().IsInteger32()); | 2017 ASSERT(instr->representation().IsInteger32() || |
| 2018 instr->representation().IsSmi()); |
| 2019 ASSERT(instr->left()->representation().Equals(instr->representation())); | 2019 ASSERT(instr->left()->representation().Equals(instr->representation())); |
| 2020 ASSERT(instr->right()->representation().Equals(instr->representation())); | 2020 ASSERT(instr->right()->representation().Equals(instr->representation())); |
| 2021 LOperand* left = UseRegisterAtStart(instr->left()); | 2021 |
| 2022 LOperand* left = instr->representation().IsSmi() |
| 2023 ? UseRegister(instr->left()) |
| 2024 : UseRegisterAtStart(instr->left()); |
| 2022 | 2025 |
| 2023 HValue* right_value = instr->right(); | 2026 HValue* right_value = instr->right(); |
| 2024 LOperand* right = NULL; | 2027 LOperand* right = NULL; |
| 2028 LOperand* temp = NULL; |
| 2025 int constant_value = 0; | 2029 int constant_value = 0; |
| 2026 if (right_value->IsConstant()) { | 2030 if (right_value->IsConstant()) { |
| 2027 right = UseConstant(right_value); | 2031 right = UseConstant(right_value); |
| 2028 HConstant* constant = HConstant::cast(right_value); | 2032 HConstant* constant = HConstant::cast(right_value); |
| 2029 constant_value = constant->Integer32Value() & 0x1f; | 2033 constant_value = constant->Integer32Value() & 0x1f; |
| 2030 } else { | 2034 } else { |
| 2031 right = UseRegisterAtStart(right_value); | 2035 right = UseRegisterAtStart(right_value); |
| 2036 if (op == Token::ROR) { |
| 2037 temp = TempRegister(); |
| 2038 } |
| 2032 } | 2039 } |
| 2033 | 2040 |
| 2034 // Shift operations can only deoptimize if we do a logical shift by 0 and the | 2041 // Shift operations can only deoptimize if we do a logical shift by 0 and the |
| 2035 // result cannot be truncated to int32. | 2042 // result cannot be truncated to int32. |
| 2036 bool does_deopt = false; | 2043 bool does_deopt = false; |
| 2037 if ((op == Token::SHR) && (constant_value == 0)) { | 2044 if ((op == Token::SHR) && (constant_value == 0)) { |
| 2038 if (FLAG_opt_safe_uint32_operations) { | 2045 if (FLAG_opt_safe_uint32_operations) { |
| 2039 does_deopt = !instr->CheckFlag(HInstruction::kUint32); | 2046 does_deopt = !instr->CheckFlag(HInstruction::kUint32); |
| 2040 } else { | 2047 } else { |
| 2041 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToInt32); | 2048 does_deopt = !instr->CheckUsesForFlag(HValue::kTruncatingToInt32); |
| 2042 } | 2049 } |
| 2043 } | 2050 } |
| 2044 | 2051 |
| 2045 LInstruction* result = | 2052 LInstruction* result; |
| 2046 DefineAsRegister(new(zone()) LShiftI(op, left, right, does_deopt)); | 2053 if (instr->representation().IsInteger32()) { |
| 2054 result = DefineAsRegister(new(zone()) LShiftI(op, left, right, does_deopt)); |
| 2055 } else { |
| 2056 ASSERT(instr->representation().IsSmi()); |
| 2057 result = DefineAsRegister( |
| 2058 new(zone()) LShiftS(op, left, right, temp, does_deopt)); |
| 2059 } |
| 2060 |
| 2047 return does_deopt ? AssignEnvironment(result) : result; | 2061 return does_deopt ? AssignEnvironment(result) : result; |
| 2048 } | 2062 } |
| 2049 | 2063 |
| 2050 | 2064 |
| 2051 LInstruction* LChunkBuilder::DoRor(HRor* instr) { | 2065 LInstruction* LChunkBuilder::DoRor(HRor* instr) { |
| 2052 return DoShift(Token::ROR, instr); | 2066 return DoShift(Token::ROR, instr); |
| 2053 } | 2067 } |
| 2054 | 2068 |
| 2055 | 2069 |
| 2056 LInstruction* LChunkBuilder::DoSar(HSar* instr) { | 2070 LInstruction* LChunkBuilder::DoSar(HSar* instr) { |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2544 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { | 2558 LInstruction* LChunkBuilder::DoWrapReceiver(HWrapReceiver* instr) { |
| 2545 LOperand* receiver = UseRegister(instr->receiver()); | 2559 LOperand* receiver = UseRegister(instr->receiver()); |
| 2546 LOperand* function = UseRegisterAtStart(instr->function()); | 2560 LOperand* function = UseRegisterAtStart(instr->function()); |
| 2547 LOperand* temp = TempRegister(); | 2561 LOperand* temp = TempRegister(); |
| 2548 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function, temp); | 2562 LWrapReceiver* result = new(zone()) LWrapReceiver(receiver, function, temp); |
| 2549 return AssignEnvironment(DefineAsRegister(result)); | 2563 return AssignEnvironment(DefineAsRegister(result)); |
| 2550 } | 2564 } |
| 2551 | 2565 |
| 2552 | 2566 |
| 2553 } } // namespace v8::internal | 2567 } } // namespace v8::internal |
| OLD | NEW |