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

Side by Side Diff: src/ia32/lithium-codegen-ia32.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/ia32/interface-descriptors-ia32.cc ('k') | src/ia32/lithium-ia32.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. 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 #if V8_TARGET_ARCH_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
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 5368 matching lines...) Expand 10 before | Expand all | Expand 10 after
5379 __ push(Immediate(instr->hydrogen()->shared_info())); 5379 __ push(Immediate(instr->hydrogen()->shared_info()));
5380 __ push(Immediate(pretenure ? factory()->true_value() 5380 __ push(Immediate(pretenure ? factory()->true_value()
5381 : factory()->false_value())); 5381 : factory()->false_value()));
5382 CallRuntime(Runtime::kNewClosure, 3, instr); 5382 CallRuntime(Runtime::kNewClosure, 3, instr);
5383 } 5383 }
5384 } 5384 }
5385 5385
5386 5386
5387 void LCodeGen::DoTypeof(LTypeof* instr) { 5387 void LCodeGen::DoTypeof(LTypeof* instr) {
5388 DCHECK(ToRegister(instr->context()).is(esi)); 5388 DCHECK(ToRegister(instr->context()).is(esi));
5389 LOperand* input = instr->value(); 5389 DCHECK(ToRegister(instr->value()).is(ebx));
5390 EmitPushTaggedOperand(input); 5390 Label end, do_call;
5391 CallRuntime(Runtime::kTypeof, 1, instr); 5391 Register value_register = ToRegister(instr->value());
5392 __ JumpIfNotSmi(value_register, &do_call);
5393 __ mov(eax, Immediate(isolate()->factory()->number_string()));
5394 __ jmp(&end);
5395 __ bind(&do_call);
5396 TypeofStub stub(isolate());
5397 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
5398 __ bind(&end);
5392 } 5399 }
5393 5400
5394 5401
5395 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { 5402 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) {
5396 Register input = ToRegister(instr->value()); 5403 Register input = ToRegister(instr->value());
5397 Condition final_branch_condition = EmitTypeofIs(instr, input); 5404 Condition final_branch_condition = EmitTypeofIs(instr, input);
5398 if (final_branch_condition != no_condition) { 5405 if (final_branch_condition != no_condition) {
5399 EmitBranch(instr, final_branch_condition); 5406 EmitBranch(instr, final_branch_condition);
5400 } 5407 }
5401 } 5408 }
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
5767 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5774 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5768 RecordSafepoint(Safepoint::kNoLazyDeopt); 5775 RecordSafepoint(Safepoint::kNoLazyDeopt);
5769 } 5776 }
5770 5777
5771 5778
5772 #undef __ 5779 #undef __
5773 5780
5774 } } // namespace v8::internal 5781 } } // namespace v8::internal
5775 5782
5776 #endif // V8_TARGET_ARCH_IA32 5783 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/interface-descriptors-ia32.cc ('k') | src/ia32/lithium-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698