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

Side by Side Diff: src/x64/full-codegen-x64.cc

Issue 6682026: Fix SmiCompare on 64 bit to distinguish between comparisons where... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 9 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 Label* if_false, 542 Label* if_false,
543 Label* fall_through) { 543 Label* fall_through) {
544 // Emit the inlined tests assumed by the stub. 544 // Emit the inlined tests assumed by the stub.
545 __ CompareRoot(result_register(), Heap::kUndefinedValueRootIndex); 545 __ CompareRoot(result_register(), Heap::kUndefinedValueRootIndex);
546 __ j(equal, if_false); 546 __ j(equal, if_false);
547 __ CompareRoot(result_register(), Heap::kTrueValueRootIndex); 547 __ CompareRoot(result_register(), Heap::kTrueValueRootIndex);
548 __ j(equal, if_true); 548 __ j(equal, if_true);
549 __ CompareRoot(result_register(), Heap::kFalseValueRootIndex); 549 __ CompareRoot(result_register(), Heap::kFalseValueRootIndex);
550 __ j(equal, if_false); 550 __ j(equal, if_false);
551 STATIC_ASSERT(kSmiTag == 0); 551 STATIC_ASSERT(kSmiTag == 0);
552 __ SmiCompare(result_register(), Smi::FromInt(0)); 552 __ SmiCompareWithObject(result_register(), Smi::FromInt(0));
553 __ j(equal, if_false); 553 __ j(equal, if_false);
554 Condition is_smi = masm_->CheckSmi(result_register()); 554 Condition is_smi = masm_->CheckSmi(result_register());
555 __ j(is_smi, if_true); 555 __ j(is_smi, if_true);
556 556
557 // Call the ToBoolean stub for all other cases. 557 // Call the ToBoolean stub for all other cases.
558 ToBooleanStub stub; 558 ToBooleanStub stub;
559 __ push(result_register()); 559 __ push(result_register());
560 __ CallStub(&stub); 560 __ CallStub(&stub);
561 __ testq(rax, rax); 561 __ testq(rax, rax);
562 562
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 __ movq(rcx, Operand(rsp, 4 * kPointerSize)); 988 __ movq(rcx, Operand(rsp, 4 * kPointerSize));
989 __ cmpq(rdx, FieldOperand(rcx, HeapObject::kMapOffset)); 989 __ cmpq(rdx, FieldOperand(rcx, HeapObject::kMapOffset));
990 __ j(equal, &update_each); 990 __ j(equal, &update_each);
991 991
992 // Convert the entry to a string or null if it isn't a property 992 // Convert the entry to a string or null if it isn't a property
993 // anymore. If the property has been removed while iterating, we 993 // anymore. If the property has been removed while iterating, we
994 // just skip it. 994 // just skip it.
995 __ push(rcx); // Enumerable. 995 __ push(rcx); // Enumerable.
996 __ push(rbx); // Current entry. 996 __ push(rbx); // Current entry.
997 __ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION); 997 __ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION);
998 __ SmiCompare(rax, Smi::FromInt(0)); 998 __ SmiCompareWithObject(rax, Smi::FromInt(0));
999 __ j(equal, loop_statement.continue_target()); 999 __ j(equal, loop_statement.continue_target());
1000 __ movq(rbx, rax); 1000 __ movq(rbx, rax);
1001 1001
1002 // Update the 'each' property or variable from the possibly filtered 1002 // Update the 'each' property or variable from the possibly filtered
1003 // entry in register rbx. 1003 // entry in register rbx.
1004 __ bind(&update_each); 1004 __ bind(&update_each);
1005 __ movq(result_register(), rbx); 1005 __ movq(result_register(), rbx);
1006 // Perform the assignment as if via '='. 1006 // Perform the assignment as if via '='.
1007 { EffectContext context(this); 1007 { EffectContext context(this);
1008 EmitAssignment(stmt->each(), stmt->AssignmentId()); 1008 EmitAssignment(stmt->each(), stmt->AssignmentId());
(...skipping 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after
2495 Label* if_false = NULL; 2495 Label* if_false = NULL;
2496 Label* fall_through = NULL; 2496 Label* fall_through = NULL;
2497 context()->PrepareTest(&materialize_true, &materialize_false, 2497 context()->PrepareTest(&materialize_true, &materialize_false,
2498 &if_true, &if_false, &fall_through); 2498 &if_true, &if_false, &fall_through);
2499 2499
2500 // Get the frame pointer for the calling frame. 2500 // Get the frame pointer for the calling frame.
2501 __ movq(rax, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); 2501 __ movq(rax, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
2502 2502
2503 // Skip the arguments adaptor frame if it exists. 2503 // Skip the arguments adaptor frame if it exists.
2504 Label check_frame_marker; 2504 Label check_frame_marker;
2505 __ SmiCompare(Operand(rax, StandardFrameConstants::kContextOffset), 2505 __ SmiCompareWithObject(Operand(rax, StandardFrameConstants::kContextOffset),
2506 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); 2506 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
2507 __ j(not_equal, &check_frame_marker); 2507 __ j(not_equal, &check_frame_marker);
2508 __ movq(rax, Operand(rax, StandardFrameConstants::kCallerFPOffset)); 2508 __ movq(rax, Operand(rax, StandardFrameConstants::kCallerFPOffset));
2509 2509
2510 // Check the marker in the calling frame. 2510 // Check the marker in the calling frame.
2511 __ bind(&check_frame_marker); 2511 __ bind(&check_frame_marker);
2512 __ SmiCompare(Operand(rax, StandardFrameConstants::kMarkerOffset), 2512 __ SmiCompareWithObject(Operand(rax, StandardFrameConstants::kMarkerOffset),
2513 Smi::FromInt(StackFrame::CONSTRUCT)); 2513 Smi::FromInt(StackFrame::CONSTRUCT));
2514 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); 2514 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
2515 Split(equal, if_true, if_false, fall_through); 2515 Split(equal, if_true, if_false, fall_through);
2516 2516
2517 context()->Plug(if_true, if_false); 2517 context()->Plug(if_true, if_false);
2518 } 2518 }
2519 2519
2520 2520
2521 void FullCodeGenerator::EmitObjectEquals(ZoneList<Expression*>* args) { 2521 void FullCodeGenerator::EmitObjectEquals(ZoneList<Expression*>* args) {
2522 ASSERT(args->length() == 2); 2522 ASSERT(args->length() == 2);
2523 2523
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2557 2557
2558 void FullCodeGenerator::EmitArgumentsLength(ZoneList<Expression*>* args) { 2558 void FullCodeGenerator::EmitArgumentsLength(ZoneList<Expression*>* args) {
2559 ASSERT(args->length() == 0); 2559 ASSERT(args->length() == 0);
2560 2560
2561 NearLabel exit; 2561 NearLabel exit;
2562 // Get the number of formal parameters. 2562 // Get the number of formal parameters.
2563 __ Move(rax, Smi::FromInt(scope()->num_parameters())); 2563 __ Move(rax, Smi::FromInt(scope()->num_parameters()));
2564 2564
2565 // Check if the calling frame is an arguments adaptor frame. 2565 // Check if the calling frame is an arguments adaptor frame.
2566 __ movq(rbx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); 2566 __ movq(rbx, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
2567 __ SmiCompare(Operand(rbx, StandardFrameConstants::kContextOffset), 2567 __ SmiCompareWithObject(Operand(rbx, StandardFrameConstants::kContextOffset),
2568 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); 2568 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
2569 __ j(not_equal, &exit); 2569 __ j(not_equal, &exit);
2570 2570
2571 // Arguments adaptor case: Read the arguments length from the 2571 // Arguments adaptor case: Read the arguments length from the
2572 // adaptor frame. 2572 // adaptor frame.
2573 __ movq(rax, Operand(rbx, ArgumentsAdaptorFrameConstants::kLengthOffset)); 2573 __ movq(rax, Operand(rbx, ArgumentsAdaptorFrameConstants::kLengthOffset));
2574 2574
2575 __ bind(&exit); 2575 __ bind(&exit);
2576 if (FLAG_debug_code) __ AbortIfNotSmi(rax); 2576 if (FLAG_debug_code) __ AbortIfNotSmi(rax);
2577 context()->Plug(rax); 2577 context()->Plug(rax);
2578 } 2578 }
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
3023 __ j(not_equal, &slow_case); 3023 __ j(not_equal, &slow_case);
3024 3024
3025 // Check that both indices are smis. 3025 // Check that both indices are smis.
3026 __ movq(index_1, Operand(rsp, 1 * kPointerSize)); 3026 __ movq(index_1, Operand(rsp, 1 * kPointerSize));
3027 __ movq(index_2, Operand(rsp, 0 * kPointerSize)); 3027 __ movq(index_2, Operand(rsp, 0 * kPointerSize));
3028 __ JumpIfNotBothSmi(index_1, index_2, &slow_case); 3028 __ JumpIfNotBothSmi(index_1, index_2, &slow_case);
3029 3029
3030 // Check that both indices are valid. 3030 // Check that both indices are valid.
3031 // The JSArray length field is a smi since the array is in fast case mode. 3031 // The JSArray length field is a smi since the array is in fast case mode.
3032 __ movq(temp, FieldOperand(object, JSArray::kLengthOffset)); 3032 __ movq(temp, FieldOperand(object, JSArray::kLengthOffset));
3033 __ SmiCompare(temp, index_1); 3033 __ cmpq(temp, index_1);
3034 __ j(below_equal, &slow_case); 3034 __ j(below_equal, &slow_case);
3035 __ SmiCompare(temp, index_2); 3035 __ cmpq(temp, index_2);
Lasse Reichstein 2011/03/14 08:51:01 Do use SmiCompare.
Erik Corry 2011/03/14 16:26:45 Done.
3036 __ j(below_equal, &slow_case); 3036 __ j(below_equal, &slow_case);
3037 3037
3038 __ SmiToInteger32(index_1, index_1); 3038 __ SmiToInteger32(index_1, index_1);
3039 __ SmiToInteger32(index_2, index_2); 3039 __ SmiToInteger32(index_2, index_2);
3040 // Bring addresses into index1 and index2. 3040 // Bring addresses into index1 and index2.
3041 __ lea(index_1, FieldOperand(elements, index_1, times_pointer_size, 3041 __ lea(index_1, FieldOperand(elements, index_1, times_pointer_size,
3042 FixedArray::kHeaderSize)); 3042 FixedArray::kHeaderSize));
3043 __ lea(index_2, FieldOperand(elements, index_2, times_pointer_size, 3043 __ lea(index_2, FieldOperand(elements, index_2, times_pointer_size,
3044 FixedArray::kHeaderSize)); 3044 FixedArray::kHeaderSize));
3045 3045
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
3966 __ ret(0); 3966 __ ret(0);
3967 } 3967 }
3968 3968
3969 3969
3970 #undef __ 3970 #undef __
3971 3971
3972 3972
3973 } } // namespace v8::internal 3973 } } // namespace v8::internal
3974 3974
3975 #endif // V8_TARGET_ARCH_X64 3975 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698