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

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

Issue 12208013: Separated smi check from HBoundsCheck. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
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 3906 matching lines...) Expand 10 before | Expand all | Expand 10 after
3917 ASSERT(ToRegister(instr->value()).is(rax)); 3917 ASSERT(ToRegister(instr->value()).is(rax));
3918 3918
3919 __ Move(rcx, instr->hydrogen()->name()); 3919 __ Move(rcx, instr->hydrogen()->name());
3920 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) 3920 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
3921 ? isolate()->builtins()->StoreIC_Initialize_Strict() 3921 ? isolate()->builtins()->StoreIC_Initialize_Strict()
3922 : isolate()->builtins()->StoreIC_Initialize(); 3922 : isolate()->builtins()->StoreIC_Initialize();
3923 CallCode(ic, RelocInfo::CODE_TARGET, instr); 3923 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3924 } 3924 }
3925 3925
3926 3926
3927 void LCodeGen::DeoptIfTaggedButNotSmi(LEnvironment* environment,
3928 HValue* value,
3929 LOperand* operand) {
3930 if (value->representation().IsTagged() && !value->type().IsSmi()) {
3931 Condition cc;
3932 if (operand->IsRegister()) {
3933 cc = masm()->CheckSmi(ToRegister(operand));
3934 } else {
3935 cc = masm()->CheckSmi(ToOperand(operand));
3936 }
3937 DeoptimizeIf(NegateCondition(cc), environment);
3938 }
3939 }
3940
3941
3942 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { 3927 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
3943 DeoptIfTaggedButNotSmi(instr->environment(), 3928 if (instr->hydrogen()->skip_check()) return;
3944 instr->hydrogen()->length(), 3929
3945 instr->length());
3946 DeoptIfTaggedButNotSmi(instr->environment(),
3947 instr->hydrogen()->index(),
3948 instr->index());
3949 if (instr->length()->IsRegister()) { 3930 if (instr->length()->IsRegister()) {
3950 Register reg = ToRegister(instr->length()); 3931 Register reg = ToRegister(instr->length());
3951 if (!instr->hydrogen()->length()->representation().IsTagged()) { 3932 if (!instr->hydrogen()->length()->representation().IsTagged()) {
3952 __ AssertZeroExtended(reg); 3933 __ AssertZeroExtended(reg);
3953 } 3934 }
3954 if (instr->index()->IsConstantOperand()) { 3935 if (instr->index()->IsConstantOperand()) {
3955 int constant_index = 3936 int constant_index =
3956 ToInteger32(LConstantOperand::cast(instr->index())); 3937 ToInteger32(LConstantOperand::cast(instr->index()));
3957 if (instr->hydrogen()->length()->representation().IsTagged()) { 3938 if (instr->hydrogen()->length()->representation().IsTagged()) {
3958 __ Cmp(reg, Smi::FromInt(constant_index)); 3939 __ Cmp(reg, Smi::FromInt(constant_index));
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
4744 } 4725 }
4745 4726
4746 4727
4747 void LCodeGen::DoCheckSmi(LCheckSmi* instr) { 4728 void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
4748 LOperand* input = instr->value(); 4729 LOperand* input = instr->value();
4749 Condition cc = masm()->CheckSmi(ToRegister(input)); 4730 Condition cc = masm()->CheckSmi(ToRegister(input));
4750 DeoptimizeIf(NegateCondition(cc), instr->environment()); 4731 DeoptimizeIf(NegateCondition(cc), instr->environment());
4751 } 4732 }
4752 4733
4753 4734
4735 void LCodeGen::DoDeoptimizeIfTaggedIsNotSmi(
4736 LDeoptimizeIfTaggedIsNotSmi* instr) {
4737 if (instr->hydrogen_value()->representation().IsTagged() &&
4738 !instr->hydrogen_value()->type().IsSmi()) {
4739 LOperand* operand = instr->value();
4740 Condition cc;
4741 if (operand->IsRegister()) {
4742 cc = masm()->CheckSmi(ToRegister(operand));
4743 } else {
4744 cc = masm()->CheckSmi(ToOperand(operand));
4745 }
4746 DeoptimizeIf(NegateCondition(cc), instr->environment());
4747 }
4748 }
4749
4750
4754 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) { 4751 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) {
4755 LOperand* input = instr->value(); 4752 LOperand* input = instr->value();
4756 Condition cc = masm()->CheckSmi(ToRegister(input)); 4753 Condition cc = masm()->CheckSmi(ToRegister(input));
4757 DeoptimizeIf(cc, instr->environment()); 4754 DeoptimizeIf(cc, instr->environment());
4758 } 4755 }
4759 4756
4760 4757
4761 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { 4758 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
4762 Register input = ToRegister(instr->value()); 4759 Register input = ToRegister(instr->value());
4763 4760
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
5742 FixedArray::kHeaderSize - kPointerSize)); 5739 FixedArray::kHeaderSize - kPointerSize));
5743 __ bind(&done); 5740 __ bind(&done);
5744 } 5741 }
5745 5742
5746 5743
5747 #undef __ 5744 #undef __
5748 5745
5749 } } // namespace v8::internal 5746 } } // namespace v8::internal
5750 5747
5751 #endif // V8_TARGET_ARCH_X64 5748 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698