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

Unified Diff: src/arm/full-codegen-arm.cc

Issue 6606005: Simplify test for typeof x == 'Object' on all platforms. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/full-codegen-arm.cc
===================================================================
--- src/arm/full-codegen-arm.cc (revision 7040)
+++ src/arm/full-codegen-arm.cc (working copy)
@@ -3977,71 +3977,52 @@
PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
if (check->Equals(Heap::number_symbol())) {
- __ tst(r0, Operand(kSmiTagMask));
- __ b(eq, if_true);
+ __ JumpIfSmi(r0, if_true);
__ ldr(r0, FieldMemOperand(r0, HeapObject::kMapOffset));
__ LoadRoot(ip, Heap::kHeapNumberMapRootIndex);
__ cmp(r0, ip);
Split(eq, if_true, if_false, fall_through);
} else if (check->Equals(Heap::string_symbol())) {
- __ tst(r0, Operand(kSmiTagMask));
- __ b(eq, if_false);
+ __ JumpIfSmi(r0, if_false);
// Check for undetectable objects => false.
- __ ldr(r0, FieldMemOperand(r0, HeapObject::kMapOffset));
+ __ CompareObjectType(r0, r0, r1, FIRST_NONSTRING_TYPE);
+ __ b(ge, if_false);
__ ldrb(r1, FieldMemOperand(r0, Map::kBitFieldOffset));
- __ and_(r1, r1, Operand(1 << Map::kIsUndetectable));
- __ cmp(r1, Operand(1 << Map::kIsUndetectable));
- __ b(eq, if_false);
- __ ldrb(r1, FieldMemOperand(r0, Map::kInstanceTypeOffset));
- __ cmp(r1, Operand(FIRST_NONSTRING_TYPE));
- Split(lt, if_true, if_false, fall_through);
+ __ tst(r1, Operand(1 << Map::kIsUndetectable));
+ Split(eq, if_true, if_false, fall_through);
} else if (check->Equals(Heap::boolean_symbol())) {
- __ LoadRoot(ip, Heap::kTrueValueRootIndex);
- __ cmp(r0, ip);
+ __ CompareRoot(r0, Heap::kTrueValueRootIndex);
__ b(eq, if_true);
- __ LoadRoot(ip, Heap::kFalseValueRootIndex);
- __ cmp(r0, ip);
+ __ CompareRoot(r0, Heap::kFalseValueRootIndex);
Split(eq, if_true, if_false, fall_through);
} else if (check->Equals(Heap::undefined_symbol())) {
- __ LoadRoot(ip, Heap::kUndefinedValueRootIndex);
- __ cmp(r0, ip);
+ __ CompareRoot(r0, Heap::kUndefinedValueRootIndex);
__ b(eq, if_true);
- __ tst(r0, Operand(kSmiTagMask));
- __ b(eq, if_false);
+ __ JumpIfSmi(r0, if_false);
// Check for undetectable objects => true.
__ ldr(r0, FieldMemOperand(r0, HeapObject::kMapOffset));
__ ldrb(r1, FieldMemOperand(r0, Map::kBitFieldOffset));
- __ and_(r1, r1, Operand(1 << Map::kIsUndetectable));
- __ cmp(r1, Operand(1 << Map::kIsUndetectable));
- Split(eq, if_true, if_false, fall_through);
+ __ tst(r1, Operand(1 << Map::kIsUndetectable));
+ Split(ne, if_true, if_false, fall_through);
+
} else if (check->Equals(Heap::function_symbol())) {
- __ tst(r0, Operand(kSmiTagMask));
- __ b(eq, if_false);
- __ CompareObjectType(r0, r1, r0, JS_FUNCTION_TYPE);
- __ b(eq, if_true);
- // Regular expressions => 'function' (they are callable).
- __ CompareInstanceType(r1, r0, JS_REGEXP_TYPE);
- Split(eq, if_true, if_false, fall_through);
+ __ JumpIfSmi(r0, if_false);
+ __ CompareObjectType(r0, r1, r0, FIRST_FUNCTION_CLASS_TYPE);
+ Split(ge, if_true, if_false, fall_through);
+
} else if (check->Equals(Heap::object_symbol())) {
- __ tst(r0, Operand(kSmiTagMask));
- __ b(eq, if_false);
- __ LoadRoot(ip, Heap::kNullValueRootIndex);
- __ cmp(r0, ip);
+ __ JumpIfSmi(r0, if_false);
+ __ CompareRoot(r0, Heap::kNullValueRootIndex);
__ b(eq, if_true);
- // Regular expressions => 'function', not 'object'.
- __ CompareObjectType(r0, r1, r0, JS_REGEXP_TYPE);
- __ b(eq, if_false);
- // Check for undetectable objects => false.
- __ ldrb(r0, FieldMemOperand(r1, Map::kBitFieldOffset));
- __ and_(r0, r0, Operand(1 << Map::kIsUndetectable));
- __ cmp(r0, Operand(1 << Map::kIsUndetectable));
- __ b(eq, if_false);
// Check for JS objects => true.
- __ ldrb(r0, FieldMemOperand(r1, Map::kInstanceTypeOffset));
- __ cmp(r0, Operand(FIRST_JS_OBJECT_TYPE));
- __ b(lt, if_false);
- __ cmp(r0, Operand(LAST_JS_OBJECT_TYPE));
- Split(le, if_true, if_false, fall_through);
+ __ CompareObjectType(r0, r0, r1, FIRST_JS_OBJECT_TYPE);
+ __ b(lo, if_false);
+ __ CompareInstanceType(r0, r1, FIRST_FUNCTION_CLASS_TYPE);
+ __ b(hs, if_false);
+ // Check for undetectable objects => false.
+ __ ldrb(r1, FieldMemOperand(r0, Map::kBitFieldOffset));
+ __ tst(r1, Operand(1 << Map::kIsUndetectable));
+ Split(eq, if_true, if_false, fall_through);
} else {
if (if_false != fall_through) __ jmp(if_false);
}
« no previous file with comments | « no previous file | src/arm/lithium-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698