| 202 | } |
| 203 | |
| 204 | txProfilerRecord* fxFrameToProfilerRecord(txMachine* the, txSlot* frame) |
| 205 | { |
| 206 | txProfiler* profiler = the->profiler; |
| 207 | txSlot* function = frame + 2; |
| 208 | if (function->kind == XS_REFERENCE_KIND) { |
| 209 | function = function->value.reference; |
| 210 | if (mxIsFunction(function)) { |
| 211 | txSlot* code = mxFunctionInstanceCode(function); |
| 212 | txSlot* home = mxFunctionInstanceHome(function); |
| 213 | txID recordID = home->ID; |
| 214 | txProfilerRecord* record = C_NULL; |
| 215 | if (recordID < profiler->recordCount) |
| 216 | record = profiler->records[recordID]; |
| 217 | if (record) |
| 218 | return record; |
| 219 | record = fxNewProfilerRecord(the, recordID); |
| 220 | record->functionID = code->ID; |
| 221 | home = home->value.home.object; |
| 222 | if (home) { |
| 223 | if (mxIsFunction(home)) { |
| 224 | record->constructorID = mxFunctionInstanceCode(home)->ID; |
| 225 | } |
| 226 | else { |
| 227 | txSlot* property = home->next; |
| 228 | while (property && (property->flag & XS_INTERNAL_FLAG)) |
| 229 | property = property->next; |
| 230 | while (property) { |
| 231 | if (property->ID == mxID(_constructor)) |
| 232 | break; |
| 233 | property = property->next; |
| 234 | } |
| 235 | if (property) { |
| 236 | if (property->kind == XS_REFERENCE_KIND) { |
| 237 | property = property->value.reference; |
| 238 | if (mxIsFunction(property)) { |
| 239 | record->constructorID = mxFunctionInstanceCode(property)->ID; |
| 240 | record->prototypeID = mxID(_prototype); |
| 241 | } |
| 242 | } |
| 243 | } |
| 244 | else { |
| 245 | property = home->next; |
| 246 | while (property) { |
| 247 | if (property->ID == mxID(_Symbol_toStringTag)) |
| 248 | break; |
| 249 | property = property->next; |
| 250 | } |
| 251 | if (property) { |
| 252 | if ((property->kind == XS_STRING_KIND) || (property->kind == XS_STRING_X_KIND)) { |
| 253 | record->prototypeID = fxFindName(the, property->value.string); |
| 254 | } |
| 255 | } |
| 256 | } |
| 257 | } |
| 258 | } |
| 259 | if ((code->kind == XS_CODE_KIND) || (code->kind == XS_CODE_X_KIND)) { |
| 260 | txByte* p = code->value.code.address + 2; |
| 261 | if (*p == XS_CODE_FILE) { |
no test coverage detected