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

Side by Side Diff: src/x64/stub-cache-x64.cc

Issue 2073018: Reverting r4703. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 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/x64/macro-assembler-x64.cc ('k') | test/cctest/test-heap.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 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 } else { 1108 } else {
1109 // Get the elements array of the object. 1109 // Get the elements array of the object.
1110 __ movq(rbx, FieldOperand(rdx, JSArray::kElementsOffset)); 1110 __ movq(rbx, FieldOperand(rdx, JSArray::kElementsOffset));
1111 1111
1112 // Check that the elements are in fast mode (not dictionary). 1112 // Check that the elements are in fast mode (not dictionary).
1113 __ Cmp(FieldOperand(rbx, HeapObject::kMapOffset), 1113 __ Cmp(FieldOperand(rbx, HeapObject::kMapOffset),
1114 Factory::fixed_array_map()); 1114 Factory::fixed_array_map());
1115 __ j(not_equal, &miss); 1115 __ j(not_equal, &miss);
1116 1116
1117 if (argc == 1) { // Otherwise fall through to call builtin. 1117 if (argc == 1) { // Otherwise fall through to call builtin.
1118 Label call_builtin, exit, with_write_barrier, attempt_to_grow_elements; 1118 Label call_builtin, exit, with_rset_update, attempt_to_grow_elements;
1119 1119
1120 // Get the array's length into rax and calculate new length. 1120 // Get the array's length into rax and calculate new length.
1121 __ movq(rax, FieldOperand(rdx, JSArray::kLengthOffset)); 1121 __ movq(rax, FieldOperand(rdx, JSArray::kLengthOffset));
1122 STATIC_ASSERT(FixedArray::kMaxLength < Smi::kMaxValue); 1122 STATIC_ASSERT(FixedArray::kMaxLength < Smi::kMaxValue);
1123 __ SmiAddConstant(rax, rax, Smi::FromInt(argc)); 1123 __ SmiAddConstant(rax, rax, Smi::FromInt(argc));
1124 1124
1125 // Get the element's length into rcx. 1125 // Get the element's length into rcx.
1126 __ movq(rcx, FieldOperand(rbx, FixedArray::kLengthOffset)); 1126 __ movl(rcx, FieldOperand(rbx, FixedArray::kLengthOffset));
1127 __ Integer32ToSmi(rcx, rcx);
1127 1128
1128 // Check if we could survive without allocation. 1129 // Check if we could survive without allocation.
1129 __ SmiCompare(rax, rcx); 1130 __ SmiCompare(rax, rcx);
1130 __ j(greater, &attempt_to_grow_elements); 1131 __ j(greater, &attempt_to_grow_elements);
1131 1132
1132 // Save new length. 1133 // Save new length.
1133 __ movq(FieldOperand(rdx, JSArray::kLengthOffset), rax); 1134 __ movq(FieldOperand(rdx, JSArray::kLengthOffset), rax);
1134 1135
1135 // Push the element. 1136 // Push the element.
1136 __ movq(rcx, Operand(rsp, argc * kPointerSize)); 1137 __ movq(rcx, Operand(rsp, argc * kPointerSize));
1137 SmiIndex index = 1138 SmiIndex index =
1138 masm()->SmiToIndex(kScratchRegister, rax, times_pointer_size); 1139 masm()->SmiToIndex(kScratchRegister, rax, times_pointer_size);
1139 __ lea(rdx, FieldOperand(rbx, 1140 __ lea(rdx, FieldOperand(rbx,
1140 index.reg, index.scale, 1141 index.reg, index.scale,
1141 FixedArray::kHeaderSize - argc * kPointerSize)); 1142 FixedArray::kHeaderSize - argc * kPointerSize));
1142 __ movq(Operand(rdx, 0), rcx); 1143 __ movq(Operand(rdx, 0), rcx);
1143 1144
1144 // Check if value is a smi. 1145 // Check if value is a smi.
1145 __ JumpIfNotSmi(rcx, &with_write_barrier); 1146 __ JumpIfNotSmi(rcx, &with_rset_update);
1146 1147
1147 __ bind(&exit); 1148 __ bind(&exit);
1148 __ ret((argc + 1) * kPointerSize); 1149 __ ret((argc + 1) * kPointerSize);
1149 1150
1150 __ bind(&with_write_barrier); 1151 __ bind(&with_rset_update);
1151 1152
1152 __ InNewSpace(rbx, rcx, equal, &exit); 1153 __ InNewSpace(rbx, rcx, equal, &exit);
1153 1154
1154 RecordWriteStub stub(rbx, rdx, rcx); 1155 RecordWriteStub stub(rbx, rdx, rcx);
1155 __ CallStub(&stub); 1156 __ CallStub(&stub);
1156 __ ret((argc + 1) * kPointerSize); 1157 __ ret((argc + 1) * kPointerSize);
1157 1158
1158 __ bind(&attempt_to_grow_elements); 1159 __ bind(&attempt_to_grow_elements);
1159 ExternalReference new_space_allocation_top = 1160 ExternalReference new_space_allocation_top =
1160 ExternalReference::new_space_allocation_top_address(); 1161 ExternalReference::new_space_allocation_top_address();
(...skipping 27 matching lines...) Expand all
1188 // ... and fill the rest with holes. 1189 // ... and fill the rest with holes.
1189 __ Move(kScratchRegister, Factory::the_hole_value()); 1190 __ Move(kScratchRegister, Factory::the_hole_value());
1190 for (int i = 1; i < kAllocationDelta; i++) { 1191 for (int i = 1; i < kAllocationDelta; i++) {
1191 __ movq(Operand(rdx, i * kPointerSize), kScratchRegister); 1192 __ movq(Operand(rdx, i * kPointerSize), kScratchRegister);
1192 } 1193 }
1193 1194
1194 // Restore receiver to rdx as finish sequence assumes it's here. 1195 // Restore receiver to rdx as finish sequence assumes it's here.
1195 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); 1196 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize));
1196 1197
1197 // Increment element's and array's sizes. 1198 // Increment element's and array's sizes.
1198 __ SmiAddConstant(FieldOperand(rbx, FixedArray::kLengthOffset), 1199 __ addl(FieldOperand(rbx, FixedArray::kLengthOffset),
1199 Smi::FromInt(kAllocationDelta)); 1200 Immediate(kAllocationDelta));
1200 __ movq(FieldOperand(rdx, JSArray::kLengthOffset), rax); 1201 __ movq(FieldOperand(rdx, JSArray::kLengthOffset), rax);
1201 1202
1202 // Elements are in new space, so write barrier is not required. 1203 // Elements are in new space, so no remembered set updates are necessary.
1203 __ ret((argc + 1) * kPointerSize); 1204 __ ret((argc + 1) * kPointerSize);
1204 1205
1205 __ bind(&call_builtin); 1206 __ bind(&call_builtin);
1206 } 1207 }
1207 1208
1208 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), 1209 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush),
1209 argc + 1, 1210 argc + 1,
1210 1); 1211 1);
1211 } 1212 }
1212 1213
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after
2358 // Return the generated code. 2359 // Return the generated code.
2359 return GetCode(); 2360 return GetCode();
2360 } 2361 }
2361 2362
2362 2363
2363 #undef __ 2364 #undef __
2364 2365
2365 } } // namespace v8::internal 2366 } } // namespace v8::internal
2366 2367
2367 #endif // V8_TARGET_ARCH_X64 2368 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698