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

Side by Side Diff: src/handles.cc

Issue 6529055: [Isolates] Merge crankshaft (r5922 from bleeding_edge). (Closed)
Patch Set: Win32 port Created 9 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/handles.h ('k') | src/heap.h » ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 21 matching lines...) Expand all
32 #include "arguments.h" 32 #include "arguments.h"
33 #include "bootstrapper.h" 33 #include "bootstrapper.h"
34 #include "compiler.h" 34 #include "compiler.h"
35 #include "debug.h" 35 #include "debug.h"
36 #include "execution.h" 36 #include "execution.h"
37 #include "global-handles.h" 37 #include "global-handles.h"
38 #include "natives.h" 38 #include "natives.h"
39 #include "runtime.h" 39 #include "runtime.h"
40 #include "string-search.h" 40 #include "string-search.h"
41 #include "stub-cache.h" 41 #include "stub-cache.h"
42 #include "vm-state-inl.h"
42 43
43 namespace v8 { 44 namespace v8 {
44 namespace internal { 45 namespace internal {
45 46
46 47
47 int HandleScope::NumberOfHandles() { 48 int HandleScope::NumberOfHandles() {
48 Isolate* isolate = Isolate::Current(); 49 Isolate* isolate = Isolate::Current();
49 HandleScopeImplementer* impl = isolate->handle_scope_implementer(); 50 HandleScopeImplementer* impl = isolate->handle_scope_implementer();
50 int n = impl->blocks()->length(); 51 int n = impl->blocks()->length();
51 if (n == 0) return 0; 52 if (n == 0) return 0;
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 861
861 bool EnsureCompiled(Handle<SharedFunctionInfo> shared, 862 bool EnsureCompiled(Handle<SharedFunctionInfo> shared,
862 ClearExceptionFlag flag) { 863 ClearExceptionFlag flag) {
863 return shared->is_compiled() || CompileLazyShared(shared, flag); 864 return shared->is_compiled() || CompileLazyShared(shared, flag);
864 } 865 }
865 866
866 867
867 static bool CompileLazyHelper(CompilationInfo* info, 868 static bool CompileLazyHelper(CompilationInfo* info,
868 ClearExceptionFlag flag) { 869 ClearExceptionFlag flag) {
869 // Compile the source information to a code object. 870 // Compile the source information to a code object.
870 ASSERT(!info->shared_info()->is_compiled()); 871 ASSERT(info->IsOptimizing() || !info->shared_info()->is_compiled());
871 bool result = Compiler::CompileLazy(info); 872 bool result = Compiler::CompileLazy(info);
872 ASSERT(result != Isolate::Current()->has_pending_exception()); 873 ASSERT(result != Isolate::Current()->has_pending_exception());
873 if (!result && flag == CLEAR_EXCEPTION) { 874 if (!result && flag == CLEAR_EXCEPTION) {
874 Isolate::Current()->clear_pending_exception(); 875 Isolate::Current()->clear_pending_exception();
875 } 876 }
876 return result; 877 return result;
877 } 878 }
878 879
879 880
880 bool CompileLazyShared(Handle<SharedFunctionInfo> shared, 881 bool CompileLazyShared(Handle<SharedFunctionInfo> shared,
881 ClearExceptionFlag flag) { 882 ClearExceptionFlag flag) {
882 CompilationInfo info(shared); 883 CompilationInfo info(shared);
883 return CompileLazyHelper(&info, flag); 884 return CompileLazyHelper(&info, flag);
884 } 885 }
885 886
886 887
887 bool CompileLazy(Handle<JSFunction> function, 888 bool CompileLazy(Handle<JSFunction> function,
888 ClearExceptionFlag flag) { 889 ClearExceptionFlag flag) {
890 bool result = true;
889 if (function->shared()->is_compiled()) { 891 if (function->shared()->is_compiled()) {
890 function->set_code(function->shared()->code()); 892 function->ReplaceCode(function->shared()->code());
891 PROFILE(FunctionCreateEvent(*function));
892 function->shared()->set_code_age(0); 893 function->shared()->set_code_age(0);
893 return true;
894 } else { 894 } else {
895 CompilationInfo info(function); 895 CompilationInfo info(function);
896 bool result = CompileLazyHelper(&info, flag); 896 result = CompileLazyHelper(&info, flag);
897 ASSERT(!result || function->is_compiled()); 897 ASSERT(!result || function->is_compiled());
898 }
899 if (result && function->is_compiled()) {
898 PROFILE(FunctionCreateEvent(*function)); 900 PROFILE(FunctionCreateEvent(*function));
899 return result;
900 } 901 }
902 return result;
901 } 903 }
902 904
903 905
904 bool CompileLazyInLoop(Handle<JSFunction> function, 906 bool CompileLazyInLoop(Handle<JSFunction> function,
905 ClearExceptionFlag flag) { 907 ClearExceptionFlag flag) {
908 bool result = true;
906 if (function->shared()->is_compiled()) { 909 if (function->shared()->is_compiled()) {
907 function->set_code(function->shared()->code()); 910 function->ReplaceCode(function->shared()->code());
908 PROFILE(FunctionCreateEvent(*function));
909 function->shared()->set_code_age(0); 911 function->shared()->set_code_age(0);
910 return true;
911 } else { 912 } else {
912 CompilationInfo info(function); 913 CompilationInfo info(function);
913 info.MarkAsInLoop(); 914 info.MarkAsInLoop();
914 bool result = CompileLazyHelper(&info, flag); 915 result = CompileLazyHelper(&info, flag);
915 ASSERT(!result || function->is_compiled()); 916 ASSERT(!result || function->is_compiled());
917 }
918 if (result && function->is_compiled()) {
916 PROFILE(FunctionCreateEvent(*function)); 919 PROFILE(FunctionCreateEvent(*function));
917 return result;
918 } 920 }
921 return result;
919 } 922 }
920 923
921 924
925 bool CompileOptimized(Handle<JSFunction> function, int osr_ast_id) {
926 CompilationInfo info(function);
927 info.SetOptimizing(osr_ast_id);
928 bool result = CompileLazyHelper(&info, KEEP_EXCEPTION);
929 if (result) PROFILE(FunctionCreateEvent(*function));
930 return result;
931 }
932
933
922 OptimizedObjectForAddingMultipleProperties:: 934 OptimizedObjectForAddingMultipleProperties::
923 OptimizedObjectForAddingMultipleProperties(Handle<JSObject> object, 935 OptimizedObjectForAddingMultipleProperties(Handle<JSObject> object,
924 int expected_additional_properties, 936 int expected_additional_properties,
925 bool condition) { 937 bool condition) {
926 object_ = object; 938 object_ = object;
927 if (condition && object_->HasFastProperties()) { 939 if (condition && object_->HasFastProperties()) {
928 // Normalize the properties of object to avoid n^2 behavior 940 // Normalize the properties of object to avoid n^2 behavior
929 // when extending the object multiple properties. Indicate the number of 941 // when extending the object multiple properties. Indicate the number of
930 // properties to be added. 942 // properties to be added.
931 unused_property_fields_ = object->map()->unused_property_fields(); 943 unused_property_fields_ = object->map()->unused_property_fields();
(...skipping 10 matching lines...) Expand all
942 954
943 OptimizedObjectForAddingMultipleProperties:: 955 OptimizedObjectForAddingMultipleProperties::
944 ~OptimizedObjectForAddingMultipleProperties() { 956 ~OptimizedObjectForAddingMultipleProperties() {
945 // Reoptimize the object to allow fast property access. 957 // Reoptimize the object to allow fast property access.
946 if (has_been_transformed_) { 958 if (has_been_transformed_) {
947 TransformToFastProperties(object_, unused_property_fields_); 959 TransformToFastProperties(object_, unused_property_fields_);
948 } 960 }
949 } 961 }
950 962
951 } } // namespace v8::internal 963 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.h ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698