Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(648)

Side by Side Diff: src/mips/lithium-codegen-mips.cc

Issue 1114563003: Optimize the typeof operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ports. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved.7 1 // Copyright 2012 the V8 project authors. All rights reserved.7
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 5535 matching lines...) Expand 10 before | Expand all | Expand 10 after
5546 __ li(a2, Operand(instr->hydrogen()->shared_info())); 5546 __ li(a2, Operand(instr->hydrogen()->shared_info()));
5547 __ li(a1, Operand(pretenure ? factory()->true_value() 5547 __ li(a1, Operand(pretenure ? factory()->true_value()
5548 : factory()->false_value())); 5548 : factory()->false_value()));
5549 __ Push(cp, a2, a1); 5549 __ Push(cp, a2, a1);
5550 CallRuntime(Runtime::kNewClosure, 3, instr); 5550 CallRuntime(Runtime::kNewClosure, 3, instr);
5551 } 5551 }
5552 } 5552 }
5553 5553
5554 5554
5555 void LCodeGen::DoTypeof(LTypeof* instr) { 5555 void LCodeGen::DoTypeof(LTypeof* instr) {
5556 DCHECK(ToRegister(instr->value()).is(a3));
5556 DCHECK(ToRegister(instr->result()).is(v0)); 5557 DCHECK(ToRegister(instr->result()).is(v0));
5557 Register input = ToRegister(instr->value()); 5558 Label end, do_call;
5558 __ push(input); 5559 Register value_register = ToRegister(instr->value());
5559 CallRuntime(Runtime::kTypeof, 1, instr); 5560 __ JumpIfNotSmi(value_register, &do_call);
5561 __ mov(v0, Immediate(isolate()->factory()->number_string()));
paul.l... 2015/04/28 17:03:36 s/b: __ li(v0, Operand(isolate()->factory()->numbe
mvstanton 2015/04/29 06:37:24 Done.
5562 __ jmp(&end);
5563 __ bind(&do_call);
5564 TypeofStub stub(isolate());
5565 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
5566 __ bind(&end);
5560 } 5567 }
5561 5568
5562 5569
5563 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { 5570 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) {
5564 Register input = ToRegister(instr->value()); 5571 Register input = ToRegister(instr->value());
5565 5572
5566 Register cmp1 = no_reg; 5573 Register cmp1 = no_reg;
5567 Operand cmp2 = Operand(no_reg); 5574 Operand cmp2 = Operand(no_reg);
5568 5575
5569 Condition final_branch_condition = EmitTypeofIs(instr->TrueLabel(chunk_), 5576 Condition final_branch_condition = EmitTypeofIs(instr->TrueLabel(chunk_),
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
5981 __ li(at, scope_info); 5988 __ li(at, scope_info);
5982 __ Push(at, ToRegister(instr->function())); 5989 __ Push(at, ToRegister(instr->function()));
5983 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5990 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5984 RecordSafepoint(Safepoint::kNoLazyDeopt); 5991 RecordSafepoint(Safepoint::kNoLazyDeopt);
5985 } 5992 }
5986 5993
5987 5994
5988 #undef __ 5995 #undef __
5989 5996
5990 } } // namespace v8::internal 5997 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698