| 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 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1926 | 1936 |
| 1927 | 1937 |
| 1928 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { | 1938 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { |
| 1929 LOperand* string = UseRegister(instr->string()); | 1939 LOperand* string = UseRegister(instr->string()); |
| 1930 LOperand* index = UseRegisterOrConstant(instr->index()); | 1940 LOperand* index = UseRegisterOrConstant(instr->index()); |
| 1931 LStringCharCodeAt* result = new LStringCharCodeAt(string, index); | 1941 LStringCharCodeAt* result = new LStringCharCodeAt(string, index); |
| 1932 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); | 1942 return AssignEnvironment(AssignPointerMap(DefineAsRegister(result))); |
| 1933 } | 1943 } |
| 1934 | 1944 |
| 1935 | 1945 |
| 1946 LInstruction* LChunkBuilder::DoStringCharFromCode(HStringCharFromCode* instr) { |
| 1947 LOperand* char_code = UseRegister(instr->value()); |
| 1948 LStringCharFromCode* result = new LStringCharFromCode(char_code); |
| 1949 return AssignPointerMap(DefineAsRegister(result)); |
| 1950 } |
| 1951 |
| 1952 |
| 1936 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { | 1953 LInstruction* LChunkBuilder::DoStringLength(HStringLength* instr) { |
| 1937 LOperand* string = UseRegisterAtStart(instr->value()); | 1954 LOperand* string = UseRegisterAtStart(instr->value()); |
| 1938 return DefineAsRegister(new LStringLength(string)); | 1955 return DefineAsRegister(new LStringLength(string)); |
| 1939 } | 1956 } |
| 1940 | 1957 |
| 1941 | 1958 |
| 1942 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { | 1959 LInstruction* LChunkBuilder::DoArrayLiteral(HArrayLiteral* instr) { |
| 1943 return MarkAsCall(DefineFixed(new LArrayLiteral, eax), instr); | 1960 return MarkAsCall(DefineFixed(new LArrayLiteral, eax), instr); |
| 1944 } | 1961 } |
| 1945 | 1962 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2082 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { | 2099 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { |
| 2083 HEnvironment* outer = current_block_->last_environment()->outer(); | 2100 HEnvironment* outer = current_block_->last_environment()->outer(); |
| 2084 current_block_->UpdateEnvironment(outer); | 2101 current_block_->UpdateEnvironment(outer); |
| 2085 return NULL; | 2102 return NULL; |
| 2086 } | 2103 } |
| 2087 | 2104 |
| 2088 | 2105 |
| 2089 } } // namespace v8::internal | 2106 } } // namespace v8::internal |
| 2090 | 2107 |
| 2091 #endif // V8_TARGET_ARCH_IA32 | 2108 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |