| Index: src/ia32/lithium-ia32.cc
|
| ===================================================================
|
| --- src/ia32/lithium-ia32.cc (revision 9531)
|
| +++ src/ia32/lithium-ia32.cc (working copy)
|
| @@ -214,10 +214,11 @@
|
| }
|
|
|
|
|
| -void LIsNullAndBranch::PrintDataTo(StringStream* stream) {
|
| +void LIsNilAndBranch::PrintDataTo(StringStream* stream) {
|
| stream->Add("if ");
|
| InputAt(0)->PrintTo(stream);
|
| - stream->Add(is_strict() ? " === null" : " == null");
|
| + stream->Add(kind() == kStrictEquality ? " === " : " == ");
|
| + stream->Add(nil() == kNullValue ? "null" : "undefined");
|
| stream->Add(" then B%d else B%d", true_block_id(), false_block_id());
|
| }
|
|
|
| @@ -351,7 +352,11 @@
|
|
|
| int LChunk::GetNextSpillIndex(bool is_double) {
|
| // Skip a slot if for a double-width slot.
|
| - if (is_double) spill_slot_count_++;
|
| + if (is_double) {
|
| + spill_slot_count_ |= 1; // Make it odd, so incrementing makes it even.
|
| + spill_slot_count_++;
|
| + num_double_slots_++;
|
| + }
|
| return spill_slot_count_++;
|
| }
|
|
|
| @@ -707,7 +712,9 @@
|
|
|
| LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
|
| HEnvironment* hydrogen_env = current_block_->last_environment();
|
| - instr->set_environment(CreateEnvironment(hydrogen_env));
|
| + int argument_index_accumulator = 0;
|
| + instr->set_environment(CreateEnvironment(hydrogen_env,
|
| + &argument_index_accumulator));
|
| return instr;
|
| }
|
|
|
| @@ -994,10 +1001,13 @@
|
| }
|
|
|
|
|
| -LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) {
|
| +LEnvironment* LChunkBuilder::CreateEnvironment(
|
| + HEnvironment* hydrogen_env,
|
| + int* argument_index_accumulator) {
|
| if (hydrogen_env == NULL) return NULL;
|
|
|
| - LEnvironment* outer = CreateEnvironment(hydrogen_env->outer());
|
| + LEnvironment* outer =
|
| + CreateEnvironment(hydrogen_env->outer(), argument_index_accumulator);
|
| int ast_id = hydrogen_env->ast_id();
|
| ASSERT(ast_id != AstNode::kNoNumber);
|
| int value_count = hydrogen_env->length();
|
| @@ -1007,7 +1017,6 @@
|
| argument_count_,
|
| value_count,
|
| outer);
|
| - int argument_index = 0;
|
| for (int i = 0; i < value_count; ++i) {
|
| if (hydrogen_env->is_special_index(i)) continue;
|
|
|
| @@ -1016,7 +1025,7 @@
|
| if (value->IsArgumentsObject()) {
|
| op = NULL;
|
| } else if (value->IsPushArgument()) {
|
| - op = new LArgument(argument_index++);
|
| + op = new LArgument((*argument_index_accumulator)++);
|
| } else {
|
| op = UseAny(value);
|
| }
|
| @@ -1471,10 +1480,10 @@
|
| }
|
|
|
|
|
| -LInstruction* LChunkBuilder::DoIsNullAndBranch(HIsNullAndBranch* instr) {
|
| +LInstruction* LChunkBuilder::DoIsNilAndBranch(HIsNilAndBranch* instr) {
|
| // We only need a temp register for non-strict compare.
|
| - LOperand* temp = instr->is_strict() ? NULL : TempRegister();
|
| - return new LIsNullAndBranch(UseRegisterAtStart(instr->value()), temp);
|
| + LOperand* temp = instr->kind() == kStrictEquality ? NULL : TempRegister();
|
| + return new LIsNilAndBranch(UseRegisterAtStart(instr->value()), temp);
|
| }
|
|
|
|
|
| @@ -1683,7 +1692,13 @@
|
|
|
|
|
| LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) {
|
| - LOperand* value = UseAtStart(instr->value());
|
| + // If the target is in new space, we'll emit a global cell compare and so
|
| + // want the value in a register. If the target gets promoted before we
|
| + // emit code, we will still get the register but will do an immediate
|
| + // compare instead of the cell compare. This is safe.
|
| + LOperand* value = Isolate::Current()->heap()->InNewSpace(*instr->target())
|
| + ? UseRegisterAtStart(instr->value())
|
| + : UseAtStart(instr->value());
|
| return AssignEnvironment(new LCheckFunction(value));
|
| }
|
|
|
| @@ -1770,7 +1785,7 @@
|
|
|
| LInstruction* LChunkBuilder::DoLoadGlobalCell(HLoadGlobalCell* instr) {
|
| LLoadGlobalCell* result = new LLoadGlobalCell;
|
| - return instr->check_hole_value()
|
| + return instr->RequiresHoleCheck()
|
| ? AssignEnvironment(DefineAsRegister(result))
|
| : DefineAsRegister(result);
|
| }
|
| @@ -1786,8 +1801,10 @@
|
|
|
| LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
|
| LStoreGlobalCell* result =
|
| - new LStoreGlobalCell(UseRegisterAtStart(instr->value()));
|
| - return instr->check_hole_value() ? AssignEnvironment(result) : result;
|
| + new LStoreGlobalCell(UseTempRegister(instr->value()),
|
| + TempRegister(),
|
| + TempRegister());
|
| + return instr->RequiresHoleCheck() ? AssignEnvironment(result) : result;
|
| }
|
|
|
|
|
| @@ -1808,15 +1825,13 @@
|
|
|
|
|
| LInstruction* LChunkBuilder::DoStoreContextSlot(HStoreContextSlot* instr) {
|
| - LOperand* context;
|
| LOperand* value;
|
| LOperand* temp;
|
| + LOperand* context = UseRegister(instr->context());
|
| if (instr->NeedsWriteBarrier()) {
|
| - context = UseTempRegister(instr->context());
|
| value = UseTempRegister(instr->value());
|
| temp = TempRegister();
|
| } else {
|
| - context = UseRegister(instr->context());
|
| value = UseRegister(instr->value());
|
| temp = NULL;
|
| }
|
| @@ -1944,7 +1959,7 @@
|
| ASSERT(instr->object()->representation().IsTagged());
|
| ASSERT(instr->key()->representation().IsInteger32());
|
|
|
| - LOperand* obj = UseTempRegister(instr->object());
|
| + LOperand* obj = UseRegister(instr->object());
|
| LOperand* val = needs_write_barrier
|
| ? UseTempRegister(instr->value())
|
| : UseRegisterAtStart(instr->value());
|
| @@ -2021,9 +2036,14 @@
|
| LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
|
| bool needs_write_barrier = instr->NeedsWriteBarrier();
|
|
|
| - LOperand* obj = needs_write_barrier
|
| - ? UseTempRegister(instr->object())
|
| - : UseRegisterAtStart(instr->object());
|
| + LOperand* obj;
|
| + if (needs_write_barrier) {
|
| + obj = instr->is_in_object()
|
| + ? UseRegister(instr->object())
|
| + : UseTempRegister(instr->object());
|
| + } else {
|
| + obj = UseRegisterAtStart(instr->object());
|
| + }
|
|
|
| LOperand* val = needs_write_barrier
|
| ? UseTempRegister(instr->value())
|
|
|