Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index 0b704d07ef5749cf056d2584e84815f7e3b03a59..cf1e7c70f5f4faedad2d567b7fd19309a46b41fa 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -91,7 +91,7 @@ void LCodeGen::FinishCode(Handle<Code> code) { |
} |
-void LCodeGen::Abort(BailoutReason reason) { |
+void LCodeGen::Abort(const char* reason) { |
info()->set_bailout_reason(reason); |
status_ = ABORTED; |
} |
@@ -334,7 +334,7 @@ bool LCodeGen::GenerateDeoptJumpTable() { |
// 32bit data after it. |
if (!is_int24((masm()->pc_offset() / Assembler::kInstrSize) + |
deopt_jump_table_.length() * 7)) { |
- Abort(kGeneratedCodeIsTooLarge); |
+ Abort("Generated code is too large"); |
} |
if (deopt_jump_table_.length() > 0) { |
@@ -423,7 +423,7 @@ Register LCodeGen::EmitLoadRegister(LOperand* op, Register scratch) { |
ASSERT(literal->IsNumber()); |
__ mov(scratch, Operand(static_cast<int32_t>(literal->Number()))); |
} else if (r.IsDouble()) { |
- Abort(kEmitLoadRegisterUnsupportedDoubleImmediate); |
+ Abort("EmitLoadRegister: Unsupported double immediate."); |
} else { |
ASSERT(r.IsTagged()); |
__ LoadObject(scratch, literal); |
@@ -461,9 +461,9 @@ DwVfpRegister LCodeGen::EmitLoadDoubleRegister(LOperand* op, |
__ vcvt_f64_s32(dbl_scratch, flt_scratch); |
return dbl_scratch; |
} else if (r.IsDouble()) { |
- Abort(kUnsupportedDoubleImmediate); |
+ Abort("unsupported double immediate"); |
} else if (r.IsTagged()) { |
- Abort(kUnsupportedTaggedImmediate); |
+ Abort("unsupported tagged immediate"); |
} |
} else if (op->IsStackSlot() || op->IsArgument()) { |
// TODO(regis): Why is vldr not taking a MemOperand? |
@@ -534,14 +534,14 @@ Operand LCodeGen::ToOperand(LOperand* op) { |
ASSERT(constant->HasInteger32Value()); |
return Operand(constant->Integer32Value()); |
} else if (r.IsDouble()) { |
- Abort(kToOperandUnsupportedDoubleImmediate); |
+ Abort("ToOperand Unsupported double immediate."); |
} |
ASSERT(r.IsTagged()); |
return Operand(constant->handle()); |
} else if (op->IsRegister()) { |
return Operand(ToRegister(op)); |
} else if (op->IsDoubleRegister()) { |
- Abort(kToOperandIsDoubleRegisterUnimplemented); |
+ Abort("ToOperand IsDoubleRegister unimplemented"); |
return Operand::Zero(); |
} |
// Stack slots not implemented, use ToMemOperand instead. |
@@ -772,7 +772,7 @@ void LCodeGen::DeoptimizeIf(Condition cc, |
Address entry = |
Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); |
if (entry == NULL) { |
- Abort(kBailoutWasNotPrepared); |
+ Abort("bailout was not prepared"); |
return; |
} |
@@ -1669,11 +1669,7 @@ void LCodeGen::DoBitI(LBitI* instr) { |
__ orr(result, left, right); |
break; |
case Token::BIT_XOR: |
- if (right_op->IsConstantOperand() && right.immediate() == int32_t(~0)) { |
- __ mvn(result, Operand(left)); |
- } else { |
- __ eor(result, left, right); |
- } |
+ __ eor(result, left, right); |
break; |
default: |
UNREACHABLE(); |
@@ -1940,7 +1936,7 @@ void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { |
static const uint32_t two_byte_seq_type = kSeqStringTag | kTwoByteStringTag; |
__ cmp(ip, Operand(encoding == String::ONE_BYTE_ENCODING |
? one_byte_seq_type : two_byte_seq_type)); |
- __ Check(eq, kUnexpectedStringType); |
+ __ Check(eq, "Unexpected string type"); |
} |
__ add(ip, |
@@ -1957,6 +1953,13 @@ void LCodeGen::DoSeqStringSetChar(LSeqStringSetChar* instr) { |
} |
+void LCodeGen::DoBitNotI(LBitNotI* instr) { |
+ Register input = ToRegister(instr->value()); |
+ Register result = ToRegister(instr->result()); |
+ __ mvn(result, Operand(input)); |
+} |
+ |
+ |
void LCodeGen::DoThrow(LThrow* instr) { |
Register input_reg = EmitLoadRegister(instr->value(), ip); |
__ push(input_reg); |
@@ -3197,7 +3200,7 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) { |
if (key_is_constant) { |
constant_key = ToInteger32(LConstantOperand::cast(instr->key())); |
if (constant_key & 0xF0000000) { |
- Abort(kArrayIndexConstantValueTooBig); |
+ Abort("array index constant value too big."); |
} |
} else { |
key = ToRegister(instr->key()); |
@@ -3281,7 +3284,7 @@ void LCodeGen::DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr) { |
if (key_is_constant) { |
constant_key = ToInteger32(LConstantOperand::cast(instr->key())); |
if (constant_key & 0xF0000000) { |
- Abort(kArrayIndexConstantValueTooBig); |
+ Abort("array index constant value too big."); |
} |
} else { |
key = ToRegister(instr->key()); |
@@ -3542,7 +3545,7 @@ void LCodeGen::DoApplyArguments(LApplyArguments* instr) { |
void LCodeGen::DoPushArgument(LPushArgument* instr) { |
LOperand* argument = instr->value(); |
if (argument->IsDoubleRegister() || argument->IsDoubleStackSlot()) { |
- Abort(kDoPushArgumentNotImplementedForDoubleType); |
+ Abort("DoPushArgument not implemented for double type."); |
} else { |
Register argument_reg = EmitLoadRegister(argument, ip); |
__ push(argument_reg); |
@@ -3762,7 +3765,7 @@ void LCodeGen::DoMathAbs(LMathAbs* instr) { |
DwVfpRegister input = ToDoubleRegister(instr->value()); |
DwVfpRegister result = ToDoubleRegister(instr->result()); |
__ vabs(result, input); |
- } else if (r.IsSmiOrInteger32()) { |
+ } else if (r.IsInteger32()) { |
EmitIntegerMathAbs(instr); |
} else { |
// Representation is tagged. |
@@ -4316,7 +4319,7 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) { |
if (key_is_constant) { |
constant_key = ToInteger32(LConstantOperand::cast(instr->key())); |
if (constant_key & 0xF0000000) { |
- Abort(kArrayIndexConstantValueTooBig); |
+ Abort("array index constant value too big."); |
} |
} else { |
key = ToRegister(instr->key()); |
@@ -4389,7 +4392,7 @@ void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) { |
if (key_is_constant) { |
constant_key = ToInteger32(LConstantOperand::cast(instr->key())); |
if (constant_key & 0xF0000000) { |
- Abort(kArrayIndexConstantValueTooBig); |
+ Abort("array index constant value too big."); |
} |
} else { |
key = ToRegister(instr->key()); |
@@ -4412,7 +4415,7 @@ void LCodeGen::DoStoreKeyedFixedDoubleArray(LStoreKeyed* instr) { |
if (masm()->emit_debug_code()) { |
__ vmrs(ip); |
__ tst(ip, Operand(kVFPDefaultNaNModeControlBit)); |
- __ Assert(ne, kDefaultNaNModeNotSet); |
+ __ Assert(ne, "Default NaN mode not set"); |
} |
__ VFPCanonicalizeNaN(value); |
} |
@@ -5211,67 +5214,33 @@ void LCodeGen::DoCheckFunction(LCheckFunction* instr) { |
} |
-void LCodeGen::DoDeferredInstanceMigration(LCheckMaps* instr, Register object) { |
- { |
- PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
- __ push(object); |
- CallRuntimeFromDeferred(Runtime::kMigrateInstance, 1, instr); |
- __ StoreToSafepointRegisterSlot(r0, scratch0()); |
- } |
- __ tst(scratch0(), Operand(kSmiTagMask)); |
- DeoptimizeIf(eq, instr->environment()); |
+void LCodeGen::DoCheckMapCommon(Register map_reg, |
+ Handle<Map> map, |
+ LEnvironment* env) { |
+ Label success; |
+ __ CompareMap(map_reg, map, &success); |
+ DeoptimizeIf(ne, env); |
+ __ bind(&success); |
} |
void LCodeGen::DoCheckMaps(LCheckMaps* instr) { |
- class DeferredCheckMaps: public LDeferredCode { |
- public: |
- DeferredCheckMaps(LCodeGen* codegen, LCheckMaps* instr, Register object) |
- : LDeferredCode(codegen), instr_(instr), object_(object) { |
- SetExit(check_maps()); |
- } |
- virtual void Generate() { |
- codegen()->DoDeferredInstanceMigration(instr_, object_); |
- } |
- Label* check_maps() { return &check_maps_; } |
- virtual LInstruction* instr() { return instr_; } |
- private: |
- LCheckMaps* instr_; |
- Label check_maps_; |
- Register object_; |
- }; |
- |
if (instr->hydrogen()->CanOmitMapChecks()) return; |
Register map_reg = scratch0(); |
- |
LOperand* input = instr->value(); |
ASSERT(input->IsRegister()); |
Register reg = ToRegister(input); |
+ Label success; |
SmallMapList* map_set = instr->hydrogen()->map_set(); |
__ ldr(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); |
- |
- DeferredCheckMaps* deferred = NULL; |
- if (instr->hydrogen()->has_migration_target()) { |
- deferred = new(zone()) DeferredCheckMaps(this, instr, reg); |
- __ bind(deferred->check_maps()); |
- } |
- |
- Label success; |
for (int i = 0; i < map_set->length() - 1; i++) { |
Handle<Map> map = map_set->at(i); |
__ CompareMap(map_reg, map, &success); |
__ b(eq, &success); |
} |
- |
Handle<Map> map = map_set->last(); |
- __ CompareMap(map_reg, map, &success); |
- if (instr->hydrogen()->has_migration_target()) { |
- __ b(ne, deferred->entry()); |
- } else { |
- DeoptimizeIf(ne, instr->environment()); |
- } |
- |
+ DoCheckMapCommon(map_reg, map, instr->environment()); |
__ bind(&success); |
} |
@@ -5326,6 +5295,25 @@ void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) { |
} |
+void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { |
+ if (instr->hydrogen()->CanOmitPrototypeChecks()) return; |
+ |
+ Register prototype_reg = ToRegister(instr->temp()); |
+ Register map_reg = ToRegister(instr->temp2()); |
+ |
+ ZoneList<Handle<JSObject> >* prototypes = instr->prototypes(); |
+ ZoneList<Handle<Map> >* maps = instr->maps(); |
+ |
+ ASSERT(prototypes->length() == maps->length()); |
+ |
+ for (int i = 0; i < prototypes->length(); i++) { |
+ __ LoadHeapObject(prototype_reg, prototypes->at(i)); |
+ __ ldr(map_reg, FieldMemOperand(prototype_reg, HeapObject::kMapOffset)); |
+ DoCheckMapCommon(map_reg, maps->at(i), instr->environment()); |
+ } |
+} |
+ |
+ |
void LCodeGen::DoAllocate(LAllocate* instr) { |
class DeferredAllocate: public LDeferredCode { |
public: |