From 120d9d521af8d47fa0960907c0b5bac1dbbd6e11 Mon Sep 17 00:00:00 2001 From: "weiliang.lin@intel.com" Date: Thu, 30 Oct 2014 03:46:02 +0000 Subject: [PATCH] X87: EmitCreateIteratorResult loads map from function's context port r24987 original commit message: EmitCreateIteratorResult loads map from function's context Caching or serialization can cause full-codegen output to be shared between contexts. CreateIteratorResult, however, was doing the wrong thing by creating results with the map that was current when the code was generated. Instead, we should chase pointers to load the right map from the function's context. BUG= R=weiliang.lin@intel.com Review URL: https://codereview.chromium.org/674073004 Patch from Chunyang Dai . Cr-Commit-Position: refs/heads/master@{#25000} git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25000 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/x87/full-codegen-x87.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/x87/full-codegen-x87.cc b/src/x87/full-codegen-x87.cc index 7e8ece4..729655d 100644 --- a/src/x87/full-codegen-x87.cc +++ b/src/x87/full-codegen-x87.cc @@ -2232,22 +2232,25 @@ void FullCodeGenerator::EmitCreateIteratorResult(bool done) { Label gc_required; Label allocated; - Handle map(isolate()->native_context()->iterator_result_map()); + const int instance_size = 5 * kPointerSize; + DCHECK_EQ(isolate()->native_context()->iterator_result_map()->instance_size(), + instance_size); - __ Allocate(map->instance_size(), eax, ecx, edx, &gc_required, TAG_OBJECT); + __ Allocate(instance_size, eax, ecx, edx, &gc_required, TAG_OBJECT); __ jmp(&allocated); __ bind(&gc_required); - __ Push(Smi::FromInt(map->instance_size())); + __ Push(Smi::FromInt(instance_size)); __ CallRuntime(Runtime::kAllocateInNewSpace, 1); __ mov(context_register(), Operand(ebp, StandardFrameConstants::kContextOffset)); __ bind(&allocated); - __ mov(ebx, map); + __ mov(ebx, Operand(esi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); + __ mov(ebx, FieldOperand(ebx, GlobalObject::kNativeContextOffset)); + __ mov(ebx, ContextOperand(ebx, Context::ITERATOR_RESULT_MAP_INDEX)); __ pop(ecx); __ mov(edx, isolate()->factory()->ToBoolean(done)); - DCHECK_EQ(map->instance_size(), 5 * kPointerSize); __ mov(FieldOperand(eax, HeapObject::kMapOffset), ebx); __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), isolate()->factory()->empty_fixed_array()); -- 2.7.4