OLD | NEW |
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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
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/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1369 // Successfully allocated the object, now update top to point to | 1369 // Successfully allocated the object, now update top to point to |
1370 // next object start and initialize the object. | 1370 // next object start and initialize the object. |
1371 __ movl(Address::Absolute(heap->TopAddress()), EBX); | 1371 __ movl(Address::Absolute(heap->TopAddress()), EBX); |
1372 | 1372 |
1373 // EAX: new closure object. | 1373 // EAX: new closure object. |
1374 // ECX: new context object (only if is_implicit_closure). | 1374 // ECX: new context object (only if is_implicit_closure). |
1375 // Set the tags. | 1375 // Set the tags. |
1376 uword tags = 0; | 1376 uword tags = 0; |
1377 tags = RawObject::SizeTag::update(closure_size, tags); | 1377 tags = RawObject::SizeTag::update(closure_size, tags); |
1378 tags = RawObject::ClassIdTag::update(cls.id(), tags); | 1378 tags = RawObject::ClassIdTag::update(cls.id(), tags); |
1379 __ movl(Address(EAX, Closure::tags_offset()), Immediate(tags)); | 1379 __ movl(Address(EAX, Instance::tags_offset()), Immediate(tags)); |
1380 | 1380 |
1381 // Initialize the function field in the object. | 1381 // Initialize the function field in the object. |
1382 // EAX: new closure object. | 1382 // EAX: new closure object. |
1383 // ECX: new context object (only if is_implicit_closure). | 1383 // ECX: new context object (only if is_implicit_closure). |
1384 // EBX: next object start. | 1384 // EBX: next object start. |
1385 __ LoadObject(EDX, func); // Load function of closure to be allocated. | 1385 __ LoadObject(EDX, func); // Load function of closure to be allocated. |
1386 __ movl(Address(EAX, Closure::function_offset()), EDX); | 1386 __ movl(Address(EAX, Closure::function_offset()), EDX); |
1387 | 1387 |
1388 // Setup the context for this closure. | 1388 // Setup the context for this closure. |
1389 if (is_implicit_static_closure) { | 1389 if (is_implicit_static_closure) { |
(...skipping 30 matching lines...) Expand all Loading... |
1420 __ addl(ECX, Immediate(kHeapObjectTag)); | 1420 __ addl(ECX, Immediate(kHeapObjectTag)); |
1421 __ movl(Address(EAX, Closure::context_offset()), ECX); | 1421 __ movl(Address(EAX, Closure::context_offset()), ECX); |
1422 } else { | 1422 } else { |
1423 __ movl(Address(EAX, Closure::context_offset()), CTX); | 1423 __ movl(Address(EAX, Closure::context_offset()), CTX); |
1424 } | 1424 } |
1425 | 1425 |
1426 // Set the type arguments field in the newly allocated closure. | 1426 // Set the type arguments field in the newly allocated closure. |
1427 __ movl(EDX, Address(ESP, kTypeArgumentsOffset)); | 1427 __ movl(EDX, Address(ESP, kTypeArgumentsOffset)); |
1428 __ movl(Address(EAX, Closure::type_arguments_offset()), EDX); | 1428 __ movl(Address(EAX, Closure::type_arguments_offset()), EDX); |
1429 | 1429 |
1430 __ movl(Address(EAX, Closure::smrck_offset()), raw_null); | |
1431 | |
1432 // Done allocating and initializing the instance. | 1430 // Done allocating and initializing the instance. |
1433 // EAX: new object. | 1431 // EAX: new object. |
1434 __ addl(EAX, Immediate(kHeapObjectTag)); | 1432 __ addl(EAX, Immediate(kHeapObjectTag)); |
1435 __ ret(); | 1433 __ ret(); |
1436 | 1434 |
1437 __ Bind(&slow_case); | 1435 __ Bind(&slow_case); |
1438 } | 1436 } |
1439 if (has_type_arguments) { | 1437 if (has_type_arguments) { |
1440 __ movl(ECX, Address(ESP, kTypeArgumentsOffset)); | 1438 __ movl(ECX, Address(ESP, kTypeArgumentsOffset)); |
1441 } | 1439 } |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2052 __ Drop(4); | 2050 __ Drop(4); |
2053 __ LeaveFrame(); | 2051 __ LeaveFrame(); |
2054 | 2052 |
2055 __ jmp(&compute_result, Assembler::kNearJump); | 2053 __ jmp(&compute_result, Assembler::kNearJump); |
2056 } | 2054 } |
2057 | 2055 |
2058 | 2056 |
2059 } // namespace dart | 2057 } // namespace dart |
2060 | 2058 |
2061 #endif // defined TARGET_ARCH_IA32 | 2059 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |