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

Side by Side Diff: runtime/vm/stub_code_x64.cc

Issue 10448079: Address review comments in commited cl (issue 10460002). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/assembler_macros.h" 9 #include "vm/assembler_macros.h"
10 #include "vm/code_generator.h" 10 #include "vm/code_generator.h"
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 __ popq(RAX); // Pop result (newly allocated object). 1274 __ popq(RAX); // Pop result (newly allocated object).
1275 // RAX: new object 1275 // RAX: new object
1276 // Restore the frame pointer. 1276 // Restore the frame pointer.
1277 __ LeaveFrame(); 1277 __ LeaveFrame();
1278 __ ret(); 1278 __ ret();
1279 } 1279 }
1280 1280
1281 1281
1282 // Called for inline allocation of closures. 1282 // Called for inline allocation of closures.
1283 // Input parameters: 1283 // Input parameters:
1284 // If the signature class is not parameterized, the receiver, if any, will be 1284 // RSP + 16 : receiver (only if implicit instance closure).
1285 // at RSP + 8 instead of RSP + 16, since no type arguments are passed. 1285 // RSP + 8 : type arguments object (null if class is not parameterized).
1286 // RSP + 16 (or RSP + 8): receiver (only if implicit instance closure).
1287 // RSP + 8 : type arguments object (only if signature class is parameterized).
1288 // RSP : points to return address. 1286 // RSP : points to return address.
1289 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler, 1287 void StubCode::GenerateAllocationStubForClosure(Assembler* assembler,
1290 const Function& func) { 1288 const Function& func) {
1291 const Immediate raw_null = 1289 const Immediate raw_null =
1292 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1290 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1293 ASSERT(func.IsClosureFunction()); 1291 ASSERT(func.IsClosureFunction());
1294 const bool is_implicit_static_closure = 1292 const bool is_implicit_static_closure =
1295 func.IsImplicitStaticClosureFunction(); 1293 func.IsImplicitStaticClosureFunction();
1296 const bool is_implicit_instance_closure = 1294 const bool is_implicit_instance_closure =
1297 func.IsImplicitInstanceClosureFunction(); 1295 func.IsImplicitInstanceClosureFunction();
1298 const Class& cls = Class::ZoneHandle(func.signature_class()); 1296 const Class& cls = Class::ZoneHandle(func.signature_class());
1299 const bool has_type_arguments = cls.HasTypeArguments(); 1297 const bool has_type_arguments = cls.HasTypeArguments();
1300 const intptr_t kTypeArgumentsOffset = 1 * kWordSize; 1298 const intptr_t kTypeArgumentsOffset = 1 * kWordSize;
1301 const intptr_t kReceiverOffset = (has_type_arguments ? 2 : 1) * kWordSize; 1299 const intptr_t kReceiverOffset = 2 * kWordSize;
1302 const intptr_t closure_size = Closure::InstanceSize(); 1300 const intptr_t closure_size = Closure::InstanceSize();
1303 const intptr_t context_size = Context::InstanceSize(1); // Captured receiver. 1301 const intptr_t context_size = Context::InstanceSize(1); // Captured receiver.
1304 if (FLAG_inline_alloc && 1302 if (FLAG_inline_alloc &&
1305 PageSpace::IsPageAllocatableSize(closure_size + context_size)) { 1303 PageSpace::IsPageAllocatableSize(closure_size + context_size)) {
1306 Label slow_case; 1304 Label slow_case;
1307 Heap* heap = Isolate::Current()->heap(); 1305 Heap* heap = Isolate::Current()->heap();
1308 __ movq(RAX, Immediate(heap->TopAddress())); 1306 __ movq(RAX, Immediate(heap->TopAddress()));
1309 __ movq(RAX, Address(RAX, 0)); 1307 __ movq(RAX, Address(RAX, 0));
1310 __ leaq(R13, Address(RAX, closure_size)); 1308 __ leaq(R13, Address(RAX, closure_size));
1311 if (is_implicit_instance_closure) { 1309 if (is_implicit_instance_closure) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1383 __ movq(Address(RBX, Context::variable_offset(0)), R10); 1381 __ movq(Address(RBX, Context::variable_offset(0)), R10);
1384 1382
1385 // Set the newly allocated context in the newly allocated closure. 1383 // Set the newly allocated context in the newly allocated closure.
1386 __ addq(RBX, Immediate(kHeapObjectTag)); 1384 __ addq(RBX, Immediate(kHeapObjectTag));
1387 __ movq(Address(RAX, Closure::context_offset()), RBX); 1385 __ movq(Address(RAX, Closure::context_offset()), RBX);
1388 } else { 1386 } else {
1389 __ movq(Address(RAX, Closure::context_offset()), CTX); 1387 __ movq(Address(RAX, Closure::context_offset()), CTX);
1390 } 1388 }
1391 1389
1392 // Set the type arguments field in the newly allocated closure. 1390 // Set the type arguments field in the newly allocated closure.
1393 if (has_type_arguments) { 1391 __ movq(R10, Address(RSP, kTypeArgumentsOffset));
1394 ASSERT(!is_implicit_static_closure); 1392 __ movq(Address(RAX, Closure::type_arguments_offset()), R10);
1395 // Use the passed-in type arguments.
1396 __ movq(R10, Address(RSP, kTypeArgumentsOffset));
1397 __ movq(Address(RAX, Closure::type_arguments_offset()), R10);
1398 } else {
1399 // Set to null.
1400 __ movq(Address(RAX, Closure::type_arguments_offset()), raw_null);
1401 }
1402 1393
1403 __ movq(Address(RAX, Closure::smrck_offset()), raw_null); 1394 __ movq(Address(RAX, Closure::smrck_offset()), raw_null);
1404 1395
1405 // Done allocating and initializing the instance. 1396 // Done allocating and initializing the instance.
1406 // RAX: new object. 1397 // RAX: new object.
1407 __ addq(RAX, Immediate(kHeapObjectTag)); 1398 __ addq(RAX, Immediate(kHeapObjectTag));
1408 __ ret(); 1399 __ ret();
1409 1400
1410 __ Bind(&slow_case); 1401 __ Bind(&slow_case);
1411 } 1402 }
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
1855 // TOS + 2: instance. 1846 // TOS + 2: instance.
1856 // TOS + 3: cache array. 1847 // TOS + 3: cache array.
1857 // Result in RCX: null -> not found, otherwise result (true or false). 1848 // Result in RCX: null -> not found, otherwise result (true or false).
1858 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) { 1849 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) {
1859 GenerateSubtypeNTestCacheStub(assembler, 3); 1850 GenerateSubtypeNTestCacheStub(assembler, 3);
1860 } 1851 }
1861 1852
1862 } // namespace dart 1853 } // namespace dart
1863 1854
1864 #endif // defined TARGET_ARCH_X64 1855 #endif // defined TARGET_ARCH_X64
OLDNEW
« runtime/vm/intermediate_language_x64.cc ('K') | « runtime/vm/stub_code_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698