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

Side by Side Diff: src/code-stub-assembler.cc

Issue 2444353002: [stubs] Port KeyedStoreIC_Megamorphic stub to Turbofan (Closed)
Patch Set: rebased Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 #include "src/code-stub-assembler.h" 4 #include "src/code-stub-assembler.h"
5 #include "src/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/frames-inl.h" 6 #include "src/frames-inl.h"
7 #include "src/frames.h" 7 #include "src/frames.h"
8 #include "src/ic/handler-configuration.h" 8 #include "src/ic/handler-configuration.h"
9 #include "src/ic/stub-cache.h" 9 #include "src/ic/stub-cache.h"
10 10
(...skipping 2227 matching lines...) Expand 10 before | Expand all | Expand 10 after
2238 // If size of the allocation for the new capacity doesn't fit in a page 2238 // If size of the allocation for the new capacity doesn't fit in a page
2239 // that we can bump-pointer allocate from, fall back to the runtime. 2239 // that we can bump-pointer allocate from, fall back to the runtime.
2240 int max_size = FixedArrayBase::GetMaxLengthForNewSpaceAllocation(to_kind); 2240 int max_size = FixedArrayBase::GetMaxLengthForNewSpaceAllocation(to_kind);
2241 GotoIf(UintPtrGreaterThanOrEqual(new_capacity, 2241 GotoIf(UintPtrGreaterThanOrEqual(new_capacity,
2242 IntPtrOrSmiConstant(max_size, mode)), 2242 IntPtrOrSmiConstant(max_size, mode)),
2243 bailout); 2243 bailout);
2244 2244
2245 // Allocate the new backing store. 2245 // Allocate the new backing store.
2246 Node* new_elements = AllocateFixedArray(to_kind, new_capacity, mode); 2246 Node* new_elements = AllocateFixedArray(to_kind, new_capacity, mode);
2247 2247
2248 // Fill in the added capacity in the new store with holes.
2249 FillFixedArrayWithValue(to_kind, new_elements, capacity, new_capacity,
2250 Heap::kTheHoleValueRootIndex, mode);
2251
2252 // Copy the elements from the old elements store to the new. 2248 // Copy the elements from the old elements store to the new.
2253 // The size-check above guarantees that the |new_elements| is allocated 2249 // The size-check above guarantees that the |new_elements| is allocated
2254 // in new space so we can skip the write barrier. 2250 // in new space so we can skip the write barrier.
2255 CopyFixedArrayElements(from_kind, elements, to_kind, new_elements, capacity, 2251 CopyFixedArrayElements(from_kind, elements, to_kind, new_elements, capacity,
2256 new_capacity, SKIP_WRITE_BARRIER, mode); 2252 new_capacity, SKIP_WRITE_BARRIER, mode);
2257 2253
2258 StoreObjectField(object, JSObject::kElementsOffset, new_elements); 2254 StoreObjectField(object, JSObject::kElementsOffset, new_elements);
2259 Comment("] GrowElementsCapacity"); 2255 Comment("] GrowElementsCapacity");
2260 return new_elements; 2256 return new_elements;
2261 } 2257 }
(...skipping 3009 matching lines...) Expand 10 before | Expand all | Expand 10 after
5271 Bind(&done); 5267 Bind(&done);
5272 return var_intptr_key.value(); 5268 return var_intptr_key.value();
5273 } 5269 }
5274 5270
5275 void CodeStubAssembler::EmitFastElementsBoundsCheck(Node* object, 5271 void CodeStubAssembler::EmitFastElementsBoundsCheck(Node* object,
5276 Node* elements, 5272 Node* elements,
5277 Node* intptr_index, 5273 Node* intptr_index,
5278 Node* is_jsarray_condition, 5274 Node* is_jsarray_condition,
5279 Label* miss) { 5275 Label* miss) {
5280 Variable var_length(this, MachineType::PointerRepresentation()); 5276 Variable var_length(this, MachineType::PointerRepresentation());
5277 Comment("Fast elements bounds check");
5281 Label if_array(this), length_loaded(this, &var_length); 5278 Label if_array(this), length_loaded(this, &var_length);
5282 GotoIf(is_jsarray_condition, &if_array); 5279 GotoIf(is_jsarray_condition, &if_array);
5283 { 5280 {
5284 var_length.Bind(SmiUntag(LoadFixedArrayBaseLength(elements))); 5281 var_length.Bind(SmiUntag(LoadFixedArrayBaseLength(elements)));
5285 Goto(&length_loaded); 5282 Goto(&length_loaded);
5286 } 5283 }
5287 Bind(&if_array); 5284 Bind(&if_array);
5288 { 5285 {
5289 var_length.Bind(SmiUntag(LoadJSArrayLength(object))); 5286 var_length.Bind(SmiUntag(LoadJSArrayLength(object)));
5290 Goto(&length_loaded); 5287 Goto(&length_loaded);
5291 } 5288 }
5292 Bind(&length_loaded); 5289 Bind(&length_loaded);
5293 GotoUnless(UintPtrLessThan(intptr_index, var_length.value()), miss); 5290 GotoUnless(UintPtrLessThan(intptr_index, var_length.value()), miss);
5294 } 5291 }
5295 5292
5296 void CodeStubAssembler::EmitElementLoad(Node* object, Node* elements, 5293 void CodeStubAssembler::EmitElementLoad(Node* object, Node* elements,
5297 Node* elements_kind, Node* intptr_index, 5294 Node* elements_kind, Node* intptr_index,
5298 Node* is_jsarray_condition, 5295 Node* is_jsarray_condition,
5299 Label* if_hole, Label* rebox_double, 5296 Label* if_hole, Label* rebox_double,
5300 Variable* var_double_value, 5297 Variable* var_double_value,
5301 Label* unimplemented_elements_kind, 5298 Label* unimplemented_elements_kind,
5302 Label* out_of_bounds, Label* miss) { 5299 Label* out_of_bounds, Label* miss) {
5303 Label if_typed_array(this), if_fast_packed(this), if_fast_holey(this), 5300 Label if_typed_array(this), if_fast_packed(this), if_fast_holey(this),
5304 if_fast_double(this), if_fast_holey_double(this), if_nonfast(this), 5301 if_fast_double(this), if_fast_holey_double(this), if_nonfast(this),
5305 if_dictionary(this), unreachable(this); 5302 if_dictionary(this);
5306 GotoIf( 5303 GotoIf(
5307 IntPtrGreaterThan(elements_kind, IntPtrConstant(LAST_FAST_ELEMENTS_KIND)), 5304 IntPtrGreaterThan(elements_kind, IntPtrConstant(LAST_FAST_ELEMENTS_KIND)),
5308 &if_nonfast); 5305 &if_nonfast);
5309 5306
5310 EmitFastElementsBoundsCheck(object, elements, intptr_index, 5307 EmitFastElementsBoundsCheck(object, elements, intptr_index,
5311 is_jsarray_condition, out_of_bounds); 5308 is_jsarray_condition, out_of_bounds);
5312 int32_t kinds[] = {// Handled by if_fast_packed. 5309 int32_t kinds[] = {// Handled by if_fast_packed.
5313 FAST_SMI_ELEMENTS, FAST_ELEMENTS, 5310 FAST_SMI_ELEMENTS, FAST_ELEMENTS,
5314 // Handled by if_fast_holey. 5311 // Handled by if_fast_holey.
5315 FAST_HOLEY_SMI_ELEMENTS, FAST_HOLEY_ELEMENTS, 5312 FAST_HOLEY_SMI_ELEMENTS, FAST_HOLEY_ELEMENTS,
(...skipping 3597 matching lines...) Expand 10 before | Expand all | Expand 10 after
8913 } 8910 }
8914 8911
8915 void CodeStubArguments::PopAndReturn(compiler::Node* value) { 8912 void CodeStubArguments::PopAndReturn(compiler::Node* value) {
8916 assembler_->PopAndReturn( 8913 assembler_->PopAndReturn(
8917 assembler_->IntPtrAddFoldConstants(argc_, assembler_->IntPtrConstant(1)), 8914 assembler_->IntPtrAddFoldConstants(argc_, assembler_->IntPtrConstant(1)),
8918 value); 8915 value);
8919 } 8916 }
8920 8917
8921 } // namespace internal 8918 } // namespace internal
8922 } // namespace v8 8919 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stub-assembler.h ('k') | src/ic/ic.cc » ('j') | src/ic/keyed-store-generic.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698