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

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: REBASE. 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
« no previous file with comments | « src/mips/interface-descriptors-mips.cc ('k') | src/mips/lithium-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5547 matching lines...) Expand 10 before | Expand all | Expand 10 after
5558 __ li(a2, Operand(instr->hydrogen()->shared_info())); 5558 __ li(a2, Operand(instr->hydrogen()->shared_info()));
5559 __ li(a1, Operand(pretenure ? factory()->true_value() 5559 __ li(a1, Operand(pretenure ? factory()->true_value()
5560 : factory()->false_value())); 5560 : factory()->false_value()));
5561 __ Push(cp, a2, a1); 5561 __ Push(cp, a2, a1);
5562 CallRuntime(Runtime::kNewClosure, 3, instr); 5562 CallRuntime(Runtime::kNewClosure, 3, instr);
5563 } 5563 }
5564 } 5564 }
5565 5565
5566 5566
5567 void LCodeGen::DoTypeof(LTypeof* instr) { 5567 void LCodeGen::DoTypeof(LTypeof* instr) {
5568 DCHECK(ToRegister(instr->value()).is(a3));
5568 DCHECK(ToRegister(instr->result()).is(v0)); 5569 DCHECK(ToRegister(instr->result()).is(v0));
5569 Register input = ToRegister(instr->value()); 5570 Label end, do_call;
5570 __ push(input); 5571 Register value_register = ToRegister(instr->value());
5571 CallRuntime(Runtime::kTypeof, 1, instr); 5572 __ JumpIfNotSmi(value_register, &do_call);
5573 __ li(v0, Operand(isolate()->factory()->number_string()));
5574 __ jmp(&end);
5575 __ bind(&do_call);
5576 TypeofStub stub(isolate());
5577 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
5578 __ bind(&end);
5572 } 5579 }
5573 5580
5574 5581
5575 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { 5582 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) {
5576 Register input = ToRegister(instr->value()); 5583 Register input = ToRegister(instr->value());
5577 5584
5578 Register cmp1 = no_reg; 5585 Register cmp1 = no_reg;
5579 Operand cmp2 = Operand(no_reg); 5586 Operand cmp2 = Operand(no_reg);
5580 5587
5581 Condition final_branch_condition = EmitTypeofIs(instr->TrueLabel(chunk_), 5588 Condition final_branch_condition = EmitTypeofIs(instr->TrueLabel(chunk_),
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
5993 __ li(at, scope_info); 6000 __ li(at, scope_info);
5994 __ Push(at, ToRegister(instr->function())); 6001 __ Push(at, ToRegister(instr->function()));
5995 CallRuntime(Runtime::kPushBlockContext, 2, instr); 6002 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5996 RecordSafepoint(Safepoint::kNoLazyDeopt); 6003 RecordSafepoint(Safepoint::kNoLazyDeopt);
5997 } 6004 }
5998 6005
5999 6006
6000 #undef __ 6007 #undef __
6001 6008
6002 } } // namespace v8::internal 6009 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/mips/interface-descriptors-mips.cc ('k') | src/mips/lithium-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698