| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode(Isolate* isolate) { | 916 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode(Isolate* isolate) { |
| 917 return DoGenerateCode(isolate, this); | 917 return DoGenerateCode(isolate, this); |
| 918 } | 918 } |
| 919 | 919 |
| 920 | 920 |
| 921 void CodeStubGraphBuilderBase::BuildInstallOptimizedCode( | 921 void CodeStubGraphBuilderBase::BuildInstallOptimizedCode( |
| 922 HValue* js_function, | 922 HValue* js_function, |
| 923 HValue* native_context, | 923 HValue* native_context, |
| 924 HValue* code_object) { | 924 HValue* code_object) { |
| 925 Counters* counters = isolate()->counters(); | 925 Counters* counters = isolate()->counters(); |
| 926 AddIncrementCounter(counters->fast_new_closure_install_optimized(), | 926 AddIncrementCounter(counters->fast_new_closure_install_optimized()); |
| 927 context()); | |
| 928 | 927 |
| 929 // TODO(fschneider): Idea: store proper code pointers in the optimized code | 928 // TODO(fschneider): Idea: store proper code pointers in the optimized code |
| 930 // map and either unmangle them on marking or do nothing as the whole map is | 929 // map and either unmangle them on marking or do nothing as the whole map is |
| 931 // discarded on major GC anyway. | 930 // discarded on major GC anyway. |
| 932 Add<HStoreCodeEntry>(js_function, code_object); | 931 Add<HStoreCodeEntry>(js_function, code_object); |
| 933 | 932 |
| 934 // Now link a function into a list of optimized functions. | 933 // Now link a function into a list of optimized functions. |
| 935 HValue* optimized_functions_list = Add<HLoadNamedField>(native_context, | 934 HValue* optimized_functions_list = Add<HLoadNamedField>(native_context, |
| 936 HObjectAccess::ForContextSlot(Context::OPTIMIZED_FUNCTIONS_LIST)); | 935 HObjectAccess::ForContextSlot(Context::OPTIMIZED_FUNCTIONS_LIST)); |
| 937 Add<HStoreNamedField>(js_function, | 936 Add<HStoreNamedField>(js_function, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 965 HInstruction* optimized_map = Add<HLoadNamedField>(shared_info, | 964 HInstruction* optimized_map = Add<HLoadNamedField>(shared_info, |
| 966 HObjectAccess::ForOptimizedCodeMap()); | 965 HObjectAccess::ForOptimizedCodeMap()); |
| 967 HValue* null_constant = Add<HConstant>(0); | 966 HValue* null_constant = Add<HConstant>(0); |
| 968 is_optimized.If<HCompareObjectEqAndBranch>(optimized_map, null_constant); | 967 is_optimized.If<HCompareObjectEqAndBranch>(optimized_map, null_constant); |
| 969 is_optimized.Then(); | 968 is_optimized.Then(); |
| 970 { | 969 { |
| 971 BuildInstallCode(js_function, shared_info); | 970 BuildInstallCode(js_function, shared_info); |
| 972 } | 971 } |
| 973 is_optimized.Else(); | 972 is_optimized.Else(); |
| 974 { | 973 { |
| 975 AddIncrementCounter(counters->fast_new_closure_try_optimized(), context()); | 974 AddIncrementCounter(counters->fast_new_closure_try_optimized()); |
| 976 // optimized_map points to fixed array of 3-element entries | 975 // optimized_map points to fixed array of 3-element entries |
| 977 // (native context, optimized code, literals). | 976 // (native context, optimized code, literals). |
| 978 // Map must never be empty, so check the first elements. | 977 // Map must never be empty, so check the first elements. |
| 979 Label install_optimized; | 978 Label install_optimized; |
| 980 HValue* first_context_slot = Add<HLoadNamedField>(optimized_map, | 979 HValue* first_context_slot = Add<HLoadNamedField>(optimized_map, |
| 981 HObjectAccess::ForFirstContextSlot()); | 980 HObjectAccess::ForFirstContextSlot()); |
| 982 IfBuilder already_in(this); | 981 IfBuilder already_in(this); |
| 983 already_in.If<HCompareObjectEqAndBranch>(native_context, | 982 already_in.If<HCompareObjectEqAndBranch>(native_context, |
| 984 first_context_slot); | 983 first_context_slot); |
| 985 already_in.Then(); | 984 already_in.Then(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1054 Counters* counters = isolate()->counters(); | 1053 Counters* counters = isolate()->counters(); |
| 1055 Factory* factory = isolate()->factory(); | 1054 Factory* factory = isolate()->factory(); |
| 1056 HInstruction* empty_fixed_array = | 1055 HInstruction* empty_fixed_array = |
| 1057 Add<HConstant>(factory->empty_fixed_array()); | 1056 Add<HConstant>(factory->empty_fixed_array()); |
| 1058 HValue* shared_info = GetParameter(0); | 1057 HValue* shared_info = GetParameter(0); |
| 1059 | 1058 |
| 1060 // Create a new closure from the given function info in new space | 1059 // Create a new closure from the given function info in new space |
| 1061 HValue* size = Add<HConstant>(JSFunction::kSize); | 1060 HValue* size = Add<HConstant>(JSFunction::kSize); |
| 1062 HInstruction* js_function = Add<HAllocate>(size, HType::JSObject(), | 1061 HInstruction* js_function = Add<HAllocate>(size, HType::JSObject(), |
| 1063 NOT_TENURED, JS_FUNCTION_TYPE); | 1062 NOT_TENURED, JS_FUNCTION_TYPE); |
| 1064 AddIncrementCounter(counters->fast_new_closure_total(), context()); | 1063 AddIncrementCounter(counters->fast_new_closure_total()); |
| 1065 | 1064 |
| 1066 int map_index = Context::FunctionMapIndex(casted_stub()->language_mode(), | 1065 int map_index = Context::FunctionMapIndex(casted_stub()->language_mode(), |
| 1067 casted_stub()->is_generator()); | 1066 casted_stub()->is_generator()); |
| 1068 | 1067 |
| 1069 // Compute the function map in the current native context and set that | 1068 // Compute the function map in the current native context and set that |
| 1070 // as the map of the allocated object. | 1069 // as the map of the allocated object. |
| 1071 HInstruction* native_context = BuildGetNativeContext(); | 1070 HInstruction* native_context = BuildGetNativeContext(); |
| 1072 HInstruction* map_slot_value = Add<HLoadNamedField>(native_context, | 1071 HInstruction* map_slot_value = Add<HLoadNamedField>(native_context, |
| 1073 HObjectAccess::ForContextSlot(map_index)); | 1072 HObjectAccess::ForContextSlot(map_index)); |
| 1074 Add<HStoreNamedField>(js_function, HObjectAccess::ForMap(), map_slot_value); | 1073 Add<HStoreNamedField>(js_function, HObjectAccess::ForMap(), map_slot_value); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1102 return js_function; | 1101 return js_function; |
| 1103 } | 1102 } |
| 1104 | 1103 |
| 1105 | 1104 |
| 1106 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { | 1105 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { |
| 1107 return DoGenerateCode(isolate, this); | 1106 return DoGenerateCode(isolate, this); |
| 1108 } | 1107 } |
| 1109 | 1108 |
| 1110 | 1109 |
| 1111 } } // namespace v8::internal | 1110 } } // namespace v8::internal |
| OLD | NEW |