| 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 | 4 |
| 5 #ifndef V8_IC_HANDLER_CONFIGURATION_INL_H_ | 5 #ifndef V8_IC_HANDLER_CONFIGURATION_INL_H_ |
| 6 #define V8_IC_HANDLER_CONFIGURATION_INL_H_ | 6 #define V8_IC_HANDLER_CONFIGURATION_INL_H_ |
| 7 | 7 |
| 8 #include "src/ic/handler-configuration.h" | 8 #include "src/ic/handler-configuration.h" |
| 9 | 9 |
| 10 #include "src/field-index-inl.h" | 10 #include "src/field-index-inl.h" |
| 11 #include "src/objects-inl.h" |
| 11 | 12 |
| 12 namespace v8 { | 13 namespace v8 { |
| 13 namespace internal { | 14 namespace internal { |
| 14 | 15 |
| 15 Handle<Object> SmiHandler::MakeLoadFieldHandler(Isolate* isolate, | 16 Handle<Object> SmiHandler::MakeLoadFieldHandler(Isolate* isolate, |
| 16 FieldIndex field_index) { | 17 FieldIndex field_index) { |
| 17 int config = LoadHandlerTypeBit::encode(kLoadICHandlerForProperties) | | 18 int config = LoadHandlerTypeBits::encode(kLoadICHandlerForFields) | |
| 18 FieldOffsetIsInobject::encode(field_index.is_inobject()) | | 19 FieldOffsetIsInobject::encode(field_index.is_inobject()) | |
| 19 FieldOffsetIsDouble::encode(field_index.is_double()) | | 20 FieldOffsetIsDouble::encode(field_index.is_double()) | |
| 20 FieldOffsetOffset::encode(field_index.offset()); | 21 FieldOffsetOffset::encode(field_index.offset()); |
| 21 return handle(Smi::FromInt(config), isolate); | 22 return handle(Smi::FromInt(config), isolate); |
| 22 } | 23 } |
| 23 | 24 |
| 25 Handle<Object> SmiHandler::MakeLoadConstantHandler(Isolate* isolate, |
| 26 int descriptor) { |
| 27 int config = LoadHandlerTypeBits::encode(kLoadICHandlerForConstants) | |
| 28 ValueIndexInDescriptorArray::encode( |
| 29 DescriptorArray::ToValueIndex(descriptor)); |
| 30 return handle(Smi::FromInt(config), isolate); |
| 31 } |
| 32 |
| 24 Handle<Object> SmiHandler::MakeKeyedLoadHandler(Isolate* isolate, | 33 Handle<Object> SmiHandler::MakeKeyedLoadHandler(Isolate* isolate, |
| 25 ElementsKind elements_kind, | 34 ElementsKind elements_kind, |
| 26 bool convert_hole_to_undefined, | 35 bool convert_hole_to_undefined, |
| 27 bool is_js_array) { | 36 bool is_js_array) { |
| 28 int config = LoadHandlerTypeBit::encode(kLoadICHandlerForElements) | | 37 int config = LoadHandlerTypeBits::encode(kLoadICHandlerForElements) | |
| 29 KeyedLoadElementsKind::encode(elements_kind) | | 38 KeyedLoadElementsKind::encode(elements_kind) | |
| 30 KeyedLoadConvertHole::encode(convert_hole_to_undefined) | | 39 KeyedLoadConvertHole::encode(convert_hole_to_undefined) | |
| 31 KeyedLoadIsJsArray::encode(is_js_array); | 40 KeyedLoadIsJsArray::encode(is_js_array); |
| 32 return handle(Smi::FromInt(config), isolate); | 41 return handle(Smi::FromInt(config), isolate); |
| 33 } | 42 } |
| 34 | 43 |
| 35 } // namespace internal | 44 } // namespace internal |
| 36 } // namespace v8 | 45 } // namespace v8 |
| 37 | 46 |
| 38 #endif // V8_IC_HANDLER_CONFIGURATION_INL_H_ | 47 #endif // V8_IC_HANDLER_CONFIGURATION_INL_H_ |
| OLD | NEW |