OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 4); | 641 CONVERT_PROPERTY_ATTRIBUTES_CHECKED(attrs, 4); |
642 | 642 |
643 RETURN_FAILURE_ON_EXCEPTION( | 643 RETURN_FAILURE_ON_EXCEPTION( |
644 isolate, JSObject::DefineAccessor(obj, name, getter, setter, attrs)); | 644 isolate, JSObject::DefineAccessor(obj, name, getter, setter, attrs)); |
645 return isolate->heap()->undefined_value(); | 645 return isolate->heap()->undefined_value(); |
646 } | 646 } |
647 | 647 |
648 | 648 |
649 RUNTIME_FUNCTION(Runtime_DefineDataPropertyInLiteral) { | 649 RUNTIME_FUNCTION(Runtime_DefineDataPropertyInLiteral) { |
650 HandleScope scope(isolate); | 650 HandleScope scope(isolate); |
651 DCHECK(args.length() == 4); | 651 DCHECK_EQ(6, args.length()); |
652 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 652 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
653 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); | 653 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
654 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); | 654 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); |
655 CONVERT_SMI_ARG_CHECKED(flag, 3); | 655 CONVERT_SMI_ARG_CHECKED(flag, 3); |
| 656 CONVERT_ARG_HANDLE_CHECKED(TypeFeedbackVector, vector, 4); |
| 657 CONVERT_SMI_ARG_CHECKED(index, 5); |
| 658 |
| 659 StoreDataPropertyInLiteralICNexus nexus(vector, vector->ToSlot(index)); |
| 660 if (nexus.ic_state() == UNINITIALIZED) { |
| 661 if (name->IsUniqueName()) { |
| 662 nexus.ConfigureMonomorphic(name, handle(object->map())); |
| 663 } else { |
| 664 nexus.ConfigureMegamorphic(); |
| 665 } |
| 666 } else if (nexus.ic_state() == MONOMORPHIC) { |
| 667 if (nexus.FindFirstMap() != object->map() || |
| 668 nexus.GetFeedbackExtra() != *name) { |
| 669 nexus.ConfigureMegamorphic(); |
| 670 } |
| 671 } |
656 | 672 |
657 DataPropertyInLiteralFlags flags = | 673 DataPropertyInLiteralFlags flags = |
658 static_cast<DataPropertyInLiteralFlag>(flag); | 674 static_cast<DataPropertyInLiteralFlag>(flag); |
659 | 675 |
660 PropertyAttributes attrs = (flags & DataPropertyInLiteralFlag::kDontEnum) | 676 PropertyAttributes attrs = (flags & DataPropertyInLiteralFlag::kDontEnum) |
661 ? PropertyAttributes::DONT_ENUM | 677 ? PropertyAttributes::DONT_ENUM |
662 : PropertyAttributes::NONE; | 678 : PropertyAttributes::NONE; |
663 | 679 |
664 if (flags & DataPropertyInLiteralFlag::kSetFunctionName) { | 680 if (flags & DataPropertyInLiteralFlag::kSetFunctionName) { |
665 DCHECK(value->IsJSFunction()); | 681 DCHECK(value->IsJSFunction()); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 if (!success) return isolate->heap()->exception(); | 947 if (!success) return isolate->heap()->exception(); |
932 MAYBE_RETURN( | 948 MAYBE_RETURN( |
933 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), | 949 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), |
934 isolate->heap()->exception()); | 950 isolate->heap()->exception()); |
935 return *value; | 951 return *value; |
936 } | 952 } |
937 | 953 |
938 | 954 |
939 } // namespace internal | 955 } // namespace internal |
940 } // namespace v8 | 956 } // namespace v8 |
OLD | NEW |