| Index: src/x64/lithium-x64.cc
|
| ===================================================================
|
| --- src/x64/lithium-x64.cc (revision 10404)
|
| +++ src/x64/lithium-x64.cc (working copy)
|
| @@ -1,4 +1,4 @@
|
| -// Copyright 2011 the V8 project authors. All rights reserved.
|
| +// Copyright 2012 the V8 project authors. All rights reserved.
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| // met:
|
| @@ -1033,16 +1033,25 @@
|
|
|
|
|
| LInstruction* LChunkBuilder::DoBranch(HBranch* instr) {
|
| - HValue* v = instr->value();
|
| - if (v->EmitAtUses()) {
|
| - ASSERT(v->IsConstant());
|
| - ASSERT(!v->representation().IsDouble());
|
| - HBasicBlock* successor = HConstant::cast(v)->ToBoolean()
|
| + HValue* value = instr->value();
|
| + if (value->EmitAtUses()) {
|
| + ASSERT(value->IsConstant());
|
| + ASSERT(!value->representation().IsDouble());
|
| + HBasicBlock* successor = HConstant::cast(value)->ToBoolean()
|
| ? instr->FirstSuccessor()
|
| : instr->SecondSuccessor();
|
| return new LGoto(successor->block_id());
|
| }
|
| - return AssignEnvironment(new LBranch(UseRegister(v)));
|
| +
|
| + LBranch* result = new LBranch(UseRegister(value));
|
| + // Tagged values that are not known smis or booleans require a
|
| + // deoptimization environment.
|
| + Representation rep = value->representation();
|
| + HType type = value->type();
|
| + if (rep.IsTagged() && !type.IsSmi() && !type.IsBoolean()) {
|
| + return AssignEnvironment(result);
|
| + }
|
| + return result;
|
| }
|
|
|
|
|
| @@ -1329,7 +1338,11 @@
|
| LOperand* left = UseRegisterAtStart(instr->LeastConstantOperand());
|
| LOperand* right = UseOrConstant(instr->MostConstantOperand());
|
| LMulI* mul = new LMulI(left, right);
|
| - return AssignEnvironment(DefineSameAsFirst(mul));
|
| + if (instr->CheckFlag(HValue::kCanOverflow) ||
|
| + instr->CheckFlag(HValue::kBailoutOnMinusZero)) {
|
| + AssignEnvironment(mul);
|
| + }
|
| + return DefineSameAsFirst(mul);
|
| } else if (instr->representation().IsDouble()) {
|
| return DoArithmeticD(Token::MUL, instr);
|
| } else {
|
| @@ -1402,6 +1415,19 @@
|
| }
|
|
|
|
|
| +LInstruction* LChunkBuilder::DoRandom(HRandom* instr) {
|
| + ASSERT(instr->representation().IsDouble());
|
| + ASSERT(instr->global_object()->representation().IsTagged());
|
| +#ifdef _WIN64
|
| + LOperand* global_object = UseFixed(instr->global_object(), rcx);
|
| +#else
|
| + LOperand* global_object = UseFixed(instr->global_object(), rdi);
|
| +#endif
|
| + LRandom* result = new LRandom(global_object);
|
| + return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
|
| +}
|
| +
|
| +
|
| LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
|
| ASSERT(instr->left()->representation().IsTagged());
|
| ASSERT(instr->right()->representation().IsTagged());
|
| @@ -1525,7 +1551,7 @@
|
|
|
| LInstruction* LChunkBuilder::DoClassOfTestAndBranch(
|
| HClassOfTestAndBranch* instr) {
|
| - return new LClassOfTestAndBranch(UseTempRegister(instr->value()),
|
| + return new LClassOfTestAndBranch(UseRegister(instr->value()),
|
| TempRegister(),
|
| TempRegister());
|
| }
|
| @@ -1553,7 +1579,7 @@
|
| LInstruction* LChunkBuilder::DoValueOf(HValueOf* instr) {
|
| LOperand* object = UseRegister(instr->value());
|
| LValueOf* result = new LValueOf(object);
|
| - return AssignEnvironment(DefineSameAsFirst(result));
|
| + return DefineSameAsFirst(result);
|
| }
|
|
|
|
|
| @@ -1866,7 +1892,8 @@
|
| LOperand* obj = UseRegisterAtStart(instr->object());
|
| LOperand* key = UseRegisterOrConstantAtStart(instr->key());
|
| LLoadKeyedFastElement* result = new LLoadKeyedFastElement(obj, key);
|
| - return AssignEnvironment(DefineAsRegister(result));
|
| + if (instr->RequiresHoleCheck()) AssignEnvironment(result);
|
| + return DefineAsRegister(result);
|
| }
|
|
|
|
|
|
|