From d54305e12afa4aa5a73cac46b9d28d74662bf455 Mon Sep 17 00:00:00 2001 From: "alexandre.rames@arm.com" Date: Tue, 18 Feb 2014 15:14:23 +0000 Subject: [PATCH] A64: Minor code generation improvement: only load the object map if needed. R=ulan@chromium.org Review URL: https://codereview.chromium.org/170503004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19456 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/a64/stub-cache-a64.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/a64/stub-cache-a64.cc b/src/a64/stub-cache-a64.cc index 3cf2a29..57c03e8 100644 --- a/src/a64/stub-cache-a64.cc +++ b/src/a64/stub-cache-a64.cc @@ -888,9 +888,13 @@ Register StubCompiler::CheckPrototypes(Handle type, reg = holder_reg; // From now on the object will be in holder_reg. __ Ldr(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset)); } else { - Register map_reg = scratch1; - // TODO(jbramley): Skip this load when we don't need the map. - __ Ldr(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); + bool need_map = (depth != 1 || check == CHECK_ALL_MAPS) || + heap()->InNewSpace(*prototype); + Register map_reg = NoReg; + if (need_map) { + map_reg = scratch1; + __ Ldr(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); + } if (depth != 1 || check == CHECK_ALL_MAPS) { __ CheckMap(map_reg, current_map, miss, DONT_DO_SMI_CHECK); -- 2.7.4