| 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 #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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 Node* context) { | 395 Node* context) { |
| 396 typedef CodeStubAssembler::Label Label; | 396 typedef CodeStubAssembler::Label Label; |
| 397 typedef CodeStubAssembler::Variable Variable; | 397 typedef CodeStubAssembler::Variable Variable; |
| 398 typedef compiler::Node Node; | 398 typedef compiler::Node Node; |
| 399 | 399 |
| 400 Label call_runtime(this, Label::kDeferred), end(this); | 400 Label call_runtime(this, Label::kDeferred), end(this); |
| 401 | 401 |
| 402 Variable result(this, MachineRepresentation::kTagged); | 402 Variable result(this, MachineRepresentation::kTagged); |
| 403 | 403 |
| 404 Node* cell = LoadObjectField(closure, JSFunction::kFeedbackVectorOffset); | 404 Node* cell = LoadObjectField(closure, JSFunction::kFeedbackVectorOffset); |
| 405 Node* literals_array = LoadObjectField(cell, Cell::kValueOffset); | 405 Node* feedback_vector = LoadObjectField(cell, Cell::kValueOffset); |
| 406 Node* boilerplate = LoadFixedArrayElement(literals_array, literal_index, 0, | 406 Node* boilerplate = LoadFixedArrayElement(feedback_vector, literal_index, 0, |
| 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 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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* cell = LoadObjectField(closure, JSFunction::kFeedbackVectorOffset); | 487 Node* cell = LoadObjectField(closure, JSFunction::kFeedbackVectorOffset); |
| 488 Node* literals_array = LoadObjectField(cell, Cell::kValueOffset); | 488 Node* feedback_vector = LoadObjectField(cell, Cell::kValueOffset); |
| 489 Node* allocation_site = LoadFixedArrayElement( | 489 Node* allocation_site = LoadFixedArrayElement( |
| 490 literals_array, literal_index, 0, CodeStubAssembler::SMI_PARAMETERS); | 490 feedback_vector, literal_index, 0, CodeStubAssembler::SMI_PARAMETERS); |
| 491 | 491 |
| 492 GotoIf(IsUndefined(allocation_site), call_runtime); | 492 GotoIf(IsUndefined(allocation_site), call_runtime); |
| 493 allocation_site = LoadFixedArrayElement(literals_array, literal_index, 0, | 493 allocation_site = LoadFixedArrayElement(feedback_vector, literal_index, 0, |
| 494 CodeStubAssembler::SMI_PARAMETERS); | 494 CodeStubAssembler::SMI_PARAMETERS); |
| 495 | 495 |
| 496 Node* boilerplate = | 496 Node* boilerplate = |
| 497 LoadObjectField(allocation_site, AllocationSite::kTransitionInfoOffset); | 497 LoadObjectField(allocation_site, AllocationSite::kTransitionInfoOffset); |
| 498 Node* boilerplate_map = LoadMap(boilerplate); | 498 Node* boilerplate_map = LoadMap(boilerplate); |
| 499 Node* boilerplate_elements = LoadElements(boilerplate); | 499 Node* boilerplate_elements = LoadElements(boilerplate); |
| 500 Node* capacity = LoadFixedArrayBaseLength(boilerplate_elements); | 500 Node* capacity = LoadFixedArrayBaseLength(boilerplate_elements); |
| 501 allocation_site = | 501 allocation_site = |
| 502 allocation_site_mode == TRACK_ALLOCATION_SITE ? allocation_site : nullptr; | 502 allocation_site_mode == TRACK_ALLOCATION_SITE ? allocation_site : nullptr; |
| 503 | 503 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 // TODO(verwaest): Unify this with the heuristic in the runtime. | 636 // TODO(verwaest): Unify this with the heuristic in the runtime. |
| 637 return literal_length == 0 | 637 return literal_length == 0 |
| 638 ? JSObject::kInitialGlobalObjectUnusedPropertiesCount | 638 ? JSObject::kInitialGlobalObjectUnusedPropertiesCount |
| 639 : literal_length; | 639 : literal_length; |
| 640 } | 640 } |
| 641 | 641 |
| 642 Node* ConstructorBuiltinsAssembler::EmitFastCloneShallowObject( | 642 Node* ConstructorBuiltinsAssembler::EmitFastCloneShallowObject( |
| 643 CodeAssemblerLabel* call_runtime, Node* closure, Node* literals_index, | 643 CodeAssemblerLabel* call_runtime, Node* closure, Node* literals_index, |
| 644 Node* properties_count) { | 644 Node* properties_count) { |
| 645 Node* cell = LoadObjectField(closure, JSFunction::kFeedbackVectorOffset); | 645 Node* cell = LoadObjectField(closure, JSFunction::kFeedbackVectorOffset); |
| 646 Node* literals_array = LoadObjectField(cell, Cell::kValueOffset); | 646 Node* feedback_vector = LoadObjectField(cell, Cell::kValueOffset); |
| 647 Node* allocation_site = LoadFixedArrayElement( | 647 Node* allocation_site = LoadFixedArrayElement( |
| 648 literals_array, literals_index, 0, CodeStubAssembler::SMI_PARAMETERS); | 648 feedback_vector, literals_index, 0, CodeStubAssembler::SMI_PARAMETERS); |
| 649 GotoIf(IsUndefined(allocation_site), call_runtime); | 649 GotoIf(IsUndefined(allocation_site), call_runtime); |
| 650 | 650 |
| 651 // Calculate the object and allocation size based on the properties count. | 651 // Calculate the object and allocation size based on the properties count. |
| 652 Node* object_size = IntPtrAdd(WordShl(properties_count, kPointerSizeLog2), | 652 Node* object_size = IntPtrAdd(WordShl(properties_count, kPointerSizeLog2), |
| 653 IntPtrConstant(JSObject::kHeaderSize)); | 653 IntPtrConstant(JSObject::kHeaderSize)); |
| 654 Node* allocation_size = object_size; | 654 Node* allocation_size = object_size; |
| 655 if (FLAG_allocation_site_pretenuring) { | 655 if (FLAG_allocation_site_pretenuring) { |
| 656 allocation_size = | 656 allocation_size = |
| 657 IntPtrAdd(object_size, IntPtrConstant(AllocationMemento::kSize)); | 657 IntPtrAdd(object_size, IntPtrConstant(AllocationMemento::kSize)); |
| 658 } | 658 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 case 6: | 759 case 6: |
| 760 return FastCloneShallowObject6(); | 760 return FastCloneShallowObject6(); |
| 761 default: | 761 default: |
| 762 UNREACHABLE(); | 762 UNREACHABLE(); |
| 763 } | 763 } |
| 764 return Handle<Code>::null(); | 764 return Handle<Code>::null(); |
| 765 } | 765 } |
| 766 | 766 |
| 767 } // namespace internal | 767 } // namespace internal |
| 768 } // namespace v8 | 768 } // namespace v8 |
| OLD | NEW |