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

Side by Side 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: Use (kSmiValueSize == 31) or (kSmiValueSize == 32) for SMI functions in macro assembler" 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 2268 matching lines...) Expand 10 before | Expand all | Expand 10 after
2279 expr->BinaryOperationFeedbackId()); 2279 expr->BinaryOperationFeedbackId());
2280 patch_site.EmitPatchInfo(); 2280 patch_site.EmitPatchInfo();
2281 __ jmp(&done, Label::kNear); 2281 __ jmp(&done, Label::kNear);
2282 2282
2283 __ bind(&smi_case); 2283 __ bind(&smi_case);
2284 switch (op) { 2284 switch (op) {
2285 case Token::SAR: 2285 case Token::SAR:
2286 __ SmiShiftArithmeticRight(rax, rdx, rcx); 2286 __ SmiShiftArithmeticRight(rax, rdx, rcx);
2287 break; 2287 break;
2288 case Token::SHL: 2288 case Token::SHL:
2289 __ SmiShiftLeft(rax, rdx, rcx); 2289 __ SmiShiftLeft(rax, rdx, rcx, &stub_call);
2290 break; 2290 break;
2291 case Token::SHR: 2291 case Token::SHR:
2292 __ SmiShiftLogicalRight(rax, rdx, rcx, &stub_call); 2292 __ SmiShiftLogicalRight(rax, rdx, rcx, &stub_call);
2293 break; 2293 break;
2294 case Token::ADD: 2294 case Token::ADD:
2295 __ SmiAdd(rax, rdx, rcx, &stub_call); 2295 __ SmiAdd(rax, rdx, rcx, &stub_call);
2296 break; 2296 break;
2297 case Token::SUB: 2297 case Token::SUB:
2298 __ SmiSub(rax, rdx, rcx, &stub_call); 2298 __ SmiSub(rax, rdx, rcx, &stub_call);
2299 break; 2299 break;
(...skipping 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after
4446 } 4446 }
4447 } 4447 }
4448 } 4448 }
4449 4449
4450 // Inline smi case if we are in a loop. 4450 // Inline smi case if we are in a loop.
4451 Label done, stub_call; 4451 Label done, stub_call;
4452 JumpPatchSite patch_site(masm_); 4452 JumpPatchSite patch_site(masm_);
4453 4453
4454 if (ShouldInlineSmiCase(expr->op())) { 4454 if (ShouldInlineSmiCase(expr->op())) {
4455 if (expr->op() == Token::INC) { 4455 if (expr->op() == Token::INC) {
4456 __ SmiAddConstant(rax, rax, Smi::FromInt(1)); 4456 __ SmiAddConstant(rax, rax, Smi::FromInt(1));
danno 2013/08/01 16:45:41 Handle the overflow case inside the macro assemble
haitao.feng 2013/08/02 09:35:51 I am OK to change this but this might affect perfo
4457 if (kSmiValueSize == 31) {
4458 // positive overflow
4459 __ testl(rax, Immediate(0x80000000));
4460 __ j(not_zero, &stub_call, Label::kNear);
4461 }
4457 } else { 4462 } else {
4458 __ SmiSubConstant(rax, rax, Smi::FromInt(1)); 4463 __ SmiSubConstant(rax, rax, Smi::FromInt(1));
4464 if (kSmiValueSize == 31) {
4465 // negative overflow
4466 __ testl(rax, Immediate(0x80000000));
4467 __ j(zero, &stub_call, Label::kNear);
4468 }
4459 } 4469 }
4460 __ j(overflow, &stub_call, Label::kNear); 4470 if (kSmiValueSize == 32) {
4471 __ j(overflow, &stub_call, Label::kNear);
4472 }
4461 // We could eliminate this smi check if we split the code at 4473 // We could eliminate this smi check if we split the code at
4462 // the first smi check before calling ToNumber. 4474 // the first smi check before calling ToNumber.
4463 patch_site.EmitJumpIfSmi(rax, &done, Label::kNear); 4475 patch_site.EmitJumpIfSmi(rax, &done, Label::kNear);
4464 4476
4465 __ bind(&stub_call); 4477 __ bind(&stub_call);
4466 // Call stub. Undo operation first. 4478 // Call stub. Undo operation first.
4467 if (expr->op() == Token::INC) { 4479 if (expr->op() == Token::INC) {
4468 __ SmiSubConstant(rax, rax, Smi::FromInt(1)); 4480 __ SmiSubConstant(rax, rax, Smi::FromInt(1));
4469 } else { 4481 } else {
4470 __ SmiAddConstant(rax, rax, Smi::FromInt(1)); 4482 __ SmiAddConstant(rax, rax, Smi::FromInt(1));
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
4905 *context_length = 0; 4917 *context_length = 0;
4906 return previous_; 4918 return previous_;
4907 } 4919 }
4908 4920
4909 4921
4910 #undef __ 4922 #undef __
4911 4923
4912 } } // namespace v8::internal 4924 } } // namespace v8::internal
4913 4925
4914 #endif // V8_TARGET_ARCH_X64 4926 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698