OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
10 #include "src/crankshaft/hydrogen.h" | 10 #include "src/crankshaft/hydrogen.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 return true; | 182 return true; |
183 } | 183 } |
184 | 184 |
185 | 185 |
186 template <class Stub> | 186 template <class Stub> |
187 class CodeStubGraphBuilder: public CodeStubGraphBuilderBase { | 187 class CodeStubGraphBuilder: public CodeStubGraphBuilderBase { |
188 public: | 188 public: |
189 explicit CodeStubGraphBuilder(CompilationInfo* info, CodeStub* stub) | 189 explicit CodeStubGraphBuilder(CompilationInfo* info, CodeStub* stub) |
190 : CodeStubGraphBuilderBase(info, stub) {} | 190 : CodeStubGraphBuilderBase(info, stub) {} |
191 | 191 |
| 192 typedef typename Stub::Descriptor Descriptor; |
| 193 |
192 protected: | 194 protected: |
193 virtual HValue* BuildCodeStub() { | 195 virtual HValue* BuildCodeStub() { |
194 if (casted_stub()->IsUninitialized()) { | 196 if (casted_stub()->IsUninitialized()) { |
195 return BuildCodeUninitializedStub(); | 197 return BuildCodeUninitializedStub(); |
196 } else { | 198 } else { |
197 return BuildCodeInitializedStub(); | 199 return BuildCodeInitializedStub(); |
198 } | 200 } |
199 } | 201 } |
200 | 202 |
201 virtual HValue* BuildCodeInitializedStub() { | 203 virtual HValue* BuildCodeInitializedStub() { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 os << "[Lazy compilation of " << stub << " took " | 282 os << "[Lazy compilation of " << stub << " took " |
281 << timer.Elapsed().InMillisecondsF() << " ms]" << std::endl; | 283 << timer.Elapsed().InMillisecondsF() << " ms]" << std::endl; |
282 } | 284 } |
283 return code; | 285 return code; |
284 } | 286 } |
285 | 287 |
286 | 288 |
287 template <> | 289 template <> |
288 HValue* CodeStubGraphBuilder<NumberToStringStub>::BuildCodeStub() { | 290 HValue* CodeStubGraphBuilder<NumberToStringStub>::BuildCodeStub() { |
289 info()->MarkAsSavesCallerDoubles(); | 291 info()->MarkAsSavesCallerDoubles(); |
290 HValue* number = GetParameter(NumberToStringStub::kNumber); | 292 HValue* number = GetParameter(Descriptor::kArgument); |
291 return BuildNumberToString(number, Type::Number()); | 293 return BuildNumberToString(number, Type::Number()); |
292 } | 294 } |
293 | 295 |
294 | 296 |
295 Handle<Code> NumberToStringStub::GenerateCode() { | 297 Handle<Code> NumberToStringStub::GenerateCode() { |
296 return DoGenerateCode(this); | 298 return DoGenerateCode(this); |
297 } | 299 } |
298 | 300 |
299 | 301 |
300 // Returns the type string of a value; see ECMA-262, 11.4.3 (p 47). | 302 // Returns the type string of a value; see ECMA-262, 11.4.3 (p 47). |
301 template <> | 303 template <> |
302 HValue* CodeStubGraphBuilder<TypeofStub>::BuildCodeStub() { | 304 HValue* CodeStubGraphBuilder<TypeofStub>::BuildCodeStub() { |
303 Factory* factory = isolate()->factory(); | 305 Factory* factory = isolate()->factory(); |
304 HConstant* number_string = Add<HConstant>(factory->number_string()); | 306 HConstant* number_string = Add<HConstant>(factory->number_string()); |
305 HValue* object = GetParameter(TypeofStub::kObject); | 307 HValue* object = GetParameter(Descriptor::kObject); |
306 | 308 |
307 IfBuilder is_smi(this); | 309 IfBuilder is_smi(this); |
308 HValue* smi_check = is_smi.If<HIsSmiAndBranch>(object); | 310 HValue* smi_check = is_smi.If<HIsSmiAndBranch>(object); |
309 is_smi.Then(); | 311 is_smi.Then(); |
310 { Push(number_string); } | 312 { Push(number_string); } |
311 is_smi.Else(); | 313 is_smi.Else(); |
312 { | 314 { |
313 IfBuilder is_number(this); | 315 IfBuilder is_number(this); |
314 is_number.If<HCompareMap>(object, isolate()->factory()->heap_number_map()); | 316 is_number.If<HCompareMap>(object, isolate()->factory()->heap_number_map()); |
315 is_number.Then(); | 317 is_number.Then(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 402 |
401 return environment()->Pop(); | 403 return environment()->Pop(); |
402 } | 404 } |
403 | 405 |
404 | 406 |
405 Handle<Code> TypeofStub::GenerateCode() { return DoGenerateCode(this); } | 407 Handle<Code> TypeofStub::GenerateCode() { return DoGenerateCode(this); } |
406 | 408 |
407 | 409 |
408 template <> | 410 template <> |
409 HValue* CodeStubGraphBuilder<FastCloneRegExpStub>::BuildCodeStub() { | 411 HValue* CodeStubGraphBuilder<FastCloneRegExpStub>::BuildCodeStub() { |
410 HValue* closure = GetParameter(0); | 412 HValue* closure = GetParameter(Descriptor::kClosure); |
411 HValue* literal_index = GetParameter(1); | 413 HValue* literal_index = GetParameter(Descriptor::kLiteralIndex); |
412 | 414 |
413 // This stub is very performance sensitive, the generated code must be tuned | 415 // This stub is very performance sensitive, the generated code must be tuned |
414 // so that it doesn't build and eager frame. | 416 // so that it doesn't build and eager frame. |
415 info()->MarkMustNotHaveEagerFrame(); | 417 info()->MarkMustNotHaveEagerFrame(); |
416 | 418 |
417 HValue* literals_array = Add<HLoadNamedField>( | 419 HValue* literals_array = Add<HLoadNamedField>( |
418 closure, nullptr, HObjectAccess::ForLiteralsPointer()); | 420 closure, nullptr, HObjectAccess::ForLiteralsPointer()); |
419 HInstruction* boilerplate = Add<HLoadKeyed>( | 421 HInstruction* boilerplate = Add<HLoadKeyed>( |
420 literals_array, literal_index, nullptr, nullptr, FAST_ELEMENTS, | 422 literals_array, literal_index, nullptr, nullptr, FAST_ELEMENTS, |
421 NEVER_RETURN_HOLE, LiteralsArray::kOffsetToFirstLiteral - kHeapObjectTag); | 423 NEVER_RETURN_HOLE, LiteralsArray::kOffsetToFirstLiteral - kHeapObjectTag); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 Handle<Code> FastCloneRegExpStub::GenerateCode() { | 462 Handle<Code> FastCloneRegExpStub::GenerateCode() { |
461 return DoGenerateCode(this); | 463 return DoGenerateCode(this); |
462 } | 464 } |
463 | 465 |
464 | 466 |
465 template <> | 467 template <> |
466 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { | 468 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { |
467 Factory* factory = isolate()->factory(); | 469 Factory* factory = isolate()->factory(); |
468 HValue* undefined = graph()->GetConstantUndefined(); | 470 HValue* undefined = graph()->GetConstantUndefined(); |
469 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode(); | 471 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode(); |
470 HValue* closure = GetParameter(0); | 472 HValue* closure = GetParameter(Descriptor::kClosure); |
471 HValue* literal_index = GetParameter(1); | 473 HValue* literal_index = GetParameter(Descriptor::kLiteralIndex); |
472 | 474 |
473 // TODO(turbofan): This codestub has regressed to need a frame on ia32 at some | 475 // TODO(turbofan): This codestub has regressed to need a frame on ia32 at some |
474 // point and wasn't caught since it wasn't built in the snapshot. We should | 476 // point and wasn't caught since it wasn't built in the snapshot. We should |
475 // probably just replace with a TurboFan stub rather than fixing it. | 477 // probably just replace with a TurboFan stub rather than fixing it. |
476 #if !(V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87) | 478 #if !(V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87) |
477 // This stub is very performance sensitive, the generated code must be tuned | 479 // This stub is very performance sensitive, the generated code must be tuned |
478 // so that it doesn't build and eager frame. | 480 // so that it doesn't build and eager frame. |
479 info()->MarkMustNotHaveEagerFrame(); | 481 info()->MarkMustNotHaveEagerFrame(); |
480 #endif | 482 #endif |
481 | 483 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 // system for weakness. For now we decided to keep it like this because having | 602 // system for weakness. For now we decided to keep it like this because having |
601 // an initial write barrier backed store makes this pointer strong until the | 603 // an initial write barrier backed store makes this pointer strong until the |
602 // next GC, and allocation sites are designed to survive several GCs anyway. | 604 // next GC, and allocation sites are designed to survive several GCs anyway. |
603 Add<HStoreNamedField>( | 605 Add<HStoreNamedField>( |
604 object, | 606 object, |
605 HObjectAccess::ForAllocationSiteOffset(AllocationSite::kWeakNextOffset), | 607 HObjectAccess::ForAllocationSiteOffset(AllocationSite::kWeakNextOffset), |
606 site); | 608 site); |
607 Add<HStoreNamedField>(site_list, HObjectAccess::ForAllocationSiteList(), | 609 Add<HStoreNamedField>(site_list, HObjectAccess::ForAllocationSiteList(), |
608 object); | 610 object); |
609 | 611 |
610 HInstruction* feedback_vector = GetParameter(0); | 612 HInstruction* feedback_vector = GetParameter(Descriptor::kVector); |
611 HInstruction* slot = GetParameter(1); | 613 HInstruction* slot = GetParameter(Descriptor::kSlot); |
612 Add<HStoreKeyed>(feedback_vector, slot, object, nullptr, FAST_ELEMENTS, | 614 Add<HStoreKeyed>(feedback_vector, slot, object, nullptr, FAST_ELEMENTS, |
613 INITIALIZING_STORE); | 615 INITIALIZING_STORE); |
614 return feedback_vector; | 616 return feedback_vector; |
615 } | 617 } |
616 | 618 |
617 | 619 |
618 Handle<Code> CreateAllocationSiteStub::GenerateCode() { | 620 Handle<Code> CreateAllocationSiteStub::GenerateCode() { |
619 return DoGenerateCode(this); | 621 return DoGenerateCode(this); |
620 } | 622 } |
621 | 623 |
622 | 624 |
623 template <> | 625 template <> |
624 HValue* CodeStubGraphBuilder<CreateWeakCellStub>::BuildCodeStub() { | 626 HValue* CodeStubGraphBuilder<CreateWeakCellStub>::BuildCodeStub() { |
625 // This stub is performance sensitive, the generated code must be tuned | 627 // This stub is performance sensitive, the generated code must be tuned |
626 // so that it doesn't build an eager frame. | 628 // so that it doesn't build an eager frame. |
627 info()->MarkMustNotHaveEagerFrame(); | 629 info()->MarkMustNotHaveEagerFrame(); |
628 | 630 |
629 HValue* size = Add<HConstant>(WeakCell::kSize); | 631 HValue* size = Add<HConstant>(WeakCell::kSize); |
630 HInstruction* object = | 632 HInstruction* object = |
631 Add<HAllocate>(size, HType::JSObject(), TENURED, JS_OBJECT_TYPE, | 633 Add<HAllocate>(size, HType::JSObject(), TENURED, JS_OBJECT_TYPE, |
632 graph()->GetConstant0()); | 634 graph()->GetConstant0()); |
633 | 635 |
634 Handle<Map> weak_cell_map = isolate()->factory()->weak_cell_map(); | 636 Handle<Map> weak_cell_map = isolate()->factory()->weak_cell_map(); |
635 AddStoreMapConstant(object, weak_cell_map); | 637 AddStoreMapConstant(object, weak_cell_map); |
636 | 638 |
637 HInstruction* value = GetParameter(CreateWeakCellDescriptor::kValueIndex); | 639 HInstruction* value = GetParameter(Descriptor::kValue); |
638 Add<HStoreNamedField>(object, HObjectAccess::ForWeakCellValue(), value); | 640 Add<HStoreNamedField>(object, HObjectAccess::ForWeakCellValue(), value); |
639 Add<HStoreNamedField>(object, HObjectAccess::ForWeakCellNext(), | 641 Add<HStoreNamedField>(object, HObjectAccess::ForWeakCellNext(), |
640 graph()->GetConstantHole()); | 642 graph()->GetConstantHole()); |
641 | 643 |
642 HInstruction* feedback_vector = | 644 HInstruction* feedback_vector = GetParameter(Descriptor::kVector); |
643 GetParameter(CreateWeakCellDescriptor::kVectorIndex); | 645 HInstruction* slot = GetParameter(Descriptor::kSlot); |
644 HInstruction* slot = GetParameter(CreateWeakCellDescriptor::kSlotIndex); | |
645 Add<HStoreKeyed>(feedback_vector, slot, object, nullptr, FAST_ELEMENTS, | 646 Add<HStoreKeyed>(feedback_vector, slot, object, nullptr, FAST_ELEMENTS, |
646 INITIALIZING_STORE); | 647 INITIALIZING_STORE); |
647 return graph()->GetConstant0(); | 648 return graph()->GetConstant0(); |
648 } | 649 } |
649 | 650 |
650 | 651 |
651 Handle<Code> CreateWeakCellStub::GenerateCode() { return DoGenerateCode(this); } | 652 Handle<Code> CreateWeakCellStub::GenerateCode() { return DoGenerateCode(this); } |
652 | 653 |
653 | 654 |
654 template <> | 655 template <> |
(...skipping 14 matching lines...) Expand all Loading... |
669 | 670 |
670 template <> | 671 template <> |
671 HValue* CodeStubGraphBuilder<StoreScriptContextFieldStub>::BuildCodeStub() { | 672 HValue* CodeStubGraphBuilder<StoreScriptContextFieldStub>::BuildCodeStub() { |
672 int context_index = casted_stub()->context_index(); | 673 int context_index = casted_stub()->context_index(); |
673 int slot_index = casted_stub()->slot_index(); | 674 int slot_index = casted_stub()->slot_index(); |
674 | 675 |
675 HValue* script_context = BuildGetScriptContext(context_index); | 676 HValue* script_context = BuildGetScriptContext(context_index); |
676 Add<HStoreNamedField>(script_context, | 677 Add<HStoreNamedField>(script_context, |
677 HObjectAccess::ForContextSlot(slot_index), | 678 HObjectAccess::ForContextSlot(slot_index), |
678 GetParameter(2), STORE_TO_INITIALIZED_ENTRY); | 679 GetParameter(2), STORE_TO_INITIALIZED_ENTRY); |
| 680 // TODO(ishell): Remove this unused stub. |
679 return GetParameter(2); | 681 return GetParameter(2); |
680 } | 682 } |
681 | 683 |
682 | 684 |
683 Handle<Code> StoreScriptContextFieldStub::GenerateCode() { | 685 Handle<Code> StoreScriptContextFieldStub::GenerateCode() { |
684 return DoGenerateCode(this); | 686 return DoGenerateCode(this); |
685 } | 687 } |
686 | 688 |
687 HValue* CodeStubGraphBuilderBase::BuildPushElement(HValue* object, HValue* argc, | 689 HValue* CodeStubGraphBuilderBase::BuildPushElement(HValue* object, HValue* argc, |
688 HValue* argument_elements, | 690 HValue* argument_elements, |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 return DoGenerateCode(this); | 1068 return DoGenerateCode(this); |
1067 } | 1069 } |
1068 | 1070 |
1069 template <> | 1071 template <> |
1070 HValue* CodeStubGraphBuilder<GrowArrayElementsStub>::BuildCodeStub() { | 1072 HValue* CodeStubGraphBuilder<GrowArrayElementsStub>::BuildCodeStub() { |
1071 ElementsKind kind = casted_stub()->elements_kind(); | 1073 ElementsKind kind = casted_stub()->elements_kind(); |
1072 if (IsFastDoubleElementsKind(kind)) { | 1074 if (IsFastDoubleElementsKind(kind)) { |
1073 info()->MarkAsSavesCallerDoubles(); | 1075 info()->MarkAsSavesCallerDoubles(); |
1074 } | 1076 } |
1075 | 1077 |
1076 HValue* object = GetParameter(GrowArrayElementsDescriptor::kObjectIndex); | 1078 HValue* object = GetParameter(Descriptor::kObject); |
1077 HValue* key = GetParameter(GrowArrayElementsDescriptor::kKeyIndex); | 1079 HValue* key = GetParameter(Descriptor::kKey); |
1078 | 1080 |
1079 HValue* elements = AddLoadElements(object); | 1081 HValue* elements = AddLoadElements(object); |
1080 HValue* current_capacity = Add<HLoadNamedField>( | 1082 HValue* current_capacity = Add<HLoadNamedField>( |
1081 elements, nullptr, HObjectAccess::ForFixedArrayLength()); | 1083 elements, nullptr, HObjectAccess::ForFixedArrayLength()); |
1082 | 1084 |
1083 HValue* length = | 1085 HValue* length = |
1084 casted_stub()->is_js_array() | 1086 casted_stub()->is_js_array() |
1085 ? Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), | 1087 ? Add<HLoadNamedField>(object, static_cast<HValue*>(NULL), |
1086 HObjectAccess::ForArrayLength(kind)) | 1088 HObjectAccess::ForArrayLength(kind)) |
1087 : current_capacity; | 1089 : current_capacity; |
1088 | 1090 |
1089 return BuildCheckAndGrowElementsCapacity(object, elements, kind, length, | 1091 return BuildCheckAndGrowElementsCapacity(object, elements, kind, length, |
1090 current_capacity, key); | 1092 current_capacity, key); |
1091 } | 1093 } |
1092 | 1094 |
1093 | 1095 |
1094 Handle<Code> GrowArrayElementsStub::GenerateCode() { | 1096 Handle<Code> GrowArrayElementsStub::GenerateCode() { |
1095 return DoGenerateCode(this); | 1097 return DoGenerateCode(this); |
1096 } | 1098 } |
1097 | 1099 |
1098 | 1100 |
1099 template <> | 1101 template <> |
1100 HValue* CodeStubGraphBuilder<LoadFastElementStub>::BuildCodeStub() { | 1102 HValue* CodeStubGraphBuilder<LoadFastElementStub>::BuildCodeStub() { |
1101 LoadKeyedHoleMode hole_mode = casted_stub()->convert_hole_to_undefined() | 1103 LoadKeyedHoleMode hole_mode = casted_stub()->convert_hole_to_undefined() |
1102 ? CONVERT_HOLE_TO_UNDEFINED | 1104 ? CONVERT_HOLE_TO_UNDEFINED |
1103 : NEVER_RETURN_HOLE; | 1105 : NEVER_RETURN_HOLE; |
1104 | 1106 |
1105 HInstruction* load = BuildUncheckedMonomorphicElementAccess( | 1107 HInstruction* load = BuildUncheckedMonomorphicElementAccess( |
1106 GetParameter(LoadDescriptor::kReceiverIndex), | 1108 GetParameter(Descriptor::kReceiver), GetParameter(Descriptor::kName), |
1107 GetParameter(LoadDescriptor::kNameIndex), NULL, | 1109 NULL, casted_stub()->is_js_array(), casted_stub()->elements_kind(), LOAD, |
1108 casted_stub()->is_js_array(), casted_stub()->elements_kind(), LOAD, | |
1109 hole_mode, STANDARD_STORE); | 1110 hole_mode, STANDARD_STORE); |
1110 return load; | 1111 return load; |
1111 } | 1112 } |
1112 | 1113 |
1113 | 1114 |
1114 Handle<Code> LoadFastElementStub::GenerateCode() { | 1115 Handle<Code> LoadFastElementStub::GenerateCode() { |
1115 return DoGenerateCode(this); | 1116 return DoGenerateCode(this); |
1116 } | 1117 } |
1117 | 1118 |
1118 | 1119 |
(...skipping 13 matching lines...) Expand all Loading... |
1132 object, nullptr, access.WithRepresentation(Representation::Tagged())); | 1133 object, nullptr, access.WithRepresentation(Representation::Tagged())); |
1133 // Load the double value from it. | 1134 // Load the double value from it. |
1134 access = HObjectAccess::ForHeapNumberValue(); | 1135 access = HObjectAccess::ForHeapNumberValue(); |
1135 } | 1136 } |
1136 return Add<HLoadNamedField>(object, nullptr, access); | 1137 return Add<HLoadNamedField>(object, nullptr, access); |
1137 } | 1138 } |
1138 | 1139 |
1139 | 1140 |
1140 template<> | 1141 template<> |
1141 HValue* CodeStubGraphBuilder<LoadFieldStub>::BuildCodeStub() { | 1142 HValue* CodeStubGraphBuilder<LoadFieldStub>::BuildCodeStub() { |
1142 return BuildLoadNamedField(GetParameter(0), casted_stub()->index()); | 1143 return BuildLoadNamedField(GetParameter(Descriptor::kReceiver), |
| 1144 casted_stub()->index()); |
1143 } | 1145 } |
1144 | 1146 |
1145 | 1147 |
1146 Handle<Code> LoadFieldStub::GenerateCode() { | 1148 Handle<Code> LoadFieldStub::GenerateCode() { |
1147 return DoGenerateCode(this); | 1149 return DoGenerateCode(this); |
1148 } | 1150 } |
1149 | 1151 |
1150 | 1152 |
1151 template <> | 1153 template <> |
1152 HValue* CodeStubGraphBuilder<LoadConstantStub>::BuildCodeStub() { | 1154 HValue* CodeStubGraphBuilder<LoadConstantStub>::BuildCodeStub() { |
1153 HValue* map = AddLoadMap(GetParameter(0), NULL); | 1155 HValue* map = AddLoadMap(GetParameter(Descriptor::kReceiver), NULL); |
1154 HObjectAccess descriptors_access = HObjectAccess::ForObservableJSObjectOffset( | 1156 HObjectAccess descriptors_access = HObjectAccess::ForObservableJSObjectOffset( |
1155 Map::kDescriptorsOffset, Representation::Tagged()); | 1157 Map::kDescriptorsOffset, Representation::Tagged()); |
1156 HValue* descriptors = Add<HLoadNamedField>(map, nullptr, descriptors_access); | 1158 HValue* descriptors = Add<HLoadNamedField>(map, nullptr, descriptors_access); |
1157 HObjectAccess value_access = HObjectAccess::ForObservableJSObjectOffset( | 1159 HObjectAccess value_access = HObjectAccess::ForObservableJSObjectOffset( |
1158 DescriptorArray::GetValueOffset(casted_stub()->constant_index())); | 1160 DescriptorArray::GetValueOffset(casted_stub()->constant_index())); |
1159 return Add<HLoadNamedField>(descriptors, nullptr, value_access); | 1161 return Add<HLoadNamedField>(descriptors, nullptr, value_access); |
1160 } | 1162 } |
1161 | 1163 |
1162 | 1164 |
1163 Handle<Code> LoadConstantStub::GenerateCode() { return DoGenerateCode(this); } | 1165 Handle<Code> LoadConstantStub::GenerateCode() { return DoGenerateCode(this); } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1278 environment()->Push(is_load ? result : value); | 1280 environment()->Push(is_load ? result : value); |
1279 } | 1281 } |
1280 in_range.End(); | 1282 in_range.End(); |
1281 | 1283 |
1282 return environment()->Pop(); | 1284 return environment()->Pop(); |
1283 } | 1285 } |
1284 | 1286 |
1285 | 1287 |
1286 template <> | 1288 template <> |
1287 HValue* CodeStubGraphBuilder<KeyedLoadSloppyArgumentsStub>::BuildCodeStub() { | 1289 HValue* CodeStubGraphBuilder<KeyedLoadSloppyArgumentsStub>::BuildCodeStub() { |
1288 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex); | 1290 HValue* receiver = GetParameter(Descriptor::kReceiver); |
1289 HValue* key = GetParameter(LoadDescriptor::kNameIndex); | 1291 HValue* key = GetParameter(Descriptor::kName); |
1290 | 1292 |
1291 return EmitKeyedSloppyArguments(receiver, key, NULL); | 1293 return EmitKeyedSloppyArguments(receiver, key, NULL); |
1292 } | 1294 } |
1293 | 1295 |
1294 | 1296 |
1295 Handle<Code> KeyedLoadSloppyArgumentsStub::GenerateCode() { | 1297 Handle<Code> KeyedLoadSloppyArgumentsStub::GenerateCode() { |
1296 return DoGenerateCode(this); | 1298 return DoGenerateCode(this); |
1297 } | 1299 } |
1298 | 1300 |
1299 | 1301 |
1300 template <> | 1302 template <> |
1301 HValue* CodeStubGraphBuilder<KeyedStoreSloppyArgumentsStub>::BuildCodeStub() { | 1303 HValue* CodeStubGraphBuilder<KeyedStoreSloppyArgumentsStub>::BuildCodeStub() { |
1302 HValue* receiver = GetParameter(StoreDescriptor::kReceiverIndex); | 1304 HValue* receiver = GetParameter(Descriptor::kReceiver); |
1303 HValue* key = GetParameter(StoreDescriptor::kNameIndex); | 1305 HValue* key = GetParameter(Descriptor::kName); |
1304 HValue* value = GetParameter(StoreDescriptor::kValueIndex); | 1306 HValue* value = GetParameter(Descriptor::kValue); |
1305 | 1307 |
1306 return EmitKeyedSloppyArguments(receiver, key, value); | 1308 return EmitKeyedSloppyArguments(receiver, key, value); |
1307 } | 1309 } |
1308 | 1310 |
1309 | 1311 |
1310 Handle<Code> KeyedStoreSloppyArgumentsStub::GenerateCode() { | 1312 Handle<Code> KeyedStoreSloppyArgumentsStub::GenerateCode() { |
1311 return DoGenerateCode(this); | 1313 return DoGenerateCode(this); |
1312 } | 1314 } |
1313 | 1315 |
1314 | 1316 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1352 } else if (representation.IsHeapObject()) { | 1354 } else if (representation.IsHeapObject()) { |
1353 BuildCheckHeapObject(value); | 1355 BuildCheckHeapObject(value); |
1354 } | 1356 } |
1355 | 1357 |
1356 Add<HStoreNamedField>(object, access, value, INITIALIZING_STORE); | 1358 Add<HStoreNamedField>(object, access, value, INITIALIZING_STORE); |
1357 } | 1359 } |
1358 | 1360 |
1359 | 1361 |
1360 template <> | 1362 template <> |
1361 HValue* CodeStubGraphBuilder<StoreFieldStub>::BuildCodeStub() { | 1363 HValue* CodeStubGraphBuilder<StoreFieldStub>::BuildCodeStub() { |
1362 BuildStoreNamedField(GetParameter(0), GetParameter(2), casted_stub()->index(), | 1364 BuildStoreNamedField(GetParameter(Descriptor::kReceiver), |
| 1365 GetParameter(Descriptor::kValue), casted_stub()->index(), |
1363 casted_stub()->representation(), false); | 1366 casted_stub()->representation(), false); |
1364 return GetParameter(2); | 1367 return GetParameter(Descriptor::kValue); |
1365 } | 1368 } |
1366 | 1369 |
1367 | 1370 |
1368 Handle<Code> StoreFieldStub::GenerateCode() { return DoGenerateCode(this); } | 1371 Handle<Code> StoreFieldStub::GenerateCode() { return DoGenerateCode(this); } |
1369 | 1372 |
1370 | 1373 |
1371 template <> | 1374 template <> |
1372 HValue* CodeStubGraphBuilder<StoreTransitionStub>::BuildCodeStub() { | 1375 HValue* CodeStubGraphBuilder<StoreTransitionStub>::BuildCodeStub() { |
1373 HValue* object = GetParameter(StoreTransitionHelper::ReceiverIndex()); | 1376 HValue* object = GetParameter(StoreTransitionHelper::ReceiverIndex()); |
1374 HValue* value = GetParameter(StoreTransitionHelper::ValueIndex()); | 1377 HValue* value = GetParameter(StoreTransitionHelper::ValueIndex()); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1428 | 1431 |
1429 | 1432 |
1430 Handle<Code> StoreTransitionStub::GenerateCode() { | 1433 Handle<Code> StoreTransitionStub::GenerateCode() { |
1431 return DoGenerateCode(this); | 1434 return DoGenerateCode(this); |
1432 } | 1435 } |
1433 | 1436 |
1434 | 1437 |
1435 template <> | 1438 template <> |
1436 HValue* CodeStubGraphBuilder<StoreFastElementStub>::BuildCodeStub() { | 1439 HValue* CodeStubGraphBuilder<StoreFastElementStub>::BuildCodeStub() { |
1437 BuildUncheckedMonomorphicElementAccess( | 1440 BuildUncheckedMonomorphicElementAccess( |
1438 GetParameter(StoreDescriptor::kReceiverIndex), | 1441 GetParameter(Descriptor::kReceiver), GetParameter(Descriptor::kName), |
1439 GetParameter(StoreDescriptor::kNameIndex), | 1442 GetParameter(Descriptor::kValue), casted_stub()->is_js_array(), |
1440 GetParameter(StoreDescriptor::kValueIndex), casted_stub()->is_js_array(), | |
1441 casted_stub()->elements_kind(), STORE, NEVER_RETURN_HOLE, | 1443 casted_stub()->elements_kind(), STORE, NEVER_RETURN_HOLE, |
1442 casted_stub()->store_mode()); | 1444 casted_stub()->store_mode()); |
1443 | 1445 |
1444 return GetParameter(2); | 1446 return GetParameter(Descriptor::kValue); |
1445 } | 1447 } |
1446 | 1448 |
1447 | 1449 |
1448 Handle<Code> StoreFastElementStub::GenerateCode() { | 1450 Handle<Code> StoreFastElementStub::GenerateCode() { |
1449 return DoGenerateCode(this); | 1451 return DoGenerateCode(this); |
1450 } | 1452 } |
1451 | 1453 |
1452 | 1454 |
1453 template <> | 1455 template <> |
1454 HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() { | 1456 HValue* CodeStubGraphBuilder<TransitionElementsKindStub>::BuildCodeStub() { |
1455 ElementsKind const from_kind = casted_stub()->from_kind(); | 1457 ElementsKind const from_kind = casted_stub()->from_kind(); |
1456 ElementsKind const to_kind = casted_stub()->to_kind(); | 1458 ElementsKind const to_kind = casted_stub()->to_kind(); |
1457 HValue* const object = GetParameter(0); | 1459 HValue* const object = GetParameter(Descriptor::kObject); |
1458 HValue* const map = GetParameter(1); | 1460 HValue* const map = GetParameter(Descriptor::kMap); |
1459 | 1461 |
1460 // The {object} is known to be a JSObject (otherwise it wouldn't have elements | 1462 // The {object} is known to be a JSObject (otherwise it wouldn't have elements |
1461 // anyways). | 1463 // anyways). |
1462 object->set_type(HType::JSObject()); | 1464 object->set_type(HType::JSObject()); |
1463 | 1465 |
1464 info()->MarkAsSavesCallerDoubles(); | 1466 info()->MarkAsSavesCallerDoubles(); |
1465 | 1467 |
1466 DCHECK_IMPLIES(IsFastHoleyElementsKind(from_kind), | 1468 DCHECK_IMPLIES(IsFastHoleyElementsKind(from_kind), |
1467 IsFastHoleyElementsKind(to_kind)); | 1469 IsFastHoleyElementsKind(to_kind)); |
1468 | 1470 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 | 1513 |
1512 | 1514 |
1513 Handle<Code> TransitionElementsKindStub::GenerateCode() { | 1515 Handle<Code> TransitionElementsKindStub::GenerateCode() { |
1514 return DoGenerateCode(this); | 1516 return DoGenerateCode(this); |
1515 } | 1517 } |
1516 | 1518 |
1517 template <> | 1519 template <> |
1518 HValue* CodeStubGraphBuilder<BinaryOpICStub>::BuildCodeInitializedStub() { | 1520 HValue* CodeStubGraphBuilder<BinaryOpICStub>::BuildCodeInitializedStub() { |
1519 BinaryOpICState state = casted_stub()->state(); | 1521 BinaryOpICState state = casted_stub()->state(); |
1520 | 1522 |
1521 HValue* left = GetParameter(BinaryOpICStub::kLeft); | 1523 HValue* left = GetParameter(Descriptor::kLeft); |
1522 HValue* right = GetParameter(BinaryOpICStub::kRight); | 1524 HValue* right = GetParameter(Descriptor::kRight); |
1523 | 1525 |
1524 Type* left_type = state.GetLeftType(); | 1526 Type* left_type = state.GetLeftType(); |
1525 Type* right_type = state.GetRightType(); | 1527 Type* right_type = state.GetRightType(); |
1526 Type* result_type = state.GetResultType(); | 1528 Type* result_type = state.GetResultType(); |
1527 | 1529 |
1528 DCHECK(!left_type->Is(Type::None()) && !right_type->Is(Type::None()) && | 1530 DCHECK(!left_type->Is(Type::None()) && !right_type->Is(Type::None()) && |
1529 (state.HasSideEffects() || !result_type->Is(Type::None()))); | 1531 (state.HasSideEffects() || !result_type->Is(Type::None()))); |
1530 | 1532 |
1531 HValue* result = NULL; | 1533 HValue* result = NULL; |
1532 HAllocationMode allocation_mode(NOT_TENURED); | 1534 HAllocationMode allocation_mode(NOT_TENURED); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 | 1590 |
1589 Handle<Code> BinaryOpICStub::GenerateCode() { | 1591 Handle<Code> BinaryOpICStub::GenerateCode() { |
1590 return DoGenerateCode(this); | 1592 return DoGenerateCode(this); |
1591 } | 1593 } |
1592 | 1594 |
1593 | 1595 |
1594 template <> | 1596 template <> |
1595 HValue* CodeStubGraphBuilder<BinaryOpWithAllocationSiteStub>::BuildCodeStub() { | 1597 HValue* CodeStubGraphBuilder<BinaryOpWithAllocationSiteStub>::BuildCodeStub() { |
1596 BinaryOpICState state = casted_stub()->state(); | 1598 BinaryOpICState state = casted_stub()->state(); |
1597 | 1599 |
1598 HValue* allocation_site = GetParameter( | 1600 HValue* allocation_site = GetParameter(Descriptor::kAllocationSite); |
1599 BinaryOpWithAllocationSiteStub::kAllocationSite); | 1601 HValue* left = GetParameter(Descriptor::kLeft); |
1600 HValue* left = GetParameter(BinaryOpWithAllocationSiteStub::kLeft); | 1602 HValue* right = GetParameter(Descriptor::kRight); |
1601 HValue* right = GetParameter(BinaryOpWithAllocationSiteStub::kRight); | |
1602 | 1603 |
1603 Type* left_type = state.GetLeftType(); | 1604 Type* left_type = state.GetLeftType(); |
1604 Type* right_type = state.GetRightType(); | 1605 Type* right_type = state.GetRightType(); |
1605 Type* result_type = state.GetResultType(); | 1606 Type* result_type = state.GetResultType(); |
1606 HAllocationMode allocation_mode(allocation_site); | 1607 HAllocationMode allocation_mode(allocation_site); |
1607 | 1608 |
1608 return BuildBinaryOperation(state.op(), left, right, left_type, right_type, | 1609 return BuildBinaryOperation(state.op(), left, right, left_type, right_type, |
1609 result_type, state.fixed_right_arg(), | 1610 result_type, state.fixed_right_arg(), |
1610 allocation_mode); | 1611 allocation_mode); |
1611 } | 1612 } |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1748 return Pop(); | 1749 return Pop(); |
1749 } | 1750 } |
1750 | 1751 |
1751 | 1752 |
1752 template <> | 1753 template <> |
1753 HValue* CodeStubGraphBuilder<StringAddStub>::BuildCodeInitializedStub() { | 1754 HValue* CodeStubGraphBuilder<StringAddStub>::BuildCodeInitializedStub() { |
1754 StringAddStub* stub = casted_stub(); | 1755 StringAddStub* stub = casted_stub(); |
1755 StringAddFlags flags = stub->flags(); | 1756 StringAddFlags flags = stub->flags(); |
1756 PretenureFlag pretenure_flag = stub->pretenure_flag(); | 1757 PretenureFlag pretenure_flag = stub->pretenure_flag(); |
1757 | 1758 |
1758 HValue* left = GetParameter(StringAddStub::kLeft); | 1759 HValue* left = GetParameter(Descriptor::kLeft); |
1759 HValue* right = GetParameter(StringAddStub::kRight); | 1760 HValue* right = GetParameter(Descriptor::kRight); |
1760 | 1761 |
1761 // Make sure that both arguments are strings if not known in advance. | 1762 // Make sure that both arguments are strings if not known in advance. |
1762 if ((flags & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) { | 1763 if ((flags & STRING_ADD_CHECK_LEFT) == STRING_ADD_CHECK_LEFT) { |
1763 left = | 1764 left = |
1764 BuildToString(left, (flags & STRING_ADD_CONVERT) == STRING_ADD_CONVERT); | 1765 BuildToString(left, (flags & STRING_ADD_CONVERT) == STRING_ADD_CONVERT); |
1765 } | 1766 } |
1766 if ((flags & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT) { | 1767 if ((flags & STRING_ADD_CHECK_RIGHT) == STRING_ADD_CHECK_RIGHT) { |
1767 right = BuildToString(right, | 1768 right = BuildToString(right, |
1768 (flags & STRING_ADD_CONVERT) == STRING_ADD_CONVERT); | 1769 (flags & STRING_ADD_CONVERT) == STRING_ADD_CONVERT); |
1769 } | 1770 } |
1770 | 1771 |
1771 return BuildStringAdd(left, right, HAllocationMode(pretenure_flag)); | 1772 return BuildStringAdd(left, right, HAllocationMode(pretenure_flag)); |
1772 } | 1773 } |
1773 | 1774 |
1774 | 1775 |
1775 Handle<Code> StringAddStub::GenerateCode() { | 1776 Handle<Code> StringAddStub::GenerateCode() { |
1776 return DoGenerateCode(this); | 1777 return DoGenerateCode(this); |
1777 } | 1778 } |
1778 | 1779 |
1779 template <> | 1780 template <> |
1780 HValue* CodeStubGraphBuilder<ToBooleanICStub>::BuildCodeInitializedStub() { | 1781 HValue* CodeStubGraphBuilder<ToBooleanICStub>::BuildCodeInitializedStub() { |
1781 ToBooleanICStub* stub = casted_stub(); | 1782 ToBooleanICStub* stub = casted_stub(); |
1782 IfBuilder if_true(this); | 1783 IfBuilder if_true(this); |
1783 if_true.If<HBranch>(GetParameter(0), stub->types()); | 1784 if_true.If<HBranch>(GetParameter(Descriptor::kArgument), stub->types()); |
1784 if_true.Then(); | 1785 if_true.Then(); |
1785 if_true.Return(graph()->GetConstantTrue()); | 1786 if_true.Return(graph()->GetConstantTrue()); |
1786 if_true.Else(); | 1787 if_true.Else(); |
1787 if_true.End(); | 1788 if_true.End(); |
1788 return graph()->GetConstantFalse(); | 1789 return graph()->GetConstantFalse(); |
1789 } | 1790 } |
1790 | 1791 |
1791 Handle<Code> ToBooleanICStub::GenerateCode() { return DoGenerateCode(this); } | 1792 Handle<Code> ToBooleanICStub::GenerateCode() { return DoGenerateCode(this); } |
1792 | 1793 |
1793 template <> | 1794 template <> |
1794 HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() { | 1795 HValue* CodeStubGraphBuilder<StoreGlobalStub>::BuildCodeInitializedStub() { |
1795 StoreGlobalStub* stub = casted_stub(); | 1796 StoreGlobalStub* stub = casted_stub(); |
1796 HParameter* value = GetParameter(StoreDescriptor::kValueIndex); | 1797 HParameter* value = GetParameter(Descriptor::kValue); |
1797 if (stub->check_global()) { | 1798 if (stub->check_global()) { |
1798 // Check that the map of the global has not changed: use a placeholder map | 1799 // Check that the map of the global has not changed: use a placeholder map |
1799 // that will be replaced later with the global object's map. | 1800 // that will be replaced later with the global object's map. |
1800 HParameter* proxy = GetParameter(StoreDescriptor::kReceiverIndex); | 1801 HParameter* proxy = GetParameter(Descriptor::kReceiver); |
1801 HValue* proxy_map = | 1802 HValue* proxy_map = |
1802 Add<HLoadNamedField>(proxy, nullptr, HObjectAccess::ForMap()); | 1803 Add<HLoadNamedField>(proxy, nullptr, HObjectAccess::ForMap()); |
1803 HValue* global = | 1804 HValue* global = |
1804 Add<HLoadNamedField>(proxy_map, nullptr, HObjectAccess::ForPrototype()); | 1805 Add<HLoadNamedField>(proxy_map, nullptr, HObjectAccess::ForPrototype()); |
1805 HValue* map_cell = Add<HConstant>(isolate()->factory()->NewWeakCell( | 1806 HValue* map_cell = Add<HConstant>(isolate()->factory()->NewWeakCell( |
1806 StoreGlobalStub::global_map_placeholder(isolate()))); | 1807 StoreGlobalStub::global_map_placeholder(isolate()))); |
1807 HValue* expected_map = Add<HLoadNamedField>( | 1808 HValue* expected_map = Add<HLoadNamedField>( |
1808 map_cell, nullptr, HObjectAccess::ForWeakCellValue()); | 1809 map_cell, nullptr, HObjectAccess::ForWeakCellValue()); |
1809 HValue* map = | 1810 HValue* map = |
1810 Add<HLoadNamedField>(global, nullptr, HObjectAccess::ForMap()); | 1811 Add<HLoadNamedField>(global, nullptr, HObjectAccess::ForMap()); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1913 } | 1914 } |
1914 | 1915 |
1915 | 1916 |
1916 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() { | 1917 Handle<Code> ElementsTransitionAndStoreStub::GenerateCode() { |
1917 return DoGenerateCode(this); | 1918 return DoGenerateCode(this); |
1918 } | 1919 } |
1919 | 1920 |
1920 | 1921 |
1921 template <> | 1922 template <> |
1922 HValue* CodeStubGraphBuilder<ToObjectStub>::BuildCodeStub() { | 1923 HValue* CodeStubGraphBuilder<ToObjectStub>::BuildCodeStub() { |
1923 HValue* receiver = GetParameter(TypeConversionDescriptor::kArgumentIndex); | 1924 HValue* receiver = GetParameter(Descriptor::kArgument); |
1924 return BuildToObject(receiver); | 1925 return BuildToObject(receiver); |
1925 } | 1926 } |
1926 | 1927 |
1927 | 1928 |
1928 Handle<Code> ToObjectStub::GenerateCode() { return DoGenerateCode(this); } | 1929 Handle<Code> ToObjectStub::GenerateCode() { return DoGenerateCode(this); } |
1929 | 1930 |
1930 template <> | 1931 template <> |
1931 HValue* CodeStubGraphBuilder<LoadDictionaryElementStub>::BuildCodeStub() { | 1932 HValue* CodeStubGraphBuilder<LoadDictionaryElementStub>::BuildCodeStub() { |
1932 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex); | 1933 HValue* receiver = GetParameter(Descriptor::kReceiver); |
1933 HValue* key = GetParameter(LoadDescriptor::kNameIndex); | 1934 HValue* key = GetParameter(Descriptor::kName); |
1934 | 1935 |
1935 Add<HCheckSmi>(key); | 1936 Add<HCheckSmi>(key); |
1936 | 1937 |
1937 HValue* elements = AddLoadElements(receiver); | 1938 HValue* elements = AddLoadElements(receiver); |
1938 | 1939 |
1939 HValue* hash = BuildElementIndexHash(key); | 1940 HValue* hash = BuildElementIndexHash(key); |
1940 | 1941 |
1941 return BuildUncheckedDictionaryElementLoad(receiver, elements, key, hash); | 1942 return BuildUncheckedDictionaryElementLoad(receiver, elements, key, hash); |
1942 } | 1943 } |
1943 | 1944 |
1944 | 1945 |
1945 Handle<Code> LoadDictionaryElementStub::GenerateCode() { | 1946 Handle<Code> LoadDictionaryElementStub::GenerateCode() { |
1946 return DoGenerateCode(this); | 1947 return DoGenerateCode(this); |
1947 } | 1948 } |
1948 | 1949 |
1949 | 1950 |
1950 template<> | 1951 template<> |
1951 HValue* CodeStubGraphBuilder<RegExpConstructResultStub>::BuildCodeStub() { | 1952 HValue* CodeStubGraphBuilder<RegExpConstructResultStub>::BuildCodeStub() { |
1952 // Determine the parameters. | 1953 // Determine the parameters. |
1953 HValue* length = GetParameter(RegExpConstructResultStub::kLength); | 1954 HValue* length = GetParameter(Descriptor::kLength); |
1954 HValue* index = GetParameter(RegExpConstructResultStub::kIndex); | 1955 HValue* index = GetParameter(Descriptor::kIndex); |
1955 HValue* input = GetParameter(RegExpConstructResultStub::kInput); | 1956 HValue* input = GetParameter(Descriptor::kInput); |
1956 | 1957 |
1957 // TODO(turbofan): This codestub has regressed to need a frame on ia32 at some | 1958 // TODO(turbofan): This codestub has regressed to need a frame on ia32 at some |
1958 // point and wasn't caught since it wasn't built in the snapshot. We should | 1959 // point and wasn't caught since it wasn't built in the snapshot. We should |
1959 // probably just replace with a TurboFan stub rather than fixing it. | 1960 // probably just replace with a TurboFan stub rather than fixing it. |
1960 #if !(V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87) | 1961 #if !(V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_X87) |
1961 info()->MarkMustNotHaveEagerFrame(); | 1962 info()->MarkMustNotHaveEagerFrame(); |
1962 #endif | 1963 #endif |
1963 | 1964 |
1964 return BuildRegExpConstructResult(length, index, input); | 1965 return BuildRegExpConstructResult(length, index, input); |
1965 } | 1966 } |
1966 | 1967 |
1967 | 1968 |
1968 Handle<Code> RegExpConstructResultStub::GenerateCode() { | 1969 Handle<Code> RegExpConstructResultStub::GenerateCode() { |
1969 return DoGenerateCode(this); | 1970 return DoGenerateCode(this); |
1970 } | 1971 } |
1971 | 1972 |
1972 | 1973 |
1973 template <> | 1974 template <> |
1974 class CodeStubGraphBuilder<KeyedLoadGenericStub> | 1975 class CodeStubGraphBuilder<KeyedLoadGenericStub> |
1975 : public CodeStubGraphBuilderBase { | 1976 : public CodeStubGraphBuilderBase { |
1976 public: | 1977 public: |
1977 explicit CodeStubGraphBuilder(CompilationInfo* info, CodeStub* stub) | 1978 explicit CodeStubGraphBuilder(CompilationInfo* info, CodeStub* stub) |
1978 : CodeStubGraphBuilderBase(info, stub) {} | 1979 : CodeStubGraphBuilderBase(info, stub) {} |
1979 | 1980 |
| 1981 typedef KeyedLoadGenericStub::Descriptor Descriptor; |
| 1982 |
1980 protected: | 1983 protected: |
1981 virtual HValue* BuildCodeStub(); | 1984 virtual HValue* BuildCodeStub(); |
1982 | 1985 |
1983 void BuildElementsKindLimitCheck(HGraphBuilder::IfBuilder* if_builder, | 1986 void BuildElementsKindLimitCheck(HGraphBuilder::IfBuilder* if_builder, |
1984 HValue* bit_field2, | 1987 HValue* bit_field2, |
1985 ElementsKind kind); | 1988 ElementsKind kind); |
1986 | 1989 |
1987 void BuildFastElementLoad(HGraphBuilder::IfBuilder* if_builder, | 1990 void BuildFastElementLoad(HGraphBuilder::IfBuilder* if_builder, |
1988 HValue* receiver, | 1991 HValue* receiver, |
1989 HValue* key, | 1992 HValue* key, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2025 js_array_check.Else(); | 2028 js_array_check.Else(); |
2026 Push(BuildUncheckedMonomorphicElementAccess(receiver, key, NULL, | 2029 Push(BuildUncheckedMonomorphicElementAccess(receiver, key, NULL, |
2027 false, kind, | 2030 false, kind, |
2028 LOAD, NEVER_RETURN_HOLE, | 2031 LOAD, NEVER_RETURN_HOLE, |
2029 STANDARD_STORE)); | 2032 STANDARD_STORE)); |
2030 js_array_check.End(); | 2033 js_array_check.End(); |
2031 } | 2034 } |
2032 | 2035 |
2033 | 2036 |
2034 HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() { | 2037 HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() { |
2035 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex); | 2038 HValue* receiver = GetParameter(Descriptor::kReceiver); |
2036 HValue* key = GetParameter(LoadDescriptor::kNameIndex); | 2039 HValue* key = GetParameter(Descriptor::kName); |
2037 // Split into a smi/integer case and unique string case. | 2040 // Split into a smi/integer case and unique string case. |
2038 HIfContinuation index_name_split_continuation(graph()->CreateBasicBlock(), | 2041 HIfContinuation index_name_split_continuation(graph()->CreateBasicBlock(), |
2039 graph()->CreateBasicBlock()); | 2042 graph()->CreateBasicBlock()); |
2040 | 2043 |
2041 BuildKeyedIndexCheck(key, &index_name_split_continuation); | 2044 BuildKeyedIndexCheck(key, &index_name_split_continuation); |
2042 | 2045 |
2043 IfBuilder index_name_split(this, &index_name_split_continuation); | 2046 IfBuilder index_name_split(this, &index_name_split_continuation); |
2044 index_name_split.Then(); | 2047 index_name_split.Then(); |
2045 { | 2048 { |
2046 // Key is an index (number) | 2049 // Key is an index (number) |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2210 return Pop(); | 2213 return Pop(); |
2211 } | 2214 } |
2212 | 2215 |
2213 | 2216 |
2214 Handle<Code> KeyedLoadGenericStub::GenerateCode() { | 2217 Handle<Code> KeyedLoadGenericStub::GenerateCode() { |
2215 return DoGenerateCode(this); | 2218 return DoGenerateCode(this); |
2216 } | 2219 } |
2217 | 2220 |
2218 } // namespace internal | 2221 } // namespace internal |
2219 } // namespace v8 | 2222 } // namespace v8 |
OLD | NEW |