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 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 STATIC_ASSERT(initial_capacity >= 0); | 1084 STATIC_ASSERT(initial_capacity >= 0); |
1085 | 1085 |
1086 __ LoadInitialArrayMap(array_function, scratch2, scratch1, false); | 1086 __ LoadInitialArrayMap(array_function, scratch2, scratch1, false); |
1087 | 1087 |
1088 // Allocate the JSArray object together with space for a fixed array with the | 1088 // Allocate the JSArray object together with space for a fixed array with the |
1089 // requested elements. | 1089 // requested elements. |
1090 int size = JSArray::kSize; | 1090 int size = JSArray::kSize; |
1091 if (initial_capacity > 0) { | 1091 if (initial_capacity > 0) { |
1092 size += FixedArray::SizeFor(initial_capacity); | 1092 size += FixedArray::SizeFor(initial_capacity); |
1093 } | 1093 } |
1094 __ AllocateInNewSpace(size, | 1094 __ Allocate(size, result, scratch2, scratch3, gc_required, TAG_OBJECT); |
1095 result, | |
1096 scratch2, | |
1097 scratch3, | |
1098 gc_required, | |
1099 TAG_OBJECT); | |
1100 | 1095 |
1101 // Allocated the JSArray. Now initialize the fields except for the elements | 1096 // Allocated the JSArray. Now initialize the fields except for the elements |
1102 // array. | 1097 // array. |
1103 // result: JSObject | 1098 // result: JSObject |
1104 // scratch1: initial map | 1099 // scratch1: initial map |
1105 // scratch2: start of next object | 1100 // scratch2: start of next object |
1106 Factory* factory = masm->isolate()->factory(); | 1101 Factory* factory = masm->isolate()->factory(); |
1107 __ movq(FieldOperand(result, JSObject::kMapOffset), scratch1); | 1102 __ movq(FieldOperand(result, JSObject::kMapOffset), scratch1); |
1108 __ Move(FieldOperand(result, JSArray::kPropertiesOffset), | 1103 __ Move(FieldOperand(result, JSArray::kPropertiesOffset), |
1109 factory->empty_fixed_array()); | 1104 factory->empty_fixed_array()); |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1612 __ bind(&argument_is_string); | 1607 __ bind(&argument_is_string); |
1613 | 1608 |
1614 // ----------- S t a t e ------------- | 1609 // ----------- S t a t e ------------- |
1615 // -- rbx : argument converted to string | 1610 // -- rbx : argument converted to string |
1616 // -- rdi : constructor function | 1611 // -- rdi : constructor function |
1617 // -- rsp[0] : return address | 1612 // -- rsp[0] : return address |
1618 // ----------------------------------- | 1613 // ----------------------------------- |
1619 | 1614 |
1620 // Allocate a JSValue and put the tagged pointer into rax. | 1615 // Allocate a JSValue and put the tagged pointer into rax. |
1621 Label gc_required; | 1616 Label gc_required; |
1622 __ AllocateInNewSpace(JSValue::kSize, | 1617 __ Allocate(JSValue::kSize, |
1623 rax, // Result. | 1618 rax, // Result. |
1624 rcx, // New allocation top (we ignore it). | 1619 rcx, // New allocation top (we ignore it). |
1625 no_reg, | 1620 no_reg, |
1626 &gc_required, | 1621 &gc_required, |
1627 TAG_OBJECT); | 1622 TAG_OBJECT); |
1628 | 1623 |
1629 // Set the map. | 1624 // Set the map. |
1630 __ LoadGlobalFunctionInitialMap(rdi, rcx); | 1625 __ LoadGlobalFunctionInitialMap(rdi, rcx); |
1631 if (FLAG_debug_code) { | 1626 if (FLAG_debug_code) { |
1632 __ cmpb(FieldOperand(rcx, Map::kInstanceSizeOffset), | 1627 __ cmpb(FieldOperand(rcx, Map::kInstanceSizeOffset), |
1633 Immediate(JSValue::kSize >> kPointerSizeLog2)); | 1628 Immediate(JSValue::kSize >> kPointerSizeLog2)); |
1634 __ Assert(equal, "Unexpected string wrapper instance size"); | 1629 __ Assert(equal, "Unexpected string wrapper instance size"); |
1635 __ cmpb(FieldOperand(rcx, Map::kUnusedPropertyFieldsOffset), Immediate(0)); | 1630 __ cmpb(FieldOperand(rcx, Map::kUnusedPropertyFieldsOffset), Immediate(0)); |
1636 __ Assert(equal, "Unexpected unused properties of string wrapper"); | 1631 __ Assert(equal, "Unexpected unused properties of string wrapper"); |
1637 } | 1632 } |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1875 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1870 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
1876 generator.Generate(); | 1871 generator.Generate(); |
1877 } | 1872 } |
1878 | 1873 |
1879 | 1874 |
1880 #undef __ | 1875 #undef __ |
1881 | 1876 |
1882 } } // namespace v8::internal | 1877 } } // namespace v8::internal |
1883 | 1878 |
1884 #endif // V8_TARGET_ARCH_X64 | 1879 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |