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

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 7060010: Merge bleeding edge into the GC branch up to 7948. The asserts (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 7 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/arm/macro-assembler-arm.h ('k') | src/arm/regexp-macro-assembler-arm.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 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 ASSERT(!obj.is(ip)); 1649 ASSERT(!obj.is(ip));
1650 LoadRoot(ip, index); 1650 LoadRoot(ip, index);
1651 cmp(obj, ip); 1651 cmp(obj, ip);
1652 } 1652 }
1653 1653
1654 1654
1655 void MacroAssembler::CheckMap(Register obj, 1655 void MacroAssembler::CheckMap(Register obj,
1656 Register scratch, 1656 Register scratch,
1657 Handle<Map> map, 1657 Handle<Map> map,
1658 Label* fail, 1658 Label* fail,
1659 bool is_heap_object) { 1659 SmiCheckType smi_check_type) {
1660 if (!is_heap_object) { 1660 if (smi_check_type == DO_SMI_CHECK) {
1661 JumpIfSmi(obj, fail); 1661 JumpIfSmi(obj, fail);
1662 } 1662 }
1663 ldr(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); 1663 ldr(scratch, FieldMemOperand(obj, HeapObject::kMapOffset));
1664 mov(ip, Operand(map)); 1664 mov(ip, Operand(map));
1665 cmp(scratch, ip); 1665 cmp(scratch, ip);
1666 b(ne, fail); 1666 b(ne, fail);
1667 } 1667 }
1668 1668
1669 1669
1670 void MacroAssembler::CheckMap(Register obj, 1670 void MacroAssembler::CheckMap(Register obj,
1671 Register scratch, 1671 Register scratch,
1672 Heap::RootListIndex index, 1672 Heap::RootListIndex index,
1673 Label* fail, 1673 Label* fail,
1674 bool is_heap_object) { 1674 SmiCheckType smi_check_type) {
1675 if (!is_heap_object) { 1675 if (smi_check_type == DO_SMI_CHECK) {
1676 JumpIfSmi(obj, fail); 1676 JumpIfSmi(obj, fail);
1677 } 1677 }
1678 ldr(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); 1678 ldr(scratch, FieldMemOperand(obj, HeapObject::kMapOffset));
1679 LoadRoot(ip, index); 1679 LoadRoot(ip, index);
1680 cmp(scratch, ip); 1680 cmp(scratch, ip);
1681 b(ne, fail); 1681 b(ne, fail);
1682 } 1682 }
1683 1683
1684 1684
1685 void MacroAssembler::DispatchMap(Register obj,
1686 Register scratch,
1687 Handle<Map> map,
1688 Handle<Code> success,
1689 SmiCheckType smi_check_type) {
1690 Label fail;
1691 if (smi_check_type == DO_SMI_CHECK) {
1692 JumpIfSmi(obj, &fail);
1693 }
1694 ldr(scratch, FieldMemOperand(obj, HeapObject::kMapOffset));
1695 mov(ip, Operand(map));
1696 cmp(scratch, ip);
1697 Jump(success, RelocInfo::CODE_TARGET, eq);
1698 bind(&fail);
1699 }
1700
1701
1685 void MacroAssembler::TryGetFunctionPrototype(Register function, 1702 void MacroAssembler::TryGetFunctionPrototype(Register function,
1686 Register result, 1703 Register result,
1687 Register scratch, 1704 Register scratch,
1688 Label* miss) { 1705 Label* miss) {
1689 // Check that the receiver isn't a smi. 1706 // Check that the receiver isn't a smi.
1690 JumpIfSmi(function, miss); 1707 JumpIfSmi(function, miss);
1691 1708
1692 // Check that the function really is a function. Load map into result reg. 1709 // Check that the function really is a function. Load map into result reg.
1693 CompareObjectType(function, result, scratch, JS_FUNCTION_TYPE); 1710 CompareObjectType(function, result, scratch, JS_FUNCTION_TYPE);
1694 b(ne, miss); 1711 b(ne, miss);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 bind(&done); 1745 bind(&done);
1729 } 1746 }
1730 1747
1731 1748
1732 void MacroAssembler::CallStub(CodeStub* stub, Condition cond) { 1749 void MacroAssembler::CallStub(CodeStub* stub, Condition cond) {
1733 ASSERT(allow_stub_calls()); // Stub calls are not allowed in some stubs. 1750 ASSERT(allow_stub_calls()); // Stub calls are not allowed in some stubs.
1734 Call(stub->GetCode(), RelocInfo::CODE_TARGET, cond); 1751 Call(stub->GetCode(), RelocInfo::CODE_TARGET, cond);
1735 } 1752 }
1736 1753
1737 1754
1755 MaybeObject* MacroAssembler::TryCallStub(CodeStub* stub, Condition cond) {
1756 ASSERT(allow_stub_calls()); // Stub calls are not allowed in some stubs.
1757 Object* result;
1758 { MaybeObject* maybe_result = stub->TryGetCode();
1759 if (!maybe_result->ToObject(&result)) return maybe_result;
1760 }
1761 Call(Handle<Code>(Code::cast(result)), RelocInfo::CODE_TARGET, cond);
1762 return result;
1763 }
1764
1765
1738 void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) { 1766 void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) {
1739 ASSERT(allow_stub_calls()); // Stub calls are not allowed in some stubs. 1767 ASSERT(allow_stub_calls()); // Stub calls are not allowed in some stubs.
1740 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond); 1768 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond);
1741 } 1769 }
1742 1770
1743 1771
1744 MaybeObject* MacroAssembler::TryTailCallStub(CodeStub* stub, Condition cond) { 1772 MaybeObject* MacroAssembler::TryTailCallStub(CodeStub* stub, Condition cond) {
1745 ASSERT(allow_stub_calls()); // Stub calls are not allowed in some stubs. 1773 ASSERT(allow_stub_calls()); // Stub calls are not allowed in some stubs.
1746 Object* result; 1774 Object* result;
1747 { MaybeObject* maybe_result = stub->TryGetCode(); 1775 { MaybeObject* maybe_result = stub->TryGetCode();
1748 if (!maybe_result->ToObject(&result)) return maybe_result; 1776 if (!maybe_result->ToObject(&result)) return maybe_result;
1749 } 1777 }
1750 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond); 1778 Jump(Handle<Code>(Code::cast(result)), RelocInfo::CODE_TARGET, cond);
1751 return result; 1779 return result;
1752 } 1780 }
1753 1781
1754 1782
1755 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) { 1783 static int AddressOffset(ExternalReference ref0, ExternalReference ref1) {
1756 return ref0.address() - ref1.address(); 1784 return ref0.address() - ref1.address();
1757 } 1785 }
1758 1786
1759 1787
1760 MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn( 1788 MaybeObject* MacroAssembler::TryCallApiFunctionAndReturn(
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
2504 } 2532 }
2505 2533
2506 2534
2507 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function, 2535 void MacroAssembler::LoadGlobalFunctionInitialMap(Register function,
2508 Register map, 2536 Register map,
2509 Register scratch) { 2537 Register scratch) {
2510 // Load the initial map. The global functions all have initial maps. 2538 // Load the initial map. The global functions all have initial maps.
2511 ldr(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); 2539 ldr(map, FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
2512 if (emit_debug_code()) { 2540 if (emit_debug_code()) {
2513 Label ok, fail; 2541 Label ok, fail;
2514 CheckMap(map, scratch, Heap::kMetaMapRootIndex, &fail, false); 2542 CheckMap(map, scratch, Heap::kMetaMapRootIndex, &fail, DO_SMI_CHECK);
2515 b(&ok); 2543 b(&ok);
2516 bind(&fail); 2544 bind(&fail);
2517 Abort("Global functions must have initial map"); 2545 Abort("Global functions must have initial map");
2518 bind(&ok); 2546 bind(&ok);
2519 } 2547 }
2520 } 2548 }
2521 2549
2522 2550
2523 void MacroAssembler::JumpIfNotPowerOfTwoOrZero( 2551 void MacroAssembler::JumpIfNotPowerOfTwoOrZero(
2524 Register reg, 2552 Register reg,
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
3011 // Result was clobbered. Restore it. 3039 // Result was clobbered. Restore it.
3012 ldr(result, MemOperand(ldr_location)); 3040 ldr(result, MemOperand(ldr_location));
3013 } 3041 }
3014 // Get the address of the constant. 3042 // Get the address of the constant.
3015 and_(result, result, Operand(kLdrOffsetMask)); 3043 and_(result, result, Operand(kLdrOffsetMask));
3016 add(result, ldr_location, Operand(result)); 3044 add(result, ldr_location, Operand(result));
3017 add(result, result, Operand(kPCRegOffset)); 3045 add(result, result, Operand(kPCRegOffset));
3018 } 3046 }
3019 3047
3020 3048
3049 void MacroAssembler::ClampUint8(Register output_reg, Register input_reg) {
3050 Usat(output_reg, 8, Operand(input_reg));
3051 }
3052
3053
3054 void MacroAssembler::ClampDoubleToUint8(Register result_reg,
3055 DoubleRegister input_reg,
3056 DoubleRegister temp_double_reg) {
3057 Label above_zero;
3058 Label done;
3059 Label in_bounds;
3060
3061 vmov(temp_double_reg, 0.0);
3062 VFPCompareAndSetFlags(input_reg, temp_double_reg);
3063 b(gt, &above_zero);
3064
3065 // Double value is less than zero, NaN or Inf, return 0.
3066 mov(result_reg, Operand(0));
3067 b(al, &done);
3068
3069 // Double value is >= 255, return 255.
3070 bind(&above_zero);
3071 vmov(temp_double_reg, 255.0);
3072 VFPCompareAndSetFlags(input_reg, temp_double_reg);
3073 b(le, &in_bounds);
3074 mov(result_reg, Operand(255));
3075 b(al, &done);
3076
3077 // In 0-255 range, round and truncate.
3078 bind(&in_bounds);
3079 vmov(temp_double_reg, 0.5);
3080 vadd(temp_double_reg, input_reg, temp_double_reg);
3081 vcvt_u32_f64(s0, temp_double_reg);
3082 vmov(result_reg, s0);
3083 bind(&done);
3084 }
3085
3086
3021 CodePatcher::CodePatcher(byte* address, int instructions) 3087 CodePatcher::CodePatcher(byte* address, int instructions)
3022 : address_(address), 3088 : address_(address),
3023 instructions_(instructions), 3089 instructions_(instructions),
3024 size_(instructions * Assembler::kInstrSize), 3090 size_(instructions * Assembler::kInstrSize),
3025 masm_(Isolate::Current(), address, size_ + Assembler::kGap) { 3091 masm_(Isolate::Current(), address, size_ + Assembler::kGap) {
3026 // Create a new macro assembler pointing to the address of the code to patch. 3092 // Create a new macro assembler pointing to the address of the code to patch.
3027 // The size is adjusted with kGap on order for the assembler to generate size 3093 // The size is adjusted with kGap on order for the assembler to generate size
3028 // bytes of instructions without failing with buffer size constraints. 3094 // bytes of instructions without failing with buffer size constraints.
3029 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 3095 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
3030 } 3096 }
(...skipping 22 matching lines...) Expand all
3053 void CodePatcher::EmitCondition(Condition cond) { 3119 void CodePatcher::EmitCondition(Condition cond) {
3054 Instr instr = Assembler::instr_at(masm_.pc_); 3120 Instr instr = Assembler::instr_at(masm_.pc_);
3055 instr = (instr & ~kCondMask) | cond; 3121 instr = (instr & ~kCondMask) | cond;
3056 masm_.emit(instr); 3122 masm_.emit(instr);
3057 } 3123 }
3058 3124
3059 3125
3060 } } // namespace v8::internal 3126 } } // namespace v8::internal
3061 3127
3062 #endif // V8_TARGET_ARCH_ARM 3128 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/arm/regexp-macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698