From 46af26a5db0e2a4010121eb4babc0592ab1eb6b7 Mon Sep 17 00:00:00 2001 From: "mvstanton@chromium.org" Date: Fri, 1 Mar 2013 16:59:53 +0000 Subject: [PATCH] A debug code assert needed to be behind the new optimize_constructed_arrays flag. BUG= Review URL: https://codereview.chromium.org/12385050 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13791 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/arm/builtins-arm.cc | 26 ++++++++++++++------------ src/ia32/builtins-ia32.cc | 24 +++++++++++++----------- src/x64/builtins-x64.cc | 24 +++++++++++++----------- 3 files changed, 40 insertions(+), 34 deletions(-) diff --git a/src/arm/builtins-arm.cc b/src/arm/builtins-arm.cc index ec27bd6..466c890 100644 --- a/src/arm/builtins-arm.cc +++ b/src/arm/builtins-arm.cc @@ -557,18 +557,20 @@ void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) { __ CompareObjectType(r1, r3, r4, MAP_TYPE); __ Assert(eq, "Unexpected initial map for Array function"); - // We should either have undefined in r2 or a valid jsglobalpropertycell - Label okay_here; - Handle undefined_sentinel( - masm->isolate()->heap()->undefined_value(), masm->isolate()); - Handle global_property_cell_map( - masm->isolate()->heap()->global_property_cell_map()); - __ cmp(r2, Operand(undefined_sentinel)); - __ b(eq, &okay_here); - __ ldr(r3, FieldMemOperand(r2, 0)); - __ cmp(r3, Operand(global_property_cell_map)); - __ Assert(eq, "Expected property cell in register ebx"); - __ bind(&okay_here); + if (FLAG_optimize_constructed_arrays) { + // We should either have undefined in r2 or a valid jsglobalpropertycell + Label okay_here; + Handle undefined_sentinel( + masm->isolate()->heap()->undefined_value(), masm->isolate()); + Handle global_property_cell_map( + masm->isolate()->heap()->global_property_cell_map()); + __ cmp(r2, Operand(undefined_sentinel)); + __ b(eq, &okay_here); + __ ldr(r3, FieldMemOperand(r2, 0)); + __ cmp(r3, Operand(global_property_cell_map)); + __ Assert(eq, "Expected property cell in register ebx"); + __ bind(&okay_here); + } } if (FLAG_optimize_constructed_arrays) { diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc index bcd713d..e3b2b7b 100644 --- a/src/ia32/builtins-ia32.cc +++ b/src/ia32/builtins-ia32.cc @@ -1496,17 +1496,19 @@ void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) { __ CmpObjectType(ecx, MAP_TYPE, ecx); __ Assert(equal, "Unexpected initial map for Array function"); - // We should either have undefined in ebx or a valid jsglobalpropertycell - Label okay_here; - Handle undefined_sentinel( - masm->isolate()->heap()->undefined_value(), masm->isolate()); - Handle global_property_cell_map( - masm->isolate()->heap()->global_property_cell_map()); - __ cmp(ebx, Immediate(undefined_sentinel)); - __ j(equal, &okay_here); - __ cmp(FieldOperand(ebx, 0), Immediate(global_property_cell_map)); - __ Assert(equal, "Expected property cell in register ebx"); - __ bind(&okay_here); + if (FLAG_optimize_constructed_arrays) { + // We should either have undefined in ebx or a valid jsglobalpropertycell + Label okay_here; + Handle undefined_sentinel( + masm->isolate()->heap()->undefined_value(), masm->isolate()); + Handle global_property_cell_map( + masm->isolate()->heap()->global_property_cell_map()); + __ cmp(ebx, Immediate(undefined_sentinel)); + __ j(equal, &okay_here); + __ cmp(FieldOperand(ebx, 0), Immediate(global_property_cell_map)); + __ Assert(equal, "Expected property cell in register ebx"); + __ bind(&okay_here); + } } if (FLAG_optimize_constructed_arrays) { diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc index c3d757a..144962b 100644 --- a/src/x64/builtins-x64.cc +++ b/src/x64/builtins-x64.cc @@ -1524,17 +1524,19 @@ void Builtins::Generate_ArrayConstructCode(MacroAssembler* masm) { __ CmpObjectType(rcx, MAP_TYPE, rcx); __ Check(equal, "Unexpected initial map for Array function"); - // We should either have undefined in ebx or a valid jsglobalpropertycell - Label okay_here; - Handle undefined_sentinel( - masm->isolate()->factory()->undefined_value()); - Handle global_property_cell_map( - masm->isolate()->heap()->global_property_cell_map()); - __ Cmp(rbx, undefined_sentinel); - __ j(equal, &okay_here); - __ Cmp(FieldOperand(rbx, 0), global_property_cell_map); - __ Assert(equal, "Expected property cell in register rbx"); - __ bind(&okay_here); + if (FLAG_optimize_constructed_arrays) { + // We should either have undefined in ebx or a valid jsglobalpropertycell + Label okay_here; + Handle undefined_sentinel( + masm->isolate()->factory()->undefined_value()); + Handle global_property_cell_map( + masm->isolate()->heap()->global_property_cell_map()); + __ Cmp(rbx, undefined_sentinel); + __ j(equal, &okay_here); + __ Cmp(FieldOperand(rbx, 0), global_property_cell_map); + __ Assert(equal, "Expected property cell in register rbx"); + __ bind(&okay_here); + } } if (FLAG_optimize_constructed_arrays) { -- 2.7.4