OLD | NEW |
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 5256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5267 | 5267 |
5268 // |handler| is a Smi, encoding what to do. See SmiHandler methods | 5268 // |handler| is a Smi, encoding what to do. See SmiHandler methods |
5269 // for the encoding format. | 5269 // for the encoding format. |
5270 Bind(&if_smi_handler); | 5270 Bind(&if_smi_handler); |
5271 { | 5271 { |
5272 Variable var_double_value(this, MachineRepresentation::kFloat64); | 5272 Variable var_double_value(this, MachineRepresentation::kFloat64); |
5273 Label rebox_double(this, &var_double_value); | 5273 Label rebox_double(this, &var_double_value); |
5274 | 5274 |
5275 Node* holder = var_holder.value(); | 5275 Node* holder = var_holder.value(); |
5276 Node* handler_word = SmiUntag(var_smi_handler.value()); | 5276 Node* handler_word = SmiUntag(var_smi_handler.value()); |
5277 Node* handler_type = DecodeWord<LoadHandlerTypeBits>(handler_word); | 5277 Node* handler_kind = DecodeWord<LoadHandler::KindBits>(handler_word); |
5278 if (support_elements == kSupportElements) { | 5278 if (support_elements == kSupportElements) { |
5279 Label property(this); | 5279 Label property(this); |
5280 GotoUnless( | 5280 GotoUnless( |
5281 WordEqual(handler_type, IntPtrConstant(kLoadICHandlerForElements)), | 5281 WordEqual(handler_kind, IntPtrConstant(LoadHandler::kForElements)), |
5282 &property); | 5282 &property); |
5283 | 5283 |
5284 Comment("element_load"); | 5284 Comment("element_load"); |
5285 Node* intptr_index = TryToIntptr(p->name, miss); | 5285 Node* intptr_index = TryToIntptr(p->name, miss); |
5286 Node* elements = LoadElements(holder); | 5286 Node* elements = LoadElements(holder); |
5287 Node* is_jsarray_condition = IsSetWord<KeyedLoadIsJsArray>(handler_word); | 5287 Node* is_jsarray_condition = |
5288 Node* elements_kind = DecodeWord<KeyedLoadElementsKind>(handler_word); | 5288 IsSetWord<LoadHandler::IsJsArrayBits>(handler_word); |
| 5289 Node* elements_kind = |
| 5290 DecodeWord<LoadHandler::ElementsKindBits>(handler_word); |
5289 Label if_hole(this), unimplemented_elements_kind(this); | 5291 Label if_hole(this), unimplemented_elements_kind(this); |
5290 Label* out_of_bounds = miss; | 5292 Label* out_of_bounds = miss; |
5291 EmitElementLoad(holder, elements, elements_kind, intptr_index, | 5293 EmitElementLoad(holder, elements, elements_kind, intptr_index, |
5292 is_jsarray_condition, &if_hole, &rebox_double, | 5294 is_jsarray_condition, &if_hole, &rebox_double, |
5293 &var_double_value, &unimplemented_elements_kind, | 5295 &var_double_value, &unimplemented_elements_kind, |
5294 out_of_bounds, miss); | 5296 out_of_bounds, miss); |
5295 | 5297 |
5296 Bind(&unimplemented_elements_kind); | 5298 Bind(&unimplemented_elements_kind); |
5297 { | 5299 { |
5298 // Smi handlers should only be installed for supported elements kinds. | 5300 // Smi handlers should only be installed for supported elements kinds. |
5299 // Crash if we get here. | 5301 // Crash if we get here. |
5300 DebugBreak(); | 5302 DebugBreak(); |
5301 Goto(miss); | 5303 Goto(miss); |
5302 } | 5304 } |
5303 | 5305 |
5304 Bind(&if_hole); | 5306 Bind(&if_hole); |
5305 { | 5307 { |
5306 Comment("convert hole"); | 5308 Comment("convert hole"); |
5307 GotoUnless(IsSetWord<KeyedLoadConvertHole>(handler_word), miss); | 5309 GotoUnless(IsSetWord<LoadHandler::ConvertHoleBits>(handler_word), miss); |
5308 Node* protector_cell = LoadRoot(Heap::kArrayProtectorRootIndex); | 5310 Node* protector_cell = LoadRoot(Heap::kArrayProtectorRootIndex); |
5309 DCHECK(isolate()->heap()->array_protector()->IsPropertyCell()); | 5311 DCHECK(isolate()->heap()->array_protector()->IsPropertyCell()); |
5310 GotoUnless( | 5312 GotoUnless( |
5311 WordEqual( | 5313 WordEqual( |
5312 LoadObjectField(protector_cell, PropertyCell::kValueOffset), | 5314 LoadObjectField(protector_cell, PropertyCell::kValueOffset), |
5313 SmiConstant(Smi::FromInt(Isolate::kArrayProtectorValid))), | 5315 SmiConstant(Smi::FromInt(Isolate::kArrayProtectorValid))), |
5314 miss); | 5316 miss); |
5315 Return(UndefinedConstant()); | 5317 Return(UndefinedConstant()); |
5316 } | 5318 } |
5317 | 5319 |
5318 Bind(&property); | 5320 Bind(&property); |
5319 Comment("property_load"); | 5321 Comment("property_load"); |
5320 } | 5322 } |
5321 | 5323 |
5322 Label constant(this), field(this); | 5324 Label constant(this), field(this); |
5323 Branch(WordEqual(handler_type, IntPtrConstant(kLoadICHandlerForFields)), | 5325 Branch(WordEqual(handler_kind, IntPtrConstant(LoadHandler::kForFields)), |
5324 &field, &constant); | 5326 &field, &constant); |
5325 | 5327 |
5326 Bind(&field); | 5328 Bind(&field); |
5327 { | 5329 { |
5328 Comment("field_load"); | 5330 Comment("field_load"); |
5329 Node* offset = DecodeWord<FieldOffsetOffset>(handler_word); | 5331 Node* offset = DecodeWord<LoadHandler::FieldOffsetBits>(handler_word); |
5330 | 5332 |
5331 Label inobject(this), out_of_object(this); | 5333 Label inobject(this), out_of_object(this); |
5332 Branch(IsSetWord<FieldOffsetIsInobject>(handler_word), &inobject, | 5334 Branch(IsSetWord<LoadHandler::IsInobjectBits>(handler_word), &inobject, |
5333 &out_of_object); | 5335 &out_of_object); |
5334 | 5336 |
5335 Bind(&inobject); | 5337 Bind(&inobject); |
5336 { | 5338 { |
5337 Label is_double(this); | 5339 Label is_double(this); |
5338 GotoIf(IsSetWord<FieldOffsetIsDouble>(handler_word), &is_double); | 5340 GotoIf(IsSetWord<LoadHandler::IsDoubleBits>(handler_word), &is_double); |
5339 Return(LoadObjectField(holder, offset)); | 5341 Return(LoadObjectField(holder, offset)); |
5340 | 5342 |
5341 Bind(&is_double); | 5343 Bind(&is_double); |
5342 if (FLAG_unbox_double_fields) { | 5344 if (FLAG_unbox_double_fields) { |
5343 var_double_value.Bind( | 5345 var_double_value.Bind( |
5344 LoadObjectField(holder, offset, MachineType::Float64())); | 5346 LoadObjectField(holder, offset, MachineType::Float64())); |
5345 } else { | 5347 } else { |
5346 Node* mutable_heap_number = LoadObjectField(holder, offset); | 5348 Node* mutable_heap_number = LoadObjectField(holder, offset); |
5347 var_double_value.Bind(LoadHeapNumberValue(mutable_heap_number)); | 5349 var_double_value.Bind(LoadHeapNumberValue(mutable_heap_number)); |
5348 } | 5350 } |
5349 Goto(&rebox_double); | 5351 Goto(&rebox_double); |
5350 } | 5352 } |
5351 | 5353 |
5352 Bind(&out_of_object); | 5354 Bind(&out_of_object); |
5353 { | 5355 { |
5354 Label is_double(this); | 5356 Label is_double(this); |
5355 Node* properties = LoadProperties(holder); | 5357 Node* properties = LoadProperties(holder); |
5356 Node* value = LoadObjectField(properties, offset); | 5358 Node* value = LoadObjectField(properties, offset); |
5357 GotoIf(IsSetWord<FieldOffsetIsDouble>(handler_word), &is_double); | 5359 GotoIf(IsSetWord<LoadHandler::IsDoubleBits>(handler_word), &is_double); |
5358 Return(value); | 5360 Return(value); |
5359 | 5361 |
5360 Bind(&is_double); | 5362 Bind(&is_double); |
5361 var_double_value.Bind(LoadHeapNumberValue(value)); | 5363 var_double_value.Bind(LoadHeapNumberValue(value)); |
5362 Goto(&rebox_double); | 5364 Goto(&rebox_double); |
5363 } | 5365 } |
5364 | 5366 |
5365 Bind(&rebox_double); | 5367 Bind(&rebox_double); |
5366 Return(AllocateHeapNumberWithValue(var_double_value.value())); | 5368 Return(AllocateHeapNumberWithValue(var_double_value.value())); |
5367 } | 5369 } |
5368 | 5370 |
5369 Bind(&constant); | 5371 Bind(&constant); |
5370 { | 5372 { |
5371 Comment("constant_load"); | 5373 Comment("constant_load"); |
5372 Node* descriptors = LoadMapDescriptors(LoadMap(holder)); | 5374 Node* descriptors = LoadMapDescriptors(LoadMap(holder)); |
5373 Node* descriptor = DecodeWord<ValueIndexInDescriptorArray>(handler_word); | 5375 Node* descriptor = |
| 5376 DecodeWord<LoadHandler::DescriptorValueIndexBits>(handler_word); |
5374 #if defined(DEBUG) | 5377 #if defined(DEBUG) |
5375 CSA_ASSERT(UintPtrLessThan( | 5378 CSA_ASSERT(UintPtrLessThan( |
5376 descriptor, LoadAndUntagFixedArrayBaseLength(descriptors))); | 5379 descriptor, LoadAndUntagFixedArrayBaseLength(descriptors))); |
5377 #endif | 5380 #endif |
5378 Return( | 5381 Return( |
5379 LoadFixedArrayElement(descriptors, descriptor, 0, INTPTR_PARAMETERS)); | 5382 LoadFixedArrayElement(descriptors, descriptor, 0, INTPTR_PARAMETERS)); |
5380 } | 5383 } |
5381 } | 5384 } |
5382 | 5385 |
5383 Bind(&try_proto_cell_handler); | 5386 Bind(&try_proto_cell_handler); |
(...skipping 2924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8308 Node* buffer_bit_field = LoadObjectField( | 8311 Node* buffer_bit_field = LoadObjectField( |
8309 buffer, JSArrayBuffer::kBitFieldOffset, MachineType::Uint32()); | 8312 buffer, JSArrayBuffer::kBitFieldOffset, MachineType::Uint32()); |
8310 Node* was_neutered_mask = Int32Constant(JSArrayBuffer::WasNeutered::kMask); | 8313 Node* was_neutered_mask = Int32Constant(JSArrayBuffer::WasNeutered::kMask); |
8311 | 8314 |
8312 return Word32NotEqual(Word32And(buffer_bit_field, was_neutered_mask), | 8315 return Word32NotEqual(Word32And(buffer_bit_field, was_neutered_mask), |
8313 Int32Constant(0)); | 8316 Int32Constant(0)); |
8314 } | 8317 } |
8315 | 8318 |
8316 } // namespace internal | 8319 } // namespace internal |
8317 } // namespace v8 | 8320 } // namespace v8 |
OLD | NEW |