From 28c557dd5ba04cced7b77d55514bc787b92b88b5 Mon Sep 17 00:00:00 2001 From: "ishell@chromium.org" Date: Mon, 9 Dec 2013 16:51:57 +0000 Subject: [PATCH] HLoadNamedField for Smis optimized for x64 R=verwaest@chromium.org Review URL: https://codereview.chromium.org/108633003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18283 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/hydrogen-instructions.h | 6 +++++- src/x64/lithium-codegen-x64.cc | 12 +++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index 23dbbd2..4dd24fd 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -6216,7 +6216,11 @@ class HLoadNamedField V8_FINAL : public HTemplateInstruction<1> { set_representation(Representation::Integer32()); } else if (representation.IsSmi()) { set_type(HType::Smi()); - set_representation(representation); + if (SmiValuesAre32Bits()) { + set_representation(Representation::Integer32()); + } else { + set_representation(representation); + } } else if (representation.IsDouble() || representation.IsExternal() || representation.IsInteger32()) { diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index 7c9949a..c6d5a14 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -2843,7 +2843,17 @@ void LCodeGen::DoLoadNamedField(LLoadNamedField* instr) { __ movq(result, FieldOperand(object, JSObject::kPropertiesOffset)); object = result; } - __ Load(result, FieldOperand(object, offset), access.representation()); + + Representation representation = access.representation(); + if (representation.IsSmi() && + instr->hydrogen()->representation().IsInteger32()) { + // Read int value directly from upper half of the smi. + STATIC_ASSERT(kSmiTag == 0); + STATIC_ASSERT(kSmiTagSize + kSmiShiftSize == 32); + offset += kPointerSize / 2; + representation = Representation::Integer32(); + } + __ Load(result, FieldOperand(object, offset), representation); } -- 2.7.4