From dde9dff2bb728279b258913e4d392227e3106840 Mon Sep 17 00:00:00 2001 From: "balazs.kilvady@imgtec.com" Date: Wed, 29 Oct 2014 18:19:57 +0000 Subject: [PATCH] MIPS: EmitCreateIteratorResult loads map from function's context. Port r24987 (cfc4713) Original commit message: 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=v8:3656 LOG=N R=paul.lind@imgtec.com Review URL: https://codereview.chromium.org/691563002 Cr-Commit-Position: refs/heads/master@{#24993} git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24993 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/mips/full-codegen-mips.cc | 13 ++++++++----- src/mips64/full-codegen-mips64.cc | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc index f459b87..e685cc9 100644 --- a/src/mips/full-codegen-mips.cc +++ b/src/mips/full-codegen-mips.cc @@ -2308,23 +2308,26 @@ 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(), v0, a2, a3, &gc_required, TAG_OBJECT); + __ Allocate(instance_size, v0, a2, a3, &gc_required, TAG_OBJECT); __ jmp(&allocated); __ bind(&gc_required); - __ Push(Smi::FromInt(map->instance_size())); + __ Push(Smi::FromInt(instance_size)); __ CallRuntime(Runtime::kAllocateInNewSpace, 1); __ lw(context_register(), MemOperand(fp, StandardFrameConstants::kContextOffset)); __ bind(&allocated); - __ li(a1, Operand(map)); + __ lw(a1, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); + __ lw(a1, FieldMemOperand(a1, GlobalObject::kNativeContextOffset)); + __ lw(a1, ContextOperand(a1, Context::ITERATOR_RESULT_MAP_INDEX)); __ pop(a2); __ li(a3, Operand(isolate()->factory()->ToBoolean(done))); __ li(t0, Operand(isolate()->factory()->empty_fixed_array())); - DCHECK_EQ(map->instance_size(), 5 * kPointerSize); __ sw(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); __ sw(t0, FieldMemOperand(v0, JSObject::kPropertiesOffset)); __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset)); diff --git a/src/mips64/full-codegen-mips64.cc b/src/mips64/full-codegen-mips64.cc index 746119d..06c3bb4 100644 --- a/src/mips64/full-codegen-mips64.cc +++ b/src/mips64/full-codegen-mips64.cc @@ -2305,23 +2305,26 @@ 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(), v0, a2, a3, &gc_required, TAG_OBJECT); + __ Allocate(instance_size, v0, a2, a3, &gc_required, TAG_OBJECT); __ jmp(&allocated); __ bind(&gc_required); - __ Push(Smi::FromInt(map->instance_size())); + __ Push(Smi::FromInt(instance_size)); __ CallRuntime(Runtime::kAllocateInNewSpace, 1); __ ld(context_register(), MemOperand(fp, StandardFrameConstants::kContextOffset)); __ bind(&allocated); - __ li(a1, Operand(map)); + __ ld(a1, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX)); + __ ld(a1, FieldMemOperand(a1, GlobalObject::kNativeContextOffset)); + __ ld(a1, ContextOperand(a1, Context::ITERATOR_RESULT_MAP_INDEX)); __ pop(a2); __ li(a3, Operand(isolate()->factory()->ToBoolean(done))); __ li(a4, Operand(isolate()->factory()->empty_fixed_array())); - DCHECK_EQ(map->instance_size(), 5 * kPointerSize); __ sd(a1, FieldMemOperand(v0, HeapObject::kMapOffset)); __ sd(a4, FieldMemOperand(v0, JSObject::kPropertiesOffset)); __ sd(a4, FieldMemOperand(v0, JSObject::kElementsOffset)); -- 2.7.4