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

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

Issue 8725009: More --use_slow_path tests, add that VMOption to two tests. (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
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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 Label slow_case; 633 Label slow_case;
634 const Immediate raw_null = 634 const Immediate raw_null =
635 Immediate(reinterpret_cast<intptr_t>(Object::null())); 635 Immediate(reinterpret_cast<intptr_t>(Object::null()));
636 636
637 if (FLAG_inline_alloc) { 637 if (FLAG_inline_alloc) {
638 // Compute the size to be allocated, it is based on the array length 638 // Compute the size to be allocated, it is based on the array length
639 // and it computed as: 639 // and it computed as:
640 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)). 640 // RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)).
641 // Assert that length is a Smi. 641 // Assert that length is a Smi.
642 __ testl(EDX, Immediate(kSmiTagSize)); 642 __ testl(EDX, Immediate(kSmiTagSize));
643 __ j(NOT_ZERO, &slow_case, Assembler::kNearJump); 643 if (FLAG_use_slow_path) {
644 __ jmp(&slow_case);
645 } else {
646 __ j(NOT_ZERO, &slow_case, Assembler::kNearJump);
647 }
644 __ movl(EDI, FieldAddress(CTX, Context::isolate_offset())); 648 __ movl(EDI, FieldAddress(CTX, Context::isolate_offset()));
645 __ movl(EDI, Address(EDI, Isolate::heap_offset())); 649 __ movl(EDI, Address(EDI, Isolate::heap_offset()));
646 __ movl(EDI, Address(EDI, Heap::new_space_offset())); 650 __ movl(EDI, Address(EDI, Heap::new_space_offset()));
647 651
648 // Calculate and align allocation size. 652 // Calculate and align allocation size.
649 // Load new object start and calculate next object start. 653 // Load new object start and calculate next object start.
650 // ECX: array element type. 654 // ECX: array element type.
651 // EDX: Array length as Smi. 655 // EDX: Array length as Smi.
652 // EDI: Points to new space object. 656 // EDI: Points to new space object.
653 __ movl(EAX, Address(EDI, Scavenger::top_offset())); 657 __ movl(EAX, Address(EDI, Scavenger::top_offset()));
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 968
965 // Now allocate the object. 969 // Now allocate the object.
966 // EDX: number of context variables. 970 // EDX: number of context variables.
967 __ movl(EAX, Address::Absolute(heap->TopAddress())); 971 __ movl(EAX, Address::Absolute(heap->TopAddress()));
968 __ addl(EBX, EAX); 972 __ addl(EBX, EAX);
969 // Check if the allocation fits into the remaining space. 973 // Check if the allocation fits into the remaining space.
970 // EAX: potential new object. 974 // EAX: potential new object.
971 // EBX: potential next object start. 975 // EBX: potential next object start.
972 // EDX: number of context variables. 976 // EDX: number of context variables.
973 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); 977 __ cmpl(EBX, Address::Absolute(heap->EndAddress()));
974 __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump); 978 if (FLAG_use_slow_path) {
979 __ jmp(&slow_case);
980 } else {
981 __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump);
982 }
975 983
976 // Successfully allocated the object, now update top to point to 984 // Successfully allocated the object, now update top to point to
977 // next object start and initialize the object. 985 // next object start and initialize the object.
978 // EAX: new object. 986 // EAX: new object.
979 // EBX: next object start. 987 // EBX: next object start.
980 // EDX: number of context variables. 988 // EDX: number of context variables.
981 __ movl(Address::Absolute(heap->TopAddress()), EBX); 989 __ movl(Address::Absolute(heap->TopAddress()), EBX);
982 __ addl(EAX, Immediate(kHeapObjectTag)); 990 __ addl(EAX, Immediate(kHeapObjectTag));
983 991
984 // Initialize the class field in the context object. 992 // Initialize the class field in the context object.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 __ j(EQUAL, &null_instantiator, Assembler::kNearJump); 1089 __ j(EQUAL, &null_instantiator, Assembler::kNearJump);
1082 __ addl(EBX, Immediate(type_args_size)); 1090 __ addl(EBX, Immediate(type_args_size));
1083 __ Bind(&null_instantiator); 1091 __ Bind(&null_instantiator);
1084 // ECX: potential new object end and, if ECX != EBX, potential new 1092 // ECX: potential new object end and, if ECX != EBX, potential new
1085 // InstantiatedTypeArguments object start. 1093 // InstantiatedTypeArguments object start.
1086 } 1094 }
1087 // Check if the allocation fits into the remaining space. 1095 // Check if the allocation fits into the remaining space.
1088 // EAX: potential new object start. 1096 // EAX: potential new object start.
1089 // EBX: potential next object start. 1097 // EBX: potential next object start.
1090 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); 1098 __ cmpl(EBX, Address::Absolute(heap->EndAddress()));
1091 __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump); 1099 if (FLAG_use_slow_path) {
1100 __ jmp(&slow_case);
1101 } else {
1102 __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump);
1103 }
1092 1104
1093 // Successfully allocated the object(s), now update top to point to 1105 // Successfully allocated the object(s), now update top to point to
1094 // next object start and initialize the object. 1106 // next object start and initialize the object.
1095 __ movl(Address::Absolute(heap->TopAddress()), EBX); 1107 __ movl(Address::Absolute(heap->TopAddress()), EBX);
1096 1108
1097 if (is_cls_parameterized) { 1109 if (is_cls_parameterized) {
1098 // Initialize the type arguments field in the object. 1110 // Initialize the type arguments field in the object.
1099 // EAX: new object start. 1111 // EAX: new object start.
1100 // ECX: potential new object end and, if ECX != EBX, potential new 1112 // ECX: potential new object end and, if ECX != EBX, potential new
1101 // InstantiatedTypeArguments object start. 1113 // InstantiatedTypeArguments object start.
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 if (FLAG_inline_alloc && 1265 if (FLAG_inline_alloc &&
1254 PageSpace::IsPageAllocatableSize(closure_size + context_size)) { 1266 PageSpace::IsPageAllocatableSize(closure_size + context_size)) {
1255 Label slow_case; 1267 Label slow_case;
1256 Heap* heap = Isolate::Current()->heap(); 1268 Heap* heap = Isolate::Current()->heap();
1257 __ movl(EAX, Address::Absolute(heap->TopAddress())); 1269 __ movl(EAX, Address::Absolute(heap->TopAddress()));
1258 __ leal(EBX, Address(EAX, closure_size)); 1270 __ leal(EBX, Address(EAX, closure_size));
1259 if (is_implicit_instance_closure) { 1271 if (is_implicit_instance_closure) {
1260 __ movl(ECX, EBX); // ECX: new context address. 1272 __ movl(ECX, EBX); // ECX: new context address.
1261 __ addl(EBX, Immediate(context_size)); 1273 __ addl(EBX, Immediate(context_size));
1262 } 1274 }
1263 if (FLAG_use_slow_path) {
1264 __ jmp(&slow_case);
1265 }
1266 // Check if the allocation fits into the remaining space. 1275 // Check if the allocation fits into the remaining space.
1267 // EAX: potential new closure object. 1276 // EAX: potential new closure object.
1268 // ECX: potential new context object (only if is_implicit_closure). 1277 // ECX: potential new context object (only if is_implicit_closure).
1269 // EBX: potential next object start. 1278 // EBX: potential next object start.
1270 __ cmpl(EBX, Address::Absolute(heap->EndAddress())); 1279 __ cmpl(EBX, Address::Absolute(heap->EndAddress()));
1271 __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump); 1280 if (FLAG_use_slow_path) {
1281 __ jmp(&slow_case);
1282 } else {
1283 __ j(ABOVE_EQUAL, &slow_case, Assembler::kNearJump);
1284 }
1272 1285
1273 // Successfully allocated the object, now update top to point to 1286 // Successfully allocated the object, now update top to point to
1274 // next object start and initialize the object. 1287 // next object start and initialize the object.
1275 __ movl(Address::Absolute(heap->TopAddress()), EBX); 1288 __ movl(Address::Absolute(heap->TopAddress()), EBX);
1276 1289
1277 // Initialize the class field in the object. 1290 // Initialize the class field in the object.
1278 // EAX: new closure object. 1291 // EAX: new closure object.
1279 // ECX: new context object (only if is_implicit_closure). 1292 // ECX: new context object (only if is_implicit_closure).
1280 __ LoadObject(EDX, cls); // Load signature class of closure. 1293 __ LoadObject(EDX, cls); // Load signature class of closure.
1281 __ movl(Address(EAX, Closure::class_offset()), EDX); 1294 __ movl(Address(EAX, Closure::class_offset()), EDX);
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 // EAX: Target function. 1541 // EAX: Target function.
1529 __ movl(EAX, FieldAddress(EAX, Function::code_offset())); 1542 __ movl(EAX, FieldAddress(EAX, Function::code_offset()));
1530 __ movl(EAX, FieldAddress(EAX, Code::instructions_offset())); 1543 __ movl(EAX, FieldAddress(EAX, Code::instructions_offset()));
1531 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); 1544 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
1532 __ jmp(EAX); 1545 __ jmp(EAX);
1533 } 1546 }
1534 1547
1535 } // namespace dart 1548 } // namespace dart
1536 1549
1537 #endif // defined TARGET_ARCH_IA32 1550 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | tests/language/src/ImplicitClosureTest.dart » ('j') | tests/language/src/ImplicitClosureTest.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698