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

Side by Side Diff: src/ia32/codegen-ia32.cc

Issue 4746001: Add check for overflow after MUL operations in side-effect free int32 express... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-927.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 8560 matching lines...) Expand 10 before | Expand all | Expand 10 after
8571 } else if (op == Token::SUB) { 8571 } else if (op == Token::SUB) {
8572 __ sub(left.reg(), Operand(right.reg())); 8572 __ sub(left.reg(), Operand(right.reg()));
8573 } else { 8573 } else {
8574 ASSERT(op == Token::MUL); 8574 ASSERT(op == Token::MUL);
8575 // We have statically verified that a negative zero can be ignored. 8575 // We have statically verified that a negative zero can be ignored.
8576 __ imul(left.reg(), Operand(right.reg())); 8576 __ imul(left.reg(), Operand(right.reg()));
8577 } 8577 }
8578 } 8578 }
8579 right.Unuse(); 8579 right.Unuse();
8580 frame_->Push(&left); 8580 frame_->Push(&left);
8581 if (!node->to_int32()) { 8581 if (!node->to_int32() || op == Token::MUL) {
8582 // If ToInt32 is called on the result of ADD, SUB, or MUL, we don't 8582 // If ToInt32 is called on the result of ADD, SUB, we don't
8583 // care about overflows. 8583 // care about overflows.
8584 // Result of MUL can be non-representable precisely in double so
8585 // we have to check for overflow.
8584 unsafe_bailout_->Branch(overflow); 8586 unsafe_bailout_->Branch(overflow);
8585 } 8587 }
8586 break; 8588 break;
8587 case Token::DIV: 8589 case Token::DIV:
8588 case Token::MOD: { 8590 case Token::MOD: {
8589 if (right.is_register() && (right.reg().is(eax) || right.reg().is(edx))) { 8591 if (right.is_register() && (right.reg().is(eax) || right.reg().is(edx))) {
8590 if (left.is_register() && left.reg().is(edi)) { 8592 if (left.is_register() && left.reg().is(edi)) {
8591 right.ToRegister(ebx); 8593 right.ToRegister(ebx);
8592 } else { 8594 } else {
8593 right.ToRegister(edi); 8595 right.ToRegister(edi);
(...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after
10069 masm.GetCode(&desc); 10071 masm.GetCode(&desc);
10070 // Call the function from C++. 10072 // Call the function from C++.
10071 return FUNCTION_CAST<MemCopyFunction>(buffer); 10073 return FUNCTION_CAST<MemCopyFunction>(buffer);
10072 } 10074 }
10073 10075
10074 #undef __ 10076 #undef __
10075 10077
10076 } } // namespace v8::internal 10078 } } // namespace v8::internal
10077 10079
10078 #endif // V8_TARGET_ARCH_IA32 10080 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-927.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698