| OLD | NEW | 
|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. | 
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without | 
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are | 
| 4 // met: | 4 // met: | 
| 5 // | 5 // | 
| 6 //     * Redistributions of source code must retain the above copyright | 6 //     * Redistributions of source code must retain the above copyright | 
| 7 //       notice, this list of conditions and the following disclaimer. | 7 //       notice, this list of conditions and the following disclaimer. | 
| 8 //     * Redistributions in binary form must reproduce the above | 8 //     * Redistributions in binary form must reproduce the above | 
| 9 //       copyright notice, this list of conditions and the following | 9 //       copyright notice, this list of conditions and the following | 
| 10 //       disclaimer in the documentation and/or other materials provided | 10 //       disclaimer in the documentation and/or other materials provided | 
| (...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1000 static void AllocateEmptyJSArray(MacroAssembler* masm, | 1000 static void AllocateEmptyJSArray(MacroAssembler* masm, | 
| 1001                                  Register array_function, | 1001                                  Register array_function, | 
| 1002                                  Register result, | 1002                                  Register result, | 
| 1003                                  Register scratch1, | 1003                                  Register scratch1, | 
| 1004                                  Register scratch2, | 1004                                  Register scratch2, | 
| 1005                                  Register scratch3, | 1005                                  Register scratch3, | 
| 1006                                  Label* gc_required) { | 1006                                  Label* gc_required) { | 
| 1007   const int initial_capacity = JSArray::kPreallocatedArrayElements; | 1007   const int initial_capacity = JSArray::kPreallocatedArrayElements; | 
| 1008   STATIC_ASSERT(initial_capacity >= 0); | 1008   STATIC_ASSERT(initial_capacity >= 0); | 
| 1009 | 1009 | 
| 1010   // Load the initial map from the array function. | 1010   __ LoadGlobalInitialConstructedArrayMap(array_function, scratch2, scratch1); | 
| 1011   __ movq(scratch1, FieldOperand(array_function, |  | 
| 1012                                  JSFunction::kPrototypeOrInitialMapOffset)); |  | 
| 1013 | 1011 | 
| 1014   // Allocate the JSArray object together with space for a fixed array with the | 1012   // Allocate the JSArray object together with space for a fixed array with the | 
| 1015   // requested elements. | 1013   // requested elements. | 
| 1016   int size = JSArray::kSize; | 1014   int size = JSArray::kSize; | 
| 1017   if (initial_capacity > 0) { | 1015   if (initial_capacity > 0) { | 
| 1018     size += FixedArray::SizeFor(initial_capacity); | 1016     size += FixedArray::SizeFor(initial_capacity); | 
| 1019   } | 1017   } | 
| 1020   __ AllocateInNewSpace(size, | 1018   __ AllocateInNewSpace(size, | 
| 1021                         result, | 1019                         result, | 
| 1022                         scratch2, | 1020                         scratch2, | 
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1101 // register elements_array is scratched. | 1099 // register elements_array is scratched. | 
| 1102 static void AllocateJSArray(MacroAssembler* masm, | 1100 static void AllocateJSArray(MacroAssembler* masm, | 
| 1103                             Register array_function,  // Array function. | 1101                             Register array_function,  // Array function. | 
| 1104                             Register array_size,  // As a smi, cannot be 0. | 1102                             Register array_size,  // As a smi, cannot be 0. | 
| 1105                             Register result, | 1103                             Register result, | 
| 1106                             Register elements_array, | 1104                             Register elements_array, | 
| 1107                             Register elements_array_end, | 1105                             Register elements_array_end, | 
| 1108                             Register scratch, | 1106                             Register scratch, | 
| 1109                             bool fill_with_hole, | 1107                             bool fill_with_hole, | 
| 1110                             Label* gc_required) { | 1108                             Label* gc_required) { | 
| 1111   // Load the initial map from the array function. | 1109   __ LoadGlobalInitialConstructedArrayMap(array_function, | 
| 1112   __ movq(elements_array, | 1110                                           scratch, | 
| 1113           FieldOperand(array_function, | 1111                                           elements_array); | 
| 1114                        JSFunction::kPrototypeOrInitialMapOffset)); |  | 
| 1115 | 1112 | 
| 1116   if (FLAG_debug_code) {  // Assert that array size is not zero. | 1113   if (FLAG_debug_code) {  // Assert that array size is not zero. | 
| 1117     __ testq(array_size, array_size); | 1114     __ testq(array_size, array_size); | 
| 1118     __ Assert(not_zero, "array size is unexpectedly 0"); | 1115     __ Assert(not_zero, "array size is unexpectedly 0"); | 
| 1119   } | 1116   } | 
| 1120 | 1117 | 
| 1121   // Allocate the JSArray object together with space for a FixedArray with the | 1118   // Allocate the JSArray object together with space for a FixedArray with the | 
| 1122   // requested elements. | 1119   // requested elements. | 
| 1123   SmiIndex index = | 1120   SmiIndex index = | 
| 1124       masm->SmiToIndex(kScratchRegister, array_size, kPointerSizeLog2); | 1121       masm->SmiToIndex(kScratchRegister, array_size, kPointerSizeLog2); | 
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1616   Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1613   Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 
| 1617   generator.Generate(); | 1614   generator.Generate(); | 
| 1618 } | 1615 } | 
| 1619 | 1616 | 
| 1620 | 1617 | 
| 1621 #undef __ | 1618 #undef __ | 
| 1622 | 1619 | 
| 1623 } }  // namespace v8::internal | 1620 } }  // namespace v8::internal | 
| 1624 | 1621 | 
| 1625 #endif  // V8_TARGET_ARCH_X64 | 1622 #endif  // V8_TARGET_ARCH_X64 | 
| OLD | NEW | 
|---|