OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1218 __ Branch(&return_not_equal, eq, a2, Operand(ODDBALL_TYPE)); | 1218 __ Branch(&return_not_equal, eq, a2, Operand(ODDBALL_TYPE)); |
1219 | 1219 |
1220 __ GetObjectType(rhs, a3, a3); | 1220 __ GetObjectType(rhs, a3, a3); |
1221 __ Branch(&return_not_equal, greater, a3, Operand(FIRST_SPEC_OBJECT_TYPE)); | 1221 __ Branch(&return_not_equal, greater, a3, Operand(FIRST_SPEC_OBJECT_TYPE)); |
1222 | 1222 |
1223 // Check for oddballs: true, false, null, undefined. | 1223 // Check for oddballs: true, false, null, undefined. |
1224 __ Branch(&return_not_equal, eq, a3, Operand(ODDBALL_TYPE)); | 1224 __ Branch(&return_not_equal, eq, a3, Operand(ODDBALL_TYPE)); |
1225 | 1225 |
1226 // Now that we have the types we might as well check for | 1226 // Now that we have the types we might as well check for |
1227 // internalized-internalized. | 1227 // internalized-internalized. |
1228 Label not_internalized; | 1228 STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0); |
1229 STATIC_ASSERT(kInternalizedTag != 0); | 1229 __ Or(a2, a2, Operand(a3)); |
1230 __ And(t2, a2, Operand(kIsNotStringMask | kIsInternalizedMask)); | 1230 __ And(at, a2, Operand(kIsNotStringMask | kIsNotInternalizedMask)); |
1231 __ Branch(¬_internalized, ne, t2, | 1231 __ Branch(&return_not_equal, eq, at, Operand(zero_reg)); |
1232 Operand(kInternalizedTag | kStringTag)); | |
1233 | |
1234 __ And(a3, a3, Operand(kIsNotStringMask | kIsInternalizedMask)); | |
1235 __ Branch(&return_not_equal, eq, a3, | |
1236 Operand(kInternalizedTag | kStringTag)); | |
1237 | |
1238 __ bind(¬_internalized); | |
1239 } | 1232 } |
1240 | 1233 |
1241 | 1234 |
1242 static void EmitCheckForTwoHeapNumbers(MacroAssembler* masm, | 1235 static void EmitCheckForTwoHeapNumbers(MacroAssembler* masm, |
1243 Register lhs, | 1236 Register lhs, |
1244 Register rhs, | 1237 Register rhs, |
1245 Label* both_loaded_as_doubles, | 1238 Label* both_loaded_as_doubles, |
1246 Label* not_heap_numbers, | 1239 Label* not_heap_numbers, |
1247 Label* slow) { | 1240 Label* slow) { |
1248 __ GetObjectType(lhs, a3, a2); | 1241 __ GetObjectType(lhs, a3, a2); |
(...skipping 15 matching lines...) Expand all Loading... |
1264 static void EmitCheckForInternalizedStringsOrObjects(MacroAssembler* masm, | 1257 static void EmitCheckForInternalizedStringsOrObjects(MacroAssembler* masm, |
1265 Register lhs, | 1258 Register lhs, |
1266 Register rhs, | 1259 Register rhs, |
1267 Label* possible_strings, | 1260 Label* possible_strings, |
1268 Label* not_both_strings) { | 1261 Label* not_both_strings) { |
1269 ASSERT((lhs.is(a0) && rhs.is(a1)) || | 1262 ASSERT((lhs.is(a0) && rhs.is(a1)) || |
1270 (lhs.is(a1) && rhs.is(a0))); | 1263 (lhs.is(a1) && rhs.is(a0))); |
1271 | 1264 |
1272 // a2 is object type of rhs. | 1265 // a2 is object type of rhs. |
1273 Label object_test; | 1266 Label object_test; |
1274 STATIC_ASSERT(kInternalizedTag != 0); | 1267 STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0); |
1275 __ And(at, a2, Operand(kIsNotStringMask)); | 1268 __ And(at, a2, Operand(kIsNotStringMask)); |
1276 __ Branch(&object_test, ne, at, Operand(zero_reg)); | 1269 __ Branch(&object_test, ne, at, Operand(zero_reg)); |
1277 __ And(at, a2, Operand(kIsInternalizedMask)); | 1270 __ And(at, a2, Operand(kIsNotInternalizedMask)); |
1278 __ Branch(possible_strings, eq, at, Operand(zero_reg)); | 1271 __ Branch(possible_strings, ne, at, Operand(zero_reg)); |
1279 __ GetObjectType(rhs, a3, a3); | 1272 __ GetObjectType(rhs, a3, a3); |
1280 __ Branch(not_both_strings, ge, a3, Operand(FIRST_NONSTRING_TYPE)); | 1273 __ Branch(not_both_strings, ge, a3, Operand(FIRST_NONSTRING_TYPE)); |
1281 __ And(at, a3, Operand(kIsInternalizedMask)); | 1274 __ And(at, a3, Operand(kIsNotInternalizedMask)); |
1282 __ Branch(possible_strings, eq, at, Operand(zero_reg)); | 1275 __ Branch(possible_strings, ne, at, Operand(zero_reg)); |
1283 | 1276 |
1284 // Both are internalized strings. We already checked they weren't the same | 1277 // Both are internalized strings. We already checked they weren't the same |
1285 // pointer so they are not equal. | 1278 // pointer so they are not equal. |
1286 __ Ret(USE_DELAY_SLOT); | 1279 __ Ret(USE_DELAY_SLOT); |
1287 __ li(v0, Operand(1)); // Non-zero indicates not equal. | 1280 __ li(v0, Operand(1)); // Non-zero indicates not equal. |
1288 | 1281 |
1289 __ bind(&object_test); | 1282 __ bind(&object_test); |
1290 __ Branch(not_both_strings, lt, a2, Operand(FIRST_SPEC_OBJECT_TYPE)); | 1283 __ Branch(not_both_strings, lt, a2, Operand(FIRST_SPEC_OBJECT_TYPE)); |
1291 __ GetObjectType(rhs, a2, a3); | 1284 __ GetObjectType(rhs, a2, a3); |
1292 __ Branch(not_both_strings, lt, a3, Operand(FIRST_SPEC_OBJECT_TYPE)); | 1285 __ Branch(not_both_strings, lt, a3, Operand(FIRST_SPEC_OBJECT_TYPE)); |
(...skipping 5083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6376 Register tmp2 = a3; | 6369 Register tmp2 = a3; |
6377 | 6370 |
6378 // Check that both operands are heap objects. | 6371 // Check that both operands are heap objects. |
6379 __ JumpIfEitherSmi(left, right, &miss); | 6372 __ JumpIfEitherSmi(left, right, &miss); |
6380 | 6373 |
6381 // Check that both operands are internalized strings. | 6374 // Check that both operands are internalized strings. |
6382 __ lw(tmp1, FieldMemOperand(left, HeapObject::kMapOffset)); | 6375 __ lw(tmp1, FieldMemOperand(left, HeapObject::kMapOffset)); |
6383 __ lw(tmp2, FieldMemOperand(right, HeapObject::kMapOffset)); | 6376 __ lw(tmp2, FieldMemOperand(right, HeapObject::kMapOffset)); |
6384 __ lbu(tmp1, FieldMemOperand(tmp1, Map::kInstanceTypeOffset)); | 6377 __ lbu(tmp1, FieldMemOperand(tmp1, Map::kInstanceTypeOffset)); |
6385 __ lbu(tmp2, FieldMemOperand(tmp2, Map::kInstanceTypeOffset)); | 6378 __ lbu(tmp2, FieldMemOperand(tmp2, Map::kInstanceTypeOffset)); |
6386 STATIC_ASSERT(kInternalizedTag != 0); | 6379 STATIC_ASSERT(kInternalizedTag == 0 && kStringTag == 0); |
6387 | 6380 __ Or(tmp1, tmp1, Operand(tmp2)); |
6388 __ And(tmp1, tmp1, Operand(kIsNotStringMask | kIsInternalizedMask)); | 6381 __ And(at, tmp1, Operand(kIsNotStringMask | kIsNotInternalizedMask)); |
6389 __ Branch(&miss, ne, tmp1, Operand(kInternalizedTag | kStringTag)); | 6382 __ Branch(&miss, ne, at, Operand(zero_reg)); |
6390 | |
6391 __ And(tmp2, tmp2, Operand(kIsNotStringMask | kIsInternalizedMask)); | |
6392 __ Branch(&miss, ne, tmp2, Operand(kInternalizedTag | kStringTag)); | |
6393 | 6383 |
6394 // Make sure a0 is non-zero. At this point input operands are | 6384 // Make sure a0 is non-zero. At this point input operands are |
6395 // guaranteed to be non-zero. | 6385 // guaranteed to be non-zero. |
6396 ASSERT(right.is(a0)); | 6386 ASSERT(right.is(a0)); |
6397 STATIC_ASSERT(EQUAL == 0); | 6387 STATIC_ASSERT(EQUAL == 0); |
6398 STATIC_ASSERT(kSmiTag == 0); | 6388 STATIC_ASSERT(kSmiTag == 0); |
6399 __ mov(v0, right); | 6389 __ mov(v0, right); |
6400 // Internalized strings are compared by identity. | 6390 // Internalized strings are compared by identity. |
6401 __ Ret(ne, left, Operand(right)); | 6391 __ Ret(ne, left, Operand(right)); |
6402 ASSERT(is_int16(EQUAL)); | 6392 ASSERT(is_int16(EQUAL)); |
(...skipping 14 matching lines...) Expand all Loading... |
6417 Register left = a1; | 6407 Register left = a1; |
6418 Register right = a0; | 6408 Register right = a0; |
6419 Register tmp1 = a2; | 6409 Register tmp1 = a2; |
6420 Register tmp2 = a3; | 6410 Register tmp2 = a3; |
6421 | 6411 |
6422 // Check that both operands are heap objects. | 6412 // Check that both operands are heap objects. |
6423 __ JumpIfEitherSmi(left, right, &miss); | 6413 __ JumpIfEitherSmi(left, right, &miss); |
6424 | 6414 |
6425 // Check that both operands are unique names. This leaves the instance | 6415 // Check that both operands are unique names. This leaves the instance |
6426 // types loaded in tmp1 and tmp2. | 6416 // types loaded in tmp1 and tmp2. |
6427 STATIC_ASSERT(kInternalizedTag != 0); | |
6428 __ lw(tmp1, FieldMemOperand(left, HeapObject::kMapOffset)); | 6417 __ lw(tmp1, FieldMemOperand(left, HeapObject::kMapOffset)); |
6429 __ lw(tmp2, FieldMemOperand(right, HeapObject::kMapOffset)); | 6418 __ lw(tmp2, FieldMemOperand(right, HeapObject::kMapOffset)); |
6430 __ lbu(tmp1, FieldMemOperand(tmp1, Map::kInstanceTypeOffset)); | 6419 __ lbu(tmp1, FieldMemOperand(tmp1, Map::kInstanceTypeOffset)); |
6431 __ lbu(tmp2, FieldMemOperand(tmp2, Map::kInstanceTypeOffset)); | 6420 __ lbu(tmp2, FieldMemOperand(tmp2, Map::kInstanceTypeOffset)); |
6432 | 6421 |
6433 __ JumpIfNotUniqueName(tmp1, &miss); | 6422 __ JumpIfNotUniqueName(tmp1, &miss); |
6434 __ JumpIfNotUniqueName(tmp2, &miss); | 6423 __ JumpIfNotUniqueName(tmp2, &miss); |
6435 | 6424 |
6436 // Use a0 as result | 6425 // Use a0 as result |
6437 __ mov(v0, a0); | 6426 __ mov(v0, a0); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6491 __ mov(v0, zero_reg); // In the delay slot. | 6480 __ mov(v0, zero_reg); // In the delay slot. |
6492 __ bind(&left_ne_right); | 6481 __ bind(&left_ne_right); |
6493 | 6482 |
6494 // Handle not identical strings. | 6483 // Handle not identical strings. |
6495 | 6484 |
6496 // Check that both strings are internalized strings. If they are, we're done | 6485 // Check that both strings are internalized strings. If they are, we're done |
6497 // because we already know they are not identical. We know they are both | 6486 // because we already know they are not identical. We know they are both |
6498 // strings. | 6487 // strings. |
6499 if (equality) { | 6488 if (equality) { |
6500 ASSERT(GetCondition() == eq); | 6489 ASSERT(GetCondition() == eq); |
6501 STATIC_ASSERT(kInternalizedTag != 0); | 6490 STATIC_ASSERT(kInternalizedTag == 0); |
6502 __ And(tmp3, tmp1, Operand(tmp2)); | 6491 __ Or(tmp3, tmp1, Operand(tmp2)); |
6503 __ And(tmp5, tmp3, Operand(kIsInternalizedMask)); | 6492 __ And(tmp5, tmp3, Operand(kIsNotInternalizedMask)); |
6504 Label is_symbol; | 6493 Label is_symbol; |
6505 __ Branch(&is_symbol, eq, tmp5, Operand(zero_reg)); | 6494 __ Branch(&is_symbol, ne, tmp5, Operand(zero_reg)); |
6506 // Make sure a0 is non-zero. At this point input operands are | 6495 // Make sure a0 is non-zero. At this point input operands are |
6507 // guaranteed to be non-zero. | 6496 // guaranteed to be non-zero. |
6508 ASSERT(right.is(a0)); | 6497 ASSERT(right.is(a0)); |
6509 __ Ret(USE_DELAY_SLOT); | 6498 __ Ret(USE_DELAY_SLOT); |
6510 __ mov(v0, a0); // In the delay slot. | 6499 __ mov(v0, a0); // In the delay slot. |
6511 __ bind(&is_symbol); | 6500 __ bind(&is_symbol); |
6512 } | 6501 } |
6513 | 6502 |
6514 // Check that both strings are sequential ASCII. | 6503 // Check that both strings are sequential ASCII. |
6515 Label runtime; | 6504 Label runtime; |
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7620 __ bind(&fast_elements_case); | 7609 __ bind(&fast_elements_case); |
7621 GenerateCase(masm, FAST_ELEMENTS); | 7610 GenerateCase(masm, FAST_ELEMENTS); |
7622 } | 7611 } |
7623 | 7612 |
7624 | 7613 |
7625 #undef __ | 7614 #undef __ |
7626 | 7615 |
7627 } } // namespace v8::internal | 7616 } } // namespace v8::internal |
7628 | 7617 |
7629 #endif // V8_TARGET_ARCH_MIPS | 7618 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |