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 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 STATIC_ASSERT(initial_capacity >= 0); | 1076 STATIC_ASSERT(initial_capacity >= 0); |
1077 | 1077 |
1078 __ LoadInitialArrayMap(array_function, scratch2, scratch1, false); | 1078 __ LoadInitialArrayMap(array_function, scratch2, scratch1, false); |
1079 | 1079 |
1080 // Allocate the JSArray object together with space for a fixed array with the | 1080 // Allocate the JSArray object together with space for a fixed array with the |
1081 // requested elements. | 1081 // requested elements. |
1082 int size = JSArray::kSize; | 1082 int size = JSArray::kSize; |
1083 if (initial_capacity > 0) { | 1083 if (initial_capacity > 0) { |
1084 size += FixedArray::SizeFor(initial_capacity); | 1084 size += FixedArray::SizeFor(initial_capacity); |
1085 } | 1085 } |
1086 __ AllocateInNewSpace(size, | 1086 __ Allocate(size, result, scratch2, scratch3, gc_required, TAG_OBJECT); |
1087 result, | |
1088 scratch2, | |
1089 scratch3, | |
1090 gc_required, | |
1091 TAG_OBJECT); | |
1092 | 1087 |
1093 // Allocated the JSArray. Now initialize the fields except for the elements | 1088 // Allocated the JSArray. Now initialize the fields except for the elements |
1094 // array. | 1089 // array. |
1095 // result: JSObject | 1090 // result: JSObject |
1096 // scratch1: initial map | 1091 // scratch1: initial map |
1097 // scratch2: start of next object | 1092 // scratch2: start of next object |
1098 Factory* factory = masm->isolate()->factory(); | 1093 Factory* factory = masm->isolate()->factory(); |
1099 __ movq(FieldOperand(result, JSObject::kMapOffset), scratch1); | 1094 __ movq(FieldOperand(result, JSObject::kMapOffset), scratch1); |
1100 __ Move(FieldOperand(result, JSArray::kPropertiesOffset), | 1095 __ Move(FieldOperand(result, JSArray::kPropertiesOffset), |
1101 factory->empty_fixed_array()); | 1096 factory->empty_fixed_array()); |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1572 __ bind(&argument_is_string); | 1567 __ bind(&argument_is_string); |
1573 | 1568 |
1574 // ----------- S t a t e ------------- | 1569 // ----------- S t a t e ------------- |
1575 // -- rbx : argument converted to string | 1570 // -- rbx : argument converted to string |
1576 // -- rdi : constructor function | 1571 // -- rdi : constructor function |
1577 // -- rsp[0] : return address | 1572 // -- rsp[0] : return address |
1578 // ----------------------------------- | 1573 // ----------------------------------- |
1579 | 1574 |
1580 // Allocate a JSValue and put the tagged pointer into rax. | 1575 // Allocate a JSValue and put the tagged pointer into rax. |
1581 Label gc_required; | 1576 Label gc_required; |
1582 __ AllocateInNewSpace(JSValue::kSize, | 1577 __ Allocate(JSValue::kSize, |
1583 rax, // Result. | 1578 rax, // Result. |
1584 rcx, // New allocation top (we ignore it). | 1579 rcx, // New allocation top (we ignore it). |
1585 no_reg, | 1580 no_reg, |
1586 &gc_required, | 1581 &gc_required, |
1587 TAG_OBJECT); | 1582 TAG_OBJECT); |
1588 | 1583 |
1589 // Set the map. | 1584 // Set the map. |
1590 __ LoadGlobalFunctionInitialMap(rdi, rcx); | 1585 __ LoadGlobalFunctionInitialMap(rdi, rcx); |
1591 if (FLAG_debug_code) { | 1586 if (FLAG_debug_code) { |
1592 __ cmpb(FieldOperand(rcx, Map::kInstanceSizeOffset), | 1587 __ cmpb(FieldOperand(rcx, Map::kInstanceSizeOffset), |
1593 Immediate(JSValue::kSize >> kPointerSizeLog2)); | 1588 Immediate(JSValue::kSize >> kPointerSizeLog2)); |
1594 __ Assert(equal, "Unexpected string wrapper instance size"); | 1589 __ Assert(equal, "Unexpected string wrapper instance size"); |
1595 __ cmpb(FieldOperand(rcx, Map::kUnusedPropertyFieldsOffset), Immediate(0)); | 1590 __ cmpb(FieldOperand(rcx, Map::kUnusedPropertyFieldsOffset), Immediate(0)); |
1596 __ Assert(equal, "Unexpected unused properties of string wrapper"); | 1591 __ Assert(equal, "Unexpected unused properties of string wrapper"); |
1597 } | 1592 } |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1835 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1830 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
1836 generator.Generate(); | 1831 generator.Generate(); |
1837 } | 1832 } |
1838 | 1833 |
1839 | 1834 |
1840 #undef __ | 1835 #undef __ |
1841 | 1836 |
1842 } } // namespace v8::internal | 1837 } } // namespace v8::internal |
1843 | 1838 |
1844 #endif // V8_TARGET_ARCH_X64 | 1839 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |