| 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 return Pop(); | 332 return Pop(); |
| 333 } | 333 } |
| 334 | 334 |
| 335 | 335 |
| 336 Handle<Code> ToNumberStub::GenerateCode(Isolate* isolate) { | 336 Handle<Code> ToNumberStub::GenerateCode(Isolate* isolate) { |
| 337 return DoGenerateCode(isolate, this); | 337 return DoGenerateCode(isolate, this); |
| 338 } | 338 } |
| 339 | 339 |
| 340 | 340 |
| 341 template <> | 341 template <> |
| 342 HValue* CodeStubGraphBuilder<NumberToStringStub>::BuildCodeStub() { |
| 343 info()->MarkAsSavesCallerDoubles(); |
| 344 HValue* number = GetParameter(NumberToStringStub::kNumber); |
| 345 return BuildNumberToString(number); |
| 346 } |
| 347 |
| 348 |
| 349 Handle<Code> NumberToStringStub::GenerateCode(Isolate* isolate) { |
| 350 return DoGenerateCode(isolate, this); |
| 351 } |
| 352 |
| 353 |
| 354 template <> |
| 342 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { | 355 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { |
| 343 Factory* factory = isolate()->factory(); | 356 Factory* factory = isolate()->factory(); |
| 344 HValue* undefined = graph()->GetConstantUndefined(); | 357 HValue* undefined = graph()->GetConstantUndefined(); |
| 345 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode(); | 358 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode(); |
| 346 FastCloneShallowArrayStub::Mode mode = casted_stub()->mode(); | 359 FastCloneShallowArrayStub::Mode mode = casted_stub()->mode(); |
| 347 int length = casted_stub()->length(); | 360 int length = casted_stub()->length(); |
| 348 | 361 |
| 349 HInstruction* allocation_site = Add<HLoadKeyed>(GetParameter(0), | 362 HInstruction* allocation_site = Add<HLoadKeyed>(GetParameter(0), |
| 350 GetParameter(1), | 363 GetParameter(1), |
| 351 static_cast<HValue*>(NULL), | 364 static_cast<HValue*>(NULL), |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 } | 470 } |
| 458 | 471 |
| 459 | 472 |
| 460 template <> | 473 template <> |
| 461 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { | 474 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { |
| 462 HValue* size = Add<HConstant>(AllocationSite::kSize); | 475 HValue* size = Add<HConstant>(AllocationSite::kSize); |
| 463 HInstruction* object = Add<HAllocate>(size, HType::JSObject(), TENURED, | 476 HInstruction* object = Add<HAllocate>(size, HType::JSObject(), TENURED, |
| 464 JS_OBJECT_TYPE); | 477 JS_OBJECT_TYPE); |
| 465 | 478 |
| 466 // Store the map | 479 // Store the map |
| 467 Handle<Map> allocation_site_map(isolate()->heap()->allocation_site_map(), | 480 Handle<Map> allocation_site_map = isolate()->factory()->allocation_site_map(); |
| 468 isolate()); | |
| 469 AddStoreMapConstant(object, allocation_site_map); | 481 AddStoreMapConstant(object, allocation_site_map); |
| 470 | 482 |
| 471 // Store the payload (smi elements kind) | 483 // Store the payload (smi elements kind) |
| 472 HValue* initial_elements_kind = Add<HConstant>(GetInitialFastElementsKind()); | 484 HValue* initial_elements_kind = Add<HConstant>(GetInitialFastElementsKind()); |
| 473 Add<HStoreNamedField>(object, | 485 Add<HStoreNamedField>(object, |
| 474 HObjectAccess::ForAllocationSiteTransitionInfo(), | 486 HObjectAccess::ForAllocationSiteTransitionInfo(), |
| 475 initial_elements_kind); | 487 initial_elements_kind); |
| 476 | 488 |
| 489 // Unlike literals, constructed arrays don't have nested sites |
| 490 Add<HStoreNamedField>(object, |
| 491 HObjectAccess::ForAllocationSiteNestedSite(), |
| 492 graph()->GetConstant0()); |
| 493 |
| 477 // Store an empty fixed array for the code dependency. | 494 // Store an empty fixed array for the code dependency. |
| 478 HConstant* empty_fixed_array = | 495 HConstant* empty_fixed_array = |
| 479 Add<HConstant>(isolate()->factory()->empty_fixed_array()); | 496 Add<HConstant>(isolate()->factory()->empty_fixed_array()); |
| 480 HStoreNamedField* store = Add<HStoreNamedField>( | 497 HStoreNamedField* store = Add<HStoreNamedField>( |
| 481 object, | 498 object, |
| 482 HObjectAccess::ForAllocationSiteDependentCode(), | 499 HObjectAccess::ForAllocationSiteDependentCode(), |
| 483 empty_fixed_array); | 500 empty_fixed_array); |
| 484 | 501 |
| 485 // Link the object to the allocation site list | 502 // Link the object to the allocation site list |
| 486 HValue* site_list = Add<HConstant>( | 503 HValue* site_list = Add<HConstant>( |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 | 1074 |
| 1058 | 1075 |
| 1059 template<> | 1076 template<> |
| 1060 HValue* CodeStubGraphBuilder<FastNewClosureStub>::BuildCodeStub() { | 1077 HValue* CodeStubGraphBuilder<FastNewClosureStub>::BuildCodeStub() { |
| 1061 Counters* counters = isolate()->counters(); | 1078 Counters* counters = isolate()->counters(); |
| 1062 Factory* factory = isolate()->factory(); | 1079 Factory* factory = isolate()->factory(); |
| 1063 HInstruction* empty_fixed_array = | 1080 HInstruction* empty_fixed_array = |
| 1064 Add<HConstant>(factory->empty_fixed_array()); | 1081 Add<HConstant>(factory->empty_fixed_array()); |
| 1065 HValue* shared_info = GetParameter(0); | 1082 HValue* shared_info = GetParameter(0); |
| 1066 | 1083 |
| 1084 AddIncrementCounter(counters->fast_new_closure_total()); |
| 1085 |
| 1067 // Create a new closure from the given function info in new space | 1086 // Create a new closure from the given function info in new space |
| 1068 HValue* size = Add<HConstant>(JSFunction::kSize); | 1087 HValue* size = Add<HConstant>(JSFunction::kSize); |
| 1069 HInstruction* js_function = Add<HAllocate>(size, HType::JSObject(), | 1088 HInstruction* js_function = Add<HAllocate>(size, HType::JSObject(), |
| 1070 NOT_TENURED, JS_FUNCTION_TYPE); | 1089 NOT_TENURED, JS_FUNCTION_TYPE); |
| 1071 AddIncrementCounter(counters->fast_new_closure_total()); | |
| 1072 | 1090 |
| 1073 int map_index = Context::FunctionMapIndex(casted_stub()->language_mode(), | 1091 int map_index = Context::FunctionMapIndex(casted_stub()->language_mode(), |
| 1074 casted_stub()->is_generator()); | 1092 casted_stub()->is_generator()); |
| 1075 | 1093 |
| 1076 // Compute the function map in the current native context and set that | 1094 // Compute the function map in the current native context and set that |
| 1077 // as the map of the allocated object. | 1095 // as the map of the allocated object. |
| 1078 HInstruction* native_context = BuildGetNativeContext(); | 1096 HInstruction* native_context = BuildGetNativeContext(); |
| 1079 HInstruction* map_slot_value = Add<HLoadNamedField>(native_context, | 1097 HInstruction* map_slot_value = Add<HLoadNamedField>(native_context, |
| 1080 HObjectAccess::ForContextSlot(map_index)); | 1098 HObjectAccess::ForContextSlot(map_index)); |
| 1081 Add<HStoreNamedField>(js_function, HObjectAccess::ForMap(), map_slot_value); | 1099 Add<HStoreNamedField>(js_function, HObjectAccess::ForMap(), map_slot_value); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1109 return js_function; | 1127 return js_function; |
| 1110 } | 1128 } |
| 1111 | 1129 |
| 1112 | 1130 |
| 1113 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { | 1131 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { |
| 1114 return DoGenerateCode(isolate, this); | 1132 return DoGenerateCode(isolate, this); |
| 1115 } | 1133 } |
| 1116 | 1134 |
| 1117 | 1135 |
| 1118 } } // namespace v8::internal | 1136 } } // namespace v8::internal |
| OLD | NEW |