| Index: src/ia32/lithium-ia32.cc
|
| ===================================================================
|
| --- src/ia32/lithium-ia32.cc (revision 6230)
|
| +++ src/ia32/lithium-ia32.cc (working copy)
|
| @@ -293,7 +293,7 @@
|
|
|
|
|
| void LCallNew::PrintDataTo(StringStream* stream) const {
|
| - LUnaryOperation::PrintDataTo(stream);
|
| + LUnaryOperation<1>::PrintDataTo(stream);
|
| stream->Add(" #%d / ", arity());
|
| }
|
|
|
| @@ -305,7 +305,8 @@
|
| }
|
|
|
|
|
| -void LUnaryOperation::PrintDataTo(StringStream* stream) const {
|
| +template <int R>
|
| +void LUnaryOperation<R>::PrintDataTo(StringStream* stream) const {
|
| stream->Add("= ");
|
| input()->PrintTo(stream);
|
| }
|
| @@ -598,32 +599,34 @@
|
| }
|
|
|
|
|
| -LInstruction* LChunkBuilder::Define(LInstruction* instr) {
|
| +LInstruction* LChunkBuilder::Define(LTemplateInstruction<1>* instr) {
|
| return Define(instr, new LUnallocated(LUnallocated::NONE));
|
| }
|
|
|
|
|
| -LInstruction* LChunkBuilder::DefineAsRegister(LInstruction* instr) {
|
| +LInstruction* LChunkBuilder::DefineAsRegister(LTemplateInstruction<1>* instr) {
|
| return Define(instr, new LUnallocated(LUnallocated::MUST_HAVE_REGISTER));
|
| }
|
|
|
|
|
| -LInstruction* LChunkBuilder::DefineAsSpilled(LInstruction* instr, int index) {
|
| +LInstruction* LChunkBuilder::DefineAsSpilled(LTemplateInstruction<1>* instr,
|
| + int index) {
|
| return Define(instr, new LUnallocated(LUnallocated::FIXED_SLOT, index));
|
| }
|
|
|
|
|
| -LInstruction* LChunkBuilder::DefineSameAsFirst(LInstruction* instr) {
|
| +LInstruction* LChunkBuilder::DefineSameAsFirst(LTemplateInstruction<1>* instr) {
|
| return Define(instr, new LUnallocated(LUnallocated::SAME_AS_FIRST_INPUT));
|
| }
|
|
|
|
|
| -LInstruction* LChunkBuilder::DefineFixed(LInstruction* instr, Register reg) {
|
| +LInstruction* LChunkBuilder::DefineFixed(LTemplateInstruction<1>* instr,
|
| + Register reg) {
|
| return Define(instr, ToUnallocated(reg));
|
| }
|
|
|
|
|
| -LInstruction* LChunkBuilder::DefineFixedDouble(LInstruction* instr,
|
| +LInstruction* LChunkBuilder::DefineFixedDouble(LTemplateInstruction<1>* instr,
|
| XMMRegister reg) {
|
| return Define(instr, ToUnallocated(reg));
|
| }
|
| @@ -692,7 +695,8 @@
|
| }
|
|
|
|
|
| -LInstruction* LChunkBuilder::Define(LInstruction* instr, LUnallocated* result) {
|
| +LInstruction* LChunkBuilder::Define(LTemplateInstruction<1>* instr,
|
| + LUnallocated* result) {
|
| allocator_->RecordDefinition(current_instruction_, result);
|
| instr->set_result(result);
|
| return instr;
|
| @@ -781,10 +785,10 @@
|
| can_deopt = !can_truncate;
|
| }
|
|
|
| - LInstruction* result =
|
| - DefineSameAsFirst(new LShiftI(op, left, right, can_deopt));
|
| - if (can_deopt) AssignEnvironment(result);
|
| - return result;
|
| + LShiftI* result = new LShiftI(op, left, right, can_deopt);
|
| + return can_deopt
|
| + ? AssignEnvironment(DefineSameAsFirst(result))
|
| + : DefineSameAsFirst(result);
|
| }
|
|
|
|
|
| @@ -813,7 +817,7 @@
|
| ASSERT(right->representation().IsTagged());
|
| LOperand* left_operand = UseFixed(left, edx);
|
| LOperand* right_operand = UseFixed(right, eax);
|
| - LInstruction* result = new LArithmeticT(op, left_operand, right_operand);
|
| + LArithmeticT* result = new LArithmeticT(op, left_operand, right_operand);
|
| return MarkAsCall(DefineFixed(result, eax), instr);
|
| }
|
|
|
| @@ -999,10 +1003,11 @@
|
|
|
|
|
| LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
|
| - LInstruction* result = new LGoto(instr->FirstSuccessor()->block_id(),
|
| - instr->include_stack_check());
|
| - if (instr->include_stack_check()) result = AssignPointerMap(result);
|
| - return result;
|
| + LGoto* result = new LGoto(instr->FirstSuccessor()->block_id(),
|
| + instr->include_stack_check());
|
| + return (instr->include_stack_check())
|
| + ? AssignPointerMap(result)
|
| + : result;
|
| }
|
|
|
|
|
| @@ -1051,10 +1056,10 @@
|
| bool reversed = op == Token::GT || op == Token::LTE;
|
| LOperand* left_operand = UseFixed(left, reversed ? eax : edx);
|
| LOperand* right_operand = UseFixed(right, reversed ? edx : eax);
|
| - LInstruction* result = new LCmpTAndBranch(left_operand,
|
| - right_operand,
|
| - first_id,
|
| - second_id);
|
| + LCmpTAndBranch* result = new LCmpTAndBranch(left_operand,
|
| + right_operand,
|
| + first_id,
|
| + second_id);
|
| return MarkAsCall(result, instr);
|
| }
|
| } else if (v->IsIsSmi()) {
|
| @@ -1108,7 +1113,7 @@
|
| second_id);
|
| } else if (v->IsInstanceOf()) {
|
| HInstanceOf* instance_of = HInstanceOf::cast(v);
|
| - LInstruction* result =
|
| + LInstanceOfAndBranch* result =
|
| new LInstanceOfAndBranch(
|
| UseFixed(instance_of->left(), InstanceofStub::left()),
|
| UseFixed(instance_of->right(), InstanceofStub::right()),
|
| @@ -1155,7 +1160,7 @@
|
|
|
|
|
| LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
|
| - LInstruction* result =
|
| + LInstanceOf* result =
|
| new LInstanceOf(UseFixed(instr->left(), InstanceofStub::left()),
|
| UseFixed(instr->right(), InstanceofStub::right()));
|
| return MarkAsCall(DefineFixed(result, eax), instr);
|
| @@ -1164,7 +1169,7 @@
|
|
|
| LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal(
|
| HInstanceOfKnownGlobal* instr) {
|
| - LInstruction* result =
|
| + LInstanceOfKnownGlobal* result =
|
| new LInstanceOfKnownGlobal(
|
| UseFixed(instr->value(), InstanceofStub::left()),
|
| FixedTemp(edi));
|
| @@ -1178,10 +1183,10 @@
|
| LOperand* receiver = UseFixed(instr->receiver(), eax);
|
| LOperand* length = UseRegisterAtStart(instr->length());
|
| LOperand* elements = UseRegisterAtStart(instr->elements());
|
| - LInstruction* result = new LApplyArguments(function,
|
| - receiver,
|
| - length,
|
| - elements);
|
| + LApplyArguments* result = new LApplyArguments(function,
|
| + receiver,
|
| + length,
|
| + elements);
|
| return MarkAsCall(DefineFixed(result, eax), instr, CAN_DEOPTIMIZE_EAGERLY);
|
| }
|
|
|
| @@ -1214,11 +1219,11 @@
|
| BuiltinFunctionId op = instr->op();
|
| if (op == kMathLog || op == kMathSin || op == kMathCos) {
|
| LOperand* input = UseFixedDouble(instr->value(), xmm1);
|
| - LInstruction* result = new LUnaryMathOperation(input);
|
| + LUnaryMathOperation* result = new LUnaryMathOperation(input);
|
| return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
|
| } else {
|
| LOperand* input = UseRegisterAtStart(instr->value());
|
| - LInstruction* result = new LUnaryMathOperation(input);
|
| + LUnaryMathOperation* result = new LUnaryMathOperation(input);
|
| switch (op) {
|
| case kMathAbs:
|
| return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
|
| @@ -1267,7 +1272,7 @@
|
| LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
|
| LOperand* constructor = UseFixed(instr->constructor(), edi);
|
| argument_count_ -= instr->argument_count();
|
| - LInstruction* result = new LCallNew(constructor);
|
| + LCallNew* result = new LCallNew(constructor);
|
| return MarkAsCall(DefineFixed(result, eax), instr);
|
| }
|
|
|
| @@ -1347,12 +1352,12 @@
|
| FixedTemp(edx);
|
| LOperand* value = UseFixed(instr->left(), eax);
|
| LOperand* divisor = UseRegister(instr->right());
|
| - LInstruction* result = DefineFixed(new LModI(value, divisor), edx);
|
| - if (instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
|
| - instr->CheckFlag(HValue::kCanBeDivByZero)) {
|
| - result = AssignEnvironment(result);
|
| - }
|
| - return result;
|
| + LModI* mod = new LModI(value, divisor);
|
| + LInstruction* result = DefineFixed(mod, edx);
|
| + return (instr->CheckFlag(HValue::kBailoutOnMinusZero) ||
|
| + instr->CheckFlag(HValue::kCanBeDivByZero))
|
| + ? AssignEnvironment(result)
|
| + : result;
|
| } else if (instr->representation().IsTagged()) {
|
| return DoArithmeticT(Token::MOD, instr);
|
| } else {
|
| @@ -1463,7 +1468,7 @@
|
| bool reversed = (op == Token::GT || op == Token::LTE);
|
| LOperand* left = UseFixed(instr->left(), reversed ? eax : edx);
|
| LOperand* right = UseFixed(instr->right(), reversed ? edx : eax);
|
| - LInstruction* result = new LCmpT(left, right);
|
| + LCmpT* result = new LCmpT(left, right);
|
| return MarkAsCall(DefineFixed(result, eax), instr);
|
| }
|
| }
|
| @@ -1473,7 +1478,7 @@
|
| HCompareJSObjectEq* instr) {
|
| LOperand* left = UseRegisterAtStart(instr->left());
|
| LOperand* right = UseRegisterAtStart(instr->right());
|
| - LInstruction* result = new LCmpJSObjectEq(left, right);
|
| + LCmpJSObjectEq* result = new LCmpJSObjectEq(left, right);
|
| return DefineAsRegister(result);
|
| }
|
|
|
| @@ -1542,7 +1547,7 @@
|
|
|
| LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) {
|
| LOperand* object = UseRegister(instr->value());
|
| - LInstruction* result = new LValueOf(object, TempRegister());
|
| + LValueOf* result = new LValueOf(object, TempRegister());
|
| return AssignEnvironment(DefineSameAsFirst(result));
|
| }
|
|
|
| @@ -1565,7 +1570,7 @@
|
| if (from.IsTagged()) {
|
| if (to.IsDouble()) {
|
| LOperand* value = UseRegister(instr->value());
|
| - LInstruction* res = new LNumberUntagD(value);
|
| + LNumberUntagD* res = new LNumberUntagD(value);
|
| return AssignEnvironment(DefineAsRegister(res));
|
| } else {
|
| ASSERT(to.IsInteger32());
|
| @@ -1576,7 +1581,7 @@
|
| (instr->CanTruncateToInt32() && CpuFeatures::IsSupported(SSE3))
|
| ? NULL
|
| : FixedTemp(xmm1);
|
| - LInstruction* res = new LTaggedToI(value, xmm_temp);
|
| + LTaggedToI* res = new LTaggedToI(value, xmm_temp);
|
| return AssignEnvironment(DefineSameAsFirst(res));
|
| } else {
|
| return DefineSameAsFirst(new LSmiUntag(value, needs_check));
|
| @@ -1589,7 +1594,7 @@
|
|
|
| // Make sure that temp and result_temp are different registers.
|
| LUnallocated* result_temp = TempRegister();
|
| - LInstruction* result = new LNumberTagD(value, temp);
|
| + LNumberTagD* result = new LNumberTagD(value, temp);
|
| return AssignPointerMap(Define(result, result_temp));
|
| } else {
|
| ASSERT(to.IsInteger32());
|
| @@ -1603,7 +1608,7 @@
|
| if (val->HasRange() && val->range()->IsInSmiRange()) {
|
| return DefineSameAsFirst(new LSmiTag(value));
|
| } else {
|
| - LInstruction* result = new LNumberTagI(value);
|
| + LNumberTagI* result = new LNumberTagI(value);
|
| return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
|
| }
|
| } else {
|
| @@ -1625,14 +1630,14 @@
|
| LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
|
| LOperand* value = UseRegisterAtStart(instr->value());
|
| LOperand* temp = TempRegister();
|
| - LInstruction* result = new LCheckInstanceType(value, temp);
|
| + LCheckInstanceType* result = new LCheckInstanceType(value, temp);
|
| return AssignEnvironment(result);
|
| }
|
|
|
|
|
| LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) {
|
| LOperand* temp = TempRegister();
|
| - LInstruction* result =
|
| + LCheckPrototypeMaps* result =
|
| new LCheckPrototypeMaps(temp,
|
| instr->holder(),
|
| instr->receiver_map());
|
| @@ -1654,7 +1659,7 @@
|
|
|
| LInstruction* LChunkBuilder::DoCheckMap(HCheckMap* instr) {
|
| LOperand* value = UseRegisterAtStart(instr->value());
|
| - LInstruction* result = new LCheckMap(value);
|
| + LCheckMap* result = new LCheckMap(value);
|
| return AssignEnvironment(result);
|
| }
|
|
|
| @@ -1682,7 +1687,7 @@
|
|
|
|
|
| LInstruction* LChunkBuilder::DoLoadGlobal(HLoadGlobal* instr) {
|
| - LInstruction* result = new LLoadGlobal;
|
| + LLoadGlobal* result = new LLoadGlobal;
|
| return instr->check_hole_value()
|
| ? AssignEnvironment(DefineAsRegister(result))
|
| : DefineAsRegister(result);
|
| @@ -1702,8 +1707,8 @@
|
|
|
| LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
|
| LOperand* object = UseFixed(instr->object(), eax);
|
| - LInstruction* result = DefineFixed(new LLoadNamedGeneric(object), eax);
|
| - return MarkAsCall(result, instr);
|
| + LLoadNamedGeneric* result = new LLoadNamedGeneric(object);
|
| + return MarkAsCall(DefineFixed(result, eax), instr);
|
| }
|
|
|
|
|
| @@ -1731,14 +1736,12 @@
|
| // Double needs an extra temp, because the result is converted from heap
|
| // number to a double register.
|
| if (r.IsDouble()) load_result = TempRegister();
|
| - LInstruction* result = new LLoadKeyedFastElement(obj,
|
| - key,
|
| - load_result);
|
| - if (r.IsDouble()) {
|
| - result = DefineAsRegister(result);
|
| - } else {
|
| - result = DefineSameAsFirst(result);
|
| - }
|
| + LLoadKeyedFastElement* load = new LLoadKeyedFastElement(obj,
|
| + key,
|
| + load_result);
|
| + LInstruction* result = r.IsDouble()
|
| + ? DefineAsRegister(load)
|
| + : DefineSameAsFirst(load);
|
| return AssignEnvironment(result);
|
| }
|
|
|
| @@ -1747,9 +1750,8 @@
|
| LOperand* object = UseFixed(instr->object(), edx);
|
| LOperand* key = UseFixed(instr->key(), eax);
|
|
|
| - LInstruction* result =
|
| - DefineFixed(new LLoadKeyedGeneric(object, key), eax);
|
| - return MarkAsCall(result, instr);
|
| + LLoadKeyedGeneric* result = new LLoadKeyedGeneric(object, key);
|
| + return MarkAsCall(DefineFixed(result, eax), instr);
|
| }
|
|
|
|
|
| @@ -1816,7 +1818,7 @@
|
| LOperand* obj = UseFixed(instr->object(), edx);
|
| LOperand* val = UseFixed(instr->value(), eax);
|
|
|
| - LInstruction* result = new LStoreNamedGeneric(obj, instr->name(), val);
|
| + LStoreNamedGeneric* result = new LStoreNamedGeneric(obj, instr->name(), val);
|
| return MarkAsCall(result, instr);
|
| }
|
|
|
| @@ -1842,8 +1844,8 @@
|
|
|
|
|
| LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) {
|
| - LInstruction* result = new LDeleteProperty(Use(instr->object()),
|
| - UseOrConstant(instr->key()));
|
| + LDeleteProperty* result = new LDeleteProperty(Use(instr->object()),
|
| + UseOrConstant(instr->key()));
|
| return MarkAsCall(DefineFixed(result, eax), instr);
|
| }
|
|
|
| @@ -1884,13 +1886,13 @@
|
| LOperand* arguments = UseRegister(instr->arguments());
|
| LOperand* length = UseTempRegister(instr->length());
|
| LOperand* index = Use(instr->index());
|
| - LInstruction* result = new LAccessArgumentsAt(arguments, length, index);
|
| - return DefineAsRegister(AssignEnvironment(result));
|
| + LAccessArgumentsAt* result = new LAccessArgumentsAt(arguments, length, index);
|
| + return AssignEnvironment(DefineAsRegister(result));
|
| }
|
|
|
|
|
| LInstruction* LChunkBuilder::DoTypeof(HTypeof* instr) {
|
| - LInstruction* result = new LTypeof(UseAtStart(instr->value()));
|
| + LTypeof* result = new LTypeof(UseAtStart(instr->value()));
|
| return MarkAsCall(DefineFixed(result, eax), instr);
|
| }
|
|
|
| @@ -1919,8 +1921,8 @@
|
| // If there is an instruction pending deoptimization environment create a
|
| // lazy bailout instruction to capture the environment.
|
| if (pending_deoptimization_ast_id_ == instr->ast_id()) {
|
| - LInstruction* result = new LLazyBailout;
|
| - result = AssignEnvironment(result);
|
| + LLazyBailout* lazy_bailout = new LLazyBailout;
|
| + LInstruction* result = AssignEnvironment(lazy_bailout);
|
| instructions_pending_deoptimization_environment_->
|
| set_deoptimization_environment(result->environment());
|
| ClearInstructionPendingDeoptimizationEnvironment();
|
|
|