Commit a4d3fbdc authored by bmeurer@chromium.org's avatar bmeurer@chromium.org

Optimistically untag the input in tagged-to-i.

Also drop redundant jmp instruction in deferred code.

R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/182723003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19698 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 10757a7e
......@@ -5249,6 +5249,10 @@ void LCodeGen::EmitNumberUntagD(Register input_reg,
void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) {
Register input_reg = ToRegister(instr->value());
// The input was optimistically untagged; revert it.
STATIC_ASSERT(kSmiTagSize == 1);
__ lea(input_reg, Operand(input_reg, times_2, kHeapObjectTag));
if (instr->truncating()) {
Label no_heap_number, check_bools, check_false;
......@@ -5278,7 +5282,6 @@ void LCodeGen::DoDeferredTaggedToI(LTaggedToI* instr, Label* done) {
__ RecordComment("Deferred TaggedToI: cannot truncate");
DeoptimizeIf(not_equal, instr->environment());
__ Set(input_reg, Immediate(0));
__ jmp(done);
} else {
Label bailout;
XMMRegister scratch = (instr->temp() != NULL)
......@@ -5318,9 +5321,13 @@ void LCodeGen::DoTaggedToI(LTaggedToI* instr) {
} else {
DeferredTaggedToI* deferred =
new(zone()) DeferredTaggedToI(this, instr, x87_stack_);
__ JumpIfNotSmi(input_reg, deferred->entry());
// Optimistically untag the input.
// If the input is a HeapObject, SmiUntag will set the carry flag.
STATIC_ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
__ SmiUntag(input_reg);
// Branch to deferred code if the input was tagged.
// The deferred code will take care of restoring the tag.
__ j(carry, deferred->entry());
__ bind(deferred->exit());
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment