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

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

Issue 6606006: [Isolates] Merge 6500:6700 from bleeding_edge to isolates. (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/macro-assembler-x64.h ('k') | src/x64/stub-cache-x64.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 void MacroAssembler::PushRoot(Heap::RootListIndex index) { 61 void MacroAssembler::PushRoot(Heap::RootListIndex index) {
62 push(Operand(kRootRegister, index << kPointerSizeLog2)); 62 push(Operand(kRootRegister, index << kPointerSizeLog2));
63 } 63 }
64 64
65 65
66 void MacroAssembler::CompareRoot(Register with, Heap::RootListIndex index) { 66 void MacroAssembler::CompareRoot(Register with, Heap::RootListIndex index) {
67 cmpq(with, Operand(kRootRegister, index << kPointerSizeLog2)); 67 cmpq(with, Operand(kRootRegister, index << kPointerSizeLog2));
68 } 68 }
69 69
70 70
71 void MacroAssembler::CompareRoot(Operand with, Heap::RootListIndex index) { 71 void MacroAssembler::CompareRoot(const Operand& with,
72 Heap::RootListIndex index) {
73 ASSERT(!with.AddressUsesRegister(kScratchRegister));
72 LoadRoot(kScratchRegister, index); 74 LoadRoot(kScratchRegister, index);
73 cmpq(with, kScratchRegister); 75 cmpq(with, kScratchRegister);
74 } 76 }
75 77
76 78
77 void MacroAssembler::RecordWriteHelper(Register object, 79 void MacroAssembler::RecordWriteHelper(Register object,
78 Register addr, 80 Register addr,
79 Register scratch) { 81 Register scratch) {
80 if (FLAG_debug_code) { 82 if (FLAG_debug_code) {
81 // Check that the object is not in new space. 83 // Check that the object is not in new space.
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 // Remove the remaining fields. 1540 // Remove the remaining fields.
1539 addq(rsp, Immediate(StackHandlerConstants::kSize - kPointerSize)); 1541 addq(rsp, Immediate(StackHandlerConstants::kSize - kPointerSize));
1540 } 1542 }
1541 1543
1542 1544
1543 void MacroAssembler::Ret() { 1545 void MacroAssembler::Ret() {
1544 ret(0); 1546 ret(0);
1545 } 1547 }
1546 1548
1547 1549
1550 void MacroAssembler::Ret(int bytes_dropped, Register scratch) {
1551 if (is_uint16(bytes_dropped)) {
1552 ret(bytes_dropped);
1553 } else {
1554 pop(scratch);
1555 addq(rsp, Immediate(bytes_dropped));
1556 push(scratch);
1557 ret(0);
1558 }
1559 }
1560
1561
1548 void MacroAssembler::FCmp() { 1562 void MacroAssembler::FCmp() {
1549 fucomip(); 1563 fucomip();
1550 fstp(0); 1564 fstp(0);
1551 } 1565 }
1552 1566
1553 1567
1554 void MacroAssembler::CmpObjectType(Register heap_object, 1568 void MacroAssembler::CmpObjectType(Register heap_object,
1555 InstanceType type, 1569 InstanceType type,
1556 Register map) { 1570 Register map) {
1557 movq(map, FieldOperand(heap_object, HeapObject::kMapOffset)); 1571 movq(map, FieldOperand(heap_object, HeapObject::kMapOffset));
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1769 1783
1770 1784
1771 void MacroAssembler::InvokeFunction(JSFunction* function, 1785 void MacroAssembler::InvokeFunction(JSFunction* function,
1772 const ParameterCount& actual, 1786 const ParameterCount& actual,
1773 InvokeFlag flag) { 1787 InvokeFlag flag) {
1774 ASSERT(function->is_compiled()); 1788 ASSERT(function->is_compiled());
1775 // Get the function and setup the context. 1789 // Get the function and setup the context.
1776 Move(rdi, Handle<JSFunction>(function)); 1790 Move(rdi, Handle<JSFunction>(function));
1777 movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); 1791 movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset));
1778 1792
1779 // Invoke the cached code. 1793 if (V8::UseCrankshaft()) {
1780 Handle<Code> code(function->code()); 1794 // Since Crankshaft can recompile a function, we need to load
1781 ParameterCount expected(function->shared()->formal_parameter_count()); 1795 // the Code object every time we call the function.
1782 InvokeCode(code, expected, actual, RelocInfo::CODE_TARGET, flag); 1796 movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset));
1797 ParameterCount expected(function->shared()->formal_parameter_count());
1798 InvokeCode(rdx, expected, actual, flag);
1799 } else {
1800 // Invoke the cached code.
1801 Handle<Code> code(function->code());
1802 ParameterCount expected(function->shared()->formal_parameter_count());
1803 InvokeCode(code, expected, actual, RelocInfo::CODE_TARGET, flag);
1804 }
1783 } 1805 }
1784 1806
1785 1807
1786 void MacroAssembler::EnterFrame(StackFrame::Type type) { 1808 void MacroAssembler::EnterFrame(StackFrame::Type type) {
1787 push(rbp); 1809 push(rbp);
1788 movq(rbp, rsp); 1810 movq(rbp, rsp);
1789 push(rsi); // Context. 1811 push(rsi); // Context.
1790 Push(Smi::FromInt(type)); 1812 Push(Smi::FromInt(type));
1791 movq(kScratchRegister, CodeObject(), RelocInfo::EMBEDDED_OBJECT); 1813 movq(kScratchRegister, CodeObject(), RelocInfo::EMBEDDED_OBJECT);
1792 push(kScratchRegister); 1814 push(kScratchRegister);
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
2087 2109
2088 // Load address of new object into result. 2110 // Load address of new object into result.
2089 LoadAllocationTopHelper(result, scratch, flags); 2111 LoadAllocationTopHelper(result, scratch, flags);
2090 2112
2091 // Calculate new top and bail out if new space is exhausted. 2113 // Calculate new top and bail out if new space is exhausted.
2092 ExternalReference new_space_allocation_limit = 2114 ExternalReference new_space_allocation_limit =
2093 ExternalReference::new_space_allocation_limit_address(); 2115 ExternalReference::new_space_allocation_limit_address();
2094 2116
2095 Register top_reg = result_end.is_valid() ? result_end : result; 2117 Register top_reg = result_end.is_valid() ? result_end : result;
2096 2118
2097 if (top_reg.is(result)) { 2119 if (!top_reg.is(result)) {
2098 addq(top_reg, Immediate(object_size)); 2120 movq(top_reg, result);
2099 } else {
2100 lea(top_reg, Operand(result, object_size));
2101 } 2121 }
2122 addq(top_reg, Immediate(object_size));
2123 j(carry, gc_required);
2102 movq(kScratchRegister, new_space_allocation_limit); 2124 movq(kScratchRegister, new_space_allocation_limit);
2103 cmpq(top_reg, Operand(kScratchRegister, 0)); 2125 cmpq(top_reg, Operand(kScratchRegister, 0));
2104 j(above, gc_required); 2126 j(above, gc_required);
2105 2127
2106 // Update allocation top. 2128 // Update allocation top.
2107 UpdateAllocationTopHelper(top_reg, scratch); 2129 UpdateAllocationTopHelper(top_reg, scratch);
2108 2130
2109 if (top_reg.is(result)) { 2131 if (top_reg.is(result)) {
2110 if ((flags & TAG_OBJECT) != 0) { 2132 if ((flags & TAG_OBJECT) != 0) {
2111 subq(result, Immediate(object_size - kHeapObjectTag)); 2133 subq(result, Immediate(object_size - kHeapObjectTag));
(...skipping 29 matching lines...) Expand all
2141 return; 2163 return;
2142 } 2164 }
2143 ASSERT(!result.is(result_end)); 2165 ASSERT(!result.is(result_end));
2144 2166
2145 // Load address of new object into result. 2167 // Load address of new object into result.
2146 LoadAllocationTopHelper(result, scratch, flags); 2168 LoadAllocationTopHelper(result, scratch, flags);
2147 2169
2148 // Calculate new top and bail out if new space is exhausted. 2170 // Calculate new top and bail out if new space is exhausted.
2149 ExternalReference new_space_allocation_limit = 2171 ExternalReference new_space_allocation_limit =
2150 ExternalReference::new_space_allocation_limit_address(); 2172 ExternalReference::new_space_allocation_limit_address();
2151 lea(result_end, Operand(result, element_count, element_size, header_size)); 2173
2174 // We assume that element_count*element_size + header_size does not
2175 // overflow.
2176 lea(result_end, Operand(element_count, element_size, header_size));
2177 addq(result_end, result);
2178 j(carry, gc_required);
2152 movq(kScratchRegister, new_space_allocation_limit); 2179 movq(kScratchRegister, new_space_allocation_limit);
2153 cmpq(result_end, Operand(kScratchRegister, 0)); 2180 cmpq(result_end, Operand(kScratchRegister, 0));
2154 j(above, gc_required); 2181 j(above, gc_required);
2155 2182
2156 // Update allocation top. 2183 // Update allocation top.
2157 UpdateAllocationTopHelper(result_end, scratch); 2184 UpdateAllocationTopHelper(result_end, scratch);
2158 2185
2159 // Tag the result if requested. 2186 // Tag the result if requested.
2160 if ((flags & TAG_OBJECT) != 0) { 2187 if ((flags & TAG_OBJECT) != 0) {
2161 addq(result, Immediate(kHeapObjectTag)); 2188 addq(result, Immediate(kHeapObjectTag));
(...skipping 25 matching lines...) Expand all
2187 // Load address of new object into result. 2214 // Load address of new object into result.
2188 LoadAllocationTopHelper(result, scratch, flags); 2215 LoadAllocationTopHelper(result, scratch, flags);
2189 2216
2190 // Calculate new top and bail out if new space is exhausted. 2217 // Calculate new top and bail out if new space is exhausted.
2191 ExternalReference new_space_allocation_limit = 2218 ExternalReference new_space_allocation_limit =
2192 ExternalReference::new_space_allocation_limit_address(); 2219 ExternalReference::new_space_allocation_limit_address();
2193 if (!object_size.is(result_end)) { 2220 if (!object_size.is(result_end)) {
2194 movq(result_end, object_size); 2221 movq(result_end, object_size);
2195 } 2222 }
2196 addq(result_end, result); 2223 addq(result_end, result);
2224 j(carry, gc_required);
2197 movq(kScratchRegister, new_space_allocation_limit); 2225 movq(kScratchRegister, new_space_allocation_limit);
2198 cmpq(result_end, Operand(kScratchRegister, 0)); 2226 cmpq(result_end, Operand(kScratchRegister, 0));
2199 j(above, gc_required); 2227 j(above, gc_required);
2200 2228
2201 // Update allocation top. 2229 // Update allocation top.
2202 UpdateAllocationTopHelper(result_end, scratch); 2230 UpdateAllocationTopHelper(result_end, scratch);
2203 2231
2204 // Tag the result if requested. 2232 // Tag the result if requested.
2205 if ((flags & TAG_OBJECT) != 0) { 2233 if ((flags & TAG_OBJECT) != 0) {
2206 addq(result, Immediate(kHeapObjectTag)); 2234 addq(result, Immediate(kHeapObjectTag));
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
2497 CPU::FlushICache(address_, size_); 2525 CPU::FlushICache(address_, size_);
2498 2526
2499 // Check that the code was patched as expected. 2527 // Check that the code was patched as expected.
2500 ASSERT(masm_.pc_ == address_ + size_); 2528 ASSERT(masm_.pc_ == address_ + size_);
2501 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2529 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2502 } 2530 }
2503 2531
2504 } } // namespace v8::internal 2532 } } // namespace v8::internal
2505 2533
2506 #endif // V8_TARGET_ARCH_X64 2534 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698