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

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

Issue 1144183004: [strong] Refactor ObjectStrength into a replacement for strong boolean args (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: cl feedback and rebase Created 5 years, 6 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 | « src/x64/lithium-x64.h ('k') | src/x87/full-codegen-x87.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 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X87 7 #if V8_TARGET_ARCH_X87
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 Label generic_heap_number_comparison; 1364 Label generic_heap_number_comparison;
1365 { 1365 {
1366 Label not_identical; 1366 Label not_identical;
1367 __ cmp(eax, edx); 1367 __ cmp(eax, edx);
1368 __ j(not_equal, &not_identical); 1368 __ j(not_equal, &not_identical);
1369 1369
1370 if (cc != equal) { 1370 if (cc != equal) {
1371 // Check for undefined. undefined OP undefined is false even though 1371 // Check for undefined. undefined OP undefined is false even though
1372 // undefined == undefined. 1372 // undefined == undefined.
1373 __ cmp(edx, isolate()->factory()->undefined_value()); 1373 __ cmp(edx, isolate()->factory()->undefined_value());
1374 if (strong()) { 1374 if (is_strong(strength())) {
1375 // In strong mode, this comparison must throw, so call the runtime. 1375 // In strong mode, this comparison must throw, so call the runtime.
1376 __ j(equal, &runtime_call, Label::kFar); 1376 __ j(equal, &runtime_call, Label::kFar);
1377 } else { 1377 } else {
1378 Label check_for_nan; 1378 Label check_for_nan;
1379 __ j(not_equal, &check_for_nan, Label::kNear); 1379 __ j(not_equal, &check_for_nan, Label::kNear);
1380 __ Move(eax, Immediate(Smi::FromInt(NegativeComparisonResult(cc)))); 1380 __ Move(eax, Immediate(Smi::FromInt(NegativeComparisonResult(cc))));
1381 __ ret(0); 1381 __ ret(0);
1382 __ bind(&check_for_nan); 1382 __ bind(&check_for_nan);
1383 } 1383 }
1384 } 1384 }
1385 1385
1386 // Test for NaN. Compare heap numbers in a general way, 1386 // Test for NaN. Compare heap numbers in a general way,
1387 // to handle NaNs correctly. 1387 // to handle NaNs correctly.
1388 __ cmp(FieldOperand(edx, HeapObject::kMapOffset), 1388 __ cmp(FieldOperand(edx, HeapObject::kMapOffset),
1389 Immediate(isolate()->factory()->heap_number_map())); 1389 Immediate(isolate()->factory()->heap_number_map()));
1390 __ j(equal, &generic_heap_number_comparison, Label::kNear); 1390 __ j(equal, &generic_heap_number_comparison, Label::kNear);
1391 if (cc != equal) { 1391 if (cc != equal) {
1392 __ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset)); 1392 __ mov(ecx, FieldOperand(eax, HeapObject::kMapOffset));
1393 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset)); 1393 __ movzx_b(ecx, FieldOperand(ecx, Map::kInstanceTypeOffset));
1394 // Call runtime on identical JSObjects. Otherwise return equal. 1394 // Call runtime on identical JSObjects. Otherwise return equal.
1395 __ cmpb(ecx, static_cast<uint8_t>(FIRST_SPEC_OBJECT_TYPE)); 1395 __ cmpb(ecx, static_cast<uint8_t>(FIRST_SPEC_OBJECT_TYPE));
1396 __ j(above_equal, &runtime_call, Label::kFar); 1396 __ j(above_equal, &runtime_call, Label::kFar);
1397 // Call runtime on identical symbols since we need to throw a TypeError. 1397 // Call runtime on identical symbols since we need to throw a TypeError.
1398 __ cmpb(ecx, static_cast<uint8_t>(SYMBOL_TYPE)); 1398 __ cmpb(ecx, static_cast<uint8_t>(SYMBOL_TYPE));
1399 __ j(equal, &runtime_call, Label::kFar); 1399 __ j(equal, &runtime_call, Label::kFar);
1400 if (strong()) { 1400 if (is_strong(strength())) {
1401 // We have already tested for smis and heap numbers, so if both 1401 // We have already tested for smis and heap numbers, so if both
1402 // arguments are not strings we must proceed to the slow case. 1402 // arguments are not strings we must proceed to the slow case.
1403 __ test(ecx, Immediate(kIsNotStringMask)); 1403 __ test(ecx, Immediate(kIsNotStringMask));
1404 __ j(not_zero, &runtime_call, Label::kFar); 1404 __ j(not_zero, &runtime_call, Label::kFar);
1405 } 1405 }
1406 } 1406 }
1407 __ Move(eax, Immediate(Smi::FromInt(EQUAL))); 1407 __ Move(eax, Immediate(Smi::FromInt(EQUAL)));
1408 __ ret(0); 1408 __ ret(0);
1409 1409
1410 1410
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
1594 // Push arguments below the return address. 1594 // Push arguments below the return address.
1595 __ pop(ecx); 1595 __ pop(ecx);
1596 __ push(edx); 1596 __ push(edx);
1597 __ push(eax); 1597 __ push(eax);
1598 1598
1599 // Figure out which native to call and setup the arguments. 1599 // Figure out which native to call and setup the arguments.
1600 Builtins::JavaScript builtin; 1600 Builtins::JavaScript builtin;
1601 if (cc == equal) { 1601 if (cc == equal) {
1602 builtin = strict() ? Builtins::STRICT_EQUALS : Builtins::EQUALS; 1602 builtin = strict() ? Builtins::STRICT_EQUALS : Builtins::EQUALS;
1603 } else { 1603 } else {
1604 builtin = strong() ? Builtins::COMPARE_STRONG : Builtins::COMPARE; 1604 builtin =
1605 is_strong(strength()) ? Builtins::COMPARE_STRONG : Builtins::COMPARE;
1605 __ push(Immediate(Smi::FromInt(NegativeComparisonResult(cc)))); 1606 __ push(Immediate(Smi::FromInt(NegativeComparisonResult(cc))));
1606 } 1607 }
1607 1608
1608 // Restore return address on the stack. 1609 // Restore return address on the stack.
1609 __ push(ecx); 1610 __ push(ecx);
1610 1611
1611 // Call the native; it returns -1 (less), 0 (equal), or 1 (greater) 1612 // Call the native; it returns -1 (less), 0 (equal), or 1 (greater)
1612 // tagged as a small integer. 1613 // tagged as a small integer.
1613 __ InvokeBuiltin(builtin, JUMP_FUNCTION); 1614 __ InvokeBuiltin(builtin, JUMP_FUNCTION);
1614 1615
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after
3300 __ j(not_equal, &maybe_undefined1, Label::kNear); 3301 __ j(not_equal, &maybe_undefined1, Label::kNear);
3301 3302
3302 __ bind(&check_left); 3303 __ bind(&check_left);
3303 __ JumpIfSmi(edx, &generic_stub, Label::kNear); 3304 __ JumpIfSmi(edx, &generic_stub, Label::kNear);
3304 __ cmp(FieldOperand(edx, HeapObject::kMapOffset), 3305 __ cmp(FieldOperand(edx, HeapObject::kMapOffset),
3305 isolate()->factory()->heap_number_map()); 3306 isolate()->factory()->heap_number_map());
3306 __ j(not_equal, &maybe_undefined2, Label::kNear); 3307 __ j(not_equal, &maybe_undefined2, Label::kNear);
3307 3308
3308 __ bind(&unordered); 3309 __ bind(&unordered);
3309 __ bind(&generic_stub); 3310 __ bind(&generic_stub);
3310 CompareICStub stub(isolate(), op(), strong(), CompareICState::GENERIC, 3311 CompareICStub stub(isolate(), op(), strength(), CompareICState::GENERIC,
3311 CompareICState::GENERIC, CompareICState::GENERIC); 3312 CompareICState::GENERIC, CompareICState::GENERIC);
3312 __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET); 3313 __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET);
3313 3314
3314 __ bind(&maybe_undefined1); 3315 __ bind(&maybe_undefined1);
3315 if (Token::IsOrderedRelationalCompareOp(op())) { 3316 if (Token::IsOrderedRelationalCompareOp(op())) {
3316 __ cmp(eax, Immediate(isolate()->factory()->undefined_value())); 3317 __ cmp(eax, Immediate(isolate()->factory()->undefined_value()));
3317 __ j(not_equal, &miss); 3318 __ j(not_equal, &miss);
3318 __ JumpIfSmi(edx, &unordered); 3319 __ JumpIfSmi(edx, &unordered);
3319 __ CmpObjectType(edx, HEAP_NUMBER_TYPE, ecx); 3320 __ CmpObjectType(edx, HEAP_NUMBER_TYPE, ecx);
3320 __ j(not_equal, &maybe_undefined2, Label::kNear); 3321 __ j(not_equal, &maybe_undefined2, Label::kNear);
(...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after
5137 Operand(ebp, 7 * kPointerSize), NULL); 5138 Operand(ebp, 7 * kPointerSize), NULL);
5138 } 5139 }
5139 5140
5140 5141
5141 #undef __ 5142 #undef __
5142 5143
5143 } // namespace internal 5144 } // namespace internal
5144 } // namespace v8 5145 } // namespace v8
5145 5146
5146 #endif // V8_TARGET_ARCH_X87 5147 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x64/lithium-x64.h ('k') | src/x87/full-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698