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

Side by Side Diff: src/arm/lithium-codegen-arm.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. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arm/lithium-codegen-arm.h" 7 #include "src/arm/lithium-codegen-arm.h"
8 #include "src/arm/lithium-gap-resolver-arm.h" 8 #include "src/arm/lithium-gap-resolver-arm.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 5516 matching lines...) Expand 10 before | Expand all | Expand 10 after
5527 __ mov(r2, Operand(instr->hydrogen()->shared_info())); 5527 __ mov(r2, Operand(instr->hydrogen()->shared_info()));
5528 __ mov(r1, Operand(pretenure ? factory()->true_value() 5528 __ mov(r1, Operand(pretenure ? factory()->true_value()
5529 : factory()->false_value())); 5529 : factory()->false_value()));
5530 __ Push(cp, r2, r1); 5530 __ Push(cp, r2, r1);
5531 CallRuntime(Runtime::kNewClosure, 3, instr); 5531 CallRuntime(Runtime::kNewClosure, 3, instr);
5532 } 5532 }
5533 } 5533 }
5534 5534
5535 5535
5536 void LCodeGen::DoTypeof(LTypeof* instr) { 5536 void LCodeGen::DoTypeof(LTypeof* instr) {
5537 Register input = ToRegister(instr->value()); 5537 DCHECK(ToRegister(instr->value()).is(r3));
5538 __ push(input); 5538 DCHECK(ToRegister(instr->result()).is(r0));
5539 CallRuntime(Runtime::kTypeof, 1, instr); 5539 Label end, do_call;
5540 Register value_register = ToRegister(instr->value());
5541 __ JumpIfNotSmi(value_register, &do_call);
5542 __ mov(r0, Operand(isolate()->factory()->number_string()));
5543 __ jmp(&end);
5544 __ bind(&do_call);
5545 TypeofStub stub(isolate());
5546 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
5547 __ bind(&end);
5540 } 5548 }
5541 5549
5542 5550
5543 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { 5551 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) {
5544 Register input = ToRegister(instr->value()); 5552 Register input = ToRegister(instr->value());
5545 5553
5546 Condition final_branch_condition = EmitTypeofIs(instr->TrueLabel(chunk_), 5554 Condition final_branch_condition = EmitTypeofIs(instr->TrueLabel(chunk_),
5547 instr->FalseLabel(chunk_), 5555 instr->FalseLabel(chunk_),
5548 input, 5556 input,
5549 instr->type_literal()); 5557 instr->type_literal());
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
5927 __ Push(scope_info); 5935 __ Push(scope_info);
5928 __ push(ToRegister(instr->function())); 5936 __ push(ToRegister(instr->function()));
5929 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5937 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5930 RecordSafepoint(Safepoint::kNoLazyDeopt); 5938 RecordSafepoint(Safepoint::kNoLazyDeopt);
5931 } 5939 }
5932 5940
5933 5941
5934 #undef __ 5942 #undef __
5935 5943
5936 } } // namespace v8::internal 5944 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698