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

Side by Side Diff: src/runtime/runtime-object.cc

Issue 2677163003: WIP: type profiling. (Closed)
Patch Set: Rebaseline. 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
OLDNEW
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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 LookupIterator it = LookupIterator::PropertyOrElement( 673 LookupIterator it = LookupIterator::PropertyOrElement(
674 isolate, object, name, object, LookupIterator::OWN); 674 isolate, object, name, object, LookupIterator::OWN);
675 // Cannot fail since this should only be called when 675 // Cannot fail since this should only be called when
676 // creating an object literal. 676 // creating an object literal.
677 CHECK(JSObject::DefineOwnPropertyIgnoreAttributes(&it, value, attrs, 677 CHECK(JSObject::DefineOwnPropertyIgnoreAttributes(&it, value, attrs,
678 Object::DONT_THROW) 678 Object::DONT_THROW)
679 .IsJust()); 679 .IsJust());
680 return *object; 680 return *object;
681 } 681 }
682 682
683 RUNTIME_FUNCTION(Runtime_StoreTypeInformation) {
684 HandleScope scope(isolate);
685 DCHECK_EQ(4, args.length());
686 CONVERT_ARG_HANDLE_CHECKED(Name, name, 0);
687 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1);
688 CONVERT_ARG_HANDLE_CHECKED(FeedbackVector, vector, 2);
689 CONVERT_SMI_ARG_CHECKED(index, 3);
690
691 DCHECK(FLAG_type_profile);
692
693 StoreDataPropertyInLiteralICNexus nexus(vector, vector->ToSlot(index));
694 if (nexus.ic_state() == UNINITIALIZED) {
695 if (name->IsUniqueName()) {
696 printf(".");
697 nexus.ConfigureMonomorphic(name, handle(name->map()));
698 } else {
699 nexus.ConfigureMegamorphic();
700 }
701 } else if (nexus.ic_state() == MONOMORPHIC) {
702 printf("1");
703 if (nexus.FindFirstMap() != name->map() ||
704 nexus.GetFeedbackExtra() != *name) {
705 nexus.ConfigureMegamorphic();
706 }
707 }
708
709 // We want to print the type profile, i.e., variable name and result of
710 // value.constructor.name or typeof value.
711
712 printf("name: ");
713 name->Print();
714 printf("value: ");
715 Object::TypeOf(isolate, value)->Print();
716 printf("\n");
717
718 return *value;
719 }
720
683 // Return property without being observable by accessors or interceptors. 721 // Return property without being observable by accessors or interceptors.
684 RUNTIME_FUNCTION(Runtime_GetDataProperty) { 722 RUNTIME_FUNCTION(Runtime_GetDataProperty) {
685 HandleScope scope(isolate); 723 HandleScope scope(isolate);
686 DCHECK_EQ(2, args.length()); 724 DCHECK_EQ(2, args.length());
687 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0); 725 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, object, 0);
688 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); 726 CONVERT_ARG_HANDLE_CHECKED(Name, name, 1);
689 return *JSReceiver::GetDataProperty(object, name); 727 return *JSReceiver::GetDataProperty(object, name);
690 } 728 }
691 729
692 RUNTIME_FUNCTION(Runtime_GetConstructorName) { 730 RUNTIME_FUNCTION(Runtime_GetConstructorName) {
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 if (!success) return isolate->heap()->exception(); 1022 if (!success) return isolate->heap()->exception();
985 MAYBE_RETURN( 1023 MAYBE_RETURN(
986 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), 1024 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR),
987 isolate->heap()->exception()); 1025 isolate->heap()->exception());
988 return *value; 1026 return *value;
989 } 1027 }
990 1028
991 1029
992 } // namespace internal 1030 } // namespace internal
993 } // namespace v8 1031 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698