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

Side by Side Diff: src/builtins/builtins-constructor.cc

Issue 2655853010: [TypeFeedbackVector] Combine the literals array and the feedback vector. (Closed)
Patch Set: more comments. Created 3 years, 10 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/builtins/arm64/builtins-arm64.cc ('k') | src/builtins/ia32/builtins-ia32.cc » ('j') | 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 4
5 #include "src/builtins/builtins-constructor.h" 5 #include "src/builtins/builtins-constructor.h"
6 #include "src/ast/ast.h" 6 #include "src/ast/ast.h"
7 #include "src/builtins/builtins-utils.h" 7 #include "src/builtins/builtins-utils.h"
8 #include "src/builtins/builtins.h" 8 #include "src/builtins/builtins.h"
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stub-assembler.h" 10 #include "src/code-stub-assembler.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 // Get the function map in the current native context and set that 114 // Get the function map in the current native context and set that
115 // as the map of the allocated object. 115 // as the map of the allocated object.
116 Node* native_context = LoadNativeContext(context); 116 Node* native_context = LoadNativeContext(context);
117 Node* map_slot_value = 117 Node* map_slot_value =
118 LoadFixedArrayElement(native_context, map_index.value()); 118 LoadFixedArrayElement(native_context, map_index.value());
119 StoreMapNoWriteBarrier(result, map_slot_value); 119 StoreMapNoWriteBarrier(result, map_slot_value);
120 120
121 // Initialize the rest of the function. 121 // Initialize the rest of the function.
122 Node* empty_fixed_array = HeapConstant(factory->empty_fixed_array()); 122 Node* empty_fixed_array = HeapConstant(factory->empty_fixed_array());
123 Node* empty_literals_array = HeapConstant(factory->empty_literals_array()); 123 Node* empty_feedback_vector =
124 HeapConstant(factory->empty_type_feedback_vector());
124 StoreObjectFieldNoWriteBarrier(result, JSObject::kPropertiesOffset, 125 StoreObjectFieldNoWriteBarrier(result, JSObject::kPropertiesOffset,
125 empty_fixed_array); 126 empty_fixed_array);
126 StoreObjectFieldNoWriteBarrier(result, JSObject::kElementsOffset, 127 StoreObjectFieldNoWriteBarrier(result, JSObject::kElementsOffset,
127 empty_fixed_array); 128 empty_fixed_array);
128 StoreObjectFieldNoWriteBarrier(result, JSFunction::kLiteralsOffset, 129 StoreObjectFieldNoWriteBarrier(result, JSFunction::kFeedbackVectorOffset,
129 empty_literals_array); 130 empty_feedback_vector);
130 StoreObjectFieldNoWriteBarrier( 131 StoreObjectFieldNoWriteBarrier(
131 result, JSFunction::kPrototypeOrInitialMapOffset, TheHoleConstant()); 132 result, JSFunction::kPrototypeOrInitialMapOffset, TheHoleConstant());
132 StoreObjectFieldNoWriteBarrier(result, JSFunction::kSharedFunctionInfoOffset, 133 StoreObjectFieldNoWriteBarrier(result, JSFunction::kSharedFunctionInfoOffset,
133 shared_info); 134 shared_info);
134 StoreObjectFieldNoWriteBarrier(result, JSFunction::kContextOffset, context); 135 StoreObjectFieldNoWriteBarrier(result, JSFunction::kContextOffset, context);
135 Handle<Code> lazy_builtin_handle( 136 Handle<Code> lazy_builtin_handle(
136 isolate->builtins()->builtin(Builtins::kCompileLazy)); 137 isolate->builtins()->builtin(Builtins::kCompileLazy));
137 Node* lazy_builtin = HeapConstant(lazy_builtin_handle); 138 Node* lazy_builtin = HeapConstant(lazy_builtin_handle);
138 Node* lazy_builtin_entry = 139 Node* lazy_builtin_entry =
139 IntPtrAdd(BitcastTaggedToWord(lazy_builtin), 140 IntPtrAdd(BitcastTaggedToWord(lazy_builtin),
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 Node* flags, 394 Node* flags,
394 Node* context) { 395 Node* context) {
395 typedef CodeStubAssembler::Label Label; 396 typedef CodeStubAssembler::Label Label;
396 typedef CodeStubAssembler::Variable Variable; 397 typedef CodeStubAssembler::Variable Variable;
397 typedef compiler::Node Node; 398 typedef compiler::Node Node;
398 399
399 Label call_runtime(this, Label::kDeferred), end(this); 400 Label call_runtime(this, Label::kDeferred), end(this);
400 401
401 Variable result(this, MachineRepresentation::kTagged); 402 Variable result(this, MachineRepresentation::kTagged);
402 403
403 Node* literals_array = LoadObjectField(closure, JSFunction::kLiteralsOffset); 404 Node* vector_array =
404 Node* boilerplate = 405 LoadObjectField(closure, JSFunction::kFeedbackVectorOffset);
405 LoadFixedArrayElement(literals_array, literal_index, 406 Node* boilerplate = LoadFixedArrayElement(vector_array, literal_index, 0,
406 LiteralsArray::kFirstLiteralIndex * kPointerSize, 407 CodeStubAssembler::SMI_PARAMETERS);
407 CodeStubAssembler::SMI_PARAMETERS);
408 GotoIf(IsUndefined(boilerplate), &call_runtime); 408 GotoIf(IsUndefined(boilerplate), &call_runtime);
409 409
410 { 410 {
411 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; 411 int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize;
412 Node* copy = Allocate(size); 412 Node* copy = Allocate(size);
413 for (int offset = 0; offset < size; offset += kPointerSize) { 413 for (int offset = 0; offset < size; offset += kPointerSize) {
414 Node* value = LoadObjectField(boilerplate, offset); 414 Node* value = LoadObjectField(boilerplate, offset);
415 StoreObjectFieldNoWriteBarrier(copy, offset, value); 415 StoreObjectFieldNoWriteBarrier(copy, offset, value);
416 } 416 }
417 result.Bind(copy); 417 result.Bind(copy);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 Node* closure, Node* literal_index, Node* context, 477 Node* closure, Node* literal_index, Node* context,
478 CodeAssemblerLabel* call_runtime, AllocationSiteMode allocation_site_mode) { 478 CodeAssemblerLabel* call_runtime, AllocationSiteMode allocation_site_mode) {
479 typedef CodeStubAssembler::Label Label; 479 typedef CodeStubAssembler::Label Label;
480 typedef CodeStubAssembler::Variable Variable; 480 typedef CodeStubAssembler::Variable Variable;
481 typedef compiler::Node Node; 481 typedef compiler::Node Node;
482 482
483 Label zero_capacity(this), cow_elements(this), fast_elements(this), 483 Label zero_capacity(this), cow_elements(this), fast_elements(this),
484 return_result(this); 484 return_result(this);
485 Variable result(this, MachineRepresentation::kTagged); 485 Variable result(this, MachineRepresentation::kTagged);
486 486
487 Node* literals_array = LoadObjectField(closure, JSFunction::kLiteralsOffset); 487 Node* vector_array =
488 Node* allocation_site = 488 LoadObjectField(closure, JSFunction::kFeedbackVectorOffset);
489 LoadFixedArrayElement(literals_array, literal_index, 489 Node* allocation_site = LoadFixedArrayElement(
490 LiteralsArray::kFirstLiteralIndex * kPointerSize, 490 vector_array, literal_index, 0, CodeStubAssembler::SMI_PARAMETERS);
491 CodeStubAssembler::SMI_PARAMETERS);
492 491
493 GotoIf(IsUndefined(allocation_site), call_runtime); 492 GotoIf(IsUndefined(allocation_site), call_runtime);
494 allocation_site = 493 allocation_site = LoadFixedArrayElement(vector_array, literal_index, 0,
495 LoadFixedArrayElement(literals_array, literal_index, 494 CodeStubAssembler::SMI_PARAMETERS);
496 LiteralsArray::kFirstLiteralIndex * kPointerSize,
497 CodeStubAssembler::SMI_PARAMETERS);
498 495
499 Node* boilerplate = 496 Node* boilerplate =
500 LoadObjectField(allocation_site, AllocationSite::kTransitionInfoOffset); 497 LoadObjectField(allocation_site, AllocationSite::kTransitionInfoOffset);
501 Node* boilerplate_map = LoadMap(boilerplate); 498 Node* boilerplate_map = LoadMap(boilerplate);
502 Node* boilerplate_elements = LoadElements(boilerplate); 499 Node* boilerplate_elements = LoadElements(boilerplate);
503 Node* capacity = LoadFixedArrayBaseLength(boilerplate_elements); 500 Node* capacity = LoadFixedArrayBaseLength(boilerplate_elements);
504 allocation_site = 501 allocation_site =
505 allocation_site_mode == TRACK_ALLOCATION_SITE ? allocation_site : nullptr; 502 allocation_site_mode == TRACK_ALLOCATION_SITE ? allocation_site : nullptr;
506 503
507 Node* zero = SmiConstant(Smi::kZero); 504 Node* zero = SmiConstant(Smi::kZero);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 // runtime. 635 // runtime.
639 // TODO(verwaest): Unify this with the heuristic in the runtime. 636 // TODO(verwaest): Unify this with the heuristic in the runtime.
640 return literal_length == 0 637 return literal_length == 0
641 ? JSObject::kInitialGlobalObjectUnusedPropertiesCount 638 ? JSObject::kInitialGlobalObjectUnusedPropertiesCount
642 : literal_length; 639 : literal_length;
643 } 640 }
644 641
645 Node* ConstructorBuiltinsAssembler::EmitFastCloneShallowObject( 642 Node* ConstructorBuiltinsAssembler::EmitFastCloneShallowObject(
646 CodeAssemblerLabel* call_runtime, Node* closure, Node* literals_index, 643 CodeAssemblerLabel* call_runtime, Node* closure, Node* literals_index,
647 Node* properties_count) { 644 Node* properties_count) {
648 Node* literals_array = LoadObjectField(closure, JSFunction::kLiteralsOffset); 645 Node* vector_array =
649 Node* allocation_site = 646 LoadObjectField(closure, JSFunction::kFeedbackVectorOffset);
650 LoadFixedArrayElement(literals_array, literals_index, 647 Node* allocation_site = LoadFixedArrayElement(
651 LiteralsArray::kFirstLiteralIndex * kPointerSize, 648 vector_array, literals_index, 0, CodeStubAssembler::SMI_PARAMETERS);
652 CodeStubAssembler::SMI_PARAMETERS);
653 GotoIf(IsUndefined(allocation_site), call_runtime); 649 GotoIf(IsUndefined(allocation_site), call_runtime);
654 650
655 // Calculate the object and allocation size based on the properties count. 651 // Calculate the object and allocation size based on the properties count.
656 Node* object_size = IntPtrAdd(WordShl(properties_count, kPointerSizeLog2), 652 Node* object_size = IntPtrAdd(WordShl(properties_count, kPointerSizeLog2),
657 IntPtrConstant(JSObject::kHeaderSize)); 653 IntPtrConstant(JSObject::kHeaderSize));
658 Node* allocation_size = object_size; 654 Node* allocation_size = object_size;
659 if (FLAG_allocation_site_pretenuring) { 655 if (FLAG_allocation_site_pretenuring) {
660 allocation_size = 656 allocation_size =
661 IntPtrAdd(object_size, IntPtrConstant(AllocationMemento::kSize)); 657 IntPtrAdd(object_size, IntPtrConstant(AllocationMemento::kSize));
662 } 658 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 case 6: 759 case 6:
764 return FastCloneShallowObject6(); 760 return FastCloneShallowObject6();
765 default: 761 default:
766 UNREACHABLE(); 762 UNREACHABLE();
767 } 763 }
768 return Handle<Code>::null(); 764 return Handle<Code>::null();
769 } 765 }
770 766
771 } // namespace internal 767 } // namespace internal
772 } // namespace v8 768 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/arm64/builtins-arm64.cc ('k') | src/builtins/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698