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/arm/lithium-codegen-arm.cc

Issue 6964011: Refactor HCheckInstanceType to allow mask/tag tests. (Closed)
Patch Set: Created 9 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 | « no previous file | src/hydrogen.cc » ('j') | src/hydrogen-instructions.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 3849 matching lines...) Expand 10 before | Expand all | Expand 10 after
3860 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) { 3860 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) {
3861 LOperand* input = instr->InputAt(0); 3861 LOperand* input = instr->InputAt(0);
3862 __ tst(ToRegister(input), Operand(kSmiTagMask)); 3862 __ tst(ToRegister(input), Operand(kSmiTagMask));
3863 DeoptimizeIf(eq, instr->environment()); 3863 DeoptimizeIf(eq, instr->environment());
3864 } 3864 }
3865 3865
3866 3866
3867 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { 3867 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) {
3868 Register input = ToRegister(instr->InputAt(0)); 3868 Register input = ToRegister(instr->InputAt(0));
3869 Register scratch = scratch0(); 3869 Register scratch = scratch0();
3870 InstanceType first = instr->hydrogen()->first();
3871 InstanceType last = instr->hydrogen()->last();
3872 3870
3873 __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); 3871 __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset));
3874 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); 3872 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset));
3875 __ cmp(scratch, Operand(first));
3876 3873
3877 // If there is only one type in the interval check for equality. 3874 if (instr->hydrogen()->is_range()) {
3878 if (first == last) { 3875 InstanceType first = instr->hydrogen()->first();
3879 DeoptimizeIf(ne, instr->environment()); 3876 InstanceType last = instr->hydrogen()->last();
3877
3878 __ cmp(scratch, Operand(first));
3879
3880 // If there is only one type in the interval check for equality.
3881 if (first == last) {
3882 DeoptimizeIf(ne, instr->environment());
3883 } else {
3884 DeoptimizeIf(lo, instr->environment());
3885 // Omit check for the last type.
3886 if (last != LAST_TYPE) {
3887 __ cmp(scratch, Operand(last));
3888 DeoptimizeIf(hi, instr->environment());
3889 }
3890 }
3880 } else { 3891 } else {
3881 DeoptimizeIf(lo, instr->environment()); 3892 uint8_t mask = instr->hydrogen()->mask();
3882 // Omit check for the last type. 3893 uint8_t tag = instr->hydrogen()->tag();
3883 if (last != LAST_TYPE) { 3894
3884 __ cmp(scratch, Operand(last)); 3895 if (IsPowerOf2(mask)) {
3885 DeoptimizeIf(hi, instr->environment()); 3896 ASSERT(tag == 0 || IsPowerOf2(tag));
3897 __ tst(scratch, Operand(mask));
3898 DeoptimizeIf(tag == 0 ? ne : eq, instr->environment());
3899 } else {
3900 __ and_(scratch, scratch, Operand(mask));
3901 __ cmp(scratch, Operand(tag));
3902 DeoptimizeIf(ne, instr->environment());
3886 } 3903 }
3887 } 3904 }
3888 } 3905 }
3889 3906
3890 3907
3891 void LCodeGen::DoCheckFunction(LCheckFunction* instr) { 3908 void LCodeGen::DoCheckFunction(LCheckFunction* instr) {
3892 ASSERT(instr->InputAt(0)->IsRegister()); 3909 ASSERT(instr->InputAt(0)->IsRegister());
3893 Register reg = ToRegister(instr->InputAt(0)); 3910 Register reg = ToRegister(instr->InputAt(0));
3894 __ cmp(reg, Operand(instr->hydrogen()->target())); 3911 __ cmp(reg, Operand(instr->hydrogen()->target()));
3895 DeoptimizeIf(ne, instr->environment()); 3912 DeoptimizeIf(ne, instr->environment());
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
4309 ASSERT(osr_pc_offset_ == -1); 4326 ASSERT(osr_pc_offset_ == -1);
4310 osr_pc_offset_ = masm()->pc_offset(); 4327 osr_pc_offset_ = masm()->pc_offset();
4311 } 4328 }
4312 4329
4313 4330
4314 4331
4315 4332
4316 #undef __ 4333 #undef __
4317 4334
4318 } } // namespace v8::internal 4335 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen.cc » ('j') | src/hydrogen-instructions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698