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

Side by Side Diff: src/ia32/stub-cache-ia32.cc

Issue 22285003: tweak of Math.abs in its x64 stub (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: 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
« no previous file with comments | « no previous file | src/x64/lithium-codegen-x64.h » ('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 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 2461 matching lines...) Expand 10 before | Expand all | Expand 10 after
2472 } 2472 }
2473 2473
2474 // Load the (only) argument into eax. 2474 // Load the (only) argument into eax.
2475 __ mov(eax, Operand(esp, 1 * kPointerSize)); 2475 __ mov(eax, Operand(esp, 1 * kPointerSize));
2476 2476
2477 // Check if the argument is a smi. 2477 // Check if the argument is a smi.
2478 Label not_smi; 2478 Label not_smi;
2479 STATIC_ASSERT(kSmiTag == 0); 2479 STATIC_ASSERT(kSmiTag == 0);
2480 __ JumpIfNotSmi(eax, &not_smi); 2480 __ JumpIfNotSmi(eax, &not_smi);
2481 2481
2482 // Branchless abs implementation, refer to below:
2483 // http://graphics.stanford.edu/~seander/bithacks.html#IntegerAbs
2482 // Set ebx to 1...1 (== -1) if the argument is negative, or to 0...0 2484 // Set ebx to 1...1 (== -1) if the argument is negative, or to 0...0
2483 // otherwise. 2485 // otherwise.
2484 __ mov(ebx, eax); 2486 __ mov(ebx, eax);
2485 __ sar(ebx, kBitsPerInt - 1); 2487 __ sar(ebx, kBitsPerInt - 1);
2486 2488
2487 // Do bitwise not or do nothing depending on ebx. 2489 // Do bitwise not or do nothing depending on ebx.
2488 __ xor_(eax, ebx); 2490 __ xor_(eax, ebx);
2489 2491
2490 // Add 1 or do nothing depending on ebx. 2492 // Add 1 or do nothing depending on ebx.
2491 __ sub(eax, ebx); 2493 __ sub(eax, ebx);
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after
3766 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); 3768 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3767 } 3769 }
3768 } 3770 }
3769 3771
3770 3772
3771 #undef __ 3773 #undef __
3772 3774
3773 } } // namespace v8::internal 3775 } } // namespace v8::internal
3774 3776
3775 #endif // V8_TARGET_ARCH_IA32 3777 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | src/x64/lithium-codegen-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698