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 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 __ j(not_equal, &miss); | 1059 __ j(not_equal, &miss); |
1060 } | 1060 } |
1061 | 1061 |
1062 StubCompiler::GenerateLoadFunctionPrototype(masm, edx, eax, ebx, &miss); | 1062 StubCompiler::GenerateLoadFunctionPrototype(masm, edx, eax, ebx, &miss); |
1063 __ bind(&miss); | 1063 __ bind(&miss); |
1064 StubCompiler::TailCallBuiltin( | 1064 StubCompiler::TailCallBuiltin( |
1065 masm, BaseLoadStoreStubCompiler::MissBuiltin(kind())); | 1065 masm, BaseLoadStoreStubCompiler::MissBuiltin(kind())); |
1066 } | 1066 } |
1067 | 1067 |
1068 | 1068 |
1069 void StoreArrayLengthStub::Generate(MacroAssembler* masm) { | |
1070 // ----------- S t a t e ------------- | |
1071 // -- eax : value | |
1072 // -- ecx : name | |
1073 // -- edx : receiver | |
1074 // -- esp[0] : return address | |
1075 // ----------------------------------- | |
1076 // | |
1077 // This accepts as a receiver anything JSArray::SetElementsLength accepts | |
1078 // (currently anything except for external arrays which means anything with | |
1079 // elements of FixedArray type). Value must be a number, but only smis are | |
1080 // accepted as the most common case. | |
1081 | |
1082 Label miss; | |
1083 | |
1084 Register receiver = edx; | |
1085 Register value = eax; | |
1086 Register scratch = ebx; | |
1087 | |
1088 if (kind() == Code::KEYED_STORE_IC) { | |
1089 __ cmp(ecx, Immediate(masm->isolate()->factory()->length_string())); | |
1090 __ j(not_equal, &miss); | |
1091 } | |
1092 | |
1093 // Check that the receiver isn't a smi. | |
1094 __ JumpIfSmi(receiver, &miss); | |
1095 | |
1096 // Check that the object is a JS array. | |
1097 __ CmpObjectType(receiver, JS_ARRAY_TYPE, scratch); | |
1098 __ j(not_equal, &miss); | |
1099 | |
1100 // Check that elements are FixedArray. | |
1101 // We rely on StoreIC_ArrayLength below to deal with all types of | |
1102 // fast elements (including COW). | |
1103 __ mov(scratch, FieldOperand(receiver, JSArray::kElementsOffset)); | |
1104 __ CmpObjectType(scratch, FIXED_ARRAY_TYPE, scratch); | |
1105 __ j(not_equal, &miss); | |
1106 | |
1107 // Check that the array has fast properties, otherwise the length | |
1108 // property might have been redefined. | |
1109 __ mov(scratch, FieldOperand(receiver, JSArray::kPropertiesOffset)); | |
1110 __ CompareRoot(FieldOperand(scratch, FixedArray::kMapOffset), | |
1111 Heap::kHashTableMapRootIndex); | |
1112 __ j(equal, &miss); | |
1113 | |
1114 // Check that value is a smi. | |
1115 __ JumpIfNotSmi(value, &miss); | |
1116 | |
1117 // Prepare tail call to StoreIC_ArrayLength. | |
1118 __ pop(scratch); | |
1119 __ push(receiver); | |
1120 __ push(value); | |
1121 __ push(scratch); // return address | |
1122 | |
1123 ExternalReference ref = | |
1124 ExternalReference(IC_Utility(IC::kStoreIC_ArrayLength), masm->isolate()); | |
1125 __ TailCallExternalReference(ref, 2, 1); | |
1126 | |
1127 __ bind(&miss); | |
1128 | |
1129 StubCompiler::TailCallBuiltin( | |
1130 masm, BaseLoadStoreStubCompiler::MissBuiltin(kind())); | |
1131 } | |
1132 | |
1133 | |
1134 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { | 1069 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { |
1135 // The key is in edx and the parameter count is in eax. | 1070 // The key is in edx and the parameter count is in eax. |
1136 | 1071 |
1137 // The displacement is used for skipping the frame pointer on the | 1072 // The displacement is used for skipping the frame pointer on the |
1138 // stack. It is the offset of the last parameter (if any) relative | 1073 // stack. It is the offset of the last parameter (if any) relative |
1139 // to the frame pointer. | 1074 // to the frame pointer. |
1140 static const int kDisplacement = 1 * kPointerSize; | 1075 static const int kDisplacement = 1 * kPointerSize; |
1141 | 1076 |
1142 // Check that the key is a smi. | 1077 // Check that the key is a smi. |
1143 Label slow; | 1078 Label slow; |
(...skipping 4307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5451 Operand(ebp, 7 * kPointerSize), | 5386 Operand(ebp, 7 * kPointerSize), |
5452 NULL); | 5387 NULL); |
5453 } | 5388 } |
5454 | 5389 |
5455 | 5390 |
5456 #undef __ | 5391 #undef __ |
5457 | 5392 |
5458 } } // namespace v8::internal | 5393 } } // namespace v8::internal |
5459 | 5394 |
5460 #endif // V8_TARGET_ARCH_IA32 | 5395 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |