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

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 181543002: Eliminate extended mode, and other modes clean-up (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 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/variables.cc ('k') | src/x64/full-codegen-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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 __ xor_(r8, r8); 1116 __ xor_(r8, r8);
1117 __ testq(rbx, rbx); 1117 __ testq(rbx, rbx);
1118 __ j(zero, &no_parameter_map, Label::kNear); 1118 __ j(zero, &no_parameter_map, Label::kNear);
1119 __ lea(r8, Operand(rbx, times_pointer_size, kParameterMapHeaderSize)); 1119 __ lea(r8, Operand(rbx, times_pointer_size, kParameterMapHeaderSize));
1120 __ bind(&no_parameter_map); 1120 __ bind(&no_parameter_map);
1121 1121
1122 // 2. Backing store. 1122 // 2. Backing store.
1123 __ lea(r8, Operand(r8, rcx, times_pointer_size, FixedArray::kHeaderSize)); 1123 __ lea(r8, Operand(r8, rcx, times_pointer_size, FixedArray::kHeaderSize));
1124 1124
1125 // 3. Arguments object. 1125 // 3. Arguments object.
1126 __ addq(r8, Immediate(Heap::kArgumentsObjectSize)); 1126 __ addq(r8, Immediate(Heap::kSloppyArgumentsObjectSize));
1127 1127
1128 // Do the allocation of all three objects in one go. 1128 // Do the allocation of all three objects in one go.
1129 __ Allocate(r8, rax, rdx, rdi, &runtime, TAG_OBJECT); 1129 __ Allocate(r8, rax, rdx, rdi, &runtime, TAG_OBJECT);
1130 1130
1131 // rax = address of new object(s) (tagged) 1131 // rax = address of new object(s) (tagged)
1132 // rcx = argument count (untagged) 1132 // rcx = argument count (untagged)
1133 // Get the arguments boilerplate from the current native context into rdi. 1133 // Get the arguments boilerplate from the current native context into rdi.
1134 Label has_mapped_parameters, copy; 1134 Label has_mapped_parameters, copy;
1135 __ movp(rdi, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); 1135 __ movp(rdi, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
1136 __ movp(rdi, FieldOperand(rdi, GlobalObject::kNativeContextOffset)); 1136 __ movp(rdi, FieldOperand(rdi, GlobalObject::kNativeContextOffset));
1137 __ testq(rbx, rbx); 1137 __ testq(rbx, rbx);
1138 __ j(not_zero, &has_mapped_parameters, Label::kNear); 1138 __ j(not_zero, &has_mapped_parameters, Label::kNear);
1139 1139
1140 const int kIndex = Context::ARGUMENTS_BOILERPLATE_INDEX; 1140 const int kIndex = Context::SLOPPY_ARGUMENTS_BOILERPLATE_INDEX;
1141 __ movp(rdi, Operand(rdi, Context::SlotOffset(kIndex))); 1141 __ movp(rdi, Operand(rdi, Context::SlotOffset(kIndex)));
1142 __ jmp(&copy, Label::kNear); 1142 __ jmp(&copy, Label::kNear);
1143 1143
1144 const int kAliasedIndex = Context::ALIASED_ARGUMENTS_BOILERPLATE_INDEX; 1144 const int kAliasedIndex = Context::ALIASED_ARGUMENTS_BOILERPLATE_INDEX;
1145 __ bind(&has_mapped_parameters); 1145 __ bind(&has_mapped_parameters);
1146 __ movp(rdi, Operand(rdi, Context::SlotOffset(kAliasedIndex))); 1146 __ movp(rdi, Operand(rdi, Context::SlotOffset(kAliasedIndex)));
1147 __ bind(&copy); 1147 __ bind(&copy);
1148 1148
1149 // rax = address of new object (tagged) 1149 // rax = address of new object (tagged)
1150 // rbx = mapped parameter count (untagged) 1150 // rbx = mapped parameter count (untagged)
(...skipping 16 matching lines...) Expand all
1167 // Note: rcx is tagged from here on. 1167 // Note: rcx is tagged from here on.
1168 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); 1168 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0);
1169 __ Integer32ToSmi(rcx, rcx); 1169 __ Integer32ToSmi(rcx, rcx);
1170 __ movp(FieldOperand(rax, JSObject::kHeaderSize + 1170 __ movp(FieldOperand(rax, JSObject::kHeaderSize +
1171 Heap::kArgumentsLengthIndex * kPointerSize), 1171 Heap::kArgumentsLengthIndex * kPointerSize),
1172 rcx); 1172 rcx);
1173 1173
1174 // Set up the elements pointer in the allocated arguments object. 1174 // Set up the elements pointer in the allocated arguments object.
1175 // If we allocated a parameter map, edi will point there, otherwise to the 1175 // If we allocated a parameter map, edi will point there, otherwise to the
1176 // backing store. 1176 // backing store.
1177 __ lea(rdi, Operand(rax, Heap::kArgumentsObjectSize)); 1177 __ lea(rdi, Operand(rax, Heap::kSloppyArgumentsObjectSize));
1178 __ movp(FieldOperand(rax, JSObject::kElementsOffset), rdi); 1178 __ movp(FieldOperand(rax, JSObject::kElementsOffset), rdi);
1179 1179
1180 // rax = address of new object (tagged) 1180 // rax = address of new object (tagged)
1181 // rbx = mapped parameter count (untagged) 1181 // rbx = mapped parameter count (untagged)
1182 // rcx = argument count (tagged) 1182 // rcx = argument count (tagged)
1183 // rdi = address of parameter map or backing store (tagged) 1183 // rdi = address of parameter map or backing store (tagged)
1184 1184
1185 // Initialize parameter map. If there are no mapped arguments, we're done. 1185 // Initialize parameter map. If there are no mapped arguments, we're done.
1186 Label skip_parameter_map; 1186 Label skip_parameter_map;
1187 __ testq(rbx, rbx); 1187 __ testq(rbx, rbx);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 __ movp(args.GetArgumentOperand(1), rdx); 1336 __ movp(args.GetArgumentOperand(1), rdx);
1337 1337
1338 // Try the new space allocation. Start out with computing the size of 1338 // Try the new space allocation. Start out with computing the size of
1339 // the arguments object and the elements array. 1339 // the arguments object and the elements array.
1340 Label add_arguments_object; 1340 Label add_arguments_object;
1341 __ bind(&try_allocate); 1341 __ bind(&try_allocate);
1342 __ testq(rcx, rcx); 1342 __ testq(rcx, rcx);
1343 __ j(zero, &add_arguments_object, Label::kNear); 1343 __ j(zero, &add_arguments_object, Label::kNear);
1344 __ lea(rcx, Operand(rcx, times_pointer_size, FixedArray::kHeaderSize)); 1344 __ lea(rcx, Operand(rcx, times_pointer_size, FixedArray::kHeaderSize));
1345 __ bind(&add_arguments_object); 1345 __ bind(&add_arguments_object);
1346 __ addq(rcx, Immediate(Heap::kArgumentsObjectSizeStrict)); 1346 __ addq(rcx, Immediate(Heap::kStrictArgumentsObjectSize));
1347 1347
1348 // Do the allocation of both objects in one go. 1348 // Do the allocation of both objects in one go.
1349 __ Allocate(rcx, rax, rdx, rbx, &runtime, TAG_OBJECT); 1349 __ Allocate(rcx, rax, rdx, rbx, &runtime, TAG_OBJECT);
1350 1350
1351 // Get the arguments boilerplate from the current native context. 1351 // Get the arguments boilerplate from the current native context.
1352 __ movp(rdi, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); 1352 __ movp(rdi, Operand(rsi, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX)));
1353 __ movp(rdi, FieldOperand(rdi, GlobalObject::kNativeContextOffset)); 1353 __ movp(rdi, FieldOperand(rdi, GlobalObject::kNativeContextOffset));
1354 const int offset = 1354 const int offset =
1355 Context::SlotOffset(Context::STRICT_MODE_ARGUMENTS_BOILERPLATE_INDEX); 1355 Context::SlotOffset(Context::STRICT_ARGUMENTS_BOILERPLATE_INDEX);
1356 __ movp(rdi, Operand(rdi, offset)); 1356 __ movp(rdi, Operand(rdi, offset));
1357 1357
1358 // Copy the JS object part. 1358 // Copy the JS object part.
1359 for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) { 1359 for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) {
1360 __ movp(rbx, FieldOperand(rdi, i)); 1360 __ movp(rbx, FieldOperand(rdi, i));
1361 __ movp(FieldOperand(rax, i), rbx); 1361 __ movp(FieldOperand(rax, i), rbx);
1362 } 1362 }
1363 1363
1364 // Get the length (smi tagged) and set that as an in-object property too. 1364 // Get the length (smi tagged) and set that as an in-object property too.
1365 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); 1365 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0);
1366 __ movp(rcx, args.GetArgumentOperand(2)); 1366 __ movp(rcx, args.GetArgumentOperand(2));
1367 __ movp(FieldOperand(rax, JSObject::kHeaderSize + 1367 __ movp(FieldOperand(rax, JSObject::kHeaderSize +
1368 Heap::kArgumentsLengthIndex * kPointerSize), 1368 Heap::kArgumentsLengthIndex * kPointerSize),
1369 rcx); 1369 rcx);
1370 1370
1371 // If there are no actual arguments, we're done. 1371 // If there are no actual arguments, we're done.
1372 Label done; 1372 Label done;
1373 __ testq(rcx, rcx); 1373 __ testq(rcx, rcx);
1374 __ j(zero, &done); 1374 __ j(zero, &done);
1375 1375
1376 // Get the parameters pointer from the stack. 1376 // Get the parameters pointer from the stack.
1377 __ movp(rdx, args.GetArgumentOperand(1)); 1377 __ movp(rdx, args.GetArgumentOperand(1));
1378 1378
1379 // Set up the elements pointer in the allocated arguments object and 1379 // Set up the elements pointer in the allocated arguments object and
1380 // initialize the header in the elements fixed array. 1380 // initialize the header in the elements fixed array.
1381 __ lea(rdi, Operand(rax, Heap::kArgumentsObjectSizeStrict)); 1381 __ lea(rdi, Operand(rax, Heap::kStrictArgumentsObjectSize));
1382 __ movp(FieldOperand(rax, JSObject::kElementsOffset), rdi); 1382 __ movp(FieldOperand(rax, JSObject::kElementsOffset), rdi);
1383 __ LoadRoot(kScratchRegister, Heap::kFixedArrayMapRootIndex); 1383 __ LoadRoot(kScratchRegister, Heap::kFixedArrayMapRootIndex);
1384 __ movp(FieldOperand(rdi, FixedArray::kMapOffset), kScratchRegister); 1384 __ movp(FieldOperand(rdi, FixedArray::kMapOffset), kScratchRegister);
1385 1385
1386 1386
1387 __ movp(FieldOperand(rdi, FixedArray::kLengthOffset), rcx); 1387 __ movp(FieldOperand(rdi, FixedArray::kLengthOffset), rcx);
1388 // Untag the length for the loop below. 1388 // Untag the length for the loop below.
1389 __ SmiToInteger64(rcx, rcx); 1389 __ SmiToInteger64(rcx, rcx);
1390 1390
1391 // Copy the fixed array slots. 1391 // Copy the fixed array slots.
(...skipping 3937 matching lines...) Expand 10 before | Expand all | Expand 10 after
5329 return_value_operand, 5329 return_value_operand,
5330 NULL); 5330 NULL);
5331 } 5331 }
5332 5332
5333 5333
5334 #undef __ 5334 #undef __
5335 5335
5336 } } // namespace v8::internal 5336 } } // namespace v8::internal
5337 5337
5338 #endif // V8_TARGET_ARCH_X64 5338 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/variables.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698