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

Unified Diff: src/x64/full-codegen-x64.cc

Issue 21014003: Optionally use 31-bits SMI value for 64-bit system (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed danno's comments Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: src/x64/full-codegen-x64.cc
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc
index f3e5a5032397a99bd8005ed8f5b0d15d3620102f..f9d878f5a3e49de290373c009bca36c111c5ff34 100644
--- a/src/x64/full-codegen-x64.cc
+++ b/src/x64/full-codegen-x64.cc
@@ -2281,21 +2281,22 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
__ jmp(&done, Label::kNear);
__ bind(&smi_case);
+ MacroAssembler::StrictSmiInstructionWrapper wrapper(masm_, &stub_call);
switch (op) {
case Token::SAR:
__ SmiShiftArithmeticRight(rax, rdx, rcx);
break;
case Token::SHL:
- __ SmiShiftLeft(rax, rdx, rcx);
+ __ SmiShiftLeft(rax, rdx, rcx, &stub_call);
break;
case Token::SHR:
__ SmiShiftLogicalRight(rax, rdx, rcx, &stub_call);
break;
case Token::ADD:
- __ SmiAdd(rax, rdx, rcx, &stub_call);
+ __ SmiAdd(rax, rdx, rcx, wrapper);
break;
case Token::SUB:
- __ SmiSub(rax, rdx, rcx, &stub_call);
+ __ SmiSub(rax, rdx, rcx, wrapper);
break;
case Token::MUL:
__ SmiMul(rax, rdx, rcx, &stub_call);
@@ -4451,10 +4452,22 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
if (ShouldInlineSmiCase(expr->op())) {
if (expr->op() == Token::INC) {
__ SmiAddConstant(rax, rax, Smi::FromInt(1));
danno 2013/08/19 21:47:44 Shouldn't overflow also be handled in SmiAddConsta
haitao.feng 2013/08/20 15:09:30 I will address this in https://codereview.chromium
+ if (SmiValuesAre31Bits()) {
+ // positive overflow
+ __ testl(rax, Immediate(0x80000000));
+ __ j(not_zero, &stub_call, Label::kNear);
+ }
} else {
__ SmiSubConstant(rax, rax, Smi::FromInt(1));
+ if (SmiValuesAre31Bits()) {
+ // negative overflow
+ __ testl(rax, Immediate(0x80000000));
+ __ j(zero, &stub_call, Label::kNear);
+ }
+ }
+ if (SmiValuesAre32Bits()) {
+ __ j(overflow, &stub_call, Label::kNear);
}
- __ j(overflow, &stub_call, Label::kNear);
// We could eliminate this smi check if we split the code at
// the first smi check before calling ToNumber.
patch_site.EmitJumpIfSmi(rax, &done, Label::kNear);

Powered by Google App Engine
This is Rietveld 408576698