diff --git a/src/ppc/full-codegen-ppc.cc b/src/ppc/full-codegen-ppc.cc index e5f460f3e6..fc65863deb 100644 --- a/src/ppc/full-codegen-ppc.cc +++ b/src/ppc/full-codegen-ppc.cc @@ -3915,6 +3915,28 @@ void FullCodeGenerator::EmitValueOf(CallRuntime* expr) { } +void FullCodeGenerator::EmitThrowIfNotADate(CallRuntime* expr) { + ZoneList* args = expr->arguments(); + DCHECK_EQ(1, args->length()); + + VisitForAccumulatorValue(args->at(0)); // Load the object. + + Label done, not_date_object; + Register object = r3; + Register result = r3; + Register scratch0 = r4; + + __ JumpIfSmi(object, ¬_date_object); + __ CompareObjectType(object, scratch0, scratch0, JS_DATE_TYPE); + __ beq(&done); + __ bind(¬_date_object); + __ CallRuntime(Runtime::kThrowNotDateError, 0); + + __ bind(&done); + context()->Plug(result); +} + + void FullCodeGenerator::EmitDateField(CallRuntime* expr) { ZoneList* args = expr->arguments(); DCHECK(args->length() == 2); @@ -3923,20 +3945,15 @@ void FullCodeGenerator::EmitDateField(CallRuntime* expr) { VisitForAccumulatorValue(args->at(0)); // Load the object. - Label runtime, done, not_date_object; Register object = r3; Register result = r3; Register scratch0 = r11; Register scratch1 = r4; - __ JumpIfSmi(object, ¬_date_object); - __ CompareObjectType(object, scratch1, scratch1, JS_DATE_TYPE); - __ bne(¬_date_object); - if (index->value() == 0) { __ LoadP(result, FieldMemOperand(object, JSDate::kValueOffset)); - __ b(&done); } else { + Label runtime, done; if (index->value() < JSDate::kFirstUncachedField) { ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); __ mov(scratch1, Operand(stamp)); @@ -3954,13 +3971,10 @@ void FullCodeGenerator::EmitDateField(CallRuntime* expr) { __ PrepareCallCFunction(2, scratch1); __ LoadSmiLiteral(r4, index); __ CallCFunction(ExternalReference::get_date_field_function(isolate()), 2); - __ b(&done); + __ bind(&done); } - __ bind(¬_date_object); - __ CallRuntime(Runtime::kThrowNotDateError, 0); - __ bind(&done); - context()->Plug(r3); + context()->Plug(result); } diff --git a/src/ppc/lithium-codegen-ppc.cc b/src/ppc/lithium-codegen-ppc.cc index 716486ec4e..11ea4bd049 100644 --- a/src/ppc/lithium-codegen-ppc.cc +++ b/src/ppc/lithium-codegen-ppc.cc @@ -1923,20 +1923,15 @@ void LCodeGen::DoDateField(LDateField* instr) { Register result = ToRegister(instr->result()); Register scratch = ToRegister(instr->temp()); Smi* index = instr->index(); - Label runtime, done; DCHECK(object.is(result)); DCHECK(object.is(r3)); DCHECK(!scratch.is(scratch0())); DCHECK(!scratch.is(object)); - __ TestIfSmi(object, r0); - DeoptimizeIf(eq, instr, Deoptimizer::kSmi, cr0); - __ CompareObjectType(object, scratch, scratch, JS_DATE_TYPE); - DeoptimizeIf(ne, instr, Deoptimizer::kNotADateObject); - if (index->value() == 0) { __ LoadP(result, FieldMemOperand(object, JSDate::kValueOffset)); } else { + Label runtime, done; if (index->value() < JSDate::kFirstUncachedField) { ExternalReference stamp = ExternalReference::date_cache_stamp(isolate()); __ mov(scratch, Operand(stamp)); diff --git a/src/ppc/lithium-ppc.cc b/src/ppc/lithium-ppc.cc index ffe3d2c654..35b09f9973 100644 --- a/src/ppc/lithium-ppc.cc +++ b/src/ppc/lithium-ppc.cc @@ -1815,7 +1815,7 @@ LInstruction* LChunkBuilder::DoDateField(HDateField* instr) { LOperand* object = UseFixed(instr->value(), r3); LDateField* result = new (zone()) LDateField(object, FixedTemp(r4), instr->index()); - return MarkAsCall(DefineFixed(result, r3), instr, CAN_DEOPTIMIZE_EAGERLY); + return MarkAsCall(DefineFixed(result, r3), instr, CANNOT_DEOPTIMIZE_EAGERLY); }