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_ASSERT(initial_capacity >= 0); | 1000 STATIC_ASSERT(initial_capacity >= 0); |
1001 | 1001 |
1002 __ LoadInitialArrayMap(array_function, scratch2, scratch1, false); | 1002 __ LoadInitialArrayMap(array_function, scratch2, scratch1, false); |
1003 | 1003 |
1004 // Allocate the JSArray object together with space for a fixed array with the | 1004 // Allocate the JSArray object together with space for a fixed array with the |
1005 // requested elements. | 1005 // requested elements. |
1006 int size = JSArray::kSize; | 1006 int size = JSArray::kSize; |
1007 if (initial_capacity > 0) { | 1007 if (initial_capacity > 0) { |
1008 size += FixedArray::SizeFor(initial_capacity); | 1008 size += FixedArray::SizeFor(initial_capacity); |
1009 } | 1009 } |
1010 __ AllocateInNewSpace(size, | 1010 __ Allocate(size, result, scratch2, scratch3, gc_required, TAG_OBJECT); |
1011 result, | |
1012 scratch2, | |
1013 scratch3, | |
1014 gc_required, | |
1015 TAG_OBJECT); | |
1016 | 1011 |
1017 // Allocated the JSArray. Now initialize the fields except for the elements | 1012 // Allocated the JSArray. Now initialize the fields except for the elements |
1018 // array. | 1013 // array. |
1019 // result: JSObject | 1014 // result: JSObject |
1020 // scratch1: initial map | 1015 // scratch1: initial map |
1021 // scratch2: start of next object | 1016 // scratch2: start of next object |
1022 __ mov(FieldOperand(result, JSObject::kMapOffset), scratch1); | 1017 __ mov(FieldOperand(result, JSObject::kMapOffset), scratch1); |
1023 Factory* factory = masm->isolate()->factory(); | 1018 Factory* factory = masm->isolate()->factory(); |
1024 __ mov(FieldOperand(result, JSArray::kPropertiesOffset), | 1019 __ mov(FieldOperand(result, JSArray::kPropertiesOffset), |
1025 factory->empty_fixed_array()); | 1020 factory->empty_fixed_array()); |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 __ IncrementCounter(counters->string_ctor_cached_number(), 1); | 1580 __ IncrementCounter(counters->string_ctor_cached_number(), 1); |
1586 __ bind(&argument_is_string); | 1581 __ bind(&argument_is_string); |
1587 // ----------- S t a t e ------------- | 1582 // ----------- S t a t e ------------- |
1588 // -- ebx : argument converted to string | 1583 // -- ebx : argument converted to string |
1589 // -- edi : constructor function | 1584 // -- edi : constructor function |
1590 // -- esp[0] : return address | 1585 // -- esp[0] : return address |
1591 // ----------------------------------- | 1586 // ----------------------------------- |
1592 | 1587 |
1593 // Allocate a JSValue and put the tagged pointer into eax. | 1588 // Allocate a JSValue and put the tagged pointer into eax. |
1594 Label gc_required; | 1589 Label gc_required; |
1595 __ AllocateInNewSpace(JSValue::kSize, | 1590 __ Allocate(JSValue::kSize, |
1596 eax, // Result. | 1591 eax, // Result. |
1597 ecx, // New allocation top (we ignore it). | 1592 ecx, // New allocation top (we ignore it). |
1598 no_reg, | 1593 no_reg, |
1599 &gc_required, | 1594 &gc_required, |
1600 TAG_OBJECT); | 1595 TAG_OBJECT); |
1601 | 1596 |
1602 // Set the map. | 1597 // Set the map. |
1603 __ LoadGlobalFunctionInitialMap(edi, ecx); | 1598 __ LoadGlobalFunctionInitialMap(edi, ecx); |
1604 if (FLAG_debug_code) { | 1599 if (FLAG_debug_code) { |
1605 __ cmpb(FieldOperand(ecx, Map::kInstanceSizeOffset), | 1600 __ cmpb(FieldOperand(ecx, Map::kInstanceSizeOffset), |
1606 JSValue::kSize >> kPointerSizeLog2); | 1601 JSValue::kSize >> kPointerSizeLog2); |
1607 __ Assert(equal, "Unexpected string wrapper instance size"); | 1602 __ Assert(equal, "Unexpected string wrapper instance size"); |
1608 __ cmpb(FieldOperand(ecx, Map::kUnusedPropertyFieldsOffset), 0); | 1603 __ cmpb(FieldOperand(ecx, Map::kUnusedPropertyFieldsOffset), 0); |
1609 __ Assert(equal, "Unexpected unused properties of string wrapper"); | 1604 __ Assert(equal, "Unexpected unused properties of string wrapper"); |
1610 } | 1605 } |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1856 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); | 1851 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
1857 generator.Generate(); | 1852 generator.Generate(); |
1858 } | 1853 } |
1859 | 1854 |
1860 | 1855 |
1861 #undef __ | 1856 #undef __ |
1862 } | 1857 } |
1863 } // namespace v8::internal | 1858 } // namespace v8::internal |
1864 | 1859 |
1865 #endif // V8_TARGET_ARCH_IA32 | 1860 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |