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

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

Issue 2842373005: [ic] Handle JSArray::length in CodeStubAssembler::CallGetterIfAccessor. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « src/code-stub-assembler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 3161 matching lines...) Expand 10 before | Expand all | Expand 10 after
3172 } 3172 }
3173 3173
3174 Node* CodeStubAssembler::IsBoolean(Node* object) { 3174 Node* CodeStubAssembler::IsBoolean(Node* object) {
3175 return IsBooleanMap(LoadMap(object)); 3175 return IsBooleanMap(LoadMap(object));
3176 } 3176 }
3177 3177
3178 Node* CodeStubAssembler::IsPropertyCell(Node* object) { 3178 Node* CodeStubAssembler::IsPropertyCell(Node* object) {
3179 return IsPropertyCellMap(LoadMap(object)); 3179 return IsPropertyCellMap(LoadMap(object));
3180 } 3180 }
3181 3181
3182 Node* CodeStubAssembler::IsAccessorInfo(Node* object) {
3183 return IsAccessorInfoMap(LoadMap(object));
3184 }
3185
3182 Node* CodeStubAssembler::IsAccessorPair(Node* object) { 3186 Node* CodeStubAssembler::IsAccessorPair(Node* object) {
3183 return IsAccessorPairMap(LoadMap(object)); 3187 return IsAccessorPairMap(LoadMap(object));
3184 } 3188 }
3185 3189
3186 Node* CodeStubAssembler::IsHeapNumber(Node* object) { 3190 Node* CodeStubAssembler::IsHeapNumber(Node* object) {
3187 return IsHeapNumberMap(LoadMap(object)); 3191 return IsHeapNumberMap(LoadMap(object));
3188 } 3192 }
3189 3193
3190 Node* CodeStubAssembler::IsName(Node* object) { 3194 Node* CodeStubAssembler::IsName(Node* object) {
3191 return Int32LessThanOrEqual(LoadInstanceType(object), 3195 return Int32LessThanOrEqual(LoadInstanceType(object),
(...skipping 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after
5330 Comment("] LoadPropertyFromGlobalDictionary"); 5334 Comment("] LoadPropertyFromGlobalDictionary");
5331 } 5335 }
5332 5336
5333 // |value| is the property backing store's contents, which is either a value 5337 // |value| is the property backing store's contents, which is either a value
5334 // or an accessor pair, as specified by |details|. 5338 // or an accessor pair, as specified by |details|.
5335 // Returns either the original value, or the result of the getter call. 5339 // Returns either the original value, or the result of the getter call.
5336 Node* CodeStubAssembler::CallGetterIfAccessor(Node* value, Node* details, 5340 Node* CodeStubAssembler::CallGetterIfAccessor(Node* value, Node* details,
5337 Node* context, Node* receiver, 5341 Node* context, Node* receiver,
5338 Label* if_bailout) { 5342 Label* if_bailout) {
5339 VARIABLE(var_value, MachineRepresentation::kTagged, value); 5343 VARIABLE(var_value, MachineRepresentation::kTagged, value);
5340 Label done(this); 5344 Label done(this), if_accessor_info(this, Label::kDeferred);
5341 5345
5342 Node* kind = DecodeWord32<PropertyDetails::KindField>(details); 5346 Node* kind = DecodeWord32<PropertyDetails::KindField>(details);
5343 GotoIf(Word32Equal(kind, Int32Constant(kData)), &done); 5347 GotoIf(Word32Equal(kind, Int32Constant(kData)), &done);
5344 5348
5345 // Accessor case. 5349 // Accessor case.
5350 GotoIfNot(IsAccessorPair(value), &if_accessor_info);
5351
5352 // AccessorPair case.
5346 { 5353 {
5347 Node* accessor_pair = value; 5354 Node* accessor_pair = value;
5348 GotoIf(Word32Equal(LoadInstanceType(accessor_pair),
5349 Int32Constant(ACCESSOR_INFO_TYPE)),
5350 if_bailout);
5351 CSA_ASSERT(this, IsAccessorPair(accessor_pair));
5352 Node* getter = LoadObjectField(accessor_pair, AccessorPair::kGetterOffset); 5355 Node* getter = LoadObjectField(accessor_pair, AccessorPair::kGetterOffset);
5353 Node* getter_map = LoadMap(getter); 5356 Node* getter_map = LoadMap(getter);
5354 Node* instance_type = LoadMapInstanceType(getter_map); 5357 Node* instance_type = LoadMapInstanceType(getter_map);
5355 // FunctionTemplateInfo getters are not supported yet. 5358 // FunctionTemplateInfo getters are not supported yet.
5356 GotoIf( 5359 GotoIf(
5357 Word32Equal(instance_type, Int32Constant(FUNCTION_TEMPLATE_INFO_TYPE)), 5360 Word32Equal(instance_type, Int32Constant(FUNCTION_TEMPLATE_INFO_TYPE)),
5358 if_bailout); 5361 if_bailout);
5359 5362
5360 // Return undefined if the {getter} is not callable. 5363 // Return undefined if the {getter} is not callable.
5361 var_value.Bind(UndefinedConstant()); 5364 var_value.Bind(UndefinedConstant());
5362 GotoIfNot(IsCallableMap(getter_map), &done); 5365 GotoIfNot(IsCallableMap(getter_map), &done);
5363 5366
5364 // Call the accessor. 5367 // Call the accessor.
5365 Callable callable = CodeFactory::Call(isolate()); 5368 Callable callable = CodeFactory::Call(isolate());
5366 Node* result = CallJS(callable, context, getter, receiver); 5369 Node* result = CallJS(callable, context, getter, receiver);
5367 var_value.Bind(result); 5370 var_value.Bind(result);
5368 Goto(&done); 5371 Goto(&done);
5369 } 5372 }
5370 5373
5374 // AccessorInfo case.
5375 BIND(&if_accessor_info);
5376 {
5377 // TODO(ishell): Consider doing this for the Function.prototype and the
5378 // String.length accessor infos as well.
5379 CSA_ASSERT(this, IsAccessorInfo(value));
5380 CSA_ASSERT(this, TaggedIsNotSmi(receiver));
5381 GotoIfNot(IsJSArray(receiver), if_bailout);
5382 // The only AccessorInfo on JSArray is the "length" property.
5383 CSA_ASSERT(this, IsLengthString(
5384 LoadObjectField(value, AccessorInfo::kNameOffset)));
5385 var_value.Bind(LoadJSArrayLength(receiver));
5386 Goto(&done);
5387 }
5388
5371 BIND(&done); 5389 BIND(&done);
5372 return var_value.value(); 5390 return var_value.value();
5373 } 5391 }
5374 5392
5375 void CodeStubAssembler::TryGetOwnProperty( 5393 void CodeStubAssembler::TryGetOwnProperty(
5376 Node* context, Node* receiver, Node* object, Node* map, Node* instance_type, 5394 Node* context, Node* receiver, Node* object, Node* map, Node* instance_type,
5377 Node* unique_name, Label* if_found_value, Variable* var_value, 5395 Node* unique_name, Label* if_found_value, Variable* var_value,
5378 Label* if_not_found, Label* if_bailout) { 5396 Label* if_not_found, Label* if_bailout) {
5379 DCHECK_EQ(MachineRepresentation::kTagged, var_value->rep()); 5397 DCHECK_EQ(MachineRepresentation::kTagged, var_value->rep());
5380 Comment("TryGetOwnProperty"); 5398 Comment("TryGetOwnProperty");
(...skipping 3375 matching lines...) Expand 10 before | Expand all | Expand 10 after
8756 formatted.c_str(), TENURED); 8774 formatted.c_str(), TENURED);
8757 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), 8775 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(),
8758 HeapConstant(string)); 8776 HeapConstant(string));
8759 } 8777 }
8760 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); 8778 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value);
8761 #endif 8779 #endif
8762 } 8780 }
8763 8781
8764 } // namespace internal 8782 } // namespace internal
8765 } // namespace v8 8783 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stub-assembler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698