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

Side by Side Diff: src/x87/code-stubs-x87.cc

Issue 1486563002: Remove {FIRST,LAST}_SPEC_OBJECT_TYPE. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 | « src/x87/builtins-x87.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_X87 5 #if V8_TARGET_ARCH_X87
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 1370
1371 // Test for NaN. Compare heap numbers in a general way, 1371 // Test for NaN. Compare heap numbers in a general way,
1372 // to handle NaNs correctly. 1372 // to handle NaNs correctly.
1373 __ cmp(FieldOperand(edx, HeapObject::kMapOffset), 1373 __ cmp(FieldOperand(edx, HeapObject::kMapOffset),
1374 Immediate(isolate()->factory()->heap_number_map())); 1374 Immediate(isolate()->factory()->heap_number_map()));
1375 __ j(equal, &generic_heap_number_comparison, Label::kNear); 1375 __ j(equal, &generic_heap_number_comparison, Label::kNear);
1376 if (cc != equal) { 1376 if (cc != equal) {
1377 __ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset)); 1377 __ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset));
1378 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset)); 1378 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset));
1379 // Call runtime on identical JSObjects. Otherwise return equal. 1379 // Call runtime on identical JSObjects. Otherwise return equal.
1380 __ cmpb(ecx, static_cast<uint8_t>(FIRST_SPEC_OBJECT_TYPE)); 1380 __ cmpb(ecx, static_cast<uint8_t>(FIRST_JS_RECEIVER_TYPE));
1381 __ j(above_equal, &runtime_call, Label::kFar); 1381 __ j(above_equal, &runtime_call, Label::kFar);
1382 // Call runtime on identical symbols since we need to throw a TypeError. 1382 // Call runtime on identical symbols since we need to throw a TypeError.
1383 __ cmpb(ecx, static_cast<uint8_t>(SYMBOL_TYPE)); 1383 __ cmpb(ecx, static_cast<uint8_t>(SYMBOL_TYPE));
1384 __ j(equal, &runtime_call, Label::kFar); 1384 __ j(equal, &runtime_call, Label::kFar);
1385 // Call runtime on identical SIMD values since we must throw a TypeError. 1385 // Call runtime on identical SIMD values since we must throw a TypeError.
1386 __ cmpb(ecx, static_cast<uint8_t>(SIMD128_VALUE_TYPE)); 1386 __ cmpb(ecx, static_cast<uint8_t>(SIMD128_VALUE_TYPE));
1387 __ j(equal, &runtime_call, Label::kFar); 1387 __ j(equal, &runtime_call, Label::kFar);
1388 if (is_strong(strength())) { 1388 if (is_strong(strength())) {
1389 // We have already tested for smis and heap numbers, so if both 1389 // We have already tested for smis and heap numbers, so if both
1390 // arguments are not strings we must proceed to the slow case. 1390 // arguments are not strings we must proceed to the slow case.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 __ ret(0); 1438 __ ret(0);
1439 1439
1440 __ bind(&not_smis); 1440 __ bind(&not_smis);
1441 // If either operand is a JSObject or an oddball value, then they are not 1441 // If either operand is a JSObject or an oddball value, then they are not
1442 // equal since their pointers are different 1442 // equal since their pointers are different
1443 // There is no test for undetectability in strict equality. 1443 // There is no test for undetectability in strict equality.
1444 1444
1445 // Get the type of the first operand. 1445 // Get the type of the first operand.
1446 // If the first object is a JS object, we have done pointer comparison. 1446 // If the first object is a JS object, we have done pointer comparison.
1447 Label first_non_object; 1447 Label first_non_object;
1448 STATIC_ASSERT(LAST_TYPE == LAST_SPEC_OBJECT_TYPE); 1448 STATIC_ASSERT(LAST_TYPE == LAST_JS_RECEIVER_TYPE);
1449 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx); 1449 __ CmpObjectType(eax, FIRST_JS_RECEIVER_TYPE, ecx);
1450 __ j(below, &first_non_object, Label::kNear); 1450 __ j(below, &first_non_object, Label::kNear);
1451 1451
1452 // Return non-zero (eax is not zero) 1452 // Return non-zero (eax is not zero)
1453 Label return_not_equal; 1453 Label return_not_equal;
1454 STATIC_ASSERT(kHeapObjectTag != 0); 1454 STATIC_ASSERT(kHeapObjectTag != 0);
1455 __ bind(&return_not_equal); 1455 __ bind(&return_not_equal);
1456 __ ret(0); 1456 __ ret(0);
1457 1457
1458 __ bind(&first_non_object); 1458 __ bind(&first_non_object);
1459 // Check for oddballs: true, false, null, undefined. 1459 // Check for oddballs: true, false, null, undefined.
1460 __ CmpInstanceType(ecx, ODDBALL_TYPE); 1460 __ CmpInstanceType(ecx, ODDBALL_TYPE);
1461 __ j(equal, &return_not_equal); 1461 __ j(equal, &return_not_equal);
1462 1462
1463 __ CmpObjectType(edx, FIRST_SPEC_OBJECT_TYPE, ecx); 1463 __ CmpObjectType(edx, FIRST_JS_RECEIVER_TYPE, ecx);
1464 __ j(above_equal, &return_not_equal); 1464 __ j(above_equal, &return_not_equal);
1465 1465
1466 // Check for oddballs: true, false, null, undefined. 1466 // Check for oddballs: true, false, null, undefined.
1467 __ CmpInstanceType(ecx, ODDBALL_TYPE); 1467 __ CmpInstanceType(ecx, ODDBALL_TYPE);
1468 __ j(equal, &return_not_equal); 1468 __ j(equal, &return_not_equal);
1469 1469
1470 // Fall through to the general case. 1470 // Fall through to the general case.
1471 __ bind(&slow); 1471 __ bind(&slow);
1472 } 1472 }
1473 1473
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 // and their pointers are different. 1549 // and their pointers are different.
1550 Label return_unequal; 1550 Label return_unequal;
1551 // At most one is a smi, so we can test for smi by adding the two. 1551 // At most one is a smi, so we can test for smi by adding the two.
1552 // A smi plus a heap object has the low bit set, a heap object plus 1552 // A smi plus a heap object has the low bit set, a heap object plus
1553 // a heap object has the low bit clear. 1553 // a heap object has the low bit clear.
1554 STATIC_ASSERT(kSmiTag == 0); 1554 STATIC_ASSERT(kSmiTag == 0);
1555 STATIC_ASSERT(kSmiTagMask == 1); 1555 STATIC_ASSERT(kSmiTagMask == 1);
1556 __ lea(ecx, Operand(eax, edx, times_1, 0)); 1556 __ lea(ecx, Operand(eax, edx, times_1, 0));
1557 __ test(ecx, Immediate(kSmiTagMask)); 1557 __ test(ecx, Immediate(kSmiTagMask));
1558 __ j(not_zero, &runtime_call, Label::kNear); 1558 __ j(not_zero, &runtime_call, Label::kNear);
1559 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx); 1559 __ CmpObjectType(eax, FIRST_JS_RECEIVER_TYPE, ecx);
1560 __ j(below, &runtime_call, Label::kNear); 1560 __ j(below, &runtime_call, Label::kNear);
1561 __ CmpObjectType(edx, FIRST_SPEC_OBJECT_TYPE, ebx); 1561 __ CmpObjectType(edx, FIRST_JS_RECEIVER_TYPE, ebx);
1562 __ j(below, &runtime_call, Label::kNear); 1562 __ j(below, &runtime_call, Label::kNear);
1563 // We do not bail out after this point. Both are JSObjects, and 1563 // We do not bail out after this point. Both are JSObjects, and
1564 // they are equal if and only if both are undetectable. 1564 // they are equal if and only if both are undetectable.
1565 // The and of the undetectable flags is 1 if and only if they are equal. 1565 // The and of the undetectable flags is 1 if and only if they are equal.
1566 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), 1566 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset),
1567 1 << Map::kIsUndetectable); 1567 1 << Map::kIsUndetectable);
1568 __ j(zero, &return_unequal, Label::kNear); 1568 __ j(zero, &return_unequal, Label::kNear);
1569 __ test_b(FieldOperand(ebx, Map::kBitFieldOffset), 1569 __ test_b(FieldOperand(ebx, Map::kBitFieldOffset),
1570 1 << Map::kIsUndetectable); 1570 1 << Map::kIsUndetectable);
1571 __ j(zero, &return_unequal, Label::kNear); 1571 __ j(zero, &return_unequal, Label::kNear);
(...skipping 3491 matching lines...) Expand 10 before | Expand all | Expand 10 after
5063 Label ok; 5063 Label ok;
5064 Register return_value = eax; 5064 Register return_value = eax;
5065 Register map = ecx; 5065 Register map = ecx;
5066 5066
5067 __ JumpIfSmi(return_value, &ok, Label::kNear); 5067 __ JumpIfSmi(return_value, &ok, Label::kNear);
5068 __ mov(map, FieldOperand(return_value, HeapObject::kMapOffset)); 5068 __ mov(map, FieldOperand(return_value, HeapObject::kMapOffset));
5069 5069
5070 __ CmpInstanceType(map, LAST_NAME_TYPE); 5070 __ CmpInstanceType(map, LAST_NAME_TYPE);
5071 __ j(below_equal, &ok, Label::kNear); 5071 __ j(below_equal, &ok, Label::kNear);
5072 5072
5073 __ CmpInstanceType(map, FIRST_SPEC_OBJECT_TYPE); 5073 __ CmpInstanceType(map, FIRST_JS_RECEIVER_TYPE);
5074 __ j(above_equal, &ok, Label::kNear); 5074 __ j(above_equal, &ok, Label::kNear);
5075 5075
5076 __ cmp(map, isolate->factory()->heap_number_map()); 5076 __ cmp(map, isolate->factory()->heap_number_map());
5077 __ j(equal, &ok, Label::kNear); 5077 __ j(equal, &ok, Label::kNear);
5078 5078
5079 __ cmp(return_value, isolate->factory()->undefined_value()); 5079 __ cmp(return_value, isolate->factory()->undefined_value());
5080 __ j(equal, &ok, Label::kNear); 5080 __ j(equal, &ok, Label::kNear);
5081 5081
5082 __ cmp(return_value, isolate->factory()->true_value()); 5082 __ cmp(return_value, isolate->factory()->true_value());
5083 __ j(equal, &ok, Label::kNear); 5083 __ j(equal, &ok, Label::kNear);
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
5320 Operand(ebp, 7 * kPointerSize), NULL); 5320 Operand(ebp, 7 * kPointerSize), NULL);
5321 } 5321 }
5322 5322
5323 5323
5324 #undef __ 5324 #undef __
5325 5325
5326 } // namespace internal 5326 } // namespace internal
5327 } // namespace v8 5327 } // namespace v8
5328 5328
5329 #endif // V8_TARGET_ARCH_X87 5329 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/builtins-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698