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

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

Issue 6603028: Merge revisions 7030:7051 from bleeding_edge to isolates branch.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
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
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | src/x64/lithium-x64.h » ('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 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 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 1630
1631 Label* false_label = chunk_->GetAssemblyLabel(false_block); 1631 Label* false_label = chunk_->GetAssemblyLabel(false_block);
1632 1632
1633 __ JumpIfSmi(input, false_label); 1633 __ JumpIfSmi(input, false_label);
1634 1634
1635 __ CmpObjectType(input, TestType(instr->hydrogen()), kScratchRegister); 1635 __ CmpObjectType(input, TestType(instr->hydrogen()), kScratchRegister);
1636 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen())); 1636 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen()));
1637 } 1637 }
1638 1638
1639 1639
1640 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) {
1641 Register input = ToRegister(instr->InputAt(0));
1642 Register result = ToRegister(instr->result());
1643
1644 if (FLAG_debug_code) {
1645 __ AbortIfNotString(input);
1646 }
1647
1648 __ movl(result, FieldOperand(input, String::kHashFieldOffset));
1649 ASSERT(String::kHashShift >= kSmiTagSize);
1650 __ IndexFromHash(result, result);
1651 }
1652
1653
1640 void LCodeGen::DoHasCachedArrayIndex(LHasCachedArrayIndex* instr) { 1654 void LCodeGen::DoHasCachedArrayIndex(LHasCachedArrayIndex* instr) {
1641 Register input = ToRegister(instr->InputAt(0)); 1655 Register input = ToRegister(instr->InputAt(0));
1642 Register result = ToRegister(instr->result()); 1656 Register result = ToRegister(instr->result());
1643 1657
1644 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); 1658 ASSERT(instr->hydrogen()->value()->representation().IsTagged());
1645 __ LoadRoot(result, Heap::kTrueValueRootIndex); 1659 __ LoadRoot(result, Heap::kTrueValueRootIndex);
1646 __ testl(FieldOperand(input, String::kHashFieldOffset), 1660 __ testl(FieldOperand(input, String::kHashFieldOffset),
1647 Immediate(String::kContainsCachedArrayIndexMask)); 1661 Immediate(String::kContainsCachedArrayIndexMask));
1648 NearLabel done; 1662 NearLabel done;
1649 __ j(not_zero, &done); 1663 __ j(zero, &done);
1650 __ LoadRoot(result, Heap::kFalseValueRootIndex); 1664 __ LoadRoot(result, Heap::kFalseValueRootIndex);
1651 __ bind(&done); 1665 __ bind(&done);
1652 } 1666 }
1653 1667
1654 1668
1655 void LCodeGen::DoHasCachedArrayIndexAndBranch( 1669 void LCodeGen::DoHasCachedArrayIndexAndBranch(
1656 LHasCachedArrayIndexAndBranch* instr) { 1670 LHasCachedArrayIndexAndBranch* instr) {
1657 Register input = ToRegister(instr->InputAt(0)); 1671 Register input = ToRegister(instr->InputAt(0));
1658 1672
1659 int true_block = chunk_->LookupDestination(instr->true_block_id()); 1673 int true_block = chunk_->LookupDestination(instr->true_block_id());
1660 int false_block = chunk_->LookupDestination(instr->false_block_id()); 1674 int false_block = chunk_->LookupDestination(instr->false_block_id());
1661 1675
1662 __ testl(FieldOperand(input, String::kHashFieldOffset), 1676 __ testl(FieldOperand(input, String::kHashFieldOffset),
1663 Immediate(String::kContainsCachedArrayIndexMask)); 1677 Immediate(String::kContainsCachedArrayIndexMask));
1664 EmitBranch(true_block, false_block, not_equal); 1678 EmitBranch(true_block, false_block, equal);
1665 } 1679 }
1666 1680
1667 1681
1668 // Branches to a label or falls through with the answer in the z flag. 1682 // Branches to a label or falls through with the answer in the z flag.
1669 // Trashes the temp register and possibly input (if it and temp are aliased). 1683 // Trashes the temp register and possibly input (if it and temp are aliased).
1670 void LCodeGen::EmitClassOfTest(Label* is_true, 1684 void LCodeGen::EmitClassOfTest(Label* is_true,
1671 Label* is_false, 1685 Label* is_false,
1672 Handle<String> class_name, 1686 Handle<String> class_name,
1673 Register input, 1687 Register input,
1674 Register temp) { 1688 Register temp) {
(...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after
3464 Handle<String> type_name) { 3478 Handle<String> type_name) {
3465 Condition final_branch_condition = no_condition; 3479 Condition final_branch_condition = no_condition;
3466 if (type_name->Equals(HEAP->number_symbol())) { 3480 if (type_name->Equals(HEAP->number_symbol())) {
3467 __ JumpIfSmi(input, true_label); 3481 __ JumpIfSmi(input, true_label);
3468 __ Cmp(FieldOperand(input, HeapObject::kMapOffset), 3482 __ Cmp(FieldOperand(input, HeapObject::kMapOffset),
3469 FACTORY->heap_number_map()); 3483 FACTORY->heap_number_map());
3470 final_branch_condition = equal; 3484 final_branch_condition = equal;
3471 3485
3472 } else if (type_name->Equals(HEAP->string_symbol())) { 3486 } else if (type_name->Equals(HEAP->string_symbol())) {
3473 __ JumpIfSmi(input, false_label); 3487 __ JumpIfSmi(input, false_label);
3474 __ movq(input, FieldOperand(input, HeapObject::kMapOffset)); 3488 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input);
3489 __ j(above_equal, false_label);
3475 __ testb(FieldOperand(input, Map::kBitFieldOffset), 3490 __ testb(FieldOperand(input, Map::kBitFieldOffset),
3476 Immediate(1 << Map::kIsUndetectable)); 3491 Immediate(1 << Map::kIsUndetectable));
3477 __ j(not_zero, false_label); 3492 final_branch_condition = zero;
3478 __ CmpInstanceType(input, FIRST_NONSTRING_TYPE);
3479 final_branch_condition = below;
3480 3493
3481 } else if (type_name->Equals(HEAP->boolean_symbol())) { 3494 } else if (type_name->Equals(HEAP->boolean_symbol())) {
3482 __ CompareRoot(input, Heap::kTrueValueRootIndex); 3495 __ CompareRoot(input, Heap::kTrueValueRootIndex);
3483 __ j(equal, true_label); 3496 __ j(equal, true_label);
3484 __ CompareRoot(input, Heap::kFalseValueRootIndex); 3497 __ CompareRoot(input, Heap::kFalseValueRootIndex);
3485 final_branch_condition = equal; 3498 final_branch_condition = equal;
3486 3499
3487 } else if (type_name->Equals(HEAP->undefined_symbol())) { 3500 } else if (type_name->Equals(HEAP->undefined_symbol())) {
3488 __ CompareRoot(input, Heap::kUndefinedValueRootIndex); 3501 __ CompareRoot(input, Heap::kUndefinedValueRootIndex);
3489 __ j(equal, true_label); 3502 __ j(equal, true_label);
3490 __ JumpIfSmi(input, false_label); 3503 __ JumpIfSmi(input, false_label);
3491 // Check for undetectable objects => true. 3504 // Check for undetectable objects => true.
3492 __ movq(input, FieldOperand(input, HeapObject::kMapOffset)); 3505 __ movq(input, FieldOperand(input, HeapObject::kMapOffset));
3493 __ testb(FieldOperand(input, Map::kBitFieldOffset), 3506 __ testb(FieldOperand(input, Map::kBitFieldOffset),
3494 Immediate(1 << Map::kIsUndetectable)); 3507 Immediate(1 << Map::kIsUndetectable));
3495 final_branch_condition = not_zero; 3508 final_branch_condition = not_zero;
3496 3509
3497 } else if (type_name->Equals(HEAP->function_symbol())) { 3510 } else if (type_name->Equals(HEAP->function_symbol())) {
3498 __ JumpIfSmi(input, false_label); 3511 __ JumpIfSmi(input, false_label);
3499 __ CmpObjectType(input, FIRST_FUNCTION_CLASS_TYPE, input); 3512 __ CmpObjectType(input, FIRST_FUNCTION_CLASS_TYPE, input);
3500 final_branch_condition = above_equal; 3513 final_branch_condition = above_equal;
3501 3514
3502 } else if (type_name->Equals(HEAP->object_symbol())) { 3515 } else if (type_name->Equals(HEAP->object_symbol())) {
3503 __ JumpIfSmi(input, false_label); 3516 __ JumpIfSmi(input, false_label);
3504 __ Cmp(input, FACTORY->null_value()); 3517 __ CompareRoot(input, Heap::kNullValueRootIndex);
3505 __ j(equal, true_label); 3518 __ j(equal, true_label);
3519 __ CmpObjectType(input, FIRST_JS_OBJECT_TYPE, input);
3520 __ j(below, false_label);
3521 __ CmpInstanceType(input, FIRST_FUNCTION_CLASS_TYPE);
3522 __ j(above_equal, false_label);
3506 // Check for undetectable objects => false. 3523 // Check for undetectable objects => false.
3507 __ testb(FieldOperand(input, Map::kBitFieldOffset), 3524 __ testb(FieldOperand(input, Map::kBitFieldOffset),
3508 Immediate(1 << Map::kIsUndetectable)); 3525 Immediate(1 << Map::kIsUndetectable));
3509 __ j(not_zero, false_label); 3526 final_branch_condition = zero;
3510 // Check for JS objects that are not RegExp or Function => true.
3511 __ CmpInstanceType(input, FIRST_JS_OBJECT_TYPE);
3512 __ j(below, false_label);
3513 __ CmpInstanceType(input, FIRST_FUNCTION_CLASS_TYPE);
3514 final_branch_condition = below_equal;
3515 3527
3516 } else { 3528 } else {
3517 final_branch_condition = never; 3529 final_branch_condition = never;
3518 __ jmp(false_label); 3530 __ jmp(false_label);
3519 } 3531 }
3520 3532
3521 return final_branch_condition; 3533 return final_branch_condition;
3522 } 3534 }
3523 3535
3524 3536
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
3641 RegisterEnvironmentForDeoptimization(environment); 3653 RegisterEnvironmentForDeoptimization(environment);
3642 ASSERT(osr_pc_offset_ == -1); 3654 ASSERT(osr_pc_offset_ == -1);
3643 osr_pc_offset_ = masm()->pc_offset(); 3655 osr_pc_offset_ = masm()->pc_offset();
3644 } 3656 }
3645 3657
3646 #undef __ 3658 #undef __
3647 3659
3648 } } // namespace v8::internal 3660 } } // namespace v8::internal
3649 3661
3650 #endif // V8_TARGET_ARCH_X64 3662 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698