| 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 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1856 AddInstruction(new(zone()) HStoreNamedField(alloc_site, | 1856 AddInstruction(new(zone()) HStoreNamedField(alloc_site, |
| 1857 isolate()->factory()->payload_string(), | 1857 isolate()->factory()->payload_string(), |
| 1858 payload, | 1858 payload, |
| 1859 true, | 1859 true, |
| 1860 Representation::Tagged(), | 1860 Representation::Tagged(), |
| 1861 AllocationSiteInfo::kPayloadOffset)); | 1861 AllocationSiteInfo::kPayloadOffset)); |
| 1862 return alloc_site; | 1862 return alloc_site; |
| 1863 } | 1863 } |
| 1864 | 1864 |
| 1865 | 1865 |
| 1866 HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* context) { |
| 1867 HInstruction* global_object = AddInstruction(new(zone()) |
| 1868 HGlobalObject(context)); |
| 1869 HInstruction* native_context = AddInstruction(new(zone()) |
| 1870 HLoadNamedField(global_object, true, Representation::Tagged(), |
| 1871 GlobalObject::kNativeContextOffset)); |
| 1872 return native_context; |
| 1873 } |
| 1874 |
| 1875 |
| 1876 HInstruction* HGraphBuilder::BuildGetArrayFunction(HValue* context) { |
| 1877 HInstruction* native_context = BuildGetNativeContext(context); |
| 1878 int offset = Context::kHeaderSize + |
| 1879 kPointerSize * Context::ARRAY_FUNCTION_INDEX; |
| 1880 HInstruction* array_function = AddInstruction(new(zone()) |
| 1881 HLoadNamedField(native_context, true, Representation::Tagged(), offset)); |
| 1882 return array_function; |
| 1883 } |
| 1884 |
| 1885 |
| 1866 HGraphBuilder::JSArrayBuilder::JSArrayBuilder(HGraphBuilder* builder, | 1886 HGraphBuilder::JSArrayBuilder::JSArrayBuilder(HGraphBuilder* builder, |
| 1867 ElementsKind kind, | 1887 ElementsKind kind, |
| 1868 HValue* allocation_site_payload, | 1888 HValue* allocation_site_payload, |
| 1869 AllocationSiteMode mode) : | 1889 AllocationSiteMode mode) : |
| 1870 builder_(builder), | 1890 builder_(builder), |
| 1871 kind_(kind), | 1891 kind_(kind), |
| 1872 allocation_site_payload_(allocation_site_payload) { | 1892 allocation_site_payload_(allocation_site_payload) { |
| 1873 if (mode == DONT_TRACK_ALLOCATION_SITE) { | 1893 if (mode == DONT_TRACK_ALLOCATION_SITE) { |
| 1874 mode_ = mode; | 1894 mode_ = mode; |
| 1875 } else { | 1895 } else { |
| 1876 mode_ = AllocationSiteInfo::GetMode(kind); | 1896 mode_ = AllocationSiteInfo::GetMode(kind); |
| 1877 } | 1897 } |
| 1878 } | 1898 } |
| 1879 | 1899 |
| 1880 | 1900 |
| 1881 HValue* HGraphBuilder::JSArrayBuilder::EmitMapCode(HValue* context) { | 1901 HValue* HGraphBuilder::JSArrayBuilder::EmitMapCode(HValue* context) { |
| 1882 // Get the global context, the native context, the map array | 1902 HInstruction* native_context = builder()->BuildGetNativeContext(context); |
| 1883 HInstruction* global_object = AddInstruction(new(zone()) | |
| 1884 HGlobalObject(context)); | |
| 1885 HInstruction* native_context = AddInstruction(new(zone()) | |
| 1886 HLoadNamedField(global_object, true, Representation::Tagged(), | |
| 1887 GlobalObject::kNativeContextOffset)); | |
| 1888 int offset = Context::kHeaderSize + | 1903 int offset = Context::kHeaderSize + |
| 1889 kPointerSize * Context::JS_ARRAY_MAPS_INDEX; | 1904 kPointerSize * Context::JS_ARRAY_MAPS_INDEX; |
| 1890 HInstruction* map_array = AddInstruction(new(zone()) | 1905 HInstruction* map_array = AddInstruction(new(zone()) |
| 1891 HLoadNamedField(native_context, true, Representation::Tagged(), offset)); | 1906 HLoadNamedField(native_context, true, Representation::Tagged(), offset)); |
| 1892 offset = kind_ * kPointerSize + FixedArrayBase::kHeaderSize; | 1907 offset = kind_ * kPointerSize + FixedArrayBase::kHeaderSize; |
| 1893 return AddInstruction(new(zone()) HLoadNamedField( | 1908 return AddInstruction(new(zone()) HLoadNamedField( |
| 1894 map_array, true, Representation::Tagged(), offset)); | 1909 map_array, true, Representation::Tagged(), offset)); |
| 1895 } | 1910 } |
| 1896 | 1911 |
| 1897 | 1912 |
| (...skipping 7738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9636 // argument to the construct call. | 9651 // argument to the construct call. |
| 9637 bool use_call_new_array = FLAG_optimize_constructed_arrays && | 9652 bool use_call_new_array = FLAG_optimize_constructed_arrays && |
| 9638 !(expr->target().is_null()) && | 9653 !(expr->target().is_null()) && |
| 9639 *(expr->target()) == isolate()->global_context()->array_function(); | 9654 *(expr->target()) == isolate()->global_context()->array_function(); |
| 9640 | 9655 |
| 9641 CHECK_ALIVE(VisitArgument(expr->expression())); | 9656 CHECK_ALIVE(VisitArgument(expr->expression())); |
| 9642 HValue* constructor = HPushArgument::cast(Top())->argument(); | 9657 HValue* constructor = HPushArgument::cast(Top())->argument(); |
| 9643 CHECK_ALIVE(VisitArgumentList(expr->arguments())); | 9658 CHECK_ALIVE(VisitArgumentList(expr->arguments())); |
| 9644 HCallNew* call; | 9659 HCallNew* call; |
| 9645 if (use_call_new_array) { | 9660 if (use_call_new_array) { |
| 9646 AddInstruction(new(zone()) HCheckFunction(constructor, | |
| 9647 Handle<JSFunction>(isolate()->global_context()->array_function()))); | |
| 9648 Handle<Object> feedback = oracle()->GetInfo(expr->CallNewFeedbackId()); | |
| 9649 ASSERT(feedback->IsSmi()); | |
| 9650 | |
| 9651 // TODO(mvstanton): It would be better to use the already created global | 9661 // TODO(mvstanton): It would be better to use the already created global |
| 9652 // property cell that is shared by full code gen. That way, any transition | 9662 // property cell that is shared by full code gen. That way, any transition |
| 9653 // information that happened after crankshaft won't be lost. The right | 9663 // information that happened after crankshaft won't be lost. The right |
| 9654 // way to do that is to begin passing the cell to the type feedback oracle | 9664 // way to do that is to begin passing the cell to the type feedback oracle |
| 9655 // instead of just the value in the cell. Do this in a follow-up checkin. | 9665 // instead of just the value in the cell. Do this in a follow-up checkin. |
| 9666 Handle<Object> feedback = oracle()->GetInfo(expr->CallNewFeedbackId()); |
| 9667 ASSERT(feedback->IsSmi()); |
| 9656 Handle<JSGlobalPropertyCell> cell = | 9668 Handle<JSGlobalPropertyCell> cell = |
| 9657 isolate()->factory()->NewJSGlobalPropertyCell(feedback); | 9669 isolate()->factory()->NewJSGlobalPropertyCell(feedback); |
| 9658 | 9670 |
| 9659 // TODO(mvstanton): Here we should probably insert code to check if the | 9671 // TODO(mvstanton): Here we should probably insert code to check if the |
| 9660 // type cell elements kind is different from when we compiled, and deopt | 9672 // type cell elements kind is different from when we compiled, and deopt |
| 9661 // in that case. Do this in a follow-up checin. | 9673 // in that case. Do this in a follow-up checin. |
| 9662 call = new(zone()) HCallNewArray(context, constructor, argument_count, | 9674 call = new(zone()) HCallNewArray(context, constructor, argument_count, |
| 9663 cell); | 9675 cell); |
| 9664 } else { | 9676 } else { |
| 9665 call = new(zone()) HCallNew(context, constructor, argument_count); | 9677 call = new(zone()) HCallNew(context, constructor, argument_count); |
| (...skipping 2607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12273 } | 12285 } |
| 12274 } | 12286 } |
| 12275 | 12287 |
| 12276 #ifdef DEBUG | 12288 #ifdef DEBUG |
| 12277 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 12289 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 12278 if (allocator_ != NULL) allocator_->Verify(); | 12290 if (allocator_ != NULL) allocator_->Verify(); |
| 12279 #endif | 12291 #endif |
| 12280 } | 12292 } |
| 12281 | 12293 |
| 12282 } } // namespace v8::internal | 12294 } } // namespace v8::internal |
| OLD | NEW |