| OLD | NEW | 
|     1 // Copyright (c) 2013, the Dart project authors.  Please see the AUTHORS file |     1 // Copyright (c) 2013, 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"  // Needed here to get TARGET_ARCH_X64. |     5 #include "vm/globals.h"  // Needed here to get TARGET_ARCH_X64. | 
|     6 #if defined(TARGET_ARCH_X64) |     6 #if defined(TARGET_ARCH_X64) | 
|     7  |     7  | 
|     8 #include "vm/intrinsifier.h" |     8 #include "vm/intrinsifier.h" | 
|     9  |     9  | 
|    10 #include "vm/assembler.h" |    10 #include "vm/assembler.h" | 
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|    69   Label fall_through; |    69   Label fall_through; | 
|    70  |    70  | 
|    71   // Try allocating in new space. |    71   // Try allocating in new space. | 
|    72   const Class& cls = Class::Handle( |    72   const Class& cls = Class::Handle( | 
|    73       Isolate::Current()->object_store()->growable_object_array_class()); |    73       Isolate::Current()->object_store()->growable_object_array_class()); | 
|    74   __ TryAllocate(cls, &fall_through, Assembler::kFarJump, RAX, kNoRegister); |    74   __ TryAllocate(cls, &fall_through, Assembler::kFarJump, RAX, kNoRegister); | 
|    75  |    75  | 
|    76   // Store backing array object in growable array object. |    76   // Store backing array object in growable array object. | 
|    77   __ movq(RCX, Address(RSP, kArrayOffset));  // data argument. |    77   __ movq(RCX, Address(RSP, kArrayOffset));  // data argument. | 
|    78   // RAX is new, no barrier needed. |    78   // RAX is new, no barrier needed. | 
|    79   __ StoreIntoObjectNoBarrier( |    79   __ InitializeFieldNoBarrier( | 
|    80       RAX, |    80       RAX, | 
|    81       FieldAddress(RAX, GrowableObjectArray::data_offset()), |    81       FieldAddress(RAX, GrowableObjectArray::data_offset()), | 
|    82       RCX); |    82       RCX); | 
|    83  |    83  | 
|    84   // RAX: new growable array object start as a tagged pointer. |    84   // RAX: new growable array object start as a tagged pointer. | 
|    85   // Store the type argument field in the growable array object. |    85   // Store the type argument field in the growable array object. | 
|    86   __ movq(RCX, Address(RSP, kTypeArgumentsOffset));  // type argument. |    86   __ movq(RCX, Address(RSP, kTypeArgumentsOffset));  // type argument. | 
|    87   __ StoreIntoObjectNoBarrier( |    87   __ InitializeFieldNoBarrier( | 
|    88       RAX, |    88       RAX, | 
|    89       FieldAddress(RAX, GrowableObjectArray::type_arguments_offset()), |    89       FieldAddress(RAX, GrowableObjectArray::type_arguments_offset()), | 
|    90       RCX); |    90       RCX); | 
|    91  |    91  | 
|    92   // Set the length field in the growable array object to 0. |    92   // Set the length field in the growable array object to 0. | 
|    93   __ ZeroInitSmiField(FieldAddress(RAX, GrowableObjectArray::length_offset())); |    93   __ ZeroInitSmiField(FieldAddress(RAX, GrowableObjectArray::length_offset())); | 
|    94   __ ret();  // returns the newly allocated object in RAX. |    94   __ ret();  // returns the newly allocated object in RAX. | 
|    95  |    95  | 
|    96   __ Bind(&fall_through); |    96   __ Bind(&fall_through); | 
|    97 } |    97 } | 
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   279     __ Bind(&done);                                                            \ |   279     __ Bind(&done);                                                            \ | 
|   280                                                                                \ |   280                                                                                \ | 
|   281     /* Get the class index and insert it into the tags. */                     \ |   281     /* Get the class index and insert it into the tags. */                     \ | 
|   282     __ orq(RDI, Immediate(RawObject::ClassIdTag::encode(cid)));                \ |   282     __ orq(RDI, Immediate(RawObject::ClassIdTag::encode(cid)));                \ | 
|   283     __ movq(FieldAddress(RAX, type_name::tags_offset()), RDI);  /* Tags. */    \ |   283     __ movq(FieldAddress(RAX, type_name::tags_offset()), RDI);  /* Tags. */    \ | 
|   284   }                                                                            \ |   284   }                                                                            \ | 
|   285   /* Set the length field. */                                                  \ |   285   /* Set the length field. */                                                  \ | 
|   286   /* RAX: new object start as a tagged pointer. */                             \ |   286   /* RAX: new object start as a tagged pointer. */                             \ | 
|   287   /* RCX: new object end address. */                                           \ |   287   /* RCX: new object end address. */                                           \ | 
|   288   __ movq(RDI, Address(RSP, kArrayLengthStackOffset));  /* Array length. */    \ |   288   __ movq(RDI, Address(RSP, kArrayLengthStackOffset));  /* Array length. */    \ | 
|   289   __ StoreIntoObjectNoBarrier(RAX,                                             \ |   289   __ InitializeFieldNoBarrier(RAX,                                             \ | 
|   290                               FieldAddress(RAX, type_name::length_offset()),   \ |   290                               FieldAddress(RAX, type_name::length_offset()),   \ | 
|   291                               RDI);                                            \ |   291                               RDI);                                            \ | 
|   292   /* Initialize all array elements to 0. */                                    \ |   292   /* Initialize all array elements to 0. */                                    \ | 
|   293   /* RAX: new object start as a tagged pointer. */                             \ |   293   /* RAX: new object start as a tagged pointer. */                             \ | 
|   294   /* RCX: new object end address. */                                           \ |   294   /* RCX: new object end address. */                                           \ | 
|   295   /* RDI: iterator which initially points to the start of the variable */      \ |   295   /* RDI: iterator which initially points to the start of the variable */      \ | 
|   296   /* RBX: scratch register. */                                                 \ |   296   /* RBX: scratch register. */                                                 \ | 
|   297   /* data area to be initialized. */                                           \ |   297   /* data area to be initialized. */                                           \ | 
|   298   __ xorq(RBX, RBX);  /* Zero. */                                              \ |   298   __ xorq(RBX, RBX);  /* Zero. */                                              \ | 
|   299   __ leaq(RDI, FieldAddress(RAX, sizeof(Raw##type_name)));                     \ |   299   __ leaq(RDI, FieldAddress(RAX, sizeof(Raw##type_name)));                     \ | 
| (...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1771     __ xorq(RDI, RDI); |  1771     __ xorq(RDI, RDI); | 
|  1772     __ Bind(&done); |  1772     __ Bind(&done); | 
|  1773  |  1773  | 
|  1774     // Get the class index and insert it into the tags. |  1774     // Get the class index and insert it into the tags. | 
|  1775     __ orq(RDI, Immediate(RawObject::ClassIdTag::encode(cid))); |  1775     __ orq(RDI, Immediate(RawObject::ClassIdTag::encode(cid))); | 
|  1776     __ movq(FieldAddress(RAX, String::tags_offset()), RDI);  // Tags. |  1776     __ movq(FieldAddress(RAX, String::tags_offset()), RDI);  // Tags. | 
|  1777   } |  1777   } | 
|  1778  |  1778  | 
|  1779   // Set the length field. |  1779   // Set the length field. | 
|  1780   __ popq(RDI); |  1780   __ popq(RDI); | 
|  1781   __ StoreIntoObjectNoBarrier(RAX, |  1781   __ InitializeFieldNoBarrier(RAX, | 
|  1782                               FieldAddress(RAX, String::length_offset()), |  1782                               FieldAddress(RAX, String::length_offset()), | 
|  1783                               RDI); |  1783                               RDI); | 
|  1784   // Clear hash. |  1784   // Clear hash. | 
|  1785   __ ZeroInitSmiField(FieldAddress(RAX, String::hash_offset())); |  1785   __ ZeroInitSmiField(FieldAddress(RAX, String::hash_offset())); | 
|  1786   __ jmp(ok, Assembler::kNearJump); |  1786   __ jmp(ok, Assembler::kNearJump); | 
|  1787  |  1787  | 
|  1788   __ Bind(&pop_and_fail); |  1788   __ Bind(&pop_and_fail); | 
|  1789   __ popq(RDI); |  1789   __ popq(RDI); | 
|  1790   __ jmp(failure); |  1790   __ jmp(failure); | 
|  1791 } |  1791 } | 
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2009   // Set return value to Isolate::current_tag_. |  2009   // Set return value to Isolate::current_tag_. | 
|  2010   __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); |  2010   __ movq(RAX, Address(RBX, Isolate::current_tag_offset())); | 
|  2011   __ ret(); |  2011   __ ret(); | 
|  2012 } |  2012 } | 
|  2013  |  2013  | 
|  2014 #undef __ |  2014 #undef __ | 
|  2015  |  2015  | 
|  2016 }  // namespace dart |  2016 }  // namespace dart | 
|  2017  |  2017  | 
|  2018 #endif  // defined TARGET_ARCH_X64 |  2018 #endif  // defined TARGET_ARCH_X64 | 
| OLD | NEW |