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

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

Issue 8664005: Fix slow path for allocation of implicit closures (issue 613). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/code_generator.h" 8 #include "vm/code_generator.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/ic_data.h" 10 #include "vm/ic_data.h"
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 __ movl(ECX, Address(ESP, kTypeArgumentsOffset)); 1347 __ movl(ECX, Address(ESP, kTypeArgumentsOffset));
1348 } 1348 }
1349 if (is_implicit_instance_closure) { 1349 if (is_implicit_instance_closure) {
1350 __ movl(EAX, Address(ESP, kReceiverOffset)); 1350 __ movl(EAX, Address(ESP, kReceiverOffset));
1351 } 1351 }
1352 // Create a stub frame. 1352 // Create a stub frame.
1353 __ EnterFrame(0); 1353 __ EnterFrame(0);
1354 const Closure& new_closure = Closure::ZoneHandle(); 1354 const Closure& new_closure = Closure::ZoneHandle();
1355 __ PushObject(new_closure); // Push Null closure for return value. 1355 __ PushObject(new_closure); // Push Null closure for return value.
1356 __ PushObject(func); 1356 __ PushObject(func);
1357 if (has_type_arguments) {
1358 __ pushl(ECX); // Push type arguments of closure to be allocated.
1359 } else {
1360 __ pushl(raw_null); // Push null type arguments.
1361 }
1362 if (is_implicit_static_closure) { 1357 if (is_implicit_static_closure) {
1363 __ CallRuntimeFromStub(kAllocateImplicitStaticClosureRuntimeEntry); 1358 __ CallRuntimeFromStub(kAllocateImplicitStaticClosureRuntimeEntry);
1364 } else if (is_implicit_instance_closure) {
1365 __ pushl(EAX); // Receiver.
1366 __ CallRuntimeFromStub(kAllocateImplicitInstanceClosureRuntimeEntry);
1367 __ popl(EAX); // Pop receiver.
1368 } else { 1359 } else {
1369 ASSERT(func.IsNonImplicitClosureFunction()); 1360 if (is_implicit_instance_closure) {
1370 __ CallRuntimeFromStub(kAllocateClosureRuntimeEntry); 1361 __ pushl(EAX); // Receiver.
1362 }
1363 if (has_type_arguments) {
1364 __ pushl(ECX); // Push type arguments of closure to be allocated.
1365 } else {
1366 __ pushl(raw_null); // Push null type arguments.
1367 }
1368 if (is_implicit_instance_closure) {
1369 __ CallRuntimeFromStub(kAllocateImplicitInstanceClosureRuntimeEntry);
1370 __ popl(EAX); // Pop argument (type arguments of object).
1371 __ popl(EAX); // Pop receiver.
1372 } else {
1373 ASSERT(func.IsNonImplicitClosureFunction());
1374 __ CallRuntimeFromStub(kAllocateClosureRuntimeEntry);
1375 __ popl(EAX); // Pop argument (type arguments of object).
1376 }
1371 } 1377 }
1372 __ popl(EAX); // Pop argument (type arguments of object).
1373 __ popl(EAX); // Pop function object. 1378 __ popl(EAX); // Pop function object.
1374 __ popl(EAX); 1379 __ popl(EAX);
1375 // EAX: new object 1380 // EAX: new object
1376 // Restore the frame pointer. 1381 // Restore the frame pointer.
1377 __ LeaveFrame(); 1382 __ LeaveFrame();
1378 __ ret(); 1383 __ ret();
1379 } 1384 }
1380 1385
1381 1386
1382 // Called for invoking noSuchMethod function from the entry code of a dart 1387 // Called for invoking noSuchMethod function from the entry code of a dart
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 // EAX: Target function. 1528 // EAX: Target function.
1524 __ movl(EAX, FieldAddress(EAX, Function::code_offset())); 1529 __ movl(EAX, FieldAddress(EAX, Function::code_offset()));
1525 __ movl(EAX, FieldAddress(EAX, Code::instructions_offset())); 1530 __ movl(EAX, FieldAddress(EAX, Code::instructions_offset()));
1526 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); 1531 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
1527 __ jmp(EAX); 1532 __ jmp(EAX);
1528 } 1533 }
1529 1534
1530 } // namespace dart 1535 } // namespace dart
1531 1536
1532 #endif // defined TARGET_ARCH_IA32 1537 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698