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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 } | 457 } |
458 | 458 |
459 | 459 |
460 template <> | 460 template <> |
461 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { | 461 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { |
462 HValue* size = Add<HConstant>(AllocationSite::kSize); | 462 HValue* size = Add<HConstant>(AllocationSite::kSize); |
463 HInstruction* object = Add<HAllocate>(size, HType::JSObject(), TENURED, | 463 HInstruction* object = Add<HAllocate>(size, HType::JSObject(), TENURED, |
464 JS_OBJECT_TYPE); | 464 JS_OBJECT_TYPE); |
465 | 465 |
466 // Store the map | 466 // Store the map |
467 Handle<Map> allocation_site_map(isolate()->heap()->allocation_site_map(), | 467 Handle<Map> allocation_site_map = isolate()->factory()->allocation_site_map(); |
468 isolate()); | |
469 AddStoreMapConstant(object, allocation_site_map); | 468 AddStoreMapConstant(object, allocation_site_map); |
470 | 469 |
471 // Store the payload (smi elements kind) | 470 // Store the payload (smi elements kind) |
472 HValue* initial_elements_kind = Add<HConstant>(GetInitialFastElementsKind()); | 471 HValue* initial_elements_kind = Add<HConstant>(GetInitialFastElementsKind()); |
473 Add<HStoreNamedField>(object, | 472 Add<HStoreNamedField>(object, |
474 HObjectAccess::ForAllocationSiteTransitionInfo(), | 473 HObjectAccess::ForAllocationSiteTransitionInfo(), |
475 initial_elements_kind); | 474 initial_elements_kind); |
476 | 475 |
477 // Store an empty fixed array for the code dependency. | 476 // Store an empty fixed array for the code dependency. |
478 HConstant* empty_fixed_array = | 477 HConstant* empty_fixed_array = |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 | 1056 |
1058 | 1057 |
1059 template<> | 1058 template<> |
1060 HValue* CodeStubGraphBuilder<FastNewClosureStub>::BuildCodeStub() { | 1059 HValue* CodeStubGraphBuilder<FastNewClosureStub>::BuildCodeStub() { |
1061 Counters* counters = isolate()->counters(); | 1060 Counters* counters = isolate()->counters(); |
1062 Factory* factory = isolate()->factory(); | 1061 Factory* factory = isolate()->factory(); |
1063 HInstruction* empty_fixed_array = | 1062 HInstruction* empty_fixed_array = |
1064 Add<HConstant>(factory->empty_fixed_array()); | 1063 Add<HConstant>(factory->empty_fixed_array()); |
1065 HValue* shared_info = GetParameter(0); | 1064 HValue* shared_info = GetParameter(0); |
1066 | 1065 |
| 1066 AddIncrementCounter(counters->fast_new_closure_total()); |
| 1067 |
1067 // Create a new closure from the given function info in new space | 1068 // Create a new closure from the given function info in new space |
1068 HValue* size = Add<HConstant>(JSFunction::kSize); | 1069 HValue* size = Add<HConstant>(JSFunction::kSize); |
1069 HInstruction* js_function = Add<HAllocate>(size, HType::JSObject(), | 1070 HInstruction* js_function = Add<HAllocate>(size, HType::JSObject(), |
1070 NOT_TENURED, JS_FUNCTION_TYPE); | 1071 NOT_TENURED, JS_FUNCTION_TYPE); |
1071 AddIncrementCounter(counters->fast_new_closure_total()); | |
1072 | 1072 |
1073 int map_index = Context::FunctionMapIndex(casted_stub()->language_mode(), | 1073 int map_index = Context::FunctionMapIndex(casted_stub()->language_mode(), |
1074 casted_stub()->is_generator()); | 1074 casted_stub()->is_generator()); |
1075 | 1075 |
1076 // Compute the function map in the current native context and set that | 1076 // Compute the function map in the current native context and set that |
1077 // as the map of the allocated object. | 1077 // as the map of the allocated object. |
1078 HInstruction* native_context = BuildGetNativeContext(); | 1078 HInstruction* native_context = BuildGetNativeContext(); |
1079 HInstruction* map_slot_value = Add<HLoadNamedField>(native_context, | 1079 HInstruction* map_slot_value = Add<HLoadNamedField>(native_context, |
1080 HObjectAccess::ForContextSlot(map_index)); | 1080 HObjectAccess::ForContextSlot(map_index)); |
1081 Add<HStoreNamedField>(js_function, HObjectAccess::ForMap(), map_slot_value); | 1081 Add<HStoreNamedField>(js_function, HObjectAccess::ForMap(), map_slot_value); |
(...skipping 27 matching lines...) Expand all Loading... |
1109 return js_function; | 1109 return js_function; |
1110 } | 1110 } |
1111 | 1111 |
1112 | 1112 |
1113 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { | 1113 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { |
1114 return DoGenerateCode(isolate, this); | 1114 return DoGenerateCode(isolate, this); |
1115 } | 1115 } |
1116 | 1116 |
1117 | 1117 |
1118 } } // namespace v8::internal | 1118 } } // namespace v8::internal |
OLD | NEW |