| OLD | NEW |
| 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 // The intrinsic code below is executed before a method has built its frame. | 5 // The intrinsic code below is executed before a method has built its frame. |
| 6 // The return address is on the stack and the arguments below it. | 6 // The return address is on the stack and the arguments below it. |
| 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. | 7 // Registers EDX (arguments descriptor) and ECX (function) must be preserved. |
| 8 // Each intrinsification method returns true if the corresponding | 8 // Each intrinsification method returns true if the corresponding |
| 9 // Dart method was intrinsified. | 9 // Dart method was intrinsified. |
| 10 | 10 |
| 11 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. | 11 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 12 #if defined(TARGET_ARCH_IA32) | 12 #if defined(TARGET_ARCH_IA32) |
| 13 | 13 |
| 14 #include "vm/intrinsifier.h" | 14 #include "vm/intrinsifier.h" |
| 15 | 15 |
| 16 #include "vm/assembler.h" | 16 #include "vm/assembler.h" |
| 17 #include "vm/assembler_macros.h" | 17 #include "vm/assembler_macros.h" |
| 18 #include "vm/object.h" | 18 #include "vm/object.h" |
| 19 #include "vm/object_store.h" | 19 #include "vm/object_store.h" |
| 20 #include "vm/os.h" | 20 #include "vm/os.h" |
| 21 #include "vm/stub_code.h" | 21 #include "vm/stub_code.h" |
| 22 | 22 |
| 23 namespace dart { | 23 namespace dart { |
| 24 | 24 |
| 25 DEFINE_FLAG(bool, intrinsify, true, "Instrinsify when possible"); | 25 DEFINE_FLAG(bool, intrinsify, false, "Instrinsify when possible"); |
| 26 DECLARE_FLAG(bool, enable_type_checks); | 26 DECLARE_FLAG(bool, enable_type_checks); |
| 27 | 27 |
| 28 // List of intrinsics: (class-name, function-name, intrinsification method). | 28 // List of intrinsics: (class-name, function-name, intrinsification method). |
| 29 #define INTRINSIC_LIST(V) \ | 29 #define INTRINSIC_LIST(V) \ |
| 30 V(IntegerImplementation, addFromInteger, Integer_addFromInteger) \ | 30 V(IntegerImplementation, addFromInteger, Integer_addFromInteger) \ |
| 31 V(IntegerImplementation, +, Integer_addFromInteger) \ | 31 V(IntegerImplementation, +, Integer_addFromInteger) \ |
| 32 V(IntegerImplementation, subFromInteger, Integer_subFromInteger) \ | 32 V(IntegerImplementation, subFromInteger, Integer_subFromInteger) \ |
| 33 V(IntegerImplementation, -, Integer_sub) \ | 33 V(IntegerImplementation, -, Integer_sub) \ |
| 34 V(IntegerImplementation, mulFromInteger, Integer_mulFromInteger) \ | 34 V(IntegerImplementation, mulFromInteger, Integer_mulFromInteger) \ |
| 35 V(IntegerImplementation, *, Integer_mulFromInteger) \ | 35 V(IntegerImplementation, *, Integer_mulFromInteger) \ |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 // Initialize the tags. | 131 // Initialize the tags. |
| 132 // EAX: new object start as a tagged pointer. | 132 // EAX: new object start as a tagged pointer. |
| 133 // EBX: new object end address. | 133 // EBX: new object end address. |
| 134 // EDI: allocation size. | 134 // EDI: allocation size. |
| 135 { | 135 { |
| 136 Label size_tag_overflow, done; | 136 Label size_tag_overflow, done; |
| 137 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); | 137 __ cmpl(EDI, Immediate(RawObject::SizeTag::kMaxSizeTag)); |
| 138 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); | 138 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); |
| 139 __ shll(EDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); | 139 __ shll(EDI, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); |
| 140 __ movl(FieldAddress(EAX, Array::tags_offset()), EDI); // Tags. | |
| 141 __ jmp(&done); | 140 __ jmp(&done); |
| 142 | 141 |
| 143 __ Bind(&size_tag_overflow); | 142 __ Bind(&size_tag_overflow); |
| 144 __ movl(FieldAddress(EAX, Array::tags_offset()), Immediate(0)); | 143 __ movl(EDI, Immediate(0)); |
| 145 __ Bind(&done); | 144 __ Bind(&done); |
| 145 |
| 146 __ Unimplemented("intrinsifier_ia32.cc: 144"); |
| 147 __ movl(FieldAddress(EAX, Array::tags_offset()), EDI); // Tags. |
| 146 } | 148 } |
| 147 | 149 |
| 148 // Store class value for array. | 150 // Store class value for array. |
| 149 // EAX: new object start as a tagged pointer. | 151 // EAX: new object start as a tagged pointer. |
| 150 // EBX: new object end address. | 152 // EBX: new object end address. |
| 151 __ movl(EDI, FieldAddress(CTX, Context::isolate_offset())); | 153 __ movl(EDI, FieldAddress(CTX, Context::isolate_offset())); |
| 152 __ movl(EDI, Address(EDI, Isolate::object_store_offset())); | 154 __ movl(EDI, Address(EDI, Isolate::object_store_offset())); |
| 153 __ movl(EDI, Address(EDI, ObjectStore::array_class_offset())); | 155 __ movl(EDI, Address(EDI, ObjectStore::array_class_offset())); |
| 154 __ StoreIntoObject(EAX, FieldAddress(EAX, Array::class_offset()), EDI); | 156 __ StoreIntoObject(EAX, FieldAddress(EAX, Array::class_offset()), EDI); |
| 155 | 157 |
| (...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1289 } \ | 1291 } \ |
| 1290 | 1292 |
| 1291 INTRINSIC_LIST(FIND_INTRINSICS); | 1293 INTRINSIC_LIST(FIND_INTRINSICS); |
| 1292 #undef FIND_INTRINSICS | 1294 #undef FIND_INTRINSICS |
| 1293 return false; | 1295 return false; |
| 1294 } | 1296 } |
| 1295 | 1297 |
| 1296 } // namespace dart | 1298 } // namespace dart |
| 1297 | 1299 |
| 1298 #endif // defined TARGET_ARCH_IA32 | 1300 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |