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

Unified Diff: src/x64/macro-assembler-x64.h

Issue 6812046: X64: Convert HeapNumbers that contain valid smi values to smis in binop-stub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments. Created 9 years, 8 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/macro-assembler-x64.h
diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h
index 8086388b12854251d557cfff29d561be4514912f..4c177205b6be4f143933f751678641b9dbc14f52 100644
--- a/src/x64/macro-assembler-x64.h
+++ b/src/x64/macro-assembler-x64.h
@@ -323,6 +323,16 @@ class MacroAssembler: public Assembler {
Register src,
int power);
+ // Perform the logical or of two smi values and return a smi value.
+ // If either argument is not a smi, jump to on_not_smis and retain
+ // the original values of source registers. The destination register
+ // may be changed if it's not one of the source registers.
+ template <typename LabelType>
+ void SmiOrIfSmis(Register dst,
+ Register src1,
+ Register src2,
+ LabelType* on_not_smis);
+
// Simple comparison of smis. Both sides must be known smis to use these,
// otherwise use Cmp.
@@ -1790,6 +1800,24 @@ void MacroAssembler::JumpUnlessBothNonNegativeSmi(Register src1,
template <typename LabelType>
+void MacroAssembler::SmiOrIfSmis(Register dst, Register src1, Register src2,
+ LabelType* on_not_smis) {
+ if (dst.is(src1) || dst.is(src2)) {
+ ASSERT(!src1.is(kScratchRegister));
+ ASSERT(!src2.is(kScratchRegister));
+ movq(kScratchRegister, src1);
+ or_(kScratchRegister, src2);
+ JumpIfNotSmi(kScratchRegister, on_not_smis);
+ movq(dst, kScratchRegister);
+ } else {
+ movq(dst, src1);
+ or_(dst, src2);
+ JumpIfNotSmi(dst, on_not_smis);
+ }
+}
+
+
+template <typename LabelType>
void MacroAssembler::JumpIfNotString(Register object,
Register object_map,
LabelType* not_string) {

Powered by Google App Engine
This is Rietveld 408576698