Changeset 37845 in webkit for trunk/JavaScriptCore/VM/CTI.cpp
- Timestamp:
- Oct 24, 2008, 9:22:51 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/VM/CTI.cpp
r37831 r37845 128 128 extern "C" { 129 129 130 __declspec(naked) JSValue* ctiTrampoline(void* code, RegisterFile*, CallFrame*, JSValue Ptr* exception, Profiler**, JSGlobalData*)130 __declspec(naked) JSValue* ctiTrampoline(void* code, RegisterFile*, CallFrame*, JSValue** exception, Profiler**, JSGlobalData*) 131 131 { 132 132 __asm { … … 169 169 } 170 170 171 ALWAYS_INLINE JSValue PtrCTI::getConstant(CallFrame* callFrame, int src)171 ALWAYS_INLINE JSValue* CTI::getConstant(CallFrame* callFrame, int src) 172 172 { 173 173 return m_codeBlock->constantRegisters[src - m_codeBlock->numVars].jsValue(callFrame); 174 174 } 175 175 176 inline uintptr_t CTI::asInteger(JSValue Ptrvalue)176 inline uintptr_t CTI::asInteger(JSValue* value) 177 177 { 178 178 return reinterpret_cast<uintptr_t>(value); … … 184 184 // TODO: we want to reuse values that are already in registers if we can - add a register allocator! 185 185 if (isConstant(src)) { 186 JSValue Ptrjs = getConstant(m_callFrame, src);186 JSValue* js = getConstant(m_callFrame, src); 187 187 m_jit.movl_i32r(asInteger(js), dst); 188 188 } else … … 194 194 { 195 195 if (isConstant(src)) { 196 JSValue Ptrjs = getConstant(m_callFrame, src);196 JSValue* js = getConstant(m_callFrame, src); 197 197 m_jit.movl_i32m(asInteger(js), offset + sizeof(void*), X86::esp); 198 198 } else { … … 213 213 } 214 214 215 ALWAYS_INLINE JSValue PtrCTI::getConstantImmediateNumericArg(unsigned src)215 ALWAYS_INLINE JSValue* CTI::getConstantImmediateNumericArg(unsigned src) 216 216 { 217 217 if (isConstant(src)) { 218 JSValue Ptrjs = getConstant(m_callFrame, src);218 JSValue* js = getConstant(m_callFrame, src); 219 219 return JSImmediate::isNumber(js) ? js : noValue(); 220 220 } … … 279 279 char which1 = '*'; 280 280 if (isConstant(src1)) { 281 JSValue Ptrjs = getConstant(m_callFrame, src1);281 JSValue* js = getConstant(m_callFrame, src1); 282 282 which1 = 283 283 JSImmediate::isImmediate(js) ? … … 293 293 char which2 = '*'; 294 294 if (isConstant(src2)) { 295 JSValue Ptrjs = getConstant(m_callFrame, src2);295 JSValue* js = getConstant(m_callFrame, src2); 296 296 which2 = 297 297 JSImmediate::isImmediate(js) ? … … 457 457 } 458 458 459 ALWAYS_INLINE unsigned CTI::getDeTaggedConstantImmediate(JSValue Ptrimm)459 ALWAYS_INLINE unsigned CTI::getDeTaggedConstantImmediate(JSValue* imm) 460 460 { 461 461 ASSERT(JSImmediate::isNumber(imm)); … … 978 978 unsigned src2 = instruction[i + 3].u.operand; 979 979 980 if (JSValue Ptrvalue = getConstantImmediateNumericArg(src1)) {980 if (JSValue* value = getConstantImmediateNumericArg(src1)) { 981 981 emitGetArg(src2, X86::edx); 982 982 emitJumpSlowCaseIfNotImmNum(X86::edx, i); … … 984 984 m_slowCases.append(SlowCaseEntry(m_jit.emitUnlinkedJo(), i)); 985 985 emitPutResult(dst, X86::edx); 986 } else if (JSValue Ptrvalue = getConstantImmediateNumericArg(src2)) {986 } else if (JSValue* value = getConstantImmediateNumericArg(src2)) { 987 987 emitGetArg(src1, X86::eax); 988 988 emitJumpSlowCaseIfNotImmNum(X86::eax, i); … … 1045 1045 1046 1046 unsigned target = instruction[i + 3].u.operand; 1047 JSValue Ptrsrc2imm = getConstantImmediateNumericArg(instruction[i + 2].u.operand);1047 JSValue* src2imm = getConstantImmediateNumericArg(instruction[i + 2].u.operand); 1048 1048 if (src2imm) { 1049 1049 emitGetArg(instruction[i + 1].u.operand, X86::edx); … … 1066 1066 1067 1067 unsigned target = instruction[i + 3].u.operand; 1068 JSValue Ptrsrc2imm = getConstantImmediateNumericArg(instruction[i + 2].u.operand);1068 JSValue* src2imm = getConstantImmediateNumericArg(instruction[i + 2].u.operand); 1069 1069 if (src2imm) { 1070 1070 emitGetArg(instruction[i + 1].u.operand, X86::edx); … … 1221 1221 1222 1222 // For now, only plant a fast int case if the constant operand is greater than zero. 1223 JSValue Ptrsrc1Value = getConstantImmediateNumericArg(src1);1224 JSValue Ptrsrc2Value = getConstantImmediateNumericArg(src2);1223 JSValue* src1Value = getConstantImmediateNumericArg(src1); 1224 JSValue* src2Value = getConstantImmediateNumericArg(src2); 1225 1225 int32_t value; 1226 1226 if (src1Value && ((value = JSImmediate::intValue(src1Value)) > 0)) { … … 1388 1388 1389 1389 // Get the value from the vector 1390 m_jit.movl_mr(OBJECT_OFFSET(ArrayStorage, m_vector[0]), X86::ecx, X86::edx, sizeof(JSValue Ptr), X86::eax);1390 m_jit.movl_mr(OBJECT_OFFSET(ArrayStorage, m_vector[0]), X86::ecx, X86::edx, sizeof(JSValue*), X86::eax); 1391 1391 emitPutResult(instruction[i + 1].u.operand); 1392 1392 i += 4; … … 1427 1427 // This is a write to the slow part of the vector; first, we have to check if this would be the first write to this location. 1428 1428 // FIXME: should be able to handle initial write to array; increment the the number of items in the array, and potentially update fast access cutoff. 1429 m_jit.cmpl_i8m(0, OBJECT_OFFSET(ArrayStorage, m_vector[0]), X86::ecx, X86::edx, sizeof(JSValue Ptr));1429 m_jit.cmpl_i8m(0, OBJECT_OFFSET(ArrayStorage, m_vector[0]), X86::ecx, X86::edx, sizeof(JSValue*)); 1430 1430 m_slowCases.append(SlowCaseEntry(m_jit.emitUnlinkedJe(), i)); 1431 1431 … … 1433 1433 m_jit.link(inFastVector, m_jit.label()); 1434 1434 emitGetArg(instruction[i + 3].u.operand, X86::eax); 1435 m_jit.movl_rm(X86::eax, OBJECT_OFFSET(ArrayStorage, m_vector[0]), X86::ecx, X86::edx, sizeof(JSValue Ptr));1435 m_jit.movl_rm(X86::eax, OBJECT_OFFSET(ArrayStorage, m_vector[0]), X86::ecx, X86::edx, sizeof(JSValue*)); 1436 1436 i += 4; 1437 1437 break; … … 1498 1498 m_jit.movl_mr(OBJECT_OFFSET(JSGlobalObject, m_propertyStorage), X86::eax, X86::eax); 1499 1499 m_jit.movl_mr(offsetAddr, X86::edx); 1500 m_jit.movl_mr(0, X86::eax, X86::edx, sizeof(JSValue Ptr), X86::eax);1500 m_jit.movl_mr(0, X86::eax, X86::edx, sizeof(JSValue*), X86::eax); 1501 1501 emitPutResult(instruction[i + 1].u.operand); 1502 1502 X86Assembler::JmpSrc end = m_jit.emitUnlinkedJmp(); … … 1526 1526 case op_jnless: { 1527 1527 unsigned target = instruction[i + 3].u.operand; 1528 JSValue Ptrsrc2imm = getConstantImmediateNumericArg(instruction[i + 2].u.operand);1528 JSValue* src2imm = getConstantImmediateNumericArg(instruction[i + 2].u.operand); 1529 1529 if (src2imm) { 1530 1530 emitGetArg(instruction[i + 1].u.operand, X86::edx); … … 1644 1644 } 1645 1645 case op_unexpected_load: { 1646 JSValue Ptrv = m_codeBlock->unexpectedConstants[instruction[i + 2].u.operand];1646 JSValue* v = m_codeBlock->unexpectedConstants[instruction[i + 2].u.operand]; 1647 1647 m_jit.movl_i32r(asInteger(v), X86::eax); 1648 1648 emitPutResult(instruction[i + 1].u.operand); … … 1695 1695 unsigned src2 = instruction[i + 3].u.operand; 1696 1696 unsigned dst = instruction[i + 1].u.operand; 1697 if (JSValue Ptrvalue = getConstantImmediateNumericArg(src1)) {1697 if (JSValue* value = getConstantImmediateNumericArg(src1)) { 1698 1698 emitGetArg(src2, X86::eax); 1699 1699 emitJumpSlowCaseIfNotImmNum(X86::eax, i); 1700 1700 m_jit.andl_i32r(asInteger(value), X86::eax); // FIXME: make it more obvious this is relying on the format of JSImmediate 1701 1701 emitPutResult(dst); 1702 } else if (JSValue Ptrvalue = getConstantImmediateNumericArg(src2)) {1702 } else if (JSValue* value = getConstantImmediateNumericArg(src2)) { 1703 1703 emitGetArg(src1, X86::eax); 1704 1704 emitJumpSlowCaseIfNotImmNum(X86::eax, i); … … 2040 2040 } 2041 2041 case op_new_error: { 2042 JSValue Ptrmessage = m_codeBlock->unexpectedConstants[instruction[i + 3].u.operand];2042 JSValue* message = m_codeBlock->unexpectedConstants[instruction[i + 3].u.operand]; 2043 2043 emitPutArgConstant(instruction[i + 2].u.operand, 0); 2044 2044 emitPutArgConstant(asInteger(message), 4); … … 2239 2239 unsigned src1 = instruction[i + 2].u.operand; 2240 2240 unsigned src2 = instruction[i + 3].u.operand; 2241 if (JSValue Ptrvalue = getConstantImmediateNumericArg(src1)) {2241 if (JSValue* value = getConstantImmediateNumericArg(src1)) { 2242 2242 X86Assembler::JmpSrc notImm = iter->from; 2243 2243 m_jit.link((++iter)->from, m_jit.label()); … … 2248 2248 emitCTICall(i, Machine::cti_op_add); 2249 2249 emitPutResult(dst); 2250 } else if (JSValue Ptrvalue = getConstantImmediateNumericArg(src2)) {2250 } else if (JSValue* value = getConstantImmediateNumericArg(src2)) { 2251 2251 X86Assembler::JmpSrc notImm = iter->from; 2252 2252 m_jit.link((++iter)->from, m_jit.label()); … … 2290 2290 2291 2291 // okay, missed the fast region, but it is still in the vector. Get the value. 2292 m_jit.movl_mr(OBJECT_OFFSET(ArrayStorage, m_vector[0]), X86::ecx, X86::edx, sizeof(JSValue Ptr), X86::ecx);2292 m_jit.movl_mr(OBJECT_OFFSET(ArrayStorage, m_vector[0]), X86::ecx, X86::edx, sizeof(JSValue*), X86::ecx); 2293 2293 // Check whether the value loaded is zero; if so we need to return undefined. 2294 2294 m_jit.testl_rr(X86::ecx, X86::ecx); … … 2333 2333 2334 2334 unsigned target = instruction[i + 3].u.operand; 2335 JSValue Ptrsrc2imm = getConstantImmediateNumericArg(instruction[i + 2].u.operand);2335 JSValue* src2imm = getConstantImmediateNumericArg(instruction[i + 2].u.operand); 2336 2336 if (src2imm) { 2337 2337 m_jit.link(iter->from, m_jit.label()); … … 2403 2403 2404 2404 unsigned target = instruction[i + 3].u.operand; 2405 JSValue Ptrsrc2imm = getConstantImmediateNumericArg(instruction[i + 2].u.operand);2405 JSValue* src2imm = getConstantImmediateNumericArg(instruction[i + 2].u.operand); 2406 2406 if (src2imm) { 2407 2407 m_jit.link(iter->from, m_jit.label()); … … 2487 2487 case op_jnless: { 2488 2488 unsigned target = instruction[i + 3].u.operand; 2489 JSValue Ptrsrc2imm = getConstantImmediateNumericArg(instruction[i + 2].u.operand);2489 JSValue* src2imm = getConstantImmediateNumericArg(instruction[i + 2].u.operand); 2490 2490 if (src2imm) { 2491 2491 m_jit.link(iter->from, m_jit.label()); … … 2659 2659 int src1 = instruction[i + 2].u.operand; 2660 2660 int src2 = instruction[i + 3].u.operand; 2661 JSValue Ptrsrc1Value = getConstantImmediateNumericArg(src1);2662 JSValue Ptrsrc2Value = getConstantImmediateNumericArg(src2);2661 JSValue* src1Value = getConstantImmediateNumericArg(src1); 2662 JSValue* src2Value = getConstantImmediateNumericArg(src2); 2663 2663 int32_t value; 2664 2664 if (src1Value && ((value = JSImmediate::intValue(src1Value)) > 0)) { … … 2893 2893 // Checks out okay! - getDirectOffset 2894 2894 m_jit.movl_mr(OBJECT_OFFSET(JSObject, m_propertyStorage), X86::eax, X86::eax); 2895 m_jit.movl_mr(cachedOffset * sizeof(JSValue Ptr), X86::eax, X86::eax);2895 m_jit.movl_mr(cachedOffset * sizeof(JSValue*), X86::eax, X86::eax); 2896 2896 m_jit.ret(); 2897 2897 … … 2933 2933 2934 2934 // Checks out okay! - getDirectOffset 2935 m_jit.movl_mr(cachedOffset * sizeof(JSValue Ptr), X86::edx, X86::ecx);2935 m_jit.movl_mr(cachedOffset * sizeof(JSValue*), X86::edx, X86::ecx); 2936 2936 2937 2937 X86Assembler::JmpSrc success = m_jit.emitUnlinkedJmp(); … … 2976 2976 2977 2977 // Checks out okay! - getDirectOffset 2978 m_jit.movl_mr(cachedOffset * sizeof(JSValue Ptr), X86::edx, X86::eax);2978 m_jit.movl_mr(cachedOffset * sizeof(JSValue*), X86::edx, X86::eax); 2979 2979 2980 2980 m_jit.ret(); … … 3021 3021 PropertyStorage* protoPropertyStorage = &protoObject->m_propertyStorage; 3022 3022 m_jit.movl_mr(static_cast<void*>(protoPropertyStorage), X86::edx); 3023 m_jit.movl_mr(cachedOffset * sizeof(JSValue Ptr), X86::edx, X86::eax);3023 m_jit.movl_mr(cachedOffset * sizeof(JSValue*), X86::edx, X86::eax); 3024 3024 m_jit.ret(); 3025 3025 … … 3047 3047 // checks out okay! - putDirectOffset 3048 3048 m_jit.movl_mr(OBJECT_OFFSET(JSObject, m_propertyStorage), X86::eax, X86::eax); 3049 m_jit.movl_rm(X86::edx, cachedOffset * sizeof(JSValue Ptr), X86::eax);3049 m_jit.movl_rm(X86::edx, cachedOffset * sizeof(JSValue*), X86::eax); 3050 3050 m_jit.ret(); 3051 3051 … … 3134 3134 // write the value 3135 3135 m_jit.movl_mr(OBJECT_OFFSET(JSObject, m_propertyStorage), X86::eax, X86::eax); 3136 m_jit.movl_rm(X86::edx, cachedOffset * sizeof(JSValue Ptr), X86::eax);3136 m_jit.movl_rm(X86::edx, cachedOffset * sizeof(JSValue*), X86::eax); 3137 3137 3138 3138 m_jit.ret(); … … 3250 3250 3251 3251 // Repatch the offset into the propoerty map to load from, then repatch the StructureID to look for. 3252 X86Assembler::repatchDisplacement(reinterpret_cast<intptr_t>(info.hotPathBegin) + repatchOffsetGetByIdPropertyMapOffset, cachedOffset * sizeof(JSValue Ptr));3252 X86Assembler::repatchDisplacement(reinterpret_cast<intptr_t>(info.hotPathBegin) + repatchOffsetGetByIdPropertyMapOffset, cachedOffset * sizeof(JSValue*)); 3253 3253 X86Assembler::repatchImmediate(reinterpret_cast<intptr_t>(info.hotPathBegin) + repatchOffsetGetByIdStructureID, reinterpret_cast<uint32_t>(structureID)); 3254 3254 } … … 3263 3263 3264 3264 // Repatch the offset into the propoerty map to load from, then repatch the StructureID to look for. 3265 X86Assembler::repatchDisplacement(reinterpret_cast<intptr_t>(info.hotPathBegin) + repatchOffsetPutByIdPropertyMapOffset, cachedOffset * sizeof(JSValue Ptr));3265 X86Assembler::repatchDisplacement(reinterpret_cast<intptr_t>(info.hotPathBegin) + repatchOffsetPutByIdPropertyMapOffset, cachedOffset * sizeof(JSValue*)); 3266 3266 X86Assembler::repatchImmediate(reinterpret_cast<intptr_t>(info.hotPathBegin) + repatchOffsetPutByIdStructureID, reinterpret_cast<uint32_t>(structureID)); 3267 3267 }
Note:
See TracChangeset
for help on using the changeset viewer.