diff options
Diffstat (limited to 'deps/v8/src/ia32/lithium-ia32.cc')
-rw-r--r-- | deps/v8/src/ia32/lithium-ia32.cc | 74 |
1 files changed, 60 insertions, 14 deletions
diff --git a/deps/v8/src/ia32/lithium-ia32.cc b/deps/v8/src/ia32/lithium-ia32.cc index c4a8be1bcc..c023fd15b6 100644 --- a/deps/v8/src/ia32/lithium-ia32.cc +++ b/deps/v8/src/ia32/lithium-ia32.cc @@ -99,7 +99,7 @@ bool LInstruction::HasDoubleRegisterResult() { bool LInstruction::HasDoubleRegisterInput() { for (int i = 0; i < InputCount(); i++) { LOperand* op = InputAt(i); - if (op->IsDoubleRegister()) { + if (op != NULL && op->IsDoubleRegister()) { return true; } } @@ -210,6 +210,11 @@ const char* LArithmeticT::Mnemonic() const { } +bool LGoto::HasInterestingComment(LCodeGen* gen) const { + return !gen->IsNextEmittedBlock(block_id()); +} + + void LGoto::PrintDataTo(StringStream* stream) { stream->Add("B%d", block_id()); } @@ -1056,11 +1061,13 @@ LInstruction* LChunkBuilder::DoCompareMap(HCompareMap* instr) { LInstruction* LChunkBuilder::DoArgumentsLength(HArgumentsLength* length) { + info()->MarkAsRequiresFrame(); return DefineAsRegister(new(zone()) LArgumentsLength(Use(length->value()))); } LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { + info()->MarkAsRequiresFrame(); return DefineAsRegister(new(zone()) LArgumentsElements); } @@ -2280,6 +2287,19 @@ LOperand* LChunkBuilder::GetStoreKeyedValueOperand(HStoreKeyed* instr) { } +// DoStoreKeyed and DoStoreNamedField have special considerations for allowing +// use of a constant instead of a register. +static bool StoreConstantValueAllowed(HValue* value) { + if (value->IsConstant()) { + HConstant* constant_value = HConstant::cast(value); + return constant_value->HasSmiValue() + || constant_value->HasDoubleValue() + || constant_value->ImmortalImmovable(); + } + return false; +} + + LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { if (!instr->is_external()) { ASSERT(instr->elements()->representation().IsTagged()); @@ -2295,19 +2315,30 @@ LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { val = UseX87TopOfStack(instr->value()); } LOperand* key = UseRegisterOrConstantAtStart(instr->key()); - return new(zone()) LStoreKeyed(object, key, val); } else { ASSERT(instr->value()->representation().IsTagged()); bool needs_write_barrier = instr->NeedsWriteBarrier(); LOperand* obj = UseRegister(instr->elements()); - LOperand* val = needs_write_barrier - ? UseTempRegister(instr->value()) - : UseRegisterAtStart(instr->value()); - LOperand* key = needs_write_barrier - ? UseTempRegister(instr->key()) - : UseRegisterOrConstantAtStart(instr->key()); + LOperand* val; + LOperand* key; + if (needs_write_barrier) { + val = UseTempRegister(instr->value()); + key = UseTempRegister(instr->key()); + } else { + if (StoreConstantValueAllowed(instr->value())) { + val = UseRegisterOrConstantAtStart(instr->value()); + } else { + val = UseRegisterAtStart(instr->value()); + } + + if (StoreConstantValueAllowed(instr->key())) { + key = UseRegisterOrConstantAtStart(instr->key()); + } else { + key = UseRegisterAtStart(instr->key()); + } + } return new(zone()) LStoreKeyed(obj, key, val); } } @@ -2407,9 +2438,14 @@ LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { : UseRegisterAtStart(instr->object()); } - LOperand* val = needs_write_barrier - ? UseTempRegister(instr->value()) - : UseRegister(instr->value()); + LOperand* val; + if (needs_write_barrier) { + val = UseTempRegister(instr->value()); + } else if (StoreConstantValueAllowed(instr->value())) { + val = UseRegisterOrConstant(instr->value()); + } else { + val = UseRegister(instr->value()); + } // We only need a scratch register if we have a write barrier or we // have a store into the properties array (not in-object-property). @@ -2480,6 +2516,7 @@ LInstruction* LChunkBuilder::DoAllocateObject(HAllocateObject* instr) { LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) { info()->MarkAsDeferredCalling(); LOperand* context = UseAny(instr->context()); + // TODO(mvstanton): why can't size be a constant if possible? LOperand* size = UseTempRegister(instr->size()); LOperand* temp = TempRegister(); LAllocate* result = new(zone()) LAllocate(context, size, temp); @@ -2541,7 +2578,8 @@ LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { ASSERT(info()->IsStub()); CodeStubInterfaceDescriptor* descriptor = info()->code_stub()->GetInterfaceDescriptor(info()->isolate()); - Register reg = descriptor->register_params_[instr->index()]; + int index = static_cast<int>(instr->index()); + Register reg = DESCRIPTOR_GET_PARAMETER_REGISTER(descriptor, index); return DefineFixed(result, reg); } } @@ -2575,9 +2613,17 @@ LInstruction* LChunkBuilder::DoArgumentsObject(HArgumentsObject* instr) { LInstruction* LChunkBuilder::DoAccessArgumentsAt(HAccessArgumentsAt* instr) { + info()->MarkAsRequiresFrame(); LOperand* args = UseRegister(instr->arguments()); - LOperand* length = UseTempRegister(instr->length()); - LOperand* index = Use(instr->index()); + LOperand* length; + LOperand* index; + if (instr->length()->IsConstant() && instr->index()->IsConstant()) { + length = UseRegisterOrConstant(instr->length()); + index = UseOrConstant(instr->index()); + } else { + length = UseTempRegister(instr->length()); + index = Use(instr->index()); + } return DefineAsRegister(new(zone()) LAccessArgumentsAt(args, length, index)); } |