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 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
686 // Cannot fail since this should only be called when | 686 // Cannot fail since this should only be called when |
687 // creating an object literal. | 687 // creating an object literal. |
688 CHECK(JSObject::DefineOwnPropertyIgnoreAttributes(&it, value, attrs, | 688 CHECK(JSObject::DefineOwnPropertyIgnoreAttributes(&it, value, attrs, |
689 Object::DONT_THROW) | 689 Object::DONT_THROW) |
690 .IsJust()); | 690 .IsJust()); |
691 return *object; | 691 return *object; |
692 } | 692 } |
693 | 693 |
694 RUNTIME_FUNCTION(Runtime_CollectTypeProfile) { | 694 RUNTIME_FUNCTION(Runtime_CollectTypeProfile) { |
695 HandleScope scope(isolate); | 695 HandleScope scope(isolate); |
696 DCHECK_EQ(4, args.length()); | 696 DCHECK_EQ(5, args.length()); |
697 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 697 CONVERT_ARG_HANDLE_CHECKED(Smi, position, 0); |
698 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 698 CONVERT_ARG_HANDLE_CHECKED(String, name, 1); |
699 CONVERT_ARG_HANDLE_CHECKED(FeedbackVector, vector, 2); | 699 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); |
700 CONVERT_SMI_ARG_CHECKED(index, 3); | 700 CONVERT_ARG_HANDLE_CHECKED(FeedbackVector, vector, 3); |
701 CONVERT_SMI_ARG_CHECKED(index, 4); | |
701 | 702 |
702 DCHECK(FLAG_type_profile); | 703 DCHECK(FLAG_type_profile); |
703 | 704 |
705 Object* function_name = vector->shared_function_info()->name(); | |
Michael Starzinger
2017/03/20 09:29:26
This must be handlified, otherwise the handlified
Michael Starzinger
2017/03/20 09:31:48
s/function and leave/function or leave/
Franzi
2017/03/20 15:38:39
Done.
| |
706 if (!function_name->IsString()) { | |
707 UNREACHABLE(); | |
708 } | |
709 | |
704 Handle<Name> type = Object::TypeOf(isolate, value); | 710 Handle<Name> type = Object::TypeOf(isolate, value); |
705 if (value->IsJSReceiver()) { | 711 if (value->IsJSReceiver()) { |
706 Handle<JSReceiver> object = Handle<JSReceiver>::cast(value); | 712 Handle<JSReceiver> object = Handle<JSReceiver>::cast(value); |
707 type = JSReceiver::GetConstructorName(object); | 713 type = JSReceiver::GetConstructorName(object); |
708 } | 714 } |
709 | 715 |
710 CollectTypeProfileNexus nexus(vector, vector->ToSlot(index)); | 716 CollectTypeProfileNexus nexus(vector, vector->ToSlot(index)); |
711 nexus.Collect(type); | 717 nexus.Collect(type); |
712 | 718 |
713 PrintF("%s\n", name->ToCString().get()); | 719 if (position->value() >= 0) { |
714 nexus.Print(); | 720 PrintF("Function: %s, position: %d, expression: %s\n", |
715 PrintF("\n"); | 721 String::cast(function_name)->ToCString().get(), position->value(), |
722 name->ToCString().get()); | |
723 nexus.Print(); | |
724 PrintF("\n"); | |
725 } | |
716 | 726 |
717 return *name; | 727 return *position; |
718 } | 728 } |
719 | 729 |
720 // Return property without being observable by accessors or interceptors. | 730 // Return property without being observable by accessors or interceptors. |
721 RUNTIME_FUNCTION(Runtime_GetDataProperty) { | 731 RUNTIME_FUNCTION(Runtime_GetDataProperty) { |
722 HandleScope scope(isolate); | 732 HandleScope scope(isolate); |
723 DCHECK_EQ(2, args.length()); | 733 DCHECK_EQ(2, args.length()); |
724 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); | 734 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); |
725 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); | 735 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); |
726 return *JSReceiver::GetDataProperty(object, name); | 736 return *JSReceiver::GetDataProperty(object, name); |
727 } | 737 } |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1021 if (!success) return isolate->heap()->exception(); | 1031 if (!success) return isolate->heap()->exception(); |
1022 MAYBE_RETURN( | 1032 MAYBE_RETURN( |
1023 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), | 1033 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), |
1024 isolate->heap()->exception()); | 1034 isolate->heap()->exception()); |
1025 return *value; | 1035 return *value; |
1026 } | 1036 } |
1027 | 1037 |
1028 | 1038 |
1029 } // namespace internal | 1039 } // namespace internal |
1030 } // namespace v8 | 1040 } // namespace v8 |
OLD | NEW |