| OLD | NEW |
| 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 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1359 ASSERT(instr->representation().IsTagged()); | 1359 ASSERT(instr->representation().IsTagged()); |
| 1360 return DoArithmeticT(Token::DIV, instr); | 1360 return DoArithmeticT(Token::DIV, instr); |
| 1361 } | 1361 } |
| 1362 } | 1362 } |
| 1363 | 1363 |
| 1364 | 1364 |
| 1365 LInstruction* LChunkBuilder::DoMod(HMod* instr) { | 1365 LInstruction* LChunkBuilder::DoMod(HMod* instr) { |
| 1366 if (instr->representation().IsInteger32()) { | 1366 if (instr->representation().IsInteger32()) { |
| 1367 ASSERT(instr->left()->representation().IsInteger32()); | 1367 ASSERT(instr->left()->representation().IsInteger32()); |
| 1368 ASSERT(instr->right()->representation().IsInteger32()); | 1368 ASSERT(instr->right()->representation().IsInteger32()); |
| 1369 // The temporary operand is necessary to ensure that right is not allocated | 1369 |
| 1370 // into edx. | 1370 LInstruction* result; |
| 1371 LOperand* temp = FixedTemp(edx); | 1371 if (instr->HasPowerOf2Divisor()) { |
| 1372 LOperand* value = UseFixed(instr->left(), eax); | 1372 ASSERT(!instr->CheckFlag(HValue::kCanBeDivByZero)); |
| 1373 LOperand* divisor = UseRegister(instr->right()); | 1373 LOperand* value = UseRegisterAtStart(instr->left()); |
| 1374 LModI* mod = new LModI(value, divisor, temp); | 1374 LModI* mod = new LModI(value, UseOrConstant(instr->right()), NULL); |
| 1375 LInstruction* result = DefineFixed(mod, edx); | 1375 result = DefineSameAsFirst(mod); |
| 1376 } else { |
| 1377 // The temporary operand is necessary to ensure that right is |
| 1378 // not allocated into edx. |
| 1379 LOperand* temp = FixedTemp(edx); |
| 1380 LOperand* value = UseFixed(instr->left(), eax); |
| 1381 LOperand* divisor = UseRegister(instr->right()); |
| 1382 LModI* mod = new LModI(value, divisor, temp); |
| 1383 result = DefineFixed(mod, edx); |
| 1384 } |
| 1385 |
| 1376 return (instr->CheckFlag(HValue::kBailoutOnMinusZero) || | 1386 return (instr->CheckFlag(HValue::kBailoutOnMinusZero) || |
| 1377 instr->CheckFlag(HValue::kCanBeDivByZero)) | 1387 instr->CheckFlag(HValue::kCanBeDivByZero)) |
| 1378 ? AssignEnvironment(result) | 1388 ? AssignEnvironment(result) |
| 1379 : result; | 1389 : result; |
| 1380 } else if (instr->representation().IsTagged()) { | 1390 } else if (instr->representation().IsTagged()) { |
| 1381 return DoArithmeticT(Token::MOD, instr); | 1391 return DoArithmeticT(Token::MOD, instr); |
| 1382 } else { | 1392 } else { |
| 1383 ASSERT(instr->representation().IsDouble()); | 1393 ASSERT(instr->representation().IsDouble()); |
| 1384 // We call a C function for double modulo. It can't trigger a GC. | 1394 // We call a C function for double modulo. It can't trigger a GC. |
| 1385 // We need to use fixed result register for the call. | 1395 // We need to use fixed result register for the call. |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1927 | 1937 |
| 1928 | 1938 |
| 1929 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { | 1939 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { |
| 1930 LOperand* string = UseRegister(instr->string()); | 1940 LOperand* string = UseRegister(instr->string()); |
| 1931 LOperand* index = UseRegisterOrConstant(instr->index()); | 1941 LOperand* index = UseRegisterOrConstant(instr->index()); |
| 1932 LStringCharCodeAt* result = new LStringCharCodeAt(string, index); | 1942 LStringCharCodeAt* result = new LStringCharCodeAt(string, index); |
| 1933 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 1943 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
| 1934 } | 1944 } |
| 1935 | 1945 |
| 1936 | 1946 |
| 1947 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { |
| 1948 LOperand* char_code = UseRegister(instr->value()); |
| 1949 LStringCharFromCode* result = new LStringCharFromCode(char_code); |
| 1950 return AssignPointerMap(DefineAsRegister(result)); |
| 1951 } |
| 1952 |
| 1953 |
| 1937 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { | 1954 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { |
| 1938 LOperand* string = UseRegisterAtStart(instr->value()); | 1955 LOperand* string = UseRegisterAtStart(instr->value()); |
| 1939 return DefineAsRegister(new LStringLength(string)); | 1956 return DefineAsRegister(new LStringLength(string)); |
| 1940 } | 1957 } |
| 1941 | 1958 |
| 1942 | 1959 |
| 1943 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { | 1960 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { |
| 1944 return MarkAsCall(DefineFixed(new LArrayLiteral, eax), instr); | 1961 return MarkAsCall(DefineFixed(new LArrayLiteral, eax), instr); |
| 1945 } | 1962 } |
| 1946 | 1963 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2083 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2100 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
| 2084 HEnvironment* outer = current_block_->last_environment()->outer(); | 2101 HEnvironment* outer = current_block_->last_environment()->outer(); |
| 2085 current_block_->UpdateEnvironment(outer); | 2102 current_block_->UpdateEnvironment(outer); |
| 2086 return NULL; | 2103 return NULL; |
| 2087 } | 2104 } |
| 2088 | 2105 |
| 2089 | 2106 |
| 2090 } } // namespace v8::internal | 2107 } } // namespace v8::internal |
| 2091 | 2108 |
| 2092 #endif // V8_TARGET_ARCH_IA32 | 2109 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |