Index: src/code-stub-assembler.cc |
diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc |
index aa9303aaf13ffbca5e2476965ac875565c627e83..12450323fd083646b5158d482efb61cdc7bbd657 100644 |
--- a/src/code-stub-assembler.cc |
+++ b/src/code-stub-assembler.cc |
@@ -3152,6 +3152,50 @@ void CodeStubAssembler::LoadPropertyFromGlobalDictionary(Node* dictionary, |
Comment("] LoadPropertyFromGlobalDictionary"); |
} |
+// On entry, var_value contains the property backing store's contents, which is |
+// either a value or an accessor pair, as specified by var_details. |
+// On successful exit, var_value contains either the original value, or the |
+// result of the getter call. |
+void CodeStubAssembler::ReturnValueOrCallGetter(Variable* var_value, |
Jakob Kummerow
2016/09/23 01:38:55
This is pulled out from below, unchanged.
Igor Sheludko
2016/09/23 07:11:24
I have a feeling that with the following signature
Jakob Kummerow
2016/09/23 18:12:22
Done.
|
+ Variable* var_details, |
+ Node* context, Node* receiver, |
+ Label* if_success, |
+ Label* if_bailout) { |
+ Node* details = var_details->value(); |
+ Node* kind = BitFieldDecode<PropertyDetails::KindField>(details); |
+ |
+ Label if_accessor(this); |
+ Branch(Word32Equal(kind, Int32Constant(kData)), if_success, &if_accessor); |
+ Bind(&if_accessor); |
+ { |
+ Node* accessor_pair = var_value->value(); |
+ GotoIf(Word32Equal(LoadInstanceType(accessor_pair), |
+ Int32Constant(ACCESSOR_INFO_TYPE)), |
+ if_bailout); |
+ AssertInstanceType(accessor_pair, ACCESSOR_PAIR_TYPE); |
+ Node* getter = LoadObjectField(accessor_pair, AccessorPair::kGetterOffset); |
+ Node* getter_map = LoadMap(getter); |
+ Node* instance_type = LoadMapInstanceType(getter_map); |
+ // FunctionTemplateInfo getters are not supported yet. |
+ GotoIf( |
+ Word32Equal(instance_type, Int32Constant(FUNCTION_TEMPLATE_INFO_TYPE)), |
+ if_bailout); |
+ |
+ // Return undefined if the {getter} is not callable. |
+ var_value->Bind(UndefinedConstant()); |
+ GotoIf(Word32Equal(Word32And(LoadMapBitField(getter_map), |
+ Int32Constant(1 << Map::kIsCallable)), |
+ Int32Constant(0)), |
+ if_success); |
+ |
+ // Call the accessor. |
+ Callable callable = CodeFactory::Call(isolate()); |
+ Node* result = CallJS(callable, context, getter, receiver); |
+ var_value->Bind(result); |
+ Goto(if_success); |
+ } |
+} |
+ |
void CodeStubAssembler::TryGetOwnProperty( |
Node* context, Node* receiver, Node* object, Node* map, Node* instance_type, |
Node* unique_name, Label* if_found_value, Variable* var_value, |
@@ -3199,41 +3243,8 @@ void CodeStubAssembler::TryGetOwnProperty( |
// Here we have details and value which could be an accessor. |
Bind(&if_found); |
{ |
- Node* details = var_details.value(); |
- Node* kind = BitFieldDecode<PropertyDetails::KindField>(details); |
- |
- Label if_accessor(this); |
- Branch(Word32Equal(kind, Int32Constant(kData)), if_found_value, |
- &if_accessor); |
- Bind(&if_accessor); |
- { |
- Node* accessor_pair = var_value->value(); |
- GotoIf(Word32Equal(LoadInstanceType(accessor_pair), |
- Int32Constant(ACCESSOR_INFO_TYPE)), |
- if_bailout); |
- AssertInstanceType(accessor_pair, ACCESSOR_PAIR_TYPE); |
- Node* getter = |
- LoadObjectField(accessor_pair, AccessorPair::kGetterOffset); |
- Node* getter_map = LoadMap(getter); |
- Node* instance_type = LoadMapInstanceType(getter_map); |
- // FunctionTemplateInfo getters are not supported yet. |
- GotoIf(Word32Equal(instance_type, |
- Int32Constant(FUNCTION_TEMPLATE_INFO_TYPE)), |
- if_bailout); |
- |
- // Return undefined if the {getter} is not callable. |
- var_value->Bind(UndefinedConstant()); |
- GotoIf(Word32Equal(Word32And(LoadMapBitField(getter_map), |
- Int32Constant(1 << Map::kIsCallable)), |
- Int32Constant(0)), |
- if_found_value); |
- |
- // Call the accessor. |
- Callable callable = CodeFactory::Call(isolate()); |
- Node* result = CallJS(callable, context, getter, receiver); |
- var_value->Bind(result); |
- Goto(if_found_value); |
- } |
+ ReturnValueOrCallGetter(var_value, &var_details, context, receiver, |
+ if_found_value, if_bailout); |
} |
} |
@@ -4472,10 +4483,10 @@ void CodeStubAssembler::KeyedLoadICGeneric(const LoadICParameters* p) { |
Bind(&if_found_on_receiver); |
{ |
- Node* kind = |
- BitFieldDecode<PropertyDetails::KindField>(var_details.value()); |
- // TODO(jkummerow): Support accessors without missing? |
- GotoUnless(Word32Equal(kind, Int32Constant(kData)), &slow); |
+ Label return_value(this); |
+ ReturnValueOrCallGetter(&var_value, &var_details, p->context, receiver, |
+ &return_value, &slow); |
+ Bind(&return_value); |
IncrementCounter(isolate()->counters()->ic_keyed_load_generic_symbol(), 1); |
Return(var_value.value()); |
} |