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

Side by Side Diff: src/arm/codegen-arm.cc

Issue 2805046: Decide that different detectable objects are not equal without calling runtim... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 5 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
« no previous file with comments | « no previous file | src/ia32/codegen-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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 7198 matching lines...) Expand 10 before | Expand all | Expand 10 after
7209 __ vldr(d7, r7, HeapNumber::kValueOffset); 7209 __ vldr(d7, r7, HeapNumber::kValueOffset);
7210 } else { 7210 } else {
7211 __ Ldrd(r2, r3, FieldMemOperand(r1, HeapNumber::kValueOffset)); 7211 __ Ldrd(r2, r3, FieldMemOperand(r1, HeapNumber::kValueOffset));
7212 __ Ldrd(r0, r1, FieldMemOperand(r0, HeapNumber::kValueOffset)); 7212 __ Ldrd(r0, r1, FieldMemOperand(r0, HeapNumber::kValueOffset));
7213 } 7213 }
7214 __ jmp(both_loaded_as_doubles); 7214 __ jmp(both_loaded_as_doubles);
7215 } 7215 }
7216 7216
7217 7217
7218 // Fast negative check for symbol-to-symbol equality. 7218 // Fast negative check for symbol-to-symbol equality.
7219 static void EmitCheckForSymbols(MacroAssembler* masm, Label* slow) { 7219 static void EmitCheckForSymbolsOrObjects(MacroAssembler* masm,
7220 Label* possible_strings,
7221 Label* not_both_strings) {
7220 // r2 is object type of r0. 7222 // r2 is object type of r0.
7221 // Ensure that no non-strings have the symbol bit set. 7223 // Ensure that no non-strings have the symbol bit set.
7222 ASSERT(kNotStringTag + kIsSymbolMask > LAST_TYPE); 7224 Label object_test;
7223 ASSERT(kSymbolTag != 0); 7225 ASSERT(kSymbolTag != 0);
7226 __ tst(r2, Operand(kIsNotStringMask));
7227 __ b(ne, &object_test);
7224 __ tst(r2, Operand(kIsSymbolMask)); 7228 __ tst(r2, Operand(kIsSymbolMask));
7225 __ b(eq, slow); 7229 __ b(eq, possible_strings);
7226 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset)); 7230 __ CompareObjectType(r1, r3, r3, FIRST_NONSTRING_TYPE);
7227 __ ldrb(r3, FieldMemOperand(r3, Map::kInstanceTypeOffset)); 7231 __ b(ge, not_both_strings);
7228 __ tst(r3, Operand(kIsSymbolMask)); 7232 __ tst(r3, Operand(kIsSymbolMask));
7229 __ b(eq, slow); 7233 __ b(eq, possible_strings);
7230 7234
7231 // Both are symbols. We already checked they weren't the same pointer 7235 // Both are symbols. We already checked they weren't the same pointer
7232 // so they are not equal. 7236 // so they are not equal.
7233 __ mov(r0, Operand(1)); // Non-zero indicates not equal. 7237 __ mov(r0, Operand(1)); // Non-zero indicates not equal.
7234 __ mov(pc, Operand(lr)); // Return. 7238 __ mov(pc, Operand(lr)); // Return.
7239
7240 __ bind(&object_test);
7241 __ cmp(r2, Operand(FIRST_JS_OBJECT_TYPE));
7242 __ b(lt, not_both_strings);
7243 __ CompareObjectType(r1, r2, r3, FIRST_JS_OBJECT_TYPE);
7244 __ b(lt, not_both_strings);
7245 // If both objects are undetectable, they are equal. Otherwise, they
7246 // are not equal, since they are different objects and an object is not
7247 // equal to undefined.
7248 __ ldr(r3, FieldMemOperand(r0, HeapObject::kMapOffset));
7249 __ ldrb(r2, FieldMemOperand(r2, Map::kBitFieldOffset));
7250 __ ldrb(r3, FieldMemOperand(r3, Map::kBitFieldOffset));
7251 __ and_(r0, r2, Operand(r3));
7252 __ and_(r0, r0, Operand(1 << Map::kIsUndetectable));
7253 __ eor(r0, r0, Operand(1 << Map::kIsUndetectable));
7254 __ mov(pc, Operand(lr)); // Return.
7235 } 7255 }
7236 7256
7237 7257
7238 void NumberToStringStub::GenerateLookupNumberStringCache(MacroAssembler* masm, 7258 void NumberToStringStub::GenerateLookupNumberStringCache(MacroAssembler* masm,
7239 Register object, 7259 Register object,
7240 Register result, 7260 Register result,
7241 Register scratch1, 7261 Register scratch1,
7242 Register scratch2, 7262 Register scratch2,
7243 Register scratch3, 7263 Register scratch3,
7244 bool object_is_smi, 7264 bool object_is_smi,
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
7438 // In this case r2 will contain the type of r0. Never falls through. 7458 // In this case r2 will contain the type of r0. Never falls through.
7439 EmitCheckForTwoHeapNumbers(masm, 7459 EmitCheckForTwoHeapNumbers(masm,
7440 &both_loaded_as_doubles, 7460 &both_loaded_as_doubles,
7441 &check_for_symbols, 7461 &check_for_symbols,
7442 &flat_string_check); 7462 &flat_string_check);
7443 7463
7444 __ bind(&check_for_symbols); 7464 __ bind(&check_for_symbols);
7445 // In the strict case the EmitStrictTwoHeapObjectCompare already took care of 7465 // In the strict case the EmitStrictTwoHeapObjectCompare already took care of
7446 // symbols. 7466 // symbols.
7447 if (cc_ == eq && !strict_) { 7467 if (cc_ == eq && !strict_) {
7448 // Either jumps to slow or returns the answer. Assumes that r2 is the type 7468 // Returns an answer for two symbols or two detectable objects.
7449 // of r0 on entry. 7469 // Otherwise jumps to string case or not both strings case.
7450 EmitCheckForSymbols(masm, &flat_string_check); 7470 // Assumes that r2 is the type of r0 on entry.
7471 EmitCheckForSymbolsOrObjects(masm, &flat_string_check, &slow);
7451 } 7472 }
7452 7473
7453 // Check for both being sequential ASCII strings, and inline if that is the 7474 // Check for both being sequential ASCII strings, and inline if that is the
7454 // case. 7475 // case.
7455 __ bind(&flat_string_check); 7476 __ bind(&flat_string_check);
7456 7477
7457 __ JumpIfNonSmisNotBothSequentialAsciiStrings(r0, r1, r2, r3, &slow); 7478 __ JumpIfNonSmisNotBothSequentialAsciiStrings(r0, r1, r2, r3, &slow);
7458 7479
7459 __ IncrementCounter(&Counters::string_compare_native, 1, r2, r3); 7480 __ IncrementCounter(&Counters::string_compare_native, 1, r2, r3);
7460 StringCompareStub::GenerateCompareFlatAsciiStrings(masm, 7481 StringCompareStub::GenerateCompareFlatAsciiStrings(masm,
(...skipping 3628 matching lines...) Expand 10 before | Expand all | Expand 10 after
11089 __ bind(&string_add_runtime); 11110 __ bind(&string_add_runtime);
11090 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); 11111 __ TailCallRuntime(Runtime::kStringAdd, 2, 1);
11091 } 11112 }
11092 11113
11093 11114
11094 #undef __ 11115 #undef __
11095 11116
11096 } } // namespace v8::internal 11117 } } // namespace v8::internal
11097 11118
11098 #endif // V8_TARGET_ARCH_ARM 11119 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698