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

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

Issue 310803003: Update DecodeFieldToSmi to support x32 port. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed the Windows and Mac build error Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/macro-assembler-x64.h
diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h
index a5a03f6aca2e0555a5b9b4b288a721cd788ab5fe..52209227c9e2602360020c64de5994d3db7f1a29 100644
--- a/src/x64/macro-assembler-x64.h
+++ b/src/x64/macro-assembler-x64.h
@@ -1022,8 +1022,22 @@ class MacroAssembler: public Assembler {
template<typename Field>
void DecodeFieldToSmi(Register reg) {
- andp(reg, Immediate(Field::kMask));
- shlp(reg, Immediate(kSmiShift - Field::kShift));
+ if (SmiValuesAre32Bits()) {
+ andp(reg, Immediate(Field::kMask));
+ shlp(reg, Immediate(kSmiShift - Field::kShift));
+ } else {
+ static const int shift = Field::kShift;
+ static const int mask = (Field::kMask >> Field::kShift) << kSmiTagSize;
haitao.feng 2014/06/09 05:43:06 Clang reports an error when using kSmiShift:
+ ASSERT(SmiValuesAre31Bits());
+ ASSERT(kSmiShift == kSmiTagSize);
+ ASSERT((mask & 0x80000000u) == 0);
+ if (shift < kSmiShift) {
+ shlp(reg, Immediate(kSmiShift - shift));
+ } else if (shift > kSmiShift) {
+ sarp(reg, Immediate(shift - kSmiShift));
+ }
+ andp(reg, Immediate(mask));
+ }
}
// Abort execution if argument is not a number, enabled via --debug-code.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698