Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: src/hydrogen.cc

Issue 14846017: Becuase of cross-context calls, hydrogen-based Array constructor needs to ensure (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ports, and turned off flag Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 10375 matching lines...) Expand 10 before | Expand all | Expand 10 after
12273 } 12288 }
12274 } 12289 }
12275 12290
12276 #ifdef DEBUG 12291 #ifdef DEBUG
12277 if (graph_ != NULL) graph_->Verify(false); // No full verify. 12292 if (graph_ != NULL) graph_->Verify(false); // No full verify.
12278 if (allocator_ != NULL) allocator_->Verify(); 12293 if (allocator_ != NULL) allocator_->Verify();
12279 #endif 12294 #endif
12280 } 12295 }
12281 12296
12282 } } // namespace v8::internal 12297 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698