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

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

Issue 555073: Merge r3610, r3611, r3612, r3630, r3636, r3640, and r3664... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 10 years, 11 months 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 | « src/version.cc ('k') | src/x64/fast-codegen-x64.cc » ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 6194 matching lines...) Expand 10 before | Expand all | Expand 10 after
6205 __ bind(&true_result); 6205 __ bind(&true_result);
6206 __ movq(rax, Immediate(1)); 6206 __ movq(rax, Immediate(1));
6207 __ ret(1 * kPointerSize); 6207 __ ret(1 * kPointerSize);
6208 __ bind(&false_result); 6208 __ bind(&false_result);
6209 __ xor_(rax, rax); 6209 __ xor_(rax, rax);
6210 __ ret(1 * kPointerSize); 6210 __ ret(1 * kPointerSize);
6211 } 6211 }
6212 6212
6213 6213
6214 bool CodeGenerator::FoldConstantSmis(Token::Value op, int left, int right) { 6214 bool CodeGenerator::FoldConstantSmis(Token::Value op, int left, int right) {
6215 // TODO(X64): This method is identical to the ia32 version.
6216 // Either find a reason to change it, or move it somewhere where it can be
6217 // shared. (Notice: It assumes that a Smi can fit in an int).
6218
6219 Object* answer_object = Heap::undefined_value(); 6215 Object* answer_object = Heap::undefined_value();
6220 switch (op) { 6216 switch (op) {
6221 case Token::ADD: 6217 case Token::ADD:
6222 if (Smi::IsValid(left + right)) { 6218 // Use intptr_t to detect overflow of 32-bit int.
6219 if (Smi::IsValid(static_cast<intptr_t>(left) + right)) {
6223 answer_object = Smi::FromInt(left + right); 6220 answer_object = Smi::FromInt(left + right);
6224 } 6221 }
6225 break; 6222 break;
6226 case Token::SUB: 6223 case Token::SUB:
6227 if (Smi::IsValid(left - right)) { 6224 // Use intptr_t to detect overflow of 32-bit int.
6225 if (Smi::IsValid(static_cast<intptr_t>(left) - right)) {
6228 answer_object = Smi::FromInt(left - right); 6226 answer_object = Smi::FromInt(left - right);
6229 } 6227 }
6230 break; 6228 break;
6231 case Token::MUL: { 6229 case Token::MUL: {
6232 double answer = static_cast<double>(left) * right; 6230 double answer = static_cast<double>(left) * right;
6233 if (answer >= Smi::kMinValue && answer <= Smi::kMaxValue) { 6231 if (answer >= Smi::kMinValue && answer <= Smi::kMaxValue) {
6234 // If the product is zero and the non-zero factor is negative, 6232 // If the product is zero and the non-zero factor is negative,
6235 // the spec requires us to return floating point negative zero. 6233 // the spec requires us to return floating point negative zero.
6236 if (answer != 0 || (left + right) >= 0) { 6234 if (answer != 0 || (left + right) >= 0) {
6237 answer_object = Smi::FromInt(static_cast<int>(answer)); 6235 answer_object = Smi::FromInt(static_cast<int>(answer));
(...skipping 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after
8216 masm.GetCode(&desc); 8214 masm.GetCode(&desc);
8217 // Call the function from C++. 8215 // Call the function from C++.
8218 return FUNCTION_CAST<ModuloFunction>(buffer); 8216 return FUNCTION_CAST<ModuloFunction>(buffer);
8219 } 8217 }
8220 8218
8221 #endif 8219 #endif
8222 8220
8223 #undef __ 8221 #undef __
8224 8222
8225 } } // namespace v8::internal 8223 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/version.cc ('k') | src/x64/fast-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698