Changeset 251425 in webkit for trunk/Source/JavaScriptCore/jit/JITOperations.cpp
- Timestamp:
- Oct 22, 2019, 2:24:48 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r251178 r251425 81 81 #include <wtf/InlineASM.h> 82 82 83 IGNORE_WARNINGS_BEGIN("frame-address") 84 83 85 namespace JSC { 84 86 … … 101 103 102 104 103 void JIT_OPERATION operationThrowStackOverflowError( ExecState* exec,CodeBlock* codeBlock)105 void JIT_OPERATION operationThrowStackOverflowError(CodeBlock* codeBlock) 104 106 { 105 107 // We pass in our own code block, because the callframe hasn't been populated. 106 108 VM& vm = codeBlock->vm(); 107 auto scope = DECLARE_THROW_SCOPE(vm); 108 exec->convertToStackOverflowFrame(vm, codeBlock); 109 NativeCallFrameTracer tracer(vm, exec); 110 throwStackOverflowError(exec, scope); 111 } 112 113 void JIT_OPERATION throwStackOverflowErrorFromThunk(VM* vmPointer, ExecState* exec) 114 { 115 VM& vm = *vmPointer; 116 auto scope = DECLARE_THROW_SCOPE(vm); 117 NativeCallFrameTracer tracer(vm, exec); 118 throwStackOverflowError(exec, scope); 119 genericUnwind(vm, exec); 109 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 110 NativeCallFrameTracer tracer(vm, callFrame); 111 auto scope = DECLARE_THROW_SCOPE(vm); 112 callFrame->convertToStackOverflowFrame(vm, codeBlock); 113 throwStackOverflowError(codeBlock->globalObject(), scope); 114 } 115 116 void JIT_OPERATION throwStackOverflowErrorFromThunk(JSGlobalObject* globalObject) 117 { 118 VM& vm = globalObject->vm(); 119 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 120 NativeCallFrameTracer tracer(vm, callFrame); 121 auto scope = DECLARE_THROW_SCOPE(vm); 122 throwStackOverflowError(globalObject, scope); 123 genericUnwind(vm, callFrame); 120 124 ASSERT(vm.targetMachinePCForThrow); 121 125 } 122 126 123 int32_t JIT_OPERATION operationCallArityCheck(ExecState* exec) 124 { 125 VM& vm = exec->vm(); 126 auto scope = DECLARE_THROW_SCOPE(vm); 127 128 int32_t missingArgCount = CommonSlowPaths::arityCheckFor(exec, vm, CodeForCall); 127 int32_t JIT_OPERATION operationCallArityCheck(JSGlobalObject* globalObject) 128 { 129 VM& vm = globalObject->vm(); 130 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 131 NativeCallFrameTracer tracer(vm, callFrame); 132 auto scope = DECLARE_THROW_SCOPE(vm); 133 134 int32_t missingArgCount = CommonSlowPaths::arityCheckFor(vm, callFrame, CodeForCall); 129 135 if (UNLIKELY(missingArgCount < 0)) { 130 CodeBlock* codeBlock = CommonSlowPaths::codeBlockFromCallFrameCallee(exec, CodeForCall); 131 exec->convertToStackOverflowFrame(vm, codeBlock); 132 NativeCallFrameTracer tracer(vm, exec); 133 throwStackOverflowError(vm.topCallFrame, scope); 136 CodeBlock* codeBlock = CommonSlowPaths::codeBlockFromCallFrameCallee(callFrame, CodeForCall); 137 callFrame->convertToStackOverflowFrame(vm, codeBlock); 138 throwStackOverflowError(globalObject, scope); 134 139 } 135 140 … … 137 142 } 138 143 139 int32_t JIT_OPERATION operationConstructArityCheck(ExecState* exec) 140 { 141 VM& vm = exec->vm(); 142 auto scope = DECLARE_THROW_SCOPE(vm); 143 144 int32_t missingArgCount = CommonSlowPaths::arityCheckFor(exec, vm, CodeForConstruct); 144 int32_t JIT_OPERATION operationConstructArityCheck(JSGlobalObject* globalObject) 145 { 146 VM& vm = globalObject->vm(); 147 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 148 NativeCallFrameTracer tracer(vm, callFrame); 149 auto scope = DECLARE_THROW_SCOPE(vm); 150 151 int32_t missingArgCount = CommonSlowPaths::arityCheckFor(vm, callFrame, CodeForConstruct); 145 152 if (UNLIKELY(missingArgCount < 0)) { 146 CodeBlock* codeBlock = CommonSlowPaths::codeBlockFromCallFrameCallee(exec, CodeForConstruct); 147 exec->convertToStackOverflowFrame(vm, codeBlock); 148 NativeCallFrameTracer tracer(vm, exec); 149 throwStackOverflowError(vm.topCallFrame, scope); 153 CodeBlock* codeBlock = CommonSlowPaths::codeBlockFromCallFrameCallee(callFrame, CodeForConstruct); 154 callFrame->convertToStackOverflowFrame(vm, codeBlock); 155 throwStackOverflowError(globalObject, scope); 150 156 } 151 157 … … 153 159 } 154 160 155 EncodedJSValue JIT_OPERATION operationTryGetById(ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid) 156 { 157 VM& vm = exec->vm(); 158 NativeCallFrameTracer tracer(vm, exec); 161 EncodedJSValue JIT_OPERATION operationTryGetById(JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid) 162 { 163 VM& vm = globalObject->vm(); 164 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 165 NativeCallFrameTracer tracer(vm, callFrame); 159 166 Identifier ident = Identifier::fromUid(vm, uid); 160 167 stubInfo->tookSlowPath = true; … … 162 169 JSValue baseValue = JSValue::decode(base); 163 170 PropertySlot slot(baseValue, PropertySlot::InternalMethodType::VMInquiry); 164 baseValue.getPropertySlot( exec, ident, slot);171 baseValue.getPropertySlot(globalObject, ident, slot); 165 172 166 173 return JSValue::encode(slot.getPureResult()); … … 168 175 169 176 170 EncodedJSValue JIT_OPERATION operationTryGetByIdGeneric(ExecState* exec, EncodedJSValue base, UniquedStringImpl* uid) 171 { 172 VM& vm = exec->vm(); 173 NativeCallFrameTracer tracer(vm, exec); 177 EncodedJSValue JIT_OPERATION operationTryGetByIdGeneric(JSGlobalObject* globalObject, EncodedJSValue base, UniquedStringImpl* uid) 178 { 179 VM& vm = globalObject->vm(); 180 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 181 NativeCallFrameTracer tracer(vm, callFrame); 174 182 Identifier ident = Identifier::fromUid(vm, uid); 175 183 176 184 JSValue baseValue = JSValue::decode(base); 177 185 PropertySlot slot(baseValue, PropertySlot::InternalMethodType::VMInquiry); 178 baseValue.getPropertySlot( exec, ident, slot);186 baseValue.getPropertySlot(globalObject, ident, slot); 179 187 180 188 return JSValue::encode(slot.getPureResult()); 181 189 } 182 190 183 EncodedJSValue JIT_OPERATION operationTryGetByIdOptimize(ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid) 184 { 185 VM& vm = exec->vm(); 186 NativeCallFrameTracer tracer(vm, exec); 191 EncodedJSValue JIT_OPERATION operationTryGetByIdOptimize(JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid) 192 { 193 VM& vm = globalObject->vm(); 194 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 195 NativeCallFrameTracer tracer(vm, callFrame); 187 196 auto scope = DECLARE_THROW_SCOPE(vm); 188 197 Identifier ident = Identifier::fromUid(vm, uid); … … 191 200 PropertySlot slot(baseValue, PropertySlot::InternalMethodType::VMInquiry); 192 201 193 baseValue.getPropertySlot( exec, ident, slot);202 baseValue.getPropertySlot(globalObject, ident, slot); 194 203 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 195 204 196 if (stubInfo->considerCaching(vm, exec->codeBlock(), baseValue.structureOrNull()) && !slot.isTaintedByOpaqueObject() && (slot.isCacheableValue() || slot.isCacheableGetter() || slot.isUnset())) 197 repatchGetByID(exec, baseValue, ident, slot, *stubInfo, GetByIDKind::Try); 205 CodeBlock* codeBlock = callFrame->codeBlock(); 206 if (stubInfo->considerCaching(vm, codeBlock, baseValue.structureOrNull()) && !slot.isTaintedByOpaqueObject() && (slot.isCacheableValue() || slot.isCacheableGetter() || slot.isUnset())) 207 repatchGetByID(globalObject, codeBlock, baseValue, ident, slot, *stubInfo, GetByIDKind::Try); 198 208 199 209 return JSValue::encode(slot.getPureResult()); 200 210 } 201 211 202 EncodedJSValue JIT_OPERATION operationGetByIdDirect(ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid) 203 { 204 VM& vm = exec->vm(); 205 NativeCallFrameTracer tracer(vm, exec); 212 EncodedJSValue JIT_OPERATION operationGetByIdDirect(JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid) 213 { 214 VM& vm = globalObject->vm(); 215 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 216 NativeCallFrameTracer tracer(vm, callFrame); 206 217 auto scope = DECLARE_THROW_SCOPE(vm); 207 218 Identifier ident = Identifier::fromUid(vm, uid); … … 211 222 PropertySlot slot(baseValue, PropertySlot::InternalMethodType::GetOwnProperty); 212 223 213 bool found = baseValue.getOwnPropertySlot( exec, ident, slot);224 bool found = baseValue.getOwnPropertySlot(globalObject, ident, slot); 214 225 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 215 226 216 RELEASE_AND_RETURN(scope, JSValue::encode(found ? slot.getValue(exec, ident) : jsUndefined())); 217 } 218 219 EncodedJSValue JIT_OPERATION operationGetByIdDirectGeneric(ExecState* exec, EncodedJSValue base, UniquedStringImpl* uid) 220 { 221 VM& vm = exec->vm(); 222 NativeCallFrameTracer tracer(vm, exec); 227 RELEASE_AND_RETURN(scope, JSValue::encode(found ? slot.getValue(globalObject, ident) : jsUndefined())); 228 } 229 230 EncodedJSValue JIT_OPERATION operationGetByIdDirectGeneric(JSGlobalObject* globalObject, EncodedJSValue base, UniquedStringImpl* uid) 231 { 232 VM& vm = globalObject->vm(); 233 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 234 NativeCallFrameTracer tracer(vm, callFrame); 223 235 auto scope = DECLARE_THROW_SCOPE(vm); 224 236 Identifier ident = Identifier::fromUid(vm, uid); … … 227 239 PropertySlot slot(baseValue, PropertySlot::InternalMethodType::GetOwnProperty); 228 240 229 bool found = baseValue.getOwnPropertySlot( exec, ident, slot);241 bool found = baseValue.getOwnPropertySlot(globalObject, ident, slot); 230 242 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 231 243 232 RELEASE_AND_RETURN(scope, JSValue::encode(found ? slot.getValue(exec, ident) : jsUndefined())); 233 } 234 235 EncodedJSValue JIT_OPERATION operationGetByIdDirectOptimize(ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid) 236 { 237 VM& vm = exec->vm(); 238 NativeCallFrameTracer tracer(vm, exec); 244 RELEASE_AND_RETURN(scope, JSValue::encode(found ? slot.getValue(globalObject, ident) : jsUndefined())); 245 } 246 247 EncodedJSValue JIT_OPERATION operationGetByIdDirectOptimize(JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid) 248 { 249 VM& vm = globalObject->vm(); 250 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 251 NativeCallFrameTracer tracer(vm, callFrame); 239 252 auto scope = DECLARE_THROW_SCOPE(vm); 240 253 Identifier ident = Identifier::fromUid(vm, uid); … … 243 256 PropertySlot slot(baseValue, PropertySlot::InternalMethodType::GetOwnProperty); 244 257 245 bool found = baseValue.getOwnPropertySlot( exec, ident, slot);258 bool found = baseValue.getOwnPropertySlot(globalObject, ident, slot); 246 259 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 247 260 248 if (stubInfo->considerCaching(vm, exec->codeBlock(), baseValue.structureOrNull())) 249 repatchGetByID(exec, baseValue, ident, slot, *stubInfo, GetByIDKind::Direct); 250 251 RELEASE_AND_RETURN(scope, JSValue::encode(found ? slot.getValue(exec, ident) : jsUndefined())); 252 } 253 254 EncodedJSValue JIT_OPERATION operationGetById(ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid) 261 CodeBlock* codeBlock = callFrame->codeBlock(); 262 if (stubInfo->considerCaching(vm, codeBlock, baseValue.structureOrNull())) 263 repatchGetByID(globalObject, codeBlock, baseValue, ident, slot, *stubInfo, GetByIDKind::Direct); 264 265 RELEASE_AND_RETURN(scope, JSValue::encode(found ? slot.getValue(globalObject, ident) : jsUndefined())); 266 } 267 268 EncodedJSValue JIT_OPERATION operationGetById(JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid) 255 269 { 256 270 SuperSamplerScope superSamplerScope(false); 257 271 258 VM& vm = exec->vm(); 259 NativeCallFrameTracer tracer(vm, exec); 272 VM& vm = globalObject->vm(); 273 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 274 NativeCallFrameTracer tracer(vm, callFrame); 260 275 261 276 stubInfo->tookSlowPath = true; … … 264 279 PropertySlot slot(baseValue, PropertySlot::InternalMethodType::Get); 265 280 Identifier ident = Identifier::fromUid(vm, uid); 266 JSValue result = baseValue.get( exec, ident, slot);281 JSValue result = baseValue.get(globalObject, ident, slot); 267 282 268 283 LOG_IC((ICEvent::OperationGetById, baseValue.classInfoOrNull(vm), ident, baseValue == slot.slotBase())); … … 271 286 } 272 287 273 EncodedJSValue JIT_OPERATION operationGetByIdGeneric( ExecState* exec, EncodedJSValue base, UniquedStringImpl* uid)288 EncodedJSValue JIT_OPERATION operationGetByIdGeneric(JSGlobalObject* globalObject, EncodedJSValue base, UniquedStringImpl* uid) 274 289 { 275 290 SuperSamplerScope superSamplerScope(false); 276 291 277 VM& vm = exec->vm(); 278 NativeCallFrameTracer tracer(vm, exec); 292 VM& vm = globalObject->vm(); 293 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 294 NativeCallFrameTracer tracer(vm, callFrame); 279 295 280 296 JSValue baseValue = JSValue::decode(base); 281 297 PropertySlot slot(baseValue, PropertySlot::InternalMethodType::Get); 282 298 Identifier ident = Identifier::fromUid(vm, uid); 283 JSValue result = baseValue.get( exec, ident, slot);299 JSValue result = baseValue.get(globalObject, ident, slot); 284 300 285 301 LOG_IC((ICEvent::OperationGetByIdGeneric, baseValue.classInfoOrNull(vm), ident, baseValue == slot.slotBase())); … … 288 304 } 289 305 290 EncodedJSValue JIT_OPERATION operationGetByIdOptimize( ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid)306 EncodedJSValue JIT_OPERATION operationGetByIdOptimize(JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid) 291 307 { 292 308 SuperSamplerScope superSamplerScope(false); 293 309 294 VM& vm = exec->vm(); 295 NativeCallFrameTracer tracer(vm, exec); 310 VM& vm = globalObject->vm(); 311 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 312 NativeCallFrameTracer tracer(vm, callFrame); 296 313 Identifier ident = Identifier::fromUid(vm, uid); 297 314 298 315 JSValue baseValue = JSValue::decode(base); 299 316 300 return JSValue::encode(baseValue.getPropertySlot( exec, ident, [&] (bool found, PropertySlot& slot) -> JSValue {317 return JSValue::encode(baseValue.getPropertySlot(globalObject, ident, [&] (bool found, PropertySlot& slot) -> JSValue { 301 318 302 319 LOG_IC((ICEvent::OperationGetByIdOptimize, baseValue.classInfoOrNull(vm), ident, baseValue == slot.slotBase())); 303 320 304 if (stubInfo->considerCaching(vm, exec->codeBlock(), baseValue.structureOrNull())) 305 repatchGetByID(exec, baseValue, ident, slot, *stubInfo, GetByIDKind::Normal); 306 return found ? slot.getValue(exec, ident) : jsUndefined(); 321 CodeBlock* codeBlock = callFrame->codeBlock(); 322 if (stubInfo->considerCaching(vm, codeBlock, baseValue.structureOrNull())) 323 repatchGetByID(globalObject, codeBlock, baseValue, ident, slot, *stubInfo, GetByIDKind::Normal); 324 return found ? slot.getValue(globalObject, ident) : jsUndefined(); 307 325 })); 308 326 } 309 327 310 EncodedJSValue JIT_OPERATION operationGetByIdWithThis( ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue base, EncodedJSValue thisEncoded, UniquedStringImpl* uid)328 EncodedJSValue JIT_OPERATION operationGetByIdWithThis(JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue base, EncodedJSValue thisEncoded, UniquedStringImpl* uid) 311 329 { 312 330 SuperSamplerScope superSamplerScope(false); 313 331 314 VM& vm = exec->vm(); 315 NativeCallFrameTracer tracer(vm, exec); 332 VM& vm = globalObject->vm(); 333 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 334 NativeCallFrameTracer tracer(vm, callFrame); 316 335 Identifier ident = Identifier::fromUid(vm, uid); 317 336 … … 322 341 PropertySlot slot(thisValue, PropertySlot::InternalMethodType::Get); 323 342 324 return JSValue::encode(baseValue.get( exec, ident, slot));325 } 326 327 EncodedJSValue JIT_OPERATION operationGetByIdWithThisGeneric( ExecState* exec, EncodedJSValue base, EncodedJSValue thisEncoded, UniquedStringImpl* uid)343 return JSValue::encode(baseValue.get(globalObject, ident, slot)); 344 } 345 346 EncodedJSValue JIT_OPERATION operationGetByIdWithThisGeneric(JSGlobalObject* globalObject, EncodedJSValue base, EncodedJSValue thisEncoded, UniquedStringImpl* uid) 328 347 { 329 348 SuperSamplerScope superSamplerScope(false); 330 349 331 VM& vm = exec->vm(); 332 NativeCallFrameTracer tracer(vm, exec); 350 VM& vm = globalObject->vm(); 351 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 352 NativeCallFrameTracer tracer(vm, callFrame); 333 353 Identifier ident = Identifier::fromUid(vm, uid); 334 354 … … 337 357 PropertySlot slot(thisValue, PropertySlot::InternalMethodType::Get); 338 358 339 return JSValue::encode(baseValue.get( exec, ident, slot));340 } 341 342 EncodedJSValue JIT_OPERATION operationGetByIdWithThisOptimize( ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue base, EncodedJSValue thisEncoded, UniquedStringImpl* uid)359 return JSValue::encode(baseValue.get(globalObject, ident, slot)); 360 } 361 362 EncodedJSValue JIT_OPERATION operationGetByIdWithThisOptimize(JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue base, EncodedJSValue thisEncoded, UniquedStringImpl* uid) 343 363 { 344 364 SuperSamplerScope superSamplerScope(false); 345 365 346 VM& vm = exec->vm(); 347 NativeCallFrameTracer tracer(vm, exec); 366 VM& vm = globalObject->vm(); 367 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 368 NativeCallFrameTracer tracer(vm, callFrame); 348 369 Identifier ident = Identifier::fromUid(vm, uid); 349 370 … … 352 373 353 374 PropertySlot slot(thisValue, PropertySlot::InternalMethodType::Get); 354 return JSValue::encode(baseValue.getPropertySlot( exec, ident, slot, [&] (bool found, PropertySlot& slot) -> JSValue {375 return JSValue::encode(baseValue.getPropertySlot(globalObject, ident, slot, [&] (bool found, PropertySlot& slot) -> JSValue { 355 376 LOG_IC((ICEvent::OperationGetByIdWithThisOptimize, baseValue.classInfoOrNull(vm), ident, baseValue == slot.slotBase())); 356 377 357 if (stubInfo->considerCaching(vm, exec->codeBlock(), baseValue.structureOrNull())) 358 repatchGetByID(exec, baseValue, ident, slot, *stubInfo, GetByIDKind::WithThis); 359 return found ? slot.getValue(exec, ident) : jsUndefined(); 378 CodeBlock* codeBlock = callFrame->codeBlock(); 379 if (stubInfo->considerCaching(vm, codeBlock, baseValue.structureOrNull())) 380 repatchGetByID(globalObject, codeBlock, baseValue, ident, slot, *stubInfo, GetByIDKind::WithThis); 381 return found ? slot.getValue(globalObject, ident) : jsUndefined(); 360 382 })); 361 383 } 362 384 363 EncodedJSValue JIT_OPERATION operationInById( ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid)385 EncodedJSValue JIT_OPERATION operationInById(JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid) 364 386 { 365 387 SuperSamplerScope superSamplerScope(false); 366 388 367 VM& vm = exec->vm(); 368 NativeCallFrameTracer tracer(vm, exec); 389 VM& vm = globalObject->vm(); 390 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 391 NativeCallFrameTracer tracer(vm, callFrame); 369 392 auto scope = DECLARE_THROW_SCOPE(vm); 370 393 … … 375 398 JSValue baseValue = JSValue::decode(base); 376 399 if (!baseValue.isObject()) { 377 throwException( exec, scope, createInvalidInParameterError(exec, baseValue));400 throwException(globalObject, scope, createInvalidInParameterError(globalObject, baseValue)); 378 401 return JSValue::encode(jsUndefined()); 379 402 } … … 384 407 scope.release(); 385 408 PropertySlot slot(baseObject, PropertySlot::InternalMethodType::HasProperty); 386 return JSValue::encode(jsBoolean(baseObject->getPropertySlot( exec, ident, slot)));387 } 388 389 EncodedJSValue JIT_OPERATION operationInByIdGeneric( ExecState* exec, EncodedJSValue base, UniquedStringImpl* uid)409 return JSValue::encode(jsBoolean(baseObject->getPropertySlot(globalObject, ident, slot))); 410 } 411 412 EncodedJSValue JIT_OPERATION operationInByIdGeneric(JSGlobalObject* globalObject, EncodedJSValue base, UniquedStringImpl* uid) 390 413 { 391 414 SuperSamplerScope superSamplerScope(false); 392 415 393 VM& vm = exec->vm(); 394 NativeCallFrameTracer tracer(vm, exec); 416 VM& vm = globalObject->vm(); 417 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 418 NativeCallFrameTracer tracer(vm, callFrame); 395 419 auto scope = DECLARE_THROW_SCOPE(vm); 396 420 … … 399 423 JSValue baseValue = JSValue::decode(base); 400 424 if (!baseValue.isObject()) { 401 throwException( exec, scope, createInvalidInParameterError(exec, baseValue));425 throwException(globalObject, scope, createInvalidInParameterError(globalObject, baseValue)); 402 426 return JSValue::encode(jsUndefined()); 403 427 } … … 408 432 scope.release(); 409 433 PropertySlot slot(baseObject, PropertySlot::InternalMethodType::HasProperty); 410 return JSValue::encode(jsBoolean(baseObject->getPropertySlot( exec, ident, slot)));411 } 412 413 EncodedJSValue JIT_OPERATION operationInByIdOptimize( ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid)434 return JSValue::encode(jsBoolean(baseObject->getPropertySlot(globalObject, ident, slot))); 435 } 436 437 EncodedJSValue JIT_OPERATION operationInByIdOptimize(JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue base, UniquedStringImpl* uid) 414 438 { 415 439 SuperSamplerScope superSamplerScope(false); 416 440 417 VM& vm = exec->vm(); 418 NativeCallFrameTracer tracer(vm, exec); 441 VM& vm = globalObject->vm(); 442 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 443 NativeCallFrameTracer tracer(vm, callFrame); 419 444 auto scope = DECLARE_THROW_SCOPE(vm); 420 445 … … 423 448 JSValue baseValue = JSValue::decode(base); 424 449 if (!baseValue.isObject()) { 425 throwException( exec, scope, createInvalidInParameterError(exec, baseValue));450 throwException(globalObject, scope, createInvalidInParameterError(globalObject, baseValue)); 426 451 return JSValue::encode(jsUndefined()); 427 452 } … … 432 457 scope.release(); 433 458 PropertySlot slot(baseObject, PropertySlot::InternalMethodType::HasProperty); 434 bool found = baseObject->getPropertySlot(exec, ident, slot); 435 if (stubInfo->considerCaching(vm, exec->codeBlock(), baseObject->structure(vm))) 436 repatchInByID(exec, baseObject, ident, found, slot, *stubInfo); 459 bool found = baseObject->getPropertySlot(globalObject, ident, slot); 460 CodeBlock* codeBlock = callFrame->codeBlock(); 461 if (stubInfo->considerCaching(vm, codeBlock, baseObject->structure(vm))) 462 repatchInByID(globalObject, codeBlock, baseObject, ident, found, slot, *stubInfo); 437 463 return JSValue::encode(jsBoolean(found)); 438 464 } 439 465 440 EncodedJSValue JIT_OPERATION operationInByVal( ExecState* exec, JSCell* base, EncodedJSValue key)466 EncodedJSValue JIT_OPERATION operationInByVal(JSGlobalObject* globalObject, JSCell* base, EncodedJSValue key) 441 467 { 442 468 SuperSamplerScope superSamplerScope(false); 443 469 444 VM& vm = exec->vm(); 445 NativeCallFrameTracer tracer(vm, exec); 446 447 return JSValue::encode(jsBoolean(CommonSlowPaths::opInByVal(exec, base, JSValue::decode(key)))); 448 } 449 450 void JIT_OPERATION operationPutByIdStrict(ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedBase, UniquedStringImpl* uid) 470 VM& vm = globalObject->vm(); 471 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 472 NativeCallFrameTracer tracer(vm, callFrame); 473 474 return JSValue::encode(jsBoolean(CommonSlowPaths::opInByVal(globalObject, base, JSValue::decode(key)))); 475 } 476 477 void JIT_OPERATION operationPutByIdStrict(JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedBase, UniquedStringImpl* uid) 451 478 { 452 479 SuperSamplerScope superSamplerScope(false); 453 480 454 VM& vm = exec->vm(); 455 NativeCallFrameTracer tracer(vm, exec); 481 VM& vm = globalObject->vm(); 482 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 483 NativeCallFrameTracer tracer(vm, callFrame); 456 484 457 485 stubInfo->tookSlowPath = true; … … 459 487 JSValue baseValue = JSValue::decode(encodedBase); 460 488 Identifier ident = Identifier::fromUid(vm, uid); 461 PutPropertySlot slot(baseValue, true, exec->codeBlock()->putByIdContext());462 baseValue.putInline( exec, ident, JSValue::decode(encodedValue), slot);489 PutPropertySlot slot(baseValue, true, callFrame->codeBlock()->putByIdContext()); 490 baseValue.putInline(globalObject, ident, JSValue::decode(encodedValue), slot); 463 491 464 492 LOG_IC((ICEvent::OperationPutByIdStrict, baseValue.classInfoOrNull(vm), ident, slot.base() == baseValue)); 465 493 } 466 494 467 void JIT_OPERATION operationPutByIdNonStrict( ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedBase, UniquedStringImpl* uid)495 void JIT_OPERATION operationPutByIdNonStrict(JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedBase, UniquedStringImpl* uid) 468 496 { 469 497 SuperSamplerScope superSamplerScope(false); 470 498 471 VM& vm = exec->vm(); 472 NativeCallFrameTracer tracer(vm, exec); 499 VM& vm = globalObject->vm(); 500 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 501 NativeCallFrameTracer tracer(vm, callFrame); 473 502 474 503 stubInfo->tookSlowPath = true; … … 476 505 JSValue baseValue = JSValue::decode(encodedBase); 477 506 Identifier ident = Identifier::fromUid(vm, uid); 478 PutPropertySlot slot(baseValue, false, exec->codeBlock()->putByIdContext());479 baseValue.putInline( exec, ident, JSValue::decode(encodedValue), slot);507 PutPropertySlot slot(baseValue, false, callFrame->codeBlock()->putByIdContext()); 508 baseValue.putInline(globalObject, ident, JSValue::decode(encodedValue), slot); 480 509 481 510 LOG_IC((ICEvent::OperationPutByIdNonStrict, baseValue.classInfoOrNull(vm), ident, slot.base() == baseValue)); 482 511 } 483 512 484 void JIT_OPERATION operationPutByIdDirectStrict( ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedBase, UniquedStringImpl* uid)513 void JIT_OPERATION operationPutByIdDirectStrict(JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedBase, UniquedStringImpl* uid) 485 514 { 486 515 SuperSamplerScope superSamplerScope(false); 487 516 488 VM& vm = exec->vm(); 489 NativeCallFrameTracer tracer(vm, exec); 517 VM& vm = globalObject->vm(); 518 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 519 NativeCallFrameTracer tracer(vm, callFrame); 490 520 491 521 stubInfo->tookSlowPath = true; … … 493 523 JSValue baseValue = JSValue::decode(encodedBase); 494 524 Identifier ident = Identifier::fromUid(vm, uid); 495 PutPropertySlot slot(baseValue, true, exec->codeBlock()->putByIdContext());496 CommonSlowPaths::putDirectWithReify(vm, exec, asObject(baseValue), ident, JSValue::decode(encodedValue), slot);525 PutPropertySlot slot(baseValue, true, callFrame->codeBlock()->putByIdContext()); 526 CommonSlowPaths::putDirectWithReify(vm, globalObject, asObject(baseValue), ident, JSValue::decode(encodedValue), slot); 497 527 498 528 LOG_IC((ICEvent::OperationPutByIdDirectStrict, baseValue.classInfoOrNull(vm), ident, slot.base() == baseValue)); 499 529 } 500 530 501 void JIT_OPERATION operationPutByIdDirectNonStrict( ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedBase, UniquedStringImpl* uid)531 void JIT_OPERATION operationPutByIdDirectNonStrict(JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedBase, UniquedStringImpl* uid) 502 532 { 503 533 SuperSamplerScope superSamplerScope(false); 504 534 505 VM& vm = exec->vm(); 506 NativeCallFrameTracer tracer(vm, exec); 535 VM& vm = globalObject->vm(); 536 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 537 NativeCallFrameTracer tracer(vm, callFrame); 507 538 508 539 stubInfo->tookSlowPath = true; … … 510 541 JSValue baseValue = JSValue::decode(encodedBase); 511 542 Identifier ident = Identifier::fromUid(vm, uid); 512 PutPropertySlot slot(baseValue, false, exec->codeBlock()->putByIdContext());513 CommonSlowPaths::putDirectWithReify(vm, exec, asObject(baseValue), ident, JSValue::decode(encodedValue), slot);543 PutPropertySlot slot(baseValue, false, callFrame->codeBlock()->putByIdContext()); 544 CommonSlowPaths::putDirectWithReify(vm, globalObject, asObject(baseValue), ident, JSValue::decode(encodedValue), slot); 514 545 515 546 LOG_IC((ICEvent::OperationPutByIdDirectNonStrict, baseValue.classInfoOrNull(vm), ident, slot.base() == baseValue)); 516 547 } 517 548 518 void JIT_OPERATION operationPutByIdStrictOptimize( ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedBase, UniquedStringImpl* uid)549 void JIT_OPERATION operationPutByIdStrictOptimize(JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedBase, UniquedStringImpl* uid) 519 550 { 520 551 SuperSamplerScope superSamplerScope(false); 521 552 522 VM& vm = exec->vm(); 523 NativeCallFrameTracer tracer(vm, exec); 553 VM& vm = globalObject->vm(); 554 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 555 NativeCallFrameTracer tracer(vm, callFrame); 524 556 auto scope = DECLARE_THROW_SCOPE(vm); 525 557 … … 529 561 JSValue value = JSValue::decode(encodedValue); 530 562 JSValue baseValue = JSValue::decode(encodedBase); 531 CodeBlock* codeBlock = exec->codeBlock();563 CodeBlock* codeBlock = callFrame->codeBlock(); 532 564 PutPropertySlot slot(baseValue, true, codeBlock->putByIdContext()); 533 565 534 566 Structure* structure = baseValue.isCell() ? baseValue.asCell()->structure(vm) : nullptr; 535 baseValue.putInline( exec, ident, value, slot);567 baseValue.putInline(globalObject, ident, value, slot); 536 568 537 569 LOG_IC((ICEvent::OperationPutByIdStrictOptimize, baseValue.classInfoOrNull(vm), ident, slot.base() == baseValue)); … … 543 575 544 576 if (stubInfo->considerCaching(vm, codeBlock, structure)) 545 repatchPutByID( exec, baseValue, structure, ident, slot, *stubInfo, NotDirect);546 } 547 548 void JIT_OPERATION operationPutByIdNonStrictOptimize( ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedBase, UniquedStringImpl* uid)577 repatchPutByID(globalObject, codeBlock, baseValue, structure, ident, slot, *stubInfo, NotDirect); 578 } 579 580 void JIT_OPERATION operationPutByIdNonStrictOptimize(JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedBase, UniquedStringImpl* uid) 549 581 { 550 582 SuperSamplerScope superSamplerScope(false); 551 583 552 VM& vm = exec->vm(); 553 NativeCallFrameTracer tracer(vm, exec); 584 VM& vm = globalObject->vm(); 585 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 586 NativeCallFrameTracer tracer(vm, callFrame); 554 587 auto scope = DECLARE_THROW_SCOPE(vm); 555 588 … … 559 592 JSValue value = JSValue::decode(encodedValue); 560 593 JSValue baseValue = JSValue::decode(encodedBase); 561 CodeBlock* codeBlock = exec->codeBlock();594 CodeBlock* codeBlock = callFrame->codeBlock(); 562 595 PutPropertySlot slot(baseValue, false, codeBlock->putByIdContext()); 563 596 564 597 Structure* structure = baseValue.isCell() ? baseValue.asCell()->structure(vm) : nullptr; 565 baseValue.putInline( exec, ident, value, slot);598 baseValue.putInline(globalObject, ident, value, slot); 566 599 567 600 LOG_IC((ICEvent::OperationPutByIdNonStrictOptimize, baseValue.classInfoOrNull(vm), ident, slot.base() == baseValue)); … … 573 606 574 607 if (stubInfo->considerCaching(vm, codeBlock, structure)) 575 repatchPutByID( exec, baseValue, structure, ident, slot, *stubInfo, NotDirect);576 } 577 578 void JIT_OPERATION operationPutByIdDirectStrictOptimize( ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedBase, UniquedStringImpl* uid)608 repatchPutByID(globalObject, codeBlock, baseValue, structure, ident, slot, *stubInfo, NotDirect); 609 } 610 611 void JIT_OPERATION operationPutByIdDirectStrictOptimize(JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedBase, UniquedStringImpl* uid) 579 612 { 580 613 SuperSamplerScope superSamplerScope(false); 581 614 582 VM& vm = exec->vm(); 583 NativeCallFrameTracer tracer(vm, exec); 615 VM& vm = globalObject->vm(); 616 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 617 NativeCallFrameTracer tracer(vm, callFrame); 584 618 auto scope = DECLARE_THROW_SCOPE(vm); 585 619 … … 589 623 JSValue value = JSValue::decode(encodedValue); 590 624 JSObject* baseObject = asObject(JSValue::decode(encodedBase)); 591 CodeBlock* codeBlock = exec->codeBlock();625 CodeBlock* codeBlock = callFrame->codeBlock(); 592 626 PutPropertySlot slot(baseObject, true, codeBlock->putByIdContext()); 593 627 Structure* structure = nullptr; 594 CommonSlowPaths::putDirectWithReify(vm, exec, baseObject, ident, value, slot, &structure);628 CommonSlowPaths::putDirectWithReify(vm, globalObject, baseObject, ident, value, slot, &structure); 595 629 596 630 LOG_IC((ICEvent::OperationPutByIdDirectStrictOptimize, baseObject->classInfo(vm), ident, slot.base() == baseObject)); … … 602 636 603 637 if (stubInfo->considerCaching(vm, codeBlock, structure)) 604 repatchPutByID( exec, baseObject, structure, ident, slot, *stubInfo, Direct);605 } 606 607 void JIT_OPERATION operationPutByIdDirectNonStrictOptimize( ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedBase, UniquedStringImpl* uid)638 repatchPutByID(globalObject, codeBlock, baseObject, structure, ident, slot, *stubInfo, Direct); 639 } 640 641 void JIT_OPERATION operationPutByIdDirectNonStrictOptimize(JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedBase, UniquedStringImpl* uid) 608 642 { 609 643 SuperSamplerScope superSamplerScope(false); 610 644 611 VM& vm = exec->vm(); 612 NativeCallFrameTracer tracer(vm, exec); 645 VM& vm = globalObject->vm(); 646 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 647 NativeCallFrameTracer tracer(vm, callFrame); 613 648 auto scope = DECLARE_THROW_SCOPE(vm); 614 649 … … 618 653 JSValue value = JSValue::decode(encodedValue); 619 654 JSObject* baseObject = asObject(JSValue::decode(encodedBase)); 620 CodeBlock* codeBlock = exec->codeBlock();655 CodeBlock* codeBlock = callFrame->codeBlock(); 621 656 PutPropertySlot slot(baseObject, false, codeBlock->putByIdContext()); 622 657 Structure* structure = nullptr; 623 CommonSlowPaths::putDirectWithReify(vm, exec, baseObject, ident, value, slot, &structure);658 CommonSlowPaths::putDirectWithReify(vm, globalObject, baseObject, ident, value, slot, &structure); 624 659 625 660 LOG_IC((ICEvent::OperationPutByIdDirectNonStrictOptimize, baseObject->classInfo(vm), ident, slot.base() == baseObject)); … … 631 666 632 667 if (stubInfo->considerCaching(vm, codeBlock, structure)) 633 repatchPutByID( exec, baseObject, structure, ident, slot, *stubInfo, Direct);668 repatchPutByID(globalObject, codeBlock, baseObject, structure, ident, slot, *stubInfo, Direct); 634 669 } 635 670 … … 639 674 } 640 675 641 static void putByVal( CallFrame* callFrame, JSValue baseValue, JSValue subscript, JSValue value, ByValInfo* byValInfo)642 { 643 VM& vm = callFrame->vm();676 static void putByVal(JSGlobalObject* globalObject, CodeBlock* codeBlock, JSValue baseValue, JSValue subscript, JSValue value, ByValInfo* byValInfo) 677 { 678 VM& vm = globalObject->vm(); 644 679 auto scope = DECLARE_THROW_SCOPE(vm); 645 680 if (LIKELY(subscript.isUInt32())) { … … 655 690 byValInfo->arrayProfile->setOutOfBounds(); 656 691 scope.release(); 657 object->methodTable(vm)->putByIndex(object, callFrame, i, value, callFrame->codeBlock()->isStrictMode());692 object->methodTable(vm)->putByIndex(object, globalObject, i, value, codeBlock->isStrictMode()); 658 693 return; 659 694 } 660 695 661 696 scope.release(); 662 baseValue.putByIndex( callFrame, i, value, callFrame->codeBlock()->isStrictMode());697 baseValue.putByIndex(globalObject, i, value, codeBlock->isStrictMode()); 663 698 return; 664 699 } else if (subscript.isInt32()) { … … 668 703 } 669 704 670 auto property = subscript.toPropertyKey( callFrame);705 auto property = subscript.toPropertyKey(globalObject); 671 706 // Don't put to an object if toString threw an exception. 672 707 RETURN_IF_EXCEPTION(scope, void()); … … 676 711 677 712 scope.release(); 678 PutPropertySlot slot(baseValue, c allFrame->codeBlock()->isStrictMode());679 baseValue.putInline( callFrame, property, value, slot);680 } 681 682 static void directPutByVal( CallFrame* callFrame, JSObject* baseObject, JSValue subscript, JSValue value, ByValInfo* byValInfo)683 { 684 VM& vm = callFrame->vm();685 auto scope = DECLARE_THROW_SCOPE(vm); 686 bool isStrictMode = c allFrame->codeBlock()->isStrictMode();713 PutPropertySlot slot(baseValue, codeBlock->isStrictMode()); 714 baseValue.putInline(globalObject, property, value, slot); 715 } 716 717 static void directPutByVal(JSGlobalObject* globalObject, CodeBlock* codeBlock, JSObject* baseObject, JSValue subscript, JSValue value, ByValInfo* byValInfo) 718 { 719 VM& vm = globalObject->vm(); 720 auto scope = DECLARE_THROW_SCOPE(vm); 721 bool isStrictMode = codeBlock->isStrictMode(); 687 722 688 723 if (LIKELY(subscript.isUInt32())) { … … 706 741 707 742 scope.release(); 708 baseObject->putDirectIndex( callFrame, index, value, 0, isStrictMode ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow);743 baseObject->putDirectIndex(globalObject, index, value, 0, isStrictMode ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow); 709 744 return; 710 745 } … … 716 751 byValInfo->tookSlowPath = true; 717 752 scope.release(); 718 baseObject->putDirectIndex( callFrame, subscriptAsUInt32, value, 0, isStrictMode ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow);753 baseObject->putDirectIndex(globalObject, subscriptAsUInt32, value, 0, isStrictMode ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow); 719 754 return; 720 755 } … … 722 757 723 758 // Don't put to an object if toString threw an exception. 724 auto property = subscript.toPropertyKey( callFrame);759 auto property = subscript.toPropertyKey(globalObject); 725 760 RETURN_IF_EXCEPTION(scope, void()); 726 761 … … 728 763 byValInfo->tookSlowPath = true; 729 764 scope.release(); 730 baseObject->putDirectIndex( callFrame, index.value(), value, 0, isStrictMode ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow);765 baseObject->putDirectIndex(globalObject, index.value(), value, 0, isStrictMode ? PutDirectIndexShouldThrow : PutDirectIndexShouldNotThrow); 731 766 return; 732 767 } … … 737 772 scope.release(); 738 773 PutPropertySlot slot(baseObject, isStrictMode); 739 CommonSlowPaths::putDirectWithReify(vm, callFrame, baseObject, property, value, slot);774 CommonSlowPaths::putDirectWithReify(vm, globalObject, baseObject, property, value, slot); 740 775 } 741 776 … … 747 782 }; 748 783 749 static OptimizationResult tryPutByValOptimize(ExecState* exec, JSValue baseValue, JSValue subscript, ByValInfo* byValInfo, ReturnAddressPtr returnAddress) 750 { 784 static OptimizationResult tryPutByValOptimize(JSGlobalObject* globalObject, CallFrame* callFrame, CodeBlock* codeBlock, JSValue baseValue, JSValue subscript, ByValInfo* byValInfo, ReturnAddressPtr returnAddress) 785 { 786 UNUSED_PARAM(callFrame); 787 751 788 // See if it's worth optimizing at all. 752 789 OptimizationResult optimizationResult = OptimizationResult::NotOptimized; 753 790 754 VM& vm = exec->vm();791 VM& vm = globalObject->vm(); 755 792 auto scope = DECLARE_THROW_SCOPE(vm); 756 793 … … 761 798 JSObject* object = asObject(baseValue); 762 799 763 ASSERT( exec->bytecodeOffset());800 ASSERT(callFrame->bytecodeOffset()); 764 801 ASSERT(!byValInfo->stubRoutine); 765 802 … … 769 806 JITArrayMode arrayMode = jitArrayModeForStructure(structure); 770 807 if (jitArrayModePermitsPut(arrayMode) && arrayMode != byValInfo->arrayMode) { 771 CodeBlock* codeBlock = exec->codeBlock();772 808 ConcurrentJSLocker locker(codeBlock->m_lock); 773 809 byValInfo->arrayProfile->computeUpdatedPrediction(locker, codeBlock, structure); … … 783 819 784 820 if (baseValue.isObject() && isStringOrSymbol(subscript)) { 785 const Identifier propertyName = subscript.toPropertyKey( exec);821 const Identifier propertyName = subscript.toPropertyKey(globalObject); 786 822 RETURN_IF_EXCEPTION(scope, OptimizationResult::GiveUp); 787 823 if (subscript.isSymbol() || !parseIndex(propertyName)) { 788 ASSERT( exec->bytecodeOffset());824 ASSERT(callFrame->bytecodeOffset()); 789 825 ASSERT(!byValInfo->stubRoutine); 790 826 if (byValInfo->seen) { 791 827 if (byValInfo->cachedId == propertyName) { 792 JIT::compilePutByValWithCachedId<OpPutByVal>(vm, exec->codeBlock(), byValInfo, returnAddress, NotDirect, propertyName);828 JIT::compilePutByValWithCachedId<OpPutByVal>(vm, codeBlock, byValInfo, returnAddress, NotDirect, propertyName); 793 829 optimizationResult = OptimizationResult::Optimized; 794 830 } else { … … 797 833 } 798 834 } else { 799 CodeBlock* codeBlock = exec->codeBlock();800 835 ConcurrentJSLocker locker(codeBlock->m_lock); 801 836 byValInfo->seen = true; … … 821 856 } 822 857 823 void JIT_OPERATION operationPutByValOptimize(ExecState* exec, EncodedJSValue encodedBaseValue, EncodedJSValue encodedSubscript, EncodedJSValue encodedValue, ByValInfo* byValInfo) 824 { 825 VM& vm = exec->vm(); 826 NativeCallFrameTracer tracer(vm, exec); 858 void JIT_OPERATION operationPutByValOptimize(JSGlobalObject* globalObject, EncodedJSValue encodedBaseValue, EncodedJSValue encodedSubscript, EncodedJSValue encodedValue, ByValInfo* byValInfo) 859 { 860 VM& vm = globalObject->vm(); 861 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 862 NativeCallFrameTracer tracer(vm, callFrame); 827 863 auto scope = DECLARE_THROW_SCOPE(vm); 828 864 … … 830 866 JSValue subscript = JSValue::decode(encodedSubscript); 831 867 JSValue value = JSValue::decode(encodedValue); 832 OptimizationResult result = tryPutByValOptimize(exec, baseValue, subscript, byValInfo, ReturnAddressPtr(OUR_RETURN_ADDRESS)); 868 CodeBlock* codeBlock = callFrame->codeBlock(); 869 OptimizationResult result = tryPutByValOptimize(globalObject, callFrame, codeBlock, baseValue, subscript, byValInfo, ReturnAddressPtr(OUR_RETURN_ADDRESS)); 833 870 RETURN_IF_EXCEPTION(scope, void()); 834 871 if (result == OptimizationResult::GiveUp) { … … 837 874 ctiPatchCallByReturnAddress(ReturnAddressPtr(OUR_RETURN_ADDRESS), operationPutByValGeneric); 838 875 } 839 RELEASE_AND_RETURN(scope, putByVal(exec, baseValue, subscript, value, byValInfo)); 840 } 841 842 static OptimizationResult tryDirectPutByValOptimize(ExecState* exec, JSObject* object, JSValue subscript, ByValInfo* byValInfo, ReturnAddressPtr returnAddress) 843 { 876 RELEASE_AND_RETURN(scope, putByVal(globalObject, codeBlock, baseValue, subscript, value, byValInfo)); 877 } 878 879 static OptimizationResult tryDirectPutByValOptimize(JSGlobalObject* globalObject, CallFrame* callFrame, CodeBlock* codeBlock, JSObject* object, JSValue subscript, ByValInfo* byValInfo, ReturnAddressPtr returnAddress) 880 { 881 UNUSED_PARAM(callFrame); 882 844 883 // See if it's worth optimizing at all. 845 884 OptimizationResult optimizationResult = OptimizationResult::NotOptimized; 846 885 847 VM& vm = exec->vm();886 VM& vm = globalObject->vm(); 848 887 auto scope = DECLARE_THROW_SCOPE(vm); 849 888 850 889 if (subscript.isInt32()) { 851 ASSERT( exec->bytecodeOffset());890 ASSERT(callFrame->bytecodeOffset()); 852 891 ASSERT(!byValInfo->stubRoutine); 853 892 … … 857 896 JITArrayMode arrayMode = jitArrayModeForStructure(structure); 858 897 if (jitArrayModePermitsPutDirect(arrayMode) && arrayMode != byValInfo->arrayMode) { 859 CodeBlock* codeBlock = exec->codeBlock();860 898 ConcurrentJSLocker locker(codeBlock->m_lock); 861 899 byValInfo->arrayProfile->computeUpdatedPrediction(locker, codeBlock, structure); … … 870 908 optimizationResult = OptimizationResult::GiveUp; 871 909 } else if (isStringOrSymbol(subscript)) { 872 const Identifier propertyName = subscript.toPropertyKey( exec);910 const Identifier propertyName = subscript.toPropertyKey(globalObject); 873 911 RETURN_IF_EXCEPTION(scope, OptimizationResult::GiveUp); 874 912 if (subscript.isSymbol() || !parseIndex(propertyName)) { 875 ASSERT( exec->bytecodeOffset());913 ASSERT(callFrame->bytecodeOffset()); 876 914 ASSERT(!byValInfo->stubRoutine); 877 915 if (byValInfo->seen) { 878 916 if (byValInfo->cachedId == propertyName) { 879 JIT::compilePutByValWithCachedId<OpPutByValDirect>(vm, exec->codeBlock(), byValInfo, returnAddress, Direct, propertyName);917 JIT::compilePutByValWithCachedId<OpPutByValDirect>(vm, codeBlock, byValInfo, returnAddress, Direct, propertyName); 880 918 optimizationResult = OptimizationResult::Optimized; 881 919 } else { … … 884 922 } 885 923 } else { 886 CodeBlock* codeBlock = exec->codeBlock();887 924 ConcurrentJSLocker locker(codeBlock->m_lock); 888 925 byValInfo->seen = true; … … 908 945 } 909 946 910 void JIT_OPERATION operationDirectPutByValOptimize(ExecState* exec, EncodedJSValue encodedBaseValue, EncodedJSValue encodedSubscript, EncodedJSValue encodedValue, ByValInfo* byValInfo) 911 { 912 VM& vm = exec->vm(); 913 NativeCallFrameTracer tracer(vm, exec); 947 void JIT_OPERATION operationDirectPutByValOptimize(JSGlobalObject* globalObject, EncodedJSValue encodedBaseValue, EncodedJSValue encodedSubscript, EncodedJSValue encodedValue, ByValInfo* byValInfo) 948 { 949 VM& vm = globalObject->vm(); 950 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 951 NativeCallFrameTracer tracer(vm, callFrame); 914 952 auto scope = DECLARE_THROW_SCOPE(vm); 915 953 … … 919 957 RELEASE_ASSERT(baseValue.isObject()); 920 958 JSObject* object = asObject(baseValue); 921 OptimizationResult result = tryDirectPutByValOptimize(exec, object, subscript, byValInfo, ReturnAddressPtr(OUR_RETURN_ADDRESS)); 959 CodeBlock* codeBlock = callFrame->codeBlock(); 960 OptimizationResult result = tryDirectPutByValOptimize(globalObject, callFrame, codeBlock, object, subscript, byValInfo, ReturnAddressPtr(OUR_RETURN_ADDRESS)); 922 961 RETURN_IF_EXCEPTION(scope, void()); 923 962 if (result == OptimizationResult::GiveUp) { … … 927 966 } 928 967 929 RELEASE_AND_RETURN(scope, directPutByVal(exec, object, subscript, value, byValInfo)); 930 } 931 932 void JIT_OPERATION operationPutByValGeneric(ExecState* exec, EncodedJSValue encodedBaseValue, EncodedJSValue encodedSubscript, EncodedJSValue encodedValue, ByValInfo* byValInfo) 933 { 934 VM& vm = exec->vm(); 935 NativeCallFrameTracer tracer(vm, exec); 968 RELEASE_AND_RETURN(scope, directPutByVal(globalObject, codeBlock, object, subscript, value, byValInfo)); 969 } 970 971 void JIT_OPERATION operationPutByValGeneric(JSGlobalObject* globalObject, EncodedJSValue encodedBaseValue, EncodedJSValue encodedSubscript, EncodedJSValue encodedValue, ByValInfo* byValInfo) 972 { 973 VM& vm = globalObject->vm(); 974 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 975 NativeCallFrameTracer tracer(vm, callFrame); 936 976 937 977 JSValue baseValue = JSValue::decode(encodedBaseValue); … … 939 979 JSValue value = JSValue::decode(encodedValue); 940 980 941 putByVal(exec, baseValue, subscript, value, byValInfo); 942 } 943 944 945 void JIT_OPERATION operationDirectPutByValGeneric(ExecState* exec, EncodedJSValue encodedBaseValue, EncodedJSValue encodedSubscript, EncodedJSValue encodedValue, ByValInfo* byValInfo) 946 { 947 VM& vm = exec->vm(); 948 NativeCallFrameTracer tracer(vm, exec); 981 putByVal(globalObject, callFrame->codeBlock(), baseValue, subscript, value, byValInfo); 982 } 983 984 985 void JIT_OPERATION operationDirectPutByValGeneric(JSGlobalObject* globalObject, EncodedJSValue encodedBaseValue, EncodedJSValue encodedSubscript, EncodedJSValue encodedValue, ByValInfo* byValInfo) 986 { 987 VM& vm = globalObject->vm(); 988 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 989 NativeCallFrameTracer tracer(vm, callFrame); 949 990 950 991 JSValue baseValue = JSValue::decode(encodedBaseValue); … … 952 993 JSValue value = JSValue::decode(encodedValue); 953 994 RELEASE_ASSERT(baseValue.isObject()); 954 directPutByVal( exec, asObject(baseValue), subscript, value, byValInfo);955 } 956 957 EncodedJSValue JIT_OPERATION operationCallEval( ExecState* exec, ExecState* execCallee)958 { 959 VM& vm = exec->vm();960 auto scope = DECLARE_THROW_SCOPE(vm); 961 962 execCallee->setCodeBlock(0);963 964 if (!isHostFunction( execCallee->guaranteedJSValueCallee(), globalFuncEval))995 directPutByVal(globalObject, callFrame->codeBlock(), asObject(baseValue), subscript, value, byValInfo); 996 } 997 998 EncodedJSValue JIT_OPERATION operationCallEval(JSGlobalObject* globalObject, CallFrame* calleeFrame) 999 { 1000 VM& vm = globalObject->vm(); 1001 auto scope = DECLARE_THROW_SCOPE(vm); 1002 1003 calleeFrame->setCodeBlock(0); 1004 1005 if (!isHostFunction(calleeFrame->guaranteedJSValueCallee(), globalFuncEval)) 965 1006 return JSValue::encode(JSValue()); 966 1007 967 JSValue result = eval( execCallee);1008 JSValue result = eval(globalObject, calleeFrame); 968 1009 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 969 1010 … … 971 1012 } 972 1013 973 static SlowPathReturnType handleHostCall(ExecState* execCallee, JSValue callee, CallLinkInfo* callLinkInfo) 974 { 975 ExecState* exec = execCallee->callerFrame(); 976 VM& vm = exec->vm(); 977 auto scope = DECLARE_THROW_SCOPE(vm); 978 979 execCallee->setCodeBlock(0); 1014 static SlowPathReturnType handleHostCall(JSGlobalObject* globalObject, CallFrame* calleeFrame, JSValue callee, CallLinkInfo* callLinkInfo) 1015 { 1016 VM& vm = globalObject->vm(); 1017 auto scope = DECLARE_THROW_SCOPE(vm); 1018 1019 calleeFrame->setCodeBlock(0); 980 1020 981 1021 if (callLinkInfo->specializationKind() == CodeForCall) { … … 986 1026 987 1027 if (callType == CallType::Host) { 988 NativeCallFrameTracer tracer(vm, execCallee);989 execCallee->setCallee(asObject(callee));990 vm.hostCallReturnValue = JSValue::decode(callData.native.function(asObject(callee)->globalObject(vm), execCallee));1028 NativeCallFrameTracer tracer(vm, calleeFrame); 1029 calleeFrame->setCallee(asObject(callee)); 1030 vm.hostCallReturnValue = JSValue::decode(callData.native.function(asObject(callee)->globalObject(vm), calleeFrame)); 991 1031 if (UNLIKELY(scope.exception())) { 992 1032 return encodeResult( … … 1001 1041 1002 1042 ASSERT(callType == CallType::None); 1003 throwException( exec, scope, createNotAFunctionError(exec, callee));1043 throwException(globalObject, scope, createNotAFunctionError(globalObject, callee)); 1004 1044 return encodeResult( 1005 1045 vm.getCTIStub(throwExceptionFromCallSlowPathGenerator).retaggedCode<JSEntryPtrTag>().executableAddress(), … … 1015 1055 1016 1056 if (constructType == ConstructType::Host) { 1017 NativeCallFrameTracer tracer(vm, execCallee);1018 execCallee->setCallee(asObject(callee));1019 vm.hostCallReturnValue = JSValue::decode(constructData.native.function(asObject(callee)->globalObject(vm), execCallee));1057 NativeCallFrameTracer tracer(vm, calleeFrame); 1058 calleeFrame->setCallee(asObject(callee)); 1059 vm.hostCallReturnValue = JSValue::decode(constructData.native.function(asObject(callee)->globalObject(vm), calleeFrame)); 1020 1060 if (UNLIKELY(scope.exception())) { 1021 1061 return encodeResult( … … 1028 1068 1029 1069 ASSERT(constructType == ConstructType::None); 1030 throwException( exec, scope, createNotAConstructorError(exec, callee));1070 throwException(globalObject, scope, createNotAConstructorError(globalObject, callee)); 1031 1071 return encodeResult( 1032 1072 vm.getCTIStub(throwExceptionFromCallSlowPathGenerator).retaggedCode<JSEntryPtrTag>().executableAddress(), … … 1034 1074 } 1035 1075 1036 SlowPathReturnType JIT_OPERATION operationLinkCall( ExecState* execCallee, CallLinkInfo* callLinkInfo)1037 { 1038 ExecState* exec = execCallee->callerFrame();1039 VM& vm = exec->vm();1076 SlowPathReturnType JIT_OPERATION operationLinkCall(CallFrame* calleeFrame, JSGlobalObject* globalObject, CallLinkInfo* callLinkInfo) 1077 { 1078 CallFrame* callFrame = calleeFrame->callerFrame(); 1079 VM& vm = globalObject->vm(); 1040 1080 auto throwScope = DECLARE_THROW_SCOPE(vm); 1041 1081 1042 1082 CodeSpecializationKind kind = callLinkInfo->specializationKind(); 1043 NativeCallFrameTracer tracer(vm, exec);1083 NativeCallFrameTracer tracer(vm, callFrame); 1044 1084 1045 1085 RELEASE_ASSERT(!callLinkInfo->isDirect()); 1046 1086 1047 JSValue calleeAsValue = execCallee->guaranteedJSValueCallee();1087 JSValue calleeAsValue = calleeFrame->guaranteedJSValueCallee(); 1048 1088 JSCell* calleeAsFunctionCell = getJSFunction(calleeAsValue); 1049 1089 if (!calleeAsFunctionCell) { … … 1055 1095 callLinkInfo->setSeen(); 1056 1096 else 1057 linkFor( execCallee, *callLinkInfo, nullptr, internalFunction, codePtr);1097 linkFor(calleeFrame, *callLinkInfo, nullptr, internalFunction, codePtr); 1058 1098 1059 1099 void* linkedTarget = codePtr.executableAddress(); 1060 1100 return encodeResult(linkedTarget, reinterpret_cast<void*>(callLinkInfo->callMode() == CallMode::Tail ? ReuseTheFrame : KeepTheFrame)); 1061 1101 } 1062 RELEASE_AND_RETURN(throwScope, handleHostCall( execCallee, calleeAsValue, callLinkInfo));1102 RELEASE_AND_RETURN(throwScope, handleHostCall(globalObject, calleeFrame, calleeAsValue, callLinkInfo)); 1063 1103 } 1064 1104 … … 1082 1122 1083 1123 if (!isCall(kind) && functionExecutable->constructAbility() == ConstructAbility::CannotConstruct) { 1084 throwException( exec, throwScope, createNotAConstructorError(exec, callee));1124 throwException(globalObject, throwScope, createNotAConstructorError(globalObject, callee)); 1085 1125 return handleThrowException(); 1086 1126 } 1087 1127 1088 CodeBlock** codeBlockSlot = execCallee->addressOfCodeBlock();1128 CodeBlock** codeBlockSlot = calleeFrame->addressOfCodeBlock(); 1089 1129 Exception* error = functionExecutable->prepareForExecution<FunctionExecutable>(vm, callee, scope, kind, *codeBlockSlot); 1090 1130 EXCEPTION_ASSERT(throwScope.exception() == error); … … 1093 1133 codeBlock = *codeBlockSlot; 1094 1134 ArityCheckMode arity; 1095 if ( execCallee->argumentCountIncludingThis() < static_cast<size_t>(codeBlock->numParameters()) || callLinkInfo->isVarargs())1135 if (calleeFrame->argumentCountIncludingThis() < static_cast<size_t>(codeBlock->numParameters()) || callLinkInfo->isVarargs()) 1096 1136 arity = MustCheckArity; 1097 1137 else … … 1103 1143 callLinkInfo->setSeen(); 1104 1144 else 1105 linkFor( execCallee, *callLinkInfo, codeBlock, callee, codePtr);1145 linkFor(calleeFrame, *callLinkInfo, codeBlock, callee, codePtr); 1106 1146 1107 1147 return encodeResult(codePtr.executableAddress(), reinterpret_cast<void*>(callLinkInfo->callMode() == CallMode::Tail ? ReuseTheFrame : KeepTheFrame)); 1108 1148 } 1109 1149 1110 void JIT_OPERATION operationLinkDirectCall(ExecState* exec, CallLinkInfo* callLinkInfo, JSFunction* callee) 1111 { 1112 VM& vm = exec->vm(); 1150 inline SlowPathReturnType virtualForWithFunction(JSGlobalObject* globalObject, CallFrame* calleeFrame, CallLinkInfo* callLinkInfo, JSCell*& calleeAsFunctionCell) 1151 { 1152 CallFrame* callFrame = calleeFrame->callerFrame(); 1153 VM& vm = globalObject->vm(); 1113 1154 auto throwScope = DECLARE_THROW_SCOPE(vm); 1114 1155 1115 1156 CodeSpecializationKind kind = callLinkInfo->specializationKind(); 1116 NativeCallFrameTracer tracer(vm, exec); 1117 1118 RELEASE_ASSERT(callLinkInfo->isDirect()); 1119 1120 // This would happen if the executable died during GC but the CodeBlock did not die. That should 1121 // not happen because the CodeBlock should have a weak reference to any executable it uses for 1122 // this purpose. 1123 RELEASE_ASSERT(callLinkInfo->executable()); 1124 1125 // Having a CodeBlock indicates that this is linked. We shouldn't be taking this path if it's 1126 // linked. 1127 RELEASE_ASSERT(!callLinkInfo->codeBlock()); 1128 1129 // We just don't support this yet. 1130 RELEASE_ASSERT(!callLinkInfo->isVarargs()); 1131 1132 ExecutableBase* executable = callLinkInfo->executable(); 1133 RELEASE_ASSERT(callee->executable() == callLinkInfo->executable()); 1134 1135 JSScope* scope = callee->scopeUnchecked(); 1136 1137 MacroAssemblerCodePtr<JSEntryPtrTag> codePtr; 1138 CodeBlock* codeBlock = nullptr; 1139 if (executable->isHostFunction()) 1140 codePtr = executable->entrypointFor(kind, MustCheckArity); 1141 else { 1142 FunctionExecutable* functionExecutable = static_cast<FunctionExecutable*>(executable); 1143 1144 RELEASE_ASSERT(isCall(kind) || functionExecutable->constructAbility() != ConstructAbility::CannotConstruct); 1145 1146 Exception* error = functionExecutable->prepareForExecution<FunctionExecutable>(vm, callee, scope, kind, codeBlock); 1147 EXCEPTION_ASSERT_UNUSED(throwScope, throwScope.exception() == error); 1148 if (UNLIKELY(error)) 1149 return; 1150 unsigned argumentStackSlots = callLinkInfo->maxArgumentCountIncludingThis(); 1151 if (argumentStackSlots < static_cast<size_t>(codeBlock->numParameters())) 1152 codePtr = functionExecutable->entrypointFor(kind, MustCheckArity); 1153 else 1154 codePtr = functionExecutable->entrypointFor(kind, ArityCheckNotRequired); 1155 } 1156 1157 linkDirectFor(exec, *callLinkInfo, codeBlock, codePtr); 1158 } 1159 1160 inline SlowPathReturnType virtualForWithFunction( 1161 ExecState* execCallee, CallLinkInfo* callLinkInfo, JSCell*& calleeAsFunctionCell) 1162 { 1163 ExecState* exec = execCallee->callerFrame(); 1164 VM& vm = exec->vm(); 1165 auto throwScope = DECLARE_THROW_SCOPE(vm); 1166 1167 CodeSpecializationKind kind = callLinkInfo->specializationKind(); 1168 NativeCallFrameTracer tracer(vm, exec); 1169 1170 JSValue calleeAsValue = execCallee->guaranteedJSValueCallee(); 1157 NativeCallFrameTracer tracer(vm, callFrame); 1158 1159 JSValue calleeAsValue = calleeFrame->guaranteedJSValueCallee(); 1171 1160 calleeAsFunctionCell = getJSFunction(calleeAsValue); 1172 1161 if (UNLIKELY(!calleeAsFunctionCell)) { … … 1176 1165 return encodeResult(codePtr.executableAddress(), reinterpret_cast<void*>(callLinkInfo->callMode() == CallMode::Tail ? ReuseTheFrame : KeepTheFrame)); 1177 1166 } 1178 RELEASE_AND_RETURN(throwScope, handleHostCall( execCallee, calleeAsValue, callLinkInfo));1167 RELEASE_AND_RETURN(throwScope, handleHostCall(globalObject, calleeFrame, calleeAsValue, callLinkInfo)); 1179 1168 } 1180 1169 … … 1186 1175 1187 1176 if (!isCall(kind) && functionExecutable->constructAbility() == ConstructAbility::CannotConstruct) { 1188 throwException( exec, throwScope, createNotAConstructorError(exec, function));1177 throwException(globalObject, throwScope, createNotAConstructorError(globalObject, function)); 1189 1178 return encodeResult( 1190 1179 vm.getCTIStub(throwExceptionFromCallSlowPathGenerator).retaggedCode<JSEntryPtrTag>().executableAddress(), … … 1192 1181 } 1193 1182 1194 CodeBlock** codeBlockSlot = execCallee->addressOfCodeBlock();1183 CodeBlock** codeBlockSlot = calleeFrame->addressOfCodeBlock(); 1195 1184 Exception* error = functionExecutable->prepareForExecution<FunctionExecutable>(vm, function, scope, kind, *codeBlockSlot); 1196 1185 EXCEPTION_ASSERT(throwScope.exception() == error); … … 1206 1195 } 1207 1196 1208 SlowPathReturnType JIT_OPERATION operationLinkPolymorphicCall( ExecState* execCallee, CallLinkInfo* callLinkInfo)1197 SlowPathReturnType JIT_OPERATION operationLinkPolymorphicCall(CallFrame* calleeFrame, JSGlobalObject* globalObject, CallLinkInfo* callLinkInfo) 1209 1198 { 1210 1199 ASSERT(callLinkInfo->specializationKind() == CodeForCall); 1211 1200 JSCell* calleeAsFunctionCell; 1212 SlowPathReturnType result = virtualForWithFunction( execCallee, callLinkInfo, calleeAsFunctionCell);1213 1214 linkPolymorphicCall( execCallee, *callLinkInfo, CallVariant(calleeAsFunctionCell));1201 SlowPathReturnType result = virtualForWithFunction(globalObject, calleeFrame, callLinkInfo, calleeAsFunctionCell); 1202 1203 linkPolymorphicCall(globalObject, calleeFrame, *callLinkInfo, CallVariant(calleeAsFunctionCell)); 1215 1204 1216 1205 return result; 1217 1206 } 1218 1207 1219 SlowPathReturnType JIT_OPERATION operationVirtualCall( ExecState* execCallee, CallLinkInfo* callLinkInfo)1208 SlowPathReturnType JIT_OPERATION operationVirtualCall(CallFrame* calleeFrame, JSGlobalObject* globalObject, CallLinkInfo* callLinkInfo) 1220 1209 { 1221 1210 JSCell* calleeAsFunctionCellIgnored; 1222 return virtualForWithFunction(execCallee, callLinkInfo, calleeAsFunctionCellIgnored); 1223 } 1224 1225 size_t JIT_OPERATION operationCompareLess(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 1226 { 1227 VM& vm = exec->vm(); 1228 NativeCallFrameTracer tracer(vm, exec); 1229 1230 return jsLess<true>(exec, JSValue::decode(encodedOp1), JSValue::decode(encodedOp2)); 1231 } 1232 1233 size_t JIT_OPERATION operationCompareLessEq(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 1234 { 1235 VM& vm = exec->vm(); 1236 NativeCallFrameTracer tracer(vm, exec); 1237 1238 return jsLessEq<true>(exec, JSValue::decode(encodedOp1), JSValue::decode(encodedOp2)); 1239 } 1240 1241 size_t JIT_OPERATION operationCompareGreater(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 1242 { 1243 VM& vm = exec->vm(); 1244 NativeCallFrameTracer tracer(vm, exec); 1245 1246 return jsLess<false>(exec, JSValue::decode(encodedOp2), JSValue::decode(encodedOp1)); 1247 } 1248 1249 size_t JIT_OPERATION operationCompareGreaterEq(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 1250 { 1251 VM& vm = exec->vm(); 1252 NativeCallFrameTracer tracer(vm, exec); 1253 1254 return jsLessEq<false>(exec, JSValue::decode(encodedOp2), JSValue::decode(encodedOp1)); 1255 } 1256 1257 size_t JIT_OPERATION operationCompareEq(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 1258 { 1259 VM& vm = exec->vm(); 1260 NativeCallFrameTracer tracer(vm, exec); 1261 1262 return JSValue::equalSlowCaseInline(exec, JSValue::decode(encodedOp1), JSValue::decode(encodedOp2)); 1211 return virtualForWithFunction(globalObject, calleeFrame, callLinkInfo, calleeAsFunctionCellIgnored); 1212 } 1213 1214 size_t JIT_OPERATION operationCompareLess(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 1215 { 1216 VM& vm = globalObject->vm(); 1217 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1218 NativeCallFrameTracer tracer(vm, callFrame); 1219 1220 return jsLess<true>(globalObject, JSValue::decode(encodedOp1), JSValue::decode(encodedOp2)); 1221 } 1222 1223 size_t JIT_OPERATION operationCompareLessEq(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 1224 { 1225 VM& vm = globalObject->vm(); 1226 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1227 NativeCallFrameTracer tracer(vm, callFrame); 1228 1229 return jsLessEq<true>(globalObject, JSValue::decode(encodedOp1), JSValue::decode(encodedOp2)); 1230 } 1231 1232 size_t JIT_OPERATION operationCompareGreater(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 1233 { 1234 VM& vm = globalObject->vm(); 1235 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1236 NativeCallFrameTracer tracer(vm, callFrame); 1237 1238 return jsLess<false>(globalObject, JSValue::decode(encodedOp2), JSValue::decode(encodedOp1)); 1239 } 1240 1241 size_t JIT_OPERATION operationCompareGreaterEq(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 1242 { 1243 VM& vm = globalObject->vm(); 1244 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1245 NativeCallFrameTracer tracer(vm, callFrame); 1246 1247 return jsLessEq<false>(globalObject, JSValue::decode(encodedOp2), JSValue::decode(encodedOp1)); 1248 } 1249 1250 size_t JIT_OPERATION operationCompareEq(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 1251 { 1252 VM& vm = globalObject->vm(); 1253 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1254 NativeCallFrameTracer tracer(vm, callFrame); 1255 1256 return JSValue::equalSlowCaseInline(globalObject, JSValue::decode(encodedOp1), JSValue::decode(encodedOp2)); 1263 1257 } 1264 1258 1265 1259 #if USE(JSVALUE64) 1266 EncodedJSValue JIT_OPERATION operationCompareStringEq( ExecState* exec, JSCell* left, JSCell* right)1260 EncodedJSValue JIT_OPERATION operationCompareStringEq(JSGlobalObject* globalObject, JSCell* left, JSCell* right) 1267 1261 #else 1268 size_t JIT_OPERATION operationCompareStringEq( ExecState* exec, JSCell* left, JSCell* right)1262 size_t JIT_OPERATION operationCompareStringEq(JSGlobalObject* globalObject, JSCell* left, JSCell* right) 1269 1263 #endif 1270 1264 { 1271 VM& vm = exec->vm(); 1272 NativeCallFrameTracer tracer(vm, exec); 1273 1274 bool result = asString(left)->equal(exec, asString(right)); 1265 VM& vm = globalObject->vm(); 1266 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1267 NativeCallFrameTracer tracer(vm, callFrame); 1268 1269 bool result = asString(left)->equal(globalObject, asString(right)); 1275 1270 #if USE(JSVALUE64) 1276 1271 return JSValue::encode(jsBoolean(result)); … … 1280 1275 } 1281 1276 1282 size_t JIT_OPERATION operationCompareStrictEq(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 1283 { 1284 VM& vm = exec->vm(); 1285 NativeCallFrameTracer tracer(vm, exec); 1277 size_t JIT_OPERATION operationCompareStrictEq(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 1278 { 1279 VM& vm = globalObject->vm(); 1280 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1281 NativeCallFrameTracer tracer(vm, callFrame); 1286 1282 1287 1283 JSValue src1 = JSValue::decode(encodedOp1); 1288 1284 JSValue src2 = JSValue::decode(encodedOp2); 1289 1285 1290 return JSValue::strictEqual(exec, src1, src2); 1291 } 1292 1293 EncodedJSValue JIT_OPERATION operationNewArrayWithProfile(ExecState* exec, ArrayAllocationProfile* profile, const JSValue* values, int size) 1294 { 1295 VM& vm = exec->vm(); 1296 NativeCallFrameTracer tracer(vm, exec); 1297 return JSValue::encode(constructArrayNegativeIndexed(exec, profile, values, size)); 1298 } 1299 1300 EncodedJSValue JIT_OPERATION operationNewArrayWithSizeAndProfile(ExecState* exec, ArrayAllocationProfile* profile, EncodedJSValue size) 1301 { 1302 VM& vm = exec->vm(); 1303 NativeCallFrameTracer tracer(vm, exec); 1286 return JSValue::strictEqual(globalObject, src1, src2); 1287 } 1288 1289 EncodedJSValue JIT_OPERATION operationNewArrayWithProfile(JSGlobalObject* globalObject, ArrayAllocationProfile* profile, const JSValue* values, int size) 1290 { 1291 VM& vm = globalObject->vm(); 1292 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1293 NativeCallFrameTracer tracer(vm, callFrame); 1294 return JSValue::encode(constructArrayNegativeIndexed(globalObject, profile, values, size)); 1295 } 1296 1297 EncodedJSValue JIT_OPERATION operationNewArrayWithSizeAndProfile(JSGlobalObject* globalObject, ArrayAllocationProfile* profile, EncodedJSValue size) 1298 { 1299 VM& vm = globalObject->vm(); 1300 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1301 NativeCallFrameTracer tracer(vm, callFrame); 1304 1302 JSValue sizeValue = JSValue::decode(size); 1305 return JSValue::encode(constructArrayWithSizeQuirk( exec, profile, exec->lexicalGlobalObject(), sizeValue));1303 return JSValue::encode(constructArrayWithSizeQuirk(globalObject, profile, sizeValue)); 1306 1304 } 1307 1305 … … 1309 1307 1310 1308 template<typename FunctionType> 1311 static EncodedJSValue operationNewFunctionCommon(ExecState* exec, JSScope* scope, JSCell* functionExecutable, bool isInvalidated) 1312 { 1313 VM& vm = exec->vm(); 1309 static EncodedJSValue newFunctionCommon(VM& vm, JSScope* scope, JSCell* functionExecutable, bool isInvalidated) 1310 { 1314 1311 ASSERT(functionExecutable->inherits<FunctionExecutable>(vm)); 1315 NativeCallFrameTracer tracer(vm, exec);1316 1312 if (isInvalidated) 1317 1313 return JSValue::encode(FunctionType::createWithInvalidatedReallocationWatchpoint(vm, static_cast<FunctionExecutable*>(functionExecutable), scope)); … … 1321 1317 extern "C" { 1322 1318 1323 EncodedJSValue JIT_OPERATION operationNewFunction(ExecState* exec, JSScope* scope, JSCell* functionExecutable) 1324 { 1325 return operationNewFunctionCommon<JSFunction>(exec, scope, functionExecutable, false); 1326 } 1327 1328 EncodedJSValue JIT_OPERATION operationNewFunctionWithInvalidatedReallocationWatchpoint(ExecState* exec, JSScope* scope, JSCell* functionExecutable) 1329 { 1330 return operationNewFunctionCommon<JSFunction>(exec, scope, functionExecutable, true); 1331 } 1332 1333 EncodedJSValue JIT_OPERATION operationNewGeneratorFunction(ExecState* exec, JSScope* scope, JSCell* functionExecutable) 1334 { 1335 return operationNewFunctionCommon<JSGeneratorFunction>(exec, scope, functionExecutable, false); 1336 } 1337 1338 EncodedJSValue JIT_OPERATION operationNewGeneratorFunctionWithInvalidatedReallocationWatchpoint(ExecState* exec, JSScope* scope, JSCell* functionExecutable) 1339 { 1340 return operationNewFunctionCommon<JSGeneratorFunction>(exec, scope, functionExecutable, true); 1341 } 1342 1343 EncodedJSValue JIT_OPERATION operationNewAsyncFunction(ExecState* exec, JSScope* scope, JSCell* functionExecutable) 1344 { 1345 return operationNewFunctionCommon<JSAsyncFunction>(exec, scope, functionExecutable, false); 1346 } 1347 1348 EncodedJSValue JIT_OPERATION operationNewAsyncFunctionWithInvalidatedReallocationWatchpoint(ExecState* exec, JSScope* scope, JSCell* functionExecutable) 1349 { 1350 return operationNewFunctionCommon<JSAsyncFunction>(exec, scope, functionExecutable, true); 1351 } 1352 1353 EncodedJSValue JIT_OPERATION operationNewAsyncGeneratorFunction(ExecState* exec, JSScope* scope, JSCell* functionExecutable) 1354 { 1355 return operationNewFunctionCommon<JSAsyncGeneratorFunction>(exec, scope, functionExecutable, false); 1356 } 1357 1358 EncodedJSValue JIT_OPERATION operationNewAsyncGeneratorFunctionWithInvalidatedReallocationWatchpoint(ExecState* exec, JSScope* scope, JSCell* functionExecutable) 1359 { 1360 return operationNewFunctionCommon<JSAsyncGeneratorFunction>(exec, scope, functionExecutable, true); 1361 } 1362 1363 void JIT_OPERATION operationSetFunctionName(ExecState* exec, JSCell* funcCell, EncodedJSValue encodedName) 1364 { 1365 VM& vm = exec->vm(); 1366 NativeCallFrameTracer tracer(vm, exec); 1319 EncodedJSValue JIT_OPERATION operationNewFunction(VM* vmPointer, JSScope* scope, JSCell* functionExecutable) 1320 { 1321 VM& vm = *vmPointer; 1322 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1323 NativeCallFrameTracer tracer(vm, callFrame); 1324 return newFunctionCommon<JSFunction>(vm, scope, functionExecutable, false); 1325 } 1326 1327 EncodedJSValue JIT_OPERATION operationNewFunctionWithInvalidatedReallocationWatchpoint(VM* vmPointer, JSScope* scope, JSCell* functionExecutable) 1328 { 1329 VM& vm = *vmPointer; 1330 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1331 NativeCallFrameTracer tracer(vm, callFrame); 1332 return newFunctionCommon<JSFunction>(vm, scope, functionExecutable, true); 1333 } 1334 1335 EncodedJSValue JIT_OPERATION operationNewGeneratorFunction(VM* vmPointer, JSScope* scope, JSCell* functionExecutable) 1336 { 1337 VM& vm = *vmPointer; 1338 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1339 NativeCallFrameTracer tracer(vm, callFrame); 1340 return newFunctionCommon<JSGeneratorFunction>(vm, scope, functionExecutable, false); 1341 } 1342 1343 EncodedJSValue JIT_OPERATION operationNewGeneratorFunctionWithInvalidatedReallocationWatchpoint(VM* vmPointer, JSScope* scope, JSCell* functionExecutable) 1344 { 1345 VM& vm = *vmPointer; 1346 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1347 NativeCallFrameTracer tracer(vm, callFrame); 1348 return newFunctionCommon<JSGeneratorFunction>(vm, scope, functionExecutable, true); 1349 } 1350 1351 EncodedJSValue JIT_OPERATION operationNewAsyncFunction(VM* vmPointer, JSScope* scope, JSCell* functionExecutable) 1352 { 1353 VM& vm = *vmPointer; 1354 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1355 NativeCallFrameTracer tracer(vm, callFrame); 1356 return newFunctionCommon<JSAsyncFunction>(vm, scope, functionExecutable, false); 1357 } 1358 1359 EncodedJSValue JIT_OPERATION operationNewAsyncFunctionWithInvalidatedReallocationWatchpoint(VM* vmPointer, JSScope* scope, JSCell* functionExecutable) 1360 { 1361 VM& vm = *vmPointer; 1362 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1363 NativeCallFrameTracer tracer(vm, callFrame); 1364 return newFunctionCommon<JSAsyncFunction>(vm, scope, functionExecutable, true); 1365 } 1366 1367 EncodedJSValue JIT_OPERATION operationNewAsyncGeneratorFunction(VM* vmPointer, JSScope* scope, JSCell* functionExecutable) 1368 { 1369 VM& vm = *vmPointer; 1370 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1371 NativeCallFrameTracer tracer(vm, callFrame); 1372 return newFunctionCommon<JSAsyncGeneratorFunction>(vm, scope, functionExecutable, false); 1373 } 1374 1375 EncodedJSValue JIT_OPERATION operationNewAsyncGeneratorFunctionWithInvalidatedReallocationWatchpoint(VM* vmPointer, JSScope* scope, JSCell* functionExecutable) 1376 { 1377 VM& vm = *vmPointer; 1378 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1379 NativeCallFrameTracer tracer(vm, callFrame); 1380 return newFunctionCommon<JSAsyncGeneratorFunction>(vm, scope, functionExecutable, true); 1381 } 1382 1383 void JIT_OPERATION operationSetFunctionName(JSGlobalObject* globalObject, JSCell* funcCell, EncodedJSValue encodedName) 1384 { 1385 VM& vm = globalObject->vm(); 1386 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1387 NativeCallFrameTracer tracer(vm, callFrame); 1367 1388 1368 1389 JSFunction* func = jsCast<JSFunction*>(funcCell); 1369 1390 JSValue name = JSValue::decode(encodedName); 1370 func->setFunctionName(exec, name); 1371 } 1372 1373 JSCell* JIT_OPERATION operationNewObject(ExecState* exec, Structure* structure) 1374 { 1375 VM& vm = exec->vm(); 1376 NativeCallFrameTracer tracer(vm, exec); 1377 1378 return constructEmptyObject(exec, structure); 1379 } 1380 1381 JSCell* JIT_OPERATION operationNewPromise(ExecState* exec, Structure* structure) 1382 { 1383 VM& vm = exec->vm(); 1384 NativeCallFrameTracer tracer(vm, exec); 1391 func->setFunctionName(globalObject, name); 1392 } 1393 1394 JSCell* JIT_OPERATION operationNewObject(VM* vmPointer, Structure* structure) 1395 { 1396 VM& vm = *vmPointer; 1397 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1398 NativeCallFrameTracer tracer(vm, callFrame); 1399 1400 return constructEmptyObject(vm, structure); 1401 } 1402 1403 JSCell* JIT_OPERATION operationNewPromise(VM* vmPointer, Structure* structure) 1404 { 1405 VM& vm = *vmPointer; 1406 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1407 NativeCallFrameTracer tracer(vm, callFrame); 1385 1408 1386 1409 return JSPromise::create(vm, structure); 1387 1410 } 1388 1411 1389 JSCell* JIT_OPERATION operationNewInternalPromise(ExecState* exec, Structure* structure) 1390 { 1391 VM& vm = exec->vm(); 1392 NativeCallFrameTracer tracer(vm, exec); 1412 JSCell* JIT_OPERATION operationNewInternalPromise(VM* vmPointer, Structure* structure) 1413 { 1414 VM& vm = *vmPointer; 1415 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1416 NativeCallFrameTracer tracer(vm, callFrame); 1393 1417 1394 1418 return JSInternalPromise::create(vm, structure); 1395 1419 } 1396 1420 1397 JSCell* JIT_OPERATION operationNewGenerator(ExecState* exec, Structure* structure) 1398 { 1399 VM& vm = exec->vm(); 1400 NativeCallFrameTracer tracer(vm, exec); 1421 JSCell* JIT_OPERATION operationNewGenerator(VM* vmPointer, Structure* structure) 1422 { 1423 VM& vm = *vmPointer; 1424 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1425 NativeCallFrameTracer tracer(vm, callFrame); 1401 1426 1402 1427 return JSGenerator::create(vm, structure); 1403 1428 } 1404 1429 1405 JSCell* JIT_OPERATION operationNewAsyncGenerator(ExecState* exec, Structure* structure) 1406 { 1407 VM& vm = exec->vm(); 1408 NativeCallFrameTracer tracer(vm, exec); 1430 JSCell* JIT_OPERATION operationNewAsyncGenerator(VM* vmPointer, Structure* structure) 1431 { 1432 VM& vm = *vmPointer; 1433 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1434 NativeCallFrameTracer tracer(vm, callFrame); 1409 1435 1410 1436 return JSAsyncGenerator::create(vm, structure); 1411 1437 } 1412 1438 1413 JSCell* JIT_OPERATION operationNewRegexp( ExecState* exec, JSCell* regexpPtr)1439 JSCell* JIT_OPERATION operationNewRegexp(JSGlobalObject* globalObject, JSCell* regexpPtr) 1414 1440 { 1415 1441 SuperSamplerScope superSamplerScope(false); 1416 VM& vm = exec->vm(); 1417 NativeCallFrameTracer tracer(vm, exec); 1442 VM& vm = globalObject->vm(); 1443 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1444 NativeCallFrameTracer tracer(vm, callFrame); 1418 1445 1419 1446 RegExp* regexp = static_cast<RegExp*>(regexpPtr); 1420 1447 ASSERT(regexp->isValid()); 1421 return RegExpObject::create(vm, exec->lexicalGlobalObject()->regExpStructure(), regexp);1448 return RegExpObject::create(vm, globalObject->regExpStructure(), regexp); 1422 1449 } 1423 1450 … … 1426 1453 // in the DFG. If a DFG slow path generator that supports a void return type is added in the 1427 1454 // future, we can switch to using that then. 1428 UnusedPtr JIT_OPERATION operationHandleTraps(ExecState* exec) 1429 { 1430 VM& vm = exec->vm(); 1431 NativeCallFrameTracer tracer(vm, exec); 1455 UnusedPtr JIT_OPERATION operationHandleTraps(JSGlobalObject* globalObject) 1456 { 1457 VM& vm = globalObject->vm(); 1458 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1459 NativeCallFrameTracer tracer(vm, callFrame); 1432 1460 ASSERT(vm.needTrapHandling()); 1433 vm.handleTraps( exec);1461 vm.handleTraps(globalObject, callFrame); 1434 1462 return nullptr; 1435 1463 } 1436 1464 1437 void JIT_OPERATION operationDebug(ExecState* exec, int32_t debugHookType) 1438 { 1439 VM& vm = exec->vm(); 1440 NativeCallFrameTracer tracer(vm, exec); 1441 1442 vm.interpreter->debug(exec, static_cast<DebugHookType>(debugHookType)); 1465 void JIT_OPERATION operationDebug(VM* vmPointer, int32_t debugHookType) 1466 { 1467 VM& vm = *vmPointer; 1468 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1469 NativeCallFrameTracer tracer(vm, callFrame); 1470 1471 vm.interpreter->debug(callFrame, static_cast<DebugHookType>(debugHookType)); 1443 1472 } 1444 1473 … … 1450 1479 } 1451 1480 1452 SlowPathReturnType JIT_OPERATION operationOptimize(ExecState* exec, uint32_t bytecodeIndex) 1453 { 1454 VM& vm = exec->vm(); 1455 NativeCallFrameTracer tracer(vm, exec); 1481 SlowPathReturnType JIT_OPERATION operationOptimize(VM* vmPointer, uint32_t bytecodeIndex) 1482 { 1483 VM& vm = *vmPointer; 1484 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1485 NativeCallFrameTracer tracer(vm, callFrame); 1456 1486 1457 1487 // Defer GC for a while so that it doesn't run between when we enter into this … … 1471 1501 DeferGCForAWhile deferGC(vm.heap); 1472 1502 1473 CodeBlock* codeBlock = exec->codeBlock();1503 CodeBlock* codeBlock = callFrame->codeBlock(); 1474 1504 if (UNLIKELY(codeBlock->jitType() != JITType::BaselineJIT)) { 1475 1505 dataLog("Unexpected code block in Baseline->DFG tier-up: ", *codeBlock, "\n"); … … 1626 1656 if (operandIsLocal(operand) && VirtualRegister(operand).toLocal() < localsUsedForCalleeSaves) 1627 1657 continue; 1628 mustHandleValues[i] = exec->uncheckedR(operand).jsValue();1658 mustHandleValues[i] = callFrame->uncheckedR(operand).jsValue(); 1629 1659 } 1630 1660 … … 1643 1673 ASSERT(optimizedCodeBlock && JITCode::isOptimizingJIT(optimizedCodeBlock->jitType())); 1644 1674 1645 if (void* dataBuffer = DFG::prepareOSREntry( exec, optimizedCodeBlock, bytecodeIndex)) {1675 if (void* dataBuffer = DFG::prepareOSREntry(vm, callFrame, optimizedCodeBlock, bytecodeIndex)) { 1646 1676 CODEBLOCK_LOG_EVENT(optimizedCodeBlock, "osrEntry", ("at bc#", bytecodeIndex)); 1647 1677 if (UNLIKELY(Options::verboseOSR())) { … … 1653 1683 codeBlock->unlinkedCodeBlock()->setDidOptimize(TrueTriState); 1654 1684 void* targetPC = vm.getCTIStub(DFG::osrEntryThunkGenerator).code().executableAddress(); 1655 targetPC = retagCodePtr(targetPC, JITThunkPtrTag, bitwise_cast<PtrTag>( exec));1685 targetPC = retagCodePtr(targetPC, JITThunkPtrTag, bitwise_cast<PtrTag>(callFrame)); 1656 1686 return encodeResult(targetPC, dataBuffer); 1657 1687 } … … 1695 1725 } 1696 1726 1697 char* JIT_OPERATION operationTryOSREnterAtCatch(ExecState* exec, uint32_t bytecodeIndex) 1698 { 1699 VM& vm = exec->vm(); 1700 NativeCallFrameTracer tracer(vm, exec); 1701 1702 CodeBlock* optimizedReplacement = exec->codeBlock()->replacement(); 1727 char* JIT_OPERATION operationTryOSREnterAtCatch(VM* vmPointer, uint32_t bytecodeIndex) 1728 { 1729 VM& vm = *vmPointer; 1730 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1731 NativeCallFrameTracer tracer(vm, callFrame); 1732 1733 CodeBlock* optimizedReplacement = callFrame->codeBlock()->replacement(); 1703 1734 if (UNLIKELY(!optimizedReplacement)) 1704 1735 return nullptr; … … 1707 1738 case JITType::DFGJIT: 1708 1739 case JITType::FTLJIT: { 1709 MacroAssemblerCodePtr<ExceptionHandlerPtrTag> entry = DFG::prepareCatchOSREntry( exec, optimizedReplacement, bytecodeIndex);1740 MacroAssemblerCodePtr<ExceptionHandlerPtrTag> entry = DFG::prepareCatchOSREntry(vm, callFrame, optimizedReplacement, bytecodeIndex); 1710 1741 return entry.executableAddress<char*>(); 1711 1742 } … … 1716 1747 } 1717 1748 1718 char* JIT_OPERATION operationTryOSREnterAtCatchAndValueProfile(ExecState* exec, uint32_t bytecodeIndex) 1719 { 1720 VM& vm = exec->vm(); 1721 NativeCallFrameTracer tracer(vm, exec); 1722 1723 CodeBlock* codeBlock = exec->codeBlock(); 1749 char* JIT_OPERATION operationTryOSREnterAtCatchAndValueProfile(VM* vmPointer, uint32_t bytecodeIndex) 1750 { 1751 VM& vm = *vmPointer; 1752 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1753 NativeCallFrameTracer tracer(vm, callFrame); 1754 1755 CodeBlock* codeBlock = callFrame->codeBlock(); 1724 1756 CodeBlock* optimizedReplacement = codeBlock->replacement(); 1725 1757 if (UNLIKELY(!optimizedReplacement)) … … 1729 1761 case JITType::DFGJIT: 1730 1762 case JITType::FTLJIT: { 1731 MacroAssemblerCodePtr<ExceptionHandlerPtrTag> entry = DFG::prepareCatchOSREntry( exec, optimizedReplacement, bytecodeIndex);1763 MacroAssemblerCodePtr<ExceptionHandlerPtrTag> entry = DFG::prepareCatchOSREntry(vm, callFrame, optimizedReplacement, bytecodeIndex); 1732 1764 return entry.executableAddress<char*>(); 1733 1765 } … … 1740 1772 auto& metadata = bytecode.metadata(codeBlock); 1741 1773 metadata.m_buffer->forEach([&] (ValueProfileAndOperand& profile) { 1742 profile.m_buckets[0] = JSValue::encode( exec->uncheckedR(profile.m_operand).jsValue());1774 profile.m_buckets[0] = JSValue::encode(callFrame->uncheckedR(profile.m_operand).jsValue()); 1743 1775 }); 1744 1776 … … 1748 1780 #endif 1749 1781 1750 void JIT_OPERATION operationPutByIndex(ExecState* exec, EncodedJSValue encodedArrayValue, int32_t index, EncodedJSValue encodedValue) 1751 { 1752 VM& vm = exec->vm(); 1753 NativeCallFrameTracer tracer(vm, exec); 1782 void JIT_OPERATION operationPutByIndex(JSGlobalObject* globalObject, EncodedJSValue encodedArrayValue, int32_t index, EncodedJSValue encodedValue) 1783 { 1784 VM& vm = globalObject->vm(); 1785 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1786 NativeCallFrameTracer tracer(vm, callFrame); 1754 1787 1755 1788 JSValue arrayValue = JSValue::decode(encodedArrayValue); 1756 1789 ASSERT(isJSArray(arrayValue)); 1757 asArray(arrayValue)->putDirectIndex( exec, index, JSValue::decode(encodedValue));1790 asArray(arrayValue)->putDirectIndex(globalObject, index, JSValue::decode(encodedValue)); 1758 1791 } 1759 1792 … … 1763 1796 }; 1764 1797 1765 static void putAccessorByVal( ExecState* exec, JSObject* base, JSValue subscript, int32_t attribute, JSObject* accessor, AccessorType accessorType)1766 { 1767 VM& vm = exec->vm();1768 auto scope = DECLARE_THROW_SCOPE(vm); 1769 auto propertyKey = subscript.toPropertyKey( exec);1798 static void putAccessorByVal(JSGlobalObject* globalObject, JSObject* base, JSValue subscript, int32_t attribute, JSObject* accessor, AccessorType accessorType) 1799 { 1800 VM& vm = globalObject->vm(); 1801 auto scope = DECLARE_THROW_SCOPE(vm); 1802 auto propertyKey = subscript.toPropertyKey(globalObject); 1770 1803 RETURN_IF_EXCEPTION(scope, void()); 1771 1804 1772 1805 scope.release(); 1773 1806 if (accessorType == AccessorType::Getter) 1774 base->putGetter( exec, propertyKey, accessor, attribute);1807 base->putGetter(globalObject, propertyKey, accessor, attribute); 1775 1808 else 1776 base->putSetter(exec, propertyKey, accessor, attribute); 1777 } 1778 1779 void JIT_OPERATION operationPutGetterById(ExecState* exec, JSCell* object, UniquedStringImpl* uid, int32_t options, JSCell* getter) 1780 { 1781 VM& vm = exec->vm(); 1782 NativeCallFrameTracer tracer(vm, exec); 1809 base->putSetter(globalObject, propertyKey, accessor, attribute); 1810 } 1811 1812 void JIT_OPERATION operationPutGetterById(JSGlobalObject* globalObject, JSCell* object, UniquedStringImpl* uid, int32_t options, JSCell* getter) 1813 { 1814 VM& vm = globalObject->vm(); 1815 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1816 NativeCallFrameTracer tracer(vm, callFrame); 1783 1817 1784 1818 ASSERT(object && object->isObject()); … … 1786 1820 1787 1821 ASSERT(getter->isObject()); 1788 baseObj->putGetter(exec, uid, getter, options); 1789 } 1790 1791 void JIT_OPERATION operationPutSetterById(ExecState* exec, JSCell* object, UniquedStringImpl* uid, int32_t options, JSCell* setter) 1792 { 1793 VM& vm = exec->vm(); 1794 NativeCallFrameTracer tracer(vm, exec); 1822 baseObj->putGetter(globalObject, uid, getter, options); 1823 } 1824 1825 void JIT_OPERATION operationPutSetterById(JSGlobalObject* globalObject, JSCell* object, UniquedStringImpl* uid, int32_t options, JSCell* setter) 1826 { 1827 VM& vm = globalObject->vm(); 1828 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1829 NativeCallFrameTracer tracer(vm, callFrame); 1795 1830 1796 1831 ASSERT(object && object->isObject()); … … 1798 1833 1799 1834 ASSERT(setter->isObject()); 1800 baseObj->putSetter(exec, uid, setter, options); 1801 } 1802 1803 void JIT_OPERATION operationPutGetterByVal(ExecState* exec, JSCell* base, EncodedJSValue encodedSubscript, int32_t attribute, JSCell* getter) 1804 { 1805 VM& vm = exec->vm(); 1806 NativeCallFrameTracer tracer(vm, exec); 1807 1808 putAccessorByVal(exec, asObject(base), JSValue::decode(encodedSubscript), attribute, asObject(getter), AccessorType::Getter); 1809 } 1810 1811 void JIT_OPERATION operationPutSetterByVal(ExecState* exec, JSCell* base, EncodedJSValue encodedSubscript, int32_t attribute, JSCell* setter) 1812 { 1813 VM& vm = exec->vm(); 1814 NativeCallFrameTracer tracer(vm, exec); 1815 1816 putAccessorByVal(exec, asObject(base), JSValue::decode(encodedSubscript), attribute, asObject(setter), AccessorType::Setter); 1835 baseObj->putSetter(globalObject, uid, setter, options); 1836 } 1837 1838 void JIT_OPERATION operationPutGetterByVal(JSGlobalObject* globalObject, JSCell* base, EncodedJSValue encodedSubscript, int32_t attribute, JSCell* getter) 1839 { 1840 VM& vm = globalObject->vm(); 1841 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1842 NativeCallFrameTracer tracer(vm, callFrame); 1843 1844 putAccessorByVal(globalObject, asObject(base), JSValue::decode(encodedSubscript), attribute, asObject(getter), AccessorType::Getter); 1845 } 1846 1847 void JIT_OPERATION operationPutSetterByVal(JSGlobalObject* globalObject, JSCell* base, EncodedJSValue encodedSubscript, int32_t attribute, JSCell* setter) 1848 { 1849 VM& vm = globalObject->vm(); 1850 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1851 NativeCallFrameTracer tracer(vm, callFrame); 1852 1853 putAccessorByVal(globalObject, asObject(base), JSValue::decode(encodedSubscript), attribute, asObject(setter), AccessorType::Setter); 1817 1854 } 1818 1855 1819 1856 #if USE(JSVALUE64) 1820 void JIT_OPERATION operationPutGetterSetter(ExecState* exec, JSCell* object, UniquedStringImpl* uid, int32_t attribute, EncodedJSValue encodedGetterValue, EncodedJSValue encodedSetterValue) 1821 { 1822 VM& vm = exec->vm(); 1823 NativeCallFrameTracer tracer(vm, exec); 1857 void JIT_OPERATION operationPutGetterSetter(JSGlobalObject* globalObject, JSCell* object, UniquedStringImpl* uid, int32_t attribute, EncodedJSValue encodedGetterValue, EncodedJSValue encodedSetterValue) 1858 { 1859 VM& vm = globalObject->vm(); 1860 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1861 NativeCallFrameTracer tracer(vm, callFrame); 1824 1862 1825 1863 ASSERT(object && object->isObject()); … … 1829 1867 JSValue setter = JSValue::decode(encodedSetterValue); 1830 1868 ASSERT(getter.isObject() || setter.isObject()); 1831 GetterSetter* accessor = GetterSetter::create(vm, exec->lexicalGlobalObject(), getter, setter);1832 CommonSlowPaths::putDirectAccessorWithReify(vm, exec, baseObject, uid, accessor, attribute);1869 GetterSetter* accessor = GetterSetter::create(vm, globalObject, getter, setter); 1870 CommonSlowPaths::putDirectAccessorWithReify(vm, globalObject, baseObject, uid, accessor, attribute); 1833 1871 } 1834 1872 1835 1873 #else 1836 void JIT_OPERATION operationPutGetterSetter(ExecState* exec, JSCell* object, UniquedStringImpl* uid, int32_t attribute, JSCell* getterCell, JSCell* setterCell) 1837 { 1838 VM& vm = exec->vm(); 1839 NativeCallFrameTracer tracer(vm, exec); 1874 void JIT_OPERATION operationPutGetterSetter(JSGlobalObject* globalObject, JSCell* object, UniquedStringImpl* uid, int32_t attribute, JSCell* getterCell, JSCell* setterCell) 1875 { 1876 VM& vm = globalObject->vm(); 1877 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1878 NativeCallFrameTracer tracer(vm, callFrame); 1840 1879 1841 1880 ASSERT(object && object->isObject()); … … 1845 1884 JSObject* getter = getterCell ? getterCell->getObject() : nullptr; 1846 1885 JSObject* setter = setterCell ? setterCell->getObject() : nullptr; 1847 GetterSetter* accessor = GetterSetter::create(vm, exec->lexicalGlobalObject(), getter, setter);1848 CommonSlowPaths::putDirectAccessorWithReify(vm, exec, baseObject, uid, accessor, attribute);1886 GetterSetter* accessor = GetterSetter::create(vm, globalObject, getter, setter); 1887 CommonSlowPaths::putDirectAccessorWithReify(vm, globalObject, baseObject, uid, accessor, attribute); 1849 1888 } 1850 1889 #endif 1851 1890 1852 void JIT_OPERATION operationPopScope(ExecState* exec, int32_t scopeReg) 1853 { 1854 VM& vm = exec->vm(); 1855 NativeCallFrameTracer tracer(vm, exec); 1856 1857 JSScope* scope = exec->uncheckedR(scopeReg).Register::scope(); 1858 exec->uncheckedR(scopeReg) = scope->next(); 1859 } 1860 1861 int32_t JIT_OPERATION operationInstanceOfCustom(ExecState* exec, EncodedJSValue encodedValue, JSObject* constructor, EncodedJSValue encodedHasInstance) 1862 { 1863 VM& vm = exec->vm(); 1864 NativeCallFrameTracer tracer(vm, exec); 1891 void JIT_OPERATION operationPopScope(JSGlobalObject* globalObject, int32_t scopeReg) 1892 { 1893 VM& vm = globalObject->vm(); 1894 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1895 NativeCallFrameTracer tracer(vm, callFrame); 1896 1897 JSScope* scope = callFrame->uncheckedR(scopeReg).Register::scope(); 1898 callFrame->uncheckedR(scopeReg) = scope->next(); 1899 } 1900 1901 int32_t JIT_OPERATION operationInstanceOfCustom(JSGlobalObject* globalObject, EncodedJSValue encodedValue, JSObject* constructor, EncodedJSValue encodedHasInstance) 1902 { 1903 VM& vm = globalObject->vm(); 1904 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 1905 NativeCallFrameTracer tracer(vm, callFrame); 1865 1906 1866 1907 JSValue value = JSValue::decode(encodedValue); 1867 1908 JSValue hasInstanceValue = JSValue::decode(encodedHasInstance); 1868 1909 1869 if (constructor->hasInstance( exec, value, hasInstanceValue))1910 if (constructor->hasInstance(globalObject, value, hasInstanceValue)) 1870 1911 return 1; 1871 1912 return 0; … … 1874 1915 } 1875 1916 1876 static JSValue getByVal(ExecState* exec, JSValue baseValue, JSValue subscript, ByValInfo* byValInfo, ReturnAddressPtr returnAddress) 1877 { 1878 VM& vm = exec->vm(); 1917 static JSValue getByVal(JSGlobalObject* globalObject, CallFrame* callFrame, JSValue baseValue, JSValue subscript, ByValInfo* byValInfo, ReturnAddressPtr returnAddress) 1918 { 1919 UNUSED_PARAM(callFrame); 1920 VM& vm = globalObject->vm(); 1879 1921 auto scope = DECLARE_THROW_SCOPE(vm); 1880 1922 … … 1882 1924 Structure& structure = *baseValue.asCell()->structure(vm); 1883 1925 if (JSCell::canUseFastGetOwnProperty(structure)) { 1884 RefPtr<AtomStringImpl> existingAtomString = asString(subscript)->toExistingAtomString( exec);1926 RefPtr<AtomStringImpl> existingAtomString = asString(subscript)->toExistingAtomString(globalObject); 1885 1927 RETURN_IF_EXCEPTION(scope, JSValue()); 1886 1928 if (existingAtomString) { 1887 1929 if (JSValue result = baseValue.asCell()->fastGetOwnProperty(vm, structure, existingAtomString.get())) { 1888 ASSERT( exec->bytecodeOffset());1930 ASSERT(callFrame->bytecodeOffset()); 1889 1931 if (byValInfo->stubInfo && byValInfo->cachedId.impl() != existingAtomString) 1890 1932 byValInfo->tookSlowPath = true; … … 1896 1938 1897 1939 if (subscript.isInt32()) { 1898 ASSERT( exec->bytecodeOffset());1940 ASSERT(callFrame->bytecodeOffset()); 1899 1941 byValInfo->tookSlowPath = true; 1900 1942 … … 1903 1945 if (i >= 0 && asString(baseValue)->canGetIndex(i)) { 1904 1946 ctiPatchCallByReturnAddress(returnAddress, operationGetByValString); 1905 RELEASE_AND_RETURN(scope, asString(baseValue)->getIndex( exec, i));1947 RELEASE_AND_RETURN(scope, asString(baseValue)->getIndex(globalObject, i)); 1906 1948 } 1907 1949 byValInfo->arrayProfile->setOutOfBounds(); … … 1929 1971 1930 1972 if (i >= 0) 1931 RELEASE_AND_RETURN(scope, baseValue.get( exec, static_cast<uint32_t>(i)));1932 } 1933 1934 baseValue.requireObjectCoercible( exec);1973 RELEASE_AND_RETURN(scope, baseValue.get(globalObject, static_cast<uint32_t>(i))); 1974 } 1975 1976 baseValue.requireObjectCoercible(globalObject); 1935 1977 RETURN_IF_EXCEPTION(scope, JSValue()); 1936 auto property = subscript.toPropertyKey( exec);1978 auto property = subscript.toPropertyKey(globalObject); 1937 1979 RETURN_IF_EXCEPTION(scope, JSValue()); 1938 1980 1939 ASSERT( exec->bytecodeOffset());1981 ASSERT(callFrame->bytecodeOffset()); 1940 1982 if (byValInfo->stubInfo && (!isStringOrSymbol(subscript) || byValInfo->cachedId != property)) 1941 1983 byValInfo->tookSlowPath = true; 1942 1984 1943 RELEASE_AND_RETURN(scope, baseValue.get( exec, property));1944 } 1945 1946 static OptimizationResult tryGetByValOptimize( ExecState* exec, JSValue baseValue, JSValue subscript, ByValInfo* byValInfo, ReturnAddressPtr returnAddress)1985 RELEASE_AND_RETURN(scope, baseValue.get(globalObject, property)); 1986 } 1987 1988 static OptimizationResult tryGetByValOptimize(JSGlobalObject* globalObject, CallFrame* callFrame, JSValue baseValue, JSValue subscript, ByValInfo* byValInfo, ReturnAddressPtr returnAddress) 1947 1989 { 1948 1990 // See if it's worth optimizing this at all. 1949 1991 OptimizationResult optimizationResult = OptimizationResult::NotOptimized; 1950 1992 1951 VM& vm = exec->vm();1993 VM& vm = globalObject->vm(); 1952 1994 auto scope = DECLARE_THROW_SCOPE(vm); 1953 1995 … … 1955 1997 JSObject* object = asObject(baseValue); 1956 1998 1957 ASSERT( exec->bytecodeOffset());1999 ASSERT(callFrame->bytecodeOffset()); 1958 2000 ASSERT(!byValInfo->stubRoutine); 1959 2001 … … 1965 2007 // If we reached this case, we got an interesting array mode we did not expect when we compiled. 1966 2008 // Let's update the profile to do better next time. 1967 CodeBlock* codeBlock = exec->codeBlock();2009 CodeBlock* codeBlock = callFrame->codeBlock(); 1968 2010 ConcurrentJSLocker locker(codeBlock->m_lock); 1969 2011 byValInfo->arrayProfile->computeUpdatedPrediction(locker, codeBlock, structure); … … 1980 2022 1981 2023 if (baseValue.isObject() && isStringOrSymbol(subscript)) { 1982 const Identifier propertyName = subscript.toPropertyKey( exec);2024 const Identifier propertyName = subscript.toPropertyKey(globalObject); 1983 2025 RETURN_IF_EXCEPTION(scope, OptimizationResult::GiveUp); 1984 2026 if (subscript.isSymbol() || !parseIndex(propertyName)) { 1985 ASSERT( exec->bytecodeOffset());2027 ASSERT(callFrame->bytecodeOffset()); 1986 2028 ASSERT(!byValInfo->stubRoutine); 1987 2029 if (byValInfo->seen) { 1988 2030 if (byValInfo->cachedId == propertyName) { 1989 JIT::compileGetByValWithCachedId(vm, exec->codeBlock(), byValInfo, returnAddress, propertyName);2031 JIT::compileGetByValWithCachedId(vm, callFrame->codeBlock(), byValInfo, returnAddress, propertyName); 1990 2032 optimizationResult = OptimizationResult::Optimized; 1991 2033 } else { … … 1994 2036 } 1995 2037 } else { 1996 CodeBlock* codeBlock = exec->codeBlock();2038 CodeBlock* codeBlock = callFrame->codeBlock(); 1997 2039 ConcurrentJSLocker locker(codeBlock->m_lock); 1998 2040 byValInfo->seen = true; … … 2020 2062 extern "C" { 2021 2063 2022 EncodedJSValue JIT_OPERATION operationGetByValGeneric(ExecState* exec, EncodedJSValue encodedBase, EncodedJSValue encodedSubscript, ByValInfo* byValInfo) 2023 { 2024 VM& vm = exec->vm(); 2025 NativeCallFrameTracer tracer(vm, exec); 2064 EncodedJSValue JIT_OPERATION operationGetByValGeneric(JSGlobalObject* globalObject, EncodedJSValue encodedBase, EncodedJSValue encodedSubscript, ByValInfo* byValInfo) 2065 { 2066 VM& vm = globalObject->vm(); 2067 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2068 NativeCallFrameTracer tracer(vm, callFrame); 2026 2069 JSValue baseValue = JSValue::decode(encodedBase); 2027 2070 JSValue subscript = JSValue::decode(encodedSubscript); 2028 2071 2029 JSValue result = getByVal( exec, baseValue, subscript, byValInfo, ReturnAddressPtr(OUR_RETURN_ADDRESS));2072 JSValue result = getByVal(globalObject, callFrame, baseValue, subscript, byValInfo, ReturnAddressPtr(OUR_RETURN_ADDRESS)); 2030 2073 return JSValue::encode(result); 2031 2074 } 2032 2075 2033 EncodedJSValue JIT_OPERATION operationGetByValOptimize(ExecState* exec, EncodedJSValue encodedBase, EncodedJSValue encodedSubscript, ByValInfo* byValInfo) 2034 { 2035 VM& vm = exec->vm(); 2036 NativeCallFrameTracer tracer(vm, exec); 2076 EncodedJSValue JIT_OPERATION operationGetByValOptimize(JSGlobalObject* globalObject, EncodedJSValue encodedBase, EncodedJSValue encodedSubscript, ByValInfo* byValInfo) 2077 { 2078 VM& vm = globalObject->vm(); 2079 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2080 NativeCallFrameTracer tracer(vm, callFrame); 2037 2081 auto scope = DECLARE_THROW_SCOPE(vm); 2038 2082 … … 2040 2084 JSValue subscript = JSValue::decode(encodedSubscript); 2041 2085 ReturnAddressPtr returnAddress = ReturnAddressPtr(OUR_RETURN_ADDRESS); 2042 OptimizationResult result = tryGetByValOptimize( exec, baseValue, subscript, byValInfo, returnAddress);2086 OptimizationResult result = tryGetByValOptimize(globalObject, callFrame, baseValue, subscript, byValInfo, returnAddress); 2043 2087 RETURN_IF_EXCEPTION(scope, { }); 2044 2088 if (result == OptimizationResult::GiveUp) { … … 2048 2092 } 2049 2093 2050 RELEASE_AND_RETURN(scope, JSValue::encode(getByVal(exec, baseValue, subscript, byValInfo, returnAddress))); 2051 } 2052 2053 EncodedJSValue JIT_OPERATION operationHasIndexedPropertyDefault(ExecState* exec, EncodedJSValue encodedBase, EncodedJSValue encodedSubscript, ByValInfo* byValInfo) 2054 { 2055 VM& vm = exec->vm(); 2056 NativeCallFrameTracer tracer(vm, exec); 2094 RELEASE_AND_RETURN(scope, JSValue::encode(getByVal(globalObject, callFrame, baseValue, subscript, byValInfo, returnAddress))); 2095 } 2096 2097 EncodedJSValue JIT_OPERATION operationHasIndexedPropertyDefault(JSGlobalObject* globalObject, EncodedJSValue encodedBase, EncodedJSValue encodedSubscript, ByValInfo* byValInfo) 2098 { 2099 VM& vm = globalObject->vm(); 2100 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2101 NativeCallFrameTracer tracer(vm, callFrame); 2057 2102 JSValue baseValue = JSValue::decode(encodedBase); 2058 2103 JSValue subscript = JSValue::decode(encodedSubscript); … … 2064 2109 bool didOptimize = false; 2065 2110 2066 ASSERT( exec->bytecodeOffset());2111 ASSERT(callFrame->bytecodeOffset()); 2067 2112 ASSERT(!byValInfo->stubRoutine); 2068 2113 … … 2071 2116 JITArrayMode arrayMode = jitArrayModeForStructure(object->structure(vm)); 2072 2117 if (arrayMode != byValInfo->arrayMode) { 2073 JIT::compileHasIndexedProperty(vm, exec->codeBlock(), byValInfo, ReturnAddressPtr(OUR_RETURN_ADDRESS), arrayMode);2118 JIT::compileHasIndexedProperty(vm, callFrame->codeBlock(), byValInfo, ReturnAddressPtr(OUR_RETURN_ADDRESS), arrayMode); 2074 2119 didOptimize = true; 2075 2120 } … … 2095 2140 if (!CommonSlowPaths::canAccessArgumentIndexQuickly(*object, index)) 2096 2141 byValInfo->arrayProfile->setOutOfBounds(); 2097 return JSValue::encode(jsBoolean(object->hasPropertyGeneric(exec, index, PropertySlot::InternalMethodType::GetOwnProperty))); 2098 } 2099 2100 EncodedJSValue JIT_OPERATION operationHasIndexedPropertyGeneric(ExecState* exec, EncodedJSValue encodedBase, EncodedJSValue encodedSubscript, ByValInfo* byValInfo) 2101 { 2102 VM& vm = exec->vm(); 2103 NativeCallFrameTracer tracer(vm, exec); 2142 return JSValue::encode(jsBoolean(object->hasPropertyGeneric(globalObject, index, PropertySlot::InternalMethodType::GetOwnProperty))); 2143 } 2144 2145 EncodedJSValue JIT_OPERATION operationHasIndexedPropertyGeneric(JSGlobalObject* globalObject, EncodedJSValue encodedBase, EncodedJSValue encodedSubscript, ByValInfo* byValInfo) 2146 { 2147 VM& vm = globalObject->vm(); 2148 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2149 NativeCallFrameTracer tracer(vm, callFrame); 2104 2150 JSValue baseValue = JSValue::decode(encodedBase); 2105 2151 JSValue subscript = JSValue::decode(encodedSubscript); … … 2115 2161 if (!CommonSlowPaths::canAccessArgumentIndexQuickly(*object, index)) 2116 2162 byValInfo->arrayProfile->setOutOfBounds(); 2117 return JSValue::encode(jsBoolean(object->hasPropertyGeneric(exec, index, PropertySlot::InternalMethodType::GetOwnProperty))); 2118 } 2119 2120 EncodedJSValue JIT_OPERATION operationGetByValString(ExecState* exec, EncodedJSValue encodedBase, EncodedJSValue encodedSubscript, ByValInfo* byValInfo) 2121 { 2122 VM& vm = exec->vm(); 2123 NativeCallFrameTracer tracer(vm, exec); 2163 return JSValue::encode(jsBoolean(object->hasPropertyGeneric(globalObject, index, PropertySlot::InternalMethodType::GetOwnProperty))); 2164 } 2165 2166 EncodedJSValue JIT_OPERATION operationGetByValString(JSGlobalObject* globalObject, EncodedJSValue encodedBase, EncodedJSValue encodedSubscript, ByValInfo* byValInfo) 2167 { 2168 VM& vm = globalObject->vm(); 2169 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2170 NativeCallFrameTracer tracer(vm, callFrame); 2124 2171 auto scope = DECLARE_THROW_SCOPE(vm); 2125 2172 JSValue baseValue = JSValue::decode(encodedBase); … … 2130 2177 uint32_t i = subscript.asUInt32(); 2131 2178 if (isJSString(baseValue) && asString(baseValue)->canGetIndex(i)) 2132 RELEASE_AND_RETURN(scope, JSValue::encode(asString(baseValue)->getIndex( exec, i)));2133 2134 result = baseValue.get( exec, i);2179 RELEASE_AND_RETURN(scope, JSValue::encode(asString(baseValue)->getIndex(globalObject, i))); 2180 2181 result = baseValue.get(globalObject, i); 2135 2182 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2136 2183 if (!isJSString(baseValue)) { 2137 ASSERT( exec->bytecodeOffset());2184 ASSERT(callFrame->bytecodeOffset()); 2138 2185 auto getByValFunction = byValInfo->stubRoutine ? operationGetByValGeneric : operationGetByValOptimize; 2139 2186 ctiPatchCallByReturnAddress(ReturnAddressPtr(OUR_RETURN_ADDRESS), getByValFunction); 2140 2187 } 2141 2188 } else { 2142 baseValue.requireObjectCoercible( exec);2189 baseValue.requireObjectCoercible(globalObject); 2143 2190 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2144 auto property = subscript.toPropertyKey( exec);2191 auto property = subscript.toPropertyKey(globalObject); 2145 2192 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2146 2193 scope.release(); 2147 result = baseValue.get( exec, property);2194 result = baseValue.get(globalObject, property); 2148 2195 } 2149 2196 … … 2151 2198 } 2152 2199 2153 EncodedJSValue JIT_OPERATION operationDeleteByIdJSResult(ExecState* exec, EncodedJSValue base, UniquedStringImpl* uid) 2154 { 2155 return JSValue::encode(jsBoolean(operationDeleteById(exec, base, uid))); 2156 } 2157 2158 size_t JIT_OPERATION operationDeleteById(ExecState* exec, EncodedJSValue encodedBase, UniquedStringImpl* uid) 2159 { 2160 VM& vm = exec->vm(); 2161 NativeCallFrameTracer tracer(vm, exec); 2162 auto scope = DECLARE_THROW_SCOPE(vm); 2163 2164 JSObject* baseObj = JSValue::decode(encodedBase).toObject(exec); 2200 static bool deleteById(JSGlobalObject* globalObject, CallFrame* callFrame, VM& vm, JSValue base, UniquedStringImpl* uid) 2201 { 2202 auto scope = DECLARE_THROW_SCOPE(vm); 2203 2204 JSObject* baseObj = base.toObject(globalObject); 2165 2205 RETURN_IF_EXCEPTION(scope, false); 2166 2206 if (!baseObj) 2167 2207 return false; 2168 bool couldDelete = baseObj->methodTable(vm)->deleteProperty(baseObj, exec, Identifier::fromUid(vm, uid));2208 bool couldDelete = baseObj->methodTable(vm)->deleteProperty(baseObj, globalObject, Identifier::fromUid(vm, uid)); 2169 2209 RETURN_IF_EXCEPTION(scope, false); 2170 if (!couldDelete && exec->codeBlock()->isStrictMode())2171 throwTypeError( exec, scope, UnableToDeletePropertyError);2210 if (!couldDelete && callFrame->codeBlock()->isStrictMode()) 2211 throwTypeError(globalObject, scope, UnableToDeletePropertyError); 2172 2212 return couldDelete; 2173 2213 } 2174 2214 2175 EncodedJSValue JIT_OPERATION operationDeleteByValJSResult(ExecState* exec, EncodedJSValue base, EncodedJSValue key) 2176 { 2177 return JSValue::encode(jsBoolean(operationDeleteByVal(exec, base, key))); 2178 } 2179 2180 size_t JIT_OPERATION operationDeleteByVal(ExecState* exec, EncodedJSValue encodedBase, EncodedJSValue encodedKey) 2181 { 2182 VM& vm = exec->vm(); 2183 NativeCallFrameTracer tracer(vm, exec); 2184 auto scope = DECLARE_THROW_SCOPE(vm); 2185 2186 JSObject* baseObj = JSValue::decode(encodedBase).toObject(exec); 2215 2216 EncodedJSValue JIT_OPERATION operationDeleteByIdJSResult(JSGlobalObject* globalObject, EncodedJSValue encodedBase, UniquedStringImpl* uid) 2217 { 2218 VM& vm = globalObject->vm(); 2219 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2220 NativeCallFrameTracer tracer(vm, callFrame); 2221 return JSValue::encode(jsBoolean(deleteById(globalObject, callFrame, vm, JSValue::decode(encodedBase), uid))); 2222 } 2223 2224 size_t JIT_OPERATION operationDeleteById(JSGlobalObject* globalObject, EncodedJSValue encodedBase, UniquedStringImpl* uid) 2225 { 2226 VM& vm = globalObject->vm(); 2227 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2228 NativeCallFrameTracer tracer(vm, callFrame); 2229 return deleteById(globalObject, callFrame, vm, JSValue::decode(encodedBase), uid); 2230 } 2231 2232 static bool deleteByVal(JSGlobalObject* globalObject, CallFrame* callFrame, VM& vm, JSValue base, JSValue key) 2233 { 2234 auto scope = DECLARE_THROW_SCOPE(vm); 2235 2236 JSObject* baseObj = base.toObject(globalObject); 2187 2237 RETURN_IF_EXCEPTION(scope, false); 2188 JSValue key = JSValue::decode(encodedKey);2189 2238 if (!baseObj) 2190 2239 return false; … … 2193 2242 uint32_t index; 2194 2243 if (key.getUInt32(index)) 2195 couldDelete = baseObj->methodTable(vm)->deletePropertyByIndex(baseObj, exec, index);2244 couldDelete = baseObj->methodTable(vm)->deletePropertyByIndex(baseObj, globalObject, index); 2196 2245 else { 2197 Identifier property = key.toPropertyKey( exec);2246 Identifier property = key.toPropertyKey(globalObject); 2198 2247 RETURN_IF_EXCEPTION(scope, false); 2199 couldDelete = baseObj->methodTable(vm)->deleteProperty(baseObj, exec, property);2248 couldDelete = baseObj->methodTable(vm)->deleteProperty(baseObj, globalObject, property); 2200 2249 } 2201 2250 RETURN_IF_EXCEPTION(scope, false); 2202 if (!couldDelete && exec->codeBlock()->isStrictMode())2203 throwTypeError( exec, scope, UnableToDeletePropertyError);2251 if (!couldDelete && callFrame->codeBlock()->isStrictMode()) 2252 throwTypeError(globalObject, scope, UnableToDeletePropertyError); 2204 2253 return couldDelete; 2205 2254 } 2206 2255 2207 JSCell* JIT_OPERATION operationPushWithScope(ExecState* exec, JSCell* currentScopeCell, EncodedJSValue objectValue) 2208 { 2209 VM& vm = exec->vm(); 2210 NativeCallFrameTracer tracer(vm, exec); 2211 auto scope = DECLARE_THROW_SCOPE(vm); 2212 2213 JSObject* object = JSValue::decode(objectValue).toObject(exec); 2256 EncodedJSValue JIT_OPERATION operationDeleteByValJSResult(JSGlobalObject* globalObject, EncodedJSValue encodedBase, EncodedJSValue encodedKey) 2257 { 2258 VM& vm = globalObject->vm(); 2259 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2260 NativeCallFrameTracer tracer(vm, callFrame); 2261 return JSValue::encode(jsBoolean(deleteByVal(globalObject, callFrame, vm, JSValue::decode(encodedBase), JSValue::decode(encodedKey)))); 2262 } 2263 2264 size_t JIT_OPERATION operationDeleteByVal(JSGlobalObject* globalObject, EncodedJSValue encodedBase, EncodedJSValue encodedKey) 2265 { 2266 VM& vm = globalObject->vm(); 2267 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2268 NativeCallFrameTracer tracer(vm, callFrame); 2269 return deleteByVal(globalObject, callFrame, vm, JSValue::decode(encodedBase), JSValue::decode(encodedKey)); 2270 } 2271 2272 JSCell* JIT_OPERATION operationPushWithScope(JSGlobalObject* globalObject, JSCell* currentScopeCell, EncodedJSValue objectValue) 2273 { 2274 VM& vm = globalObject->vm(); 2275 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2276 NativeCallFrameTracer tracer(vm, callFrame); 2277 auto scope = DECLARE_THROW_SCOPE(vm); 2278 2279 JSObject* object = JSValue::decode(objectValue).toObject(globalObject); 2214 2280 RETURN_IF_EXCEPTION(scope, nullptr); 2215 2281 2216 2282 JSScope* currentScope = jsCast<JSScope*>(currentScopeCell); 2217 2283 2218 return JSWithScope::create(vm, exec->lexicalGlobalObject(), currentScope, object); 2219 } 2220 2221 JSCell* JIT_OPERATION operationPushWithScopeObject(ExecState* exec, JSCell* currentScopeCell, JSObject* object) 2222 { 2223 VM& vm = exec->vm(); 2224 NativeCallFrameTracer tracer(vm, exec); 2284 return JSWithScope::create(vm, globalObject, currentScope, object); 2285 } 2286 2287 JSCell* JIT_OPERATION operationPushWithScopeObject(JSGlobalObject* globalObject, JSCell* currentScopeCell, JSObject* object) 2288 { 2289 VM& vm = globalObject->vm(); 2290 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2291 NativeCallFrameTracer tracer(vm, callFrame); 2225 2292 JSScope* currentScope = jsCast<JSScope*>(currentScopeCell); 2226 return JSWithScope::create(vm, exec->lexicalGlobalObject(), currentScope, object); 2227 } 2228 2229 EncodedJSValue JIT_OPERATION operationInstanceOf(ExecState* exec, EncodedJSValue encodedValue, EncodedJSValue encodedProto) 2230 { 2231 VM& vm = exec->vm(); 2232 NativeCallFrameTracer tracer(vm, exec); 2293 return JSWithScope::create(vm, globalObject, currentScope, object); 2294 } 2295 2296 EncodedJSValue JIT_OPERATION operationInstanceOf(JSGlobalObject* globalObject, EncodedJSValue encodedValue, EncodedJSValue encodedProto) 2297 { 2298 VM& vm = globalObject->vm(); 2299 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2300 NativeCallFrameTracer tracer(vm, callFrame); 2233 2301 JSValue value = JSValue::decode(encodedValue); 2234 2302 JSValue proto = JSValue::decode(encodedProto); 2235 2303 2236 bool result = JSObject::defaultHasInstance( exec, value, proto);2304 bool result = JSObject::defaultHasInstance(globalObject, value, proto); 2237 2305 return JSValue::encode(jsBoolean(result)); 2238 2306 } 2239 2307 2240 EncodedJSValue JIT_OPERATION operationInstanceOfGeneric(ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedProto) 2241 { 2242 VM& vm = exec->vm(); 2243 NativeCallFrameTracer tracer(vm, exec); 2308 EncodedJSValue JIT_OPERATION operationInstanceOfGeneric(JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedProto) 2309 { 2310 VM& vm = globalObject->vm(); 2311 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2312 NativeCallFrameTracer tracer(vm, callFrame); 2244 2313 JSValue value = JSValue::decode(encodedValue); 2245 2314 JSValue proto = JSValue::decode(encodedProto); … … 2247 2316 stubInfo->tookSlowPath = true; 2248 2317 2249 bool result = JSObject::defaultHasInstance( exec, value, proto);2318 bool result = JSObject::defaultHasInstance(globalObject, value, proto); 2250 2319 return JSValue::encode(jsBoolean(result)); 2251 2320 } 2252 2321 2253 EncodedJSValue JIT_OPERATION operationInstanceOfOptimize(ExecState* exec, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedProto) 2254 { 2255 VM& vm = exec->vm(); 2256 NativeCallFrameTracer tracer(vm, exec); 2322 EncodedJSValue JIT_OPERATION operationInstanceOfOptimize(JSGlobalObject* globalObject, StructureStubInfo* stubInfo, EncodedJSValue encodedValue, EncodedJSValue encodedProto) 2323 { 2324 VM& vm = globalObject->vm(); 2325 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2326 NativeCallFrameTracer tracer(vm, callFrame); 2257 2327 auto scope = DECLARE_THROW_SCOPE(vm); 2258 2328 JSValue value = JSValue::decode(encodedValue); 2259 2329 JSValue proto = JSValue::decode(encodedProto); 2260 2330 2261 bool result = JSObject::defaultHasInstance( exec, value, proto);2331 bool result = JSObject::defaultHasInstance(globalObject, value, proto); 2262 2332 RETURN_IF_EXCEPTION(scope, JSValue::encode(jsUndefined())); 2263 2333 2264 if (stubInfo->considerCaching(vm, exec->codeBlock(), value.structureOrNull())) 2265 repatchInstanceOf(exec, value, proto, *stubInfo, result); 2334 CodeBlock* codeBlock = callFrame->codeBlock(); 2335 if (stubInfo->considerCaching(vm, codeBlock, value.structureOrNull())) 2336 repatchInstanceOf(globalObject, codeBlock, value, proto, *stubInfo, result); 2266 2337 2267 2338 return JSValue::encode(jsBoolean(result)); 2268 2339 } 2269 2340 2270 int32_t JIT_OPERATION operationSizeFrameForForwardArguments(ExecState* exec, EncodedJSValue, int32_t numUsedStackSlots, int32_t) 2271 { 2272 VM& vm = exec->vm(); 2273 NativeCallFrameTracer tracer(vm, exec); 2274 return sizeFrameForForwardArguments(exec, vm, numUsedStackSlots); 2275 } 2276 2277 int32_t JIT_OPERATION operationSizeFrameForVarargs(ExecState* exec, EncodedJSValue encodedArguments, int32_t numUsedStackSlots, int32_t firstVarArgOffset) 2278 { 2279 VM& vm = exec->vm(); 2280 NativeCallFrameTracer tracer(vm, exec); 2341 int32_t JIT_OPERATION operationSizeFrameForForwardArguments(JSGlobalObject* globalObject, EncodedJSValue, int32_t numUsedStackSlots, int32_t) 2342 { 2343 VM& vm = globalObject->vm(); 2344 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2345 NativeCallFrameTracer tracer(vm, callFrame); 2346 return sizeFrameForForwardArguments(globalObject, callFrame, vm, numUsedStackSlots); 2347 } 2348 2349 int32_t JIT_OPERATION operationSizeFrameForVarargs(JSGlobalObject* globalObject, EncodedJSValue encodedArguments, int32_t numUsedStackSlots, int32_t firstVarArgOffset) 2350 { 2351 VM& vm = globalObject->vm(); 2352 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2353 NativeCallFrameTracer tracer(vm, callFrame); 2281 2354 JSValue arguments = JSValue::decode(encodedArguments); 2282 return sizeFrameForVarargs(exec, vm, arguments, numUsedStackSlots, firstVarArgOffset); 2283 } 2284 2285 CallFrame* JIT_OPERATION operationSetupForwardArgumentsFrame(ExecState* exec, CallFrame* newCallFrame, EncodedJSValue, int32_t, int32_t length) 2286 { 2287 VM& vm = exec->vm(); 2288 NativeCallFrameTracer tracer(vm, exec); 2289 setupForwardArgumentsFrame(exec, newCallFrame, length); 2355 return sizeFrameForVarargs(globalObject, callFrame, vm, arguments, numUsedStackSlots, firstVarArgOffset); 2356 } 2357 2358 CallFrame* JIT_OPERATION operationSetupForwardArgumentsFrame(JSGlobalObject* globalObject, CallFrame* newCallFrame, EncodedJSValue, int32_t, int32_t length) 2359 { 2360 VM& vm = globalObject->vm(); 2361 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2362 NativeCallFrameTracer tracer(vm, callFrame); 2363 setupForwardArgumentsFrame(globalObject, callFrame, newCallFrame, length); 2290 2364 return newCallFrame; 2291 2365 } 2292 2366 2293 CallFrame* JIT_OPERATION operationSetupVarargsFrame(ExecState* exec, CallFrame* newCallFrame, EncodedJSValue encodedArguments, int32_t firstVarArgOffset, int32_t length) 2294 { 2295 VM& vm = exec->vm(); 2296 NativeCallFrameTracer tracer(vm, exec); 2367 CallFrame* JIT_OPERATION operationSetupVarargsFrame(JSGlobalObject* globalObject, CallFrame* newCallFrame, EncodedJSValue encodedArguments, int32_t firstVarArgOffset, int32_t length) 2368 { 2369 VM& vm = globalObject->vm(); 2370 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2371 NativeCallFrameTracer tracer(vm, callFrame); 2297 2372 JSValue arguments = JSValue::decode(encodedArguments); 2298 setupVarargsFrame( exec, newCallFrame, arguments, firstVarArgOffset, length);2373 setupVarargsFrame(globalObject, callFrame, newCallFrame, arguments, firstVarArgOffset, length); 2299 2374 return newCallFrame; 2300 2375 } 2301 2376 2302 char* JIT_OPERATION operationSwitchCharWithUnknownKeyType(ExecState* exec, EncodedJSValue encodedKey, size_t tableIndex) 2303 { 2304 VM& vm = exec->vm(); 2305 NativeCallFrameTracer tracer(vm, exec); 2377 char* JIT_OPERATION operationSwitchCharWithUnknownKeyType(JSGlobalObject* globalObject, EncodedJSValue encodedKey, size_t tableIndex) 2378 { 2379 VM& vm = globalObject->vm(); 2380 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2381 NativeCallFrameTracer tracer(vm, callFrame); 2306 2382 auto throwScope = DECLARE_THROW_SCOPE(vm); 2383 2307 2384 JSValue key = JSValue::decode(encodedKey); 2308 CodeBlock* codeBlock = exec->codeBlock();2385 CodeBlock* codeBlock = callFrame->codeBlock(); 2309 2386 2310 2387 SimpleJumpTable& jumpTable = codeBlock->switchJumpTable(tableIndex); … … 2314 2391 JSString* string = asString(key); 2315 2392 if (string->length() == 1) { 2316 String value = string->value( exec);2393 String value = string->value(globalObject); 2317 2394 RETURN_IF_EXCEPTION(throwScope, nullptr); 2318 2395 result = jumpTable.ctiForValue(value[0]).executableAddress(); … … 2324 2401 } 2325 2402 2326 char* JIT_OPERATION operationSwitchImmWithUnknownKeyType(ExecState* exec, EncodedJSValue encodedKey, size_t tableIndex) 2327 { 2328 VM& vm = exec->vm(); 2329 NativeCallFrameTracer tracer(vm, exec); 2403 char* JIT_OPERATION operationSwitchImmWithUnknownKeyType(VM* vmPointer, EncodedJSValue encodedKey, size_t tableIndex) 2404 { 2405 VM& vm = *vmPointer; 2406 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2407 NativeCallFrameTracer tracer(vm, callFrame); 2330 2408 JSValue key = JSValue::decode(encodedKey); 2331 CodeBlock* codeBlock = exec->codeBlock();2409 CodeBlock* codeBlock = callFrame->codeBlock(); 2332 2410 2333 2411 SimpleJumpTable& jumpTable = codeBlock->switchJumpTable(tableIndex); … … 2343 2421 } 2344 2422 2345 char* JIT_OPERATION operationSwitchStringWithUnknownKeyType(ExecState* exec, EncodedJSValue encodedKey, size_t tableIndex) 2346 { 2347 VM& vm = exec->vm(); 2348 NativeCallFrameTracer tracer(vm, exec); 2423 char* JIT_OPERATION operationSwitchStringWithUnknownKeyType(JSGlobalObject* globalObject, EncodedJSValue encodedKey, size_t tableIndex) 2424 { 2425 VM& vm = globalObject->vm(); 2426 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2427 NativeCallFrameTracer tracer(vm, callFrame); 2349 2428 JSValue key = JSValue::decode(encodedKey); 2350 CodeBlock* codeBlock = exec->codeBlock();2429 CodeBlock* codeBlock = callFrame->codeBlock(); 2351 2430 auto throwScope = DECLARE_THROW_SCOPE(vm); 2352 2431 … … 2355 2434 2356 2435 if (key.isString()) { 2357 StringImpl* value = asString(key)->value( exec).impl();2436 StringImpl* value = asString(key)->value(globalObject).impl(); 2358 2437 2359 2438 RETURN_IF_EXCEPTION(throwScope, nullptr); … … 2367 2446 } 2368 2447 2369 EncodedJSValue JIT_OPERATION operationGetFromScope(ExecState* exec, const Instruction* pc) 2370 { 2371 VM& vm = exec->vm(); 2372 NativeCallFrameTracer tracer(vm, exec); 2448 EncodedJSValue JIT_OPERATION operationGetFromScope(JSGlobalObject* globalObject, const Instruction* pc) 2449 { 2450 VM& vm = globalObject->vm(); 2451 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2452 NativeCallFrameTracer tracer(vm, callFrame); 2373 2453 auto throwScope = DECLARE_THROW_SCOPE(vm); 2374 2454 2375 CodeBlock* codeBlock = exec->codeBlock();2455 CodeBlock* codeBlock = callFrame->codeBlock(); 2376 2456 2377 2457 auto bytecode = pc->as<OpGetFromScope>(); 2378 2458 const Identifier& ident = codeBlock->identifier(bytecode.m_var); 2379 JSObject* scope = jsCast<JSObject*>( exec->uncheckedR(bytecode.m_scope.offset()).jsValue());2459 JSObject* scope = jsCast<JSObject*>(callFrame->uncheckedR(bytecode.m_scope.offset()).jsValue()); 2380 2460 GetPutInfo& getPutInfo = bytecode.metadata(codeBlock).m_getPutInfo; 2381 2461 … … 2383 2463 ASSERT(getPutInfo.resolveType() != ModuleVar); 2384 2464 2385 RELEASE_AND_RETURN(throwScope, JSValue::encode(scope->getPropertySlot( exec, ident, [&] (bool found, PropertySlot& slot) -> JSValue {2465 RELEASE_AND_RETURN(throwScope, JSValue::encode(scope->getPropertySlot(globalObject, ident, [&] (bool found, PropertySlot& slot) -> JSValue { 2386 2466 if (!found) { 2387 2467 if (getPutInfo.resolveMode() == ThrowIfNotFound) 2388 throwException( exec, throwScope, createUndefinedVariableError(exec, ident));2468 throwException(globalObject, throwScope, createUndefinedVariableError(globalObject, ident)); 2389 2469 return jsUndefined(); 2390 2470 } … … 2393 2473 if (scope->isGlobalLexicalEnvironment()) { 2394 2474 // When we can't statically prove we need a TDZ check, we must perform the check on the slow path. 2395 result = slot.getValue( exec, ident);2475 result = slot.getValue(globalObject, ident); 2396 2476 if (result == jsTDZValue()) { 2397 throwException( exec, throwScope, createTDZError(exec));2477 throwException(globalObject, throwScope, createTDZError(globalObject)); 2398 2478 return jsUndefined(); 2399 2479 } 2400 2480 } 2401 2481 2402 CommonSlowPaths::tryCacheGetFromScopeGlobal( exec, vm, bytecode, scope, slot, ident);2482 CommonSlowPaths::tryCacheGetFromScopeGlobal(globalObject, codeBlock, vm, bytecode, scope, slot, ident); 2403 2483 2404 2484 if (!result) 2405 return slot.getValue( exec, ident);2485 return slot.getValue(globalObject, ident); 2406 2486 return result; 2407 2487 }))); 2408 2488 } 2409 2489 2410 void JIT_OPERATION operationPutToScope(ExecState* exec, const Instruction* pc) 2411 { 2412 VM& vm = exec->vm(); 2413 NativeCallFrameTracer tracer(vm, exec); 2490 void JIT_OPERATION operationPutToScope(JSGlobalObject* globalObject, const Instruction* pc) 2491 { 2492 VM& vm = globalObject->vm(); 2493 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2494 NativeCallFrameTracer tracer(vm, callFrame); 2414 2495 auto throwScope = DECLARE_THROW_SCOPE(vm); 2415 2496 2416 CodeBlock* codeBlock = exec->codeBlock();2497 CodeBlock* codeBlock = callFrame->codeBlock(); 2417 2498 auto bytecode = pc->as<OpPutToScope>(); 2418 2499 auto& metadata = bytecode.metadata(codeBlock); 2419 2500 2420 2501 const Identifier& ident = codeBlock->identifier(bytecode.m_var); 2421 JSObject* scope = jsCast<JSObject*>( exec->uncheckedR(bytecode.m_scope.offset()).jsValue());2422 JSValue value = exec->r(bytecode.m_value.offset()).jsValue();2502 JSObject* scope = jsCast<JSObject*>(callFrame->uncheckedR(bytecode.m_scope.offset()).jsValue()); 2503 JSValue value = callFrame->r(bytecode.m_value.offset()).jsValue(); 2423 2504 GetPutInfo& getPutInfo = metadata.m_getPutInfo; 2424 2505 … … 2434 2515 } 2435 2516 2436 bool hasProperty = scope->hasProperty( exec, ident);2517 bool hasProperty = scope->hasProperty(globalObject, ident); 2437 2518 RETURN_IF_EXCEPTION(throwScope, void()); 2438 2519 if (hasProperty … … 2441 2522 // When we can't statically prove we need a TDZ check, we must perform the check on the slow path. 2442 2523 PropertySlot slot(scope, PropertySlot::InternalMethodType::Get); 2443 JSGlobalLexicalEnvironment::getOwnPropertySlot(scope, exec, ident, slot);2444 if (slot.getValue( exec, ident) == jsTDZValue()) {2445 throwException( exec, throwScope, createTDZError(exec));2524 JSGlobalLexicalEnvironment::getOwnPropertySlot(scope, globalObject, ident, slot); 2525 if (slot.getValue(globalObject, ident) == jsTDZValue()) { 2526 throwException(globalObject, throwScope, createTDZError(globalObject)); 2446 2527 return; 2447 2528 } … … 2449 2530 2450 2531 if (getPutInfo.resolveMode() == ThrowIfNotFound && !hasProperty) { 2451 throwException( exec, throwScope, createUndefinedVariableError(exec, ident));2532 throwException(globalObject, throwScope, createUndefinedVariableError(globalObject, ident)); 2452 2533 return; 2453 2534 } 2454 2535 2455 2536 PutPropertySlot slot(scope, codeBlock->isStrictMode(), PutPropertySlot::UnknownContext, isInitialization(getPutInfo.initializationMode())); 2456 scope->methodTable(vm)->put(scope, exec, ident, value, slot);2537 scope->methodTable(vm)->put(scope, globalObject, ident, value, slot); 2457 2538 2458 2539 RETURN_IF_EXCEPTION(throwScope, void()); 2459 2540 2460 CommonSlowPaths::tryCachePutToScopeGlobal(exec, codeBlock, bytecode, scope, slot, ident); 2461 } 2462 2463 void JIT_OPERATION operationThrow(ExecState* exec, EncodedJSValue encodedExceptionValue) 2464 { 2465 VM& vm = exec->vm(); 2466 NativeCallFrameTracer tracer(vm, exec); 2541 CommonSlowPaths::tryCachePutToScopeGlobal(globalObject, codeBlock, bytecode, scope, slot, ident); 2542 } 2543 2544 void JIT_OPERATION operationThrow(JSGlobalObject* globalObject, EncodedJSValue encodedExceptionValue) 2545 { 2546 VM& vm = globalObject->vm(); 2547 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2548 NativeCallFrameTracer tracer(vm, callFrame); 2467 2549 auto scope = DECLARE_THROW_SCOPE(vm); 2468 2550 2469 2551 JSValue exceptionValue = JSValue::decode(encodedExceptionValue); 2470 throwException( exec, scope, exceptionValue);2552 throwException(globalObject, scope, exceptionValue); 2471 2553 2472 2554 // Results stored out-of-band in vm.targetMachinePCForThrow & vm.callFrameForCatch 2473 genericUnwind(vm, exec); 2474 } 2475 2476 char* JIT_OPERATION operationReallocateButterflyToHavePropertyStorageWithInitialCapacity(ExecState* exec, JSObject* object) 2477 { 2478 VM& vm = exec->vm(); 2479 NativeCallFrameTracer tracer(vm, exec); 2555 genericUnwind(vm, callFrame); 2556 } 2557 2558 char* JIT_OPERATION operationReallocateButterflyToHavePropertyStorageWithInitialCapacity(VM* vmPointer, JSObject* object) 2559 { 2560 VM& vm = *vmPointer; 2561 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2562 NativeCallFrameTracer tracer(vm, callFrame); 2480 2563 2481 2564 ASSERT(!object->structure(vm)->outOfLineCapacity()); … … 2485 2568 } 2486 2569 2487 char* JIT_OPERATION operationReallocateButterflyToGrowPropertyStorage(ExecState* exec, JSObject* object, size_t newSize) 2488 { 2489 VM& vm = exec->vm(); 2490 NativeCallFrameTracer tracer(vm, exec); 2570 char* JIT_OPERATION operationReallocateButterflyToGrowPropertyStorage(VM* vmPointer, JSObject* object, size_t newSize) 2571 { 2572 VM& vm = *vmPointer; 2573 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2574 NativeCallFrameTracer tracer(vm, callFrame); 2491 2575 2492 2576 Butterfly* result = object->allocateMoreOutOfLineStorage(vm, object->structure(vm)->outOfLineCapacity(), newSize); … … 2495 2579 } 2496 2580 2497 void JIT_OPERATION operationOSRWriteBarrier(ExecState* exec, JSCell* cell) 2498 { 2499 VM& vm = exec->vm(); 2500 NativeCallFrameTracer tracer(vm, exec); 2581 void JIT_OPERATION operationOSRWriteBarrier(VM* vmPointer, JSCell* cell) 2582 { 2583 VM& vm = *vmPointer; 2584 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2585 NativeCallFrameTracer tracer(vm, callFrame); 2501 2586 vm.heap.writeBarrier(cell); 2502 2587 } 2503 2588 2504 void JIT_OPERATION operationWriteBarrierSlowPath(ExecState* exec, JSCell* cell) 2505 { 2506 VM& vm = exec->vm(); 2507 NativeCallFrameTracer tracer(vm, exec); 2589 void JIT_OPERATION operationWriteBarrierSlowPath(VM* vmPointer, JSCell* cell) 2590 { 2591 VM& vm = *vmPointer; 2592 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2593 NativeCallFrameTracer tracer(vm, callFrame); 2508 2594 vm.heap.writeBarrierSlowPath(cell); 2509 2595 } 2510 2596 2511 void JIT_OPERATION lookupExceptionHandler(VM* vmPointer, ExecState* exec)2597 void JIT_OPERATION operationLookupExceptionHandler(VM* vmPointer) 2512 2598 { 2513 2599 VM& vm = *vmPointer; 2514 NativeCallFrameTracer tracer(vm, exec); 2515 genericUnwind(vm, exec); 2600 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2601 NativeCallFrameTracer tracer(vm, callFrame); 2602 genericUnwind(vm, callFrame); 2516 2603 ASSERT(vm.targetMachinePCForThrow); 2517 2604 } 2518 2605 2519 void JIT_OPERATION lookupExceptionHandlerFromCallerFrame(VM* vm, ExecState* exec) 2520 { 2521 ASSERT(exec->isStackOverflowFrame()); 2522 ASSERT(jsCast<ErrorInstance*>(vm->exceptionForInspection()->value().asCell())->isStackOverflowError()); 2523 lookupExceptionHandler(vm, exec); 2524 } 2525 2526 void JIT_OPERATION operationVMHandleException(ExecState* exec) 2527 { 2528 VM& vm = exec->vm(); 2529 NativeCallFrameTracer tracer(vm, exec); 2530 genericUnwind(vm, exec); 2531 } 2532 2533 // This function "should" just take the ExecState*, but doing so would make it more difficult 2606 void JIT_OPERATION operationLookupExceptionHandlerFromCallerFrame(VM* vmPointer) 2607 { 2608 VM& vm = *vmPointer; 2609 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2610 NativeCallFrameTracer tracer(vm, callFrame); 2611 ASSERT(callFrame->isStackOverflowFrame()); 2612 ASSERT(jsCast<ErrorInstance*>(vm.exceptionForInspection()->value().asCell())->isStackOverflowError()); 2613 genericUnwind(vm, callFrame); 2614 ASSERT(vm.targetMachinePCForThrow); 2615 } 2616 2617 void JIT_OPERATION operationVMHandleException(VM* vmPointer) 2618 { 2619 VM& vm = *vmPointer; 2620 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2621 NativeCallFrameTracer tracer(vm, callFrame); 2622 genericUnwind(vm, callFrame); 2623 } 2624 2625 // This function "should" just take the JSGlobalObject*, but doing so would make it more difficult 2534 2626 // to call from exception check sites. So, unlike all of our other functions, we allow 2535 2627 // ourselves to play some gnarly ABI tricks just to simplify the calling convention. This is 2536 2628 // particularly safe here since this is never called on the critical path - it's only for 2537 2629 // testing. 2538 void JIT_OPERATION operationExceptionFuzz(ExecState* exec) 2539 { 2540 VM& vm = exec->vm(); 2541 NativeCallFrameTracer tracer(vm, exec); 2630 void JIT_OPERATION operationExceptionFuzz(JSGlobalObject* globalObject) 2631 { 2632 VM& vm = globalObject->vm(); 2633 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2634 NativeCallFrameTracer tracer(vm, callFrame); 2542 2635 auto scope = DECLARE_THROW_SCOPE(vm); 2543 2636 UNUSED_PARAM(scope); 2544 2637 #if COMPILER(GCC_COMPATIBLE) 2545 2638 void* returnPC = __builtin_return_address(0); 2546 doExceptionFuzzing( exec, scope, "JITOperations", returnPC);2639 doExceptionFuzzing(globalObject, scope, "JITOperations", returnPC); 2547 2640 #endif // COMPILER(GCC_COMPATIBLE) 2548 2641 } 2549 2642 2550 ALWAYS_INLINE static EncodedJSValue unprofiledAdd(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 2551 { 2552 VM& vm = exec->vm(); 2553 NativeCallFrameTracer tracer(vm, exec); 2554 2555 JSValue op1 = JSValue::decode(encodedOp1); 2556 JSValue op2 = JSValue::decode(encodedOp2); 2557 2558 return JSValue::encode(jsAdd(exec, op1, op2)); 2559 } 2560 2561 ALWAYS_INLINE static EncodedJSValue profiledAdd(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile& arithProfile) 2562 { 2563 VM& vm = exec->vm(); 2564 NativeCallFrameTracer tracer(vm, exec); 2565 2566 JSValue op1 = JSValue::decode(encodedOp1); 2567 JSValue op2 = JSValue::decode(encodedOp2); 2568 2643 ALWAYS_INLINE static JSValue profiledAdd(JSGlobalObject* globalObject, JSValue op1, JSValue op2, ArithProfile& arithProfile) 2644 { 2569 2645 arithProfile.observeLHSAndRHS(op1, op2); 2570 JSValue result = jsAdd( exec, op1, op2);2646 JSValue result = jsAdd(globalObject, op1, op2); 2571 2647 arithProfile.observeResult(result); 2572 2573 return JSValue::encode(result); 2574 } 2575 2576 EncodedJSValue JIT_OPERATION operationValueAdd(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 2577 { 2578 return unprofiledAdd(exec, encodedOp1, encodedOp2); 2579 } 2580 2581 EncodedJSValue JIT_OPERATION operationValueAddProfiled(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile* arithProfile) 2648 return result; 2649 } 2650 2651 EncodedJSValue JIT_OPERATION operationValueAdd(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 2652 { 2653 VM& vm = globalObject->vm(); 2654 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2655 NativeCallFrameTracer tracer(vm, callFrame); 2656 return JSValue::encode(jsAdd(globalObject, JSValue::decode(encodedOp1), JSValue::decode(encodedOp2))); 2657 } 2658 2659 EncodedJSValue JIT_OPERATION operationValueAddProfiled(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile* arithProfile) 2582 2660 { 2583 2661 ASSERT(arithProfile); 2584 return profiledAdd(exec, encodedOp1, encodedOp2, *arithProfile); 2585 } 2586 2587 EncodedJSValue JIT_OPERATION operationValueAddProfiledOptimize(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITAddIC* addIC) 2588 { 2589 VM& vm = exec->vm(); 2590 NativeCallFrameTracer tracer(vm, exec); 2662 VM& vm = globalObject->vm(); 2663 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2664 NativeCallFrameTracer tracer(vm, callFrame); 2665 return JSValue::encode(profiledAdd(globalObject, JSValue::decode(encodedOp1), JSValue::decode(encodedOp2), *arithProfile)); 2666 } 2667 2668 EncodedJSValue JIT_OPERATION operationValueAddProfiledOptimize(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITAddIC* addIC) 2669 { 2670 VM& vm = globalObject->vm(); 2671 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2672 NativeCallFrameTracer tracer(vm, callFrame); 2591 2673 2592 2674 JSValue op1 = JSValue::decode(encodedOp1); … … 2597 2679 arithProfile->observeLHSAndRHS(op1, op2); 2598 2680 auto nonOptimizeVariant = operationValueAddProfiledNoOptimize; 2599 addIC->generateOutOfLine( exec->codeBlock(), nonOptimizeVariant);2681 addIC->generateOutOfLine(callFrame->codeBlock(), nonOptimizeVariant); 2600 2682 2601 2683 #if ENABLE(MATH_IC_STATS) 2602 exec->codeBlock()->dumpMathICStats();2684 callFrame->codeBlock()->dumpMathICStats(); 2603 2685 #endif 2604 2686 2605 JSValue result = jsAdd( exec, op1, op2);2687 JSValue result = jsAdd(globalObject, op1, op2); 2606 2688 arithProfile->observeResult(result); 2607 2689 … … 2609 2691 } 2610 2692 2611 EncodedJSValue JIT_OPERATION operationValueAddProfiledNoOptimize(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITAddIC* addIC) 2612 { 2613 VM& vm = exec->vm(); 2614 NativeCallFrameTracer tracer(vm, exec); 2693 EncodedJSValue JIT_OPERATION operationValueAddProfiledNoOptimize(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITAddIC* addIC) 2694 { 2695 VM& vm = globalObject->vm(); 2696 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2697 NativeCallFrameTracer tracer(vm, callFrame); 2615 2698 2616 2699 ArithProfile* arithProfile = addIC->arithProfile(); 2617 2700 ASSERT(arithProfile); 2618 return profiledAdd(exec, encodedOp1, encodedOp2, *arithProfile); 2619 } 2620 2621 EncodedJSValue JIT_OPERATION operationValueAddOptimize(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITAddIC* addIC) 2622 { 2623 VM& vm = exec->vm(); 2624 NativeCallFrameTracer tracer(vm, exec); 2701 return JSValue::encode(profiledAdd(globalObject, JSValue::decode(encodedOp1), JSValue::decode(encodedOp2), *arithProfile)); 2702 } 2703 2704 EncodedJSValue JIT_OPERATION operationValueAddOptimize(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITAddIC* addIC) 2705 { 2706 VM& vm = globalObject->vm(); 2707 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2708 NativeCallFrameTracer tracer(vm, callFrame); 2625 2709 2626 2710 JSValue op1 = JSValue::decode(encodedOp1); … … 2630 2714 if (ArithProfile* arithProfile = addIC->arithProfile()) 2631 2715 arithProfile->observeLHSAndRHS(op1, op2); 2632 addIC->generateOutOfLine( exec->codeBlock(), nonOptimizeVariant);2716 addIC->generateOutOfLine(callFrame->codeBlock(), nonOptimizeVariant); 2633 2717 2634 2718 #if ENABLE(MATH_IC_STATS) 2635 exec->codeBlock()->dumpMathICStats();2719 callFrame->codeBlock()->dumpMathICStats(); 2636 2720 #endif 2637 2721 2638 return JSValue::encode(jsAdd(exec, op1, op2)); 2639 } 2640 2641 EncodedJSValue JIT_OPERATION operationValueAddNoOptimize(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITAddIC*) 2642 { 2643 VM& vm = exec->vm(); 2644 NativeCallFrameTracer tracer(vm, exec); 2722 return JSValue::encode(jsAdd(globalObject, op1, op2)); 2723 } 2724 2725 EncodedJSValue JIT_OPERATION operationValueAddNoOptimize(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITAddIC*) 2726 { 2727 VM& vm = globalObject->vm(); 2728 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2729 NativeCallFrameTracer tracer(vm, callFrame); 2645 2730 2646 2731 JSValue op1 = JSValue::decode(encodedOp1); 2647 2732 JSValue op2 = JSValue::decode(encodedOp2); 2648 2733 2649 JSValue result = jsAdd( exec, op1, op2);2734 JSValue result = jsAdd(globalObject, op1, op2); 2650 2735 2651 2736 return JSValue::encode(result); 2652 2737 } 2653 2738 2654 ALWAYS_INLINE static EncodedJSValue unprofiledMul( ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2)2739 ALWAYS_INLINE static EncodedJSValue unprofiledMul(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 2655 2740 { 2656 2741 JSValue op1 = JSValue::decode(encodedOp1); 2657 2742 JSValue op2 = JSValue::decode(encodedOp2); 2658 2743 2659 return JSValue::encode(jsMul( exec, op1, op2));2660 } 2661 2662 ALWAYS_INLINE static EncodedJSValue profiledMul( ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile& arithProfile, bool shouldObserveLHSAndRHSTypes = true)2663 { 2664 VM& vm = exec->vm();2744 return JSValue::encode(jsMul(globalObject, op1, op2)); 2745 } 2746 2747 ALWAYS_INLINE static EncodedJSValue profiledMul(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile& arithProfile, bool shouldObserveLHSAndRHSTypes = true) 2748 { 2749 VM& vm = globalObject->vm(); 2665 2750 auto scope = DECLARE_THROW_SCOPE(vm); 2666 2751 JSValue op1 = JSValue::decode(encodedOp1); … … 2670 2755 arithProfile.observeLHSAndRHS(op1, op2); 2671 2756 2672 JSValue result = jsMul( exec, op1, op2);2757 JSValue result = jsMul(globalObject, op1, op2); 2673 2758 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2674 2759 arithProfile.observeResult(result); … … 2676 2761 } 2677 2762 2678 EncodedJSValue JIT_OPERATION operationValueMul(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 2679 { 2680 VM& vm = exec->vm(); 2681 NativeCallFrameTracer tracer(vm, exec); 2682 2683 return unprofiledMul(exec, encodedOp1, encodedOp2); 2684 } 2685 2686 EncodedJSValue JIT_OPERATION operationValueMulNoOptimize(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITMulIC*) 2687 { 2688 VM& vm = exec->vm(); 2689 NativeCallFrameTracer tracer(vm, exec); 2690 2691 return unprofiledMul(exec, encodedOp1, encodedOp2); 2692 } 2693 2694 EncodedJSValue JIT_OPERATION operationValueMulOptimize(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITMulIC* mulIC) 2695 { 2696 VM& vm = exec->vm(); 2697 NativeCallFrameTracer tracer(vm, exec); 2763 EncodedJSValue JIT_OPERATION operationValueMul(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 2764 { 2765 VM& vm = globalObject->vm(); 2766 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2767 NativeCallFrameTracer tracer(vm, callFrame); 2768 2769 return unprofiledMul(globalObject, encodedOp1, encodedOp2); 2770 } 2771 2772 EncodedJSValue JIT_OPERATION operationValueMulNoOptimize(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITMulIC*) 2773 { 2774 VM& vm = globalObject->vm(); 2775 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2776 NativeCallFrameTracer tracer(vm, callFrame); 2777 2778 return unprofiledMul(globalObject, encodedOp1, encodedOp2); 2779 } 2780 2781 EncodedJSValue JIT_OPERATION operationValueMulOptimize(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITMulIC* mulIC) 2782 { 2783 VM& vm = globalObject->vm(); 2784 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2785 NativeCallFrameTracer tracer(vm, callFrame); 2698 2786 2699 2787 auto nonOptimizeVariant = operationValueMulNoOptimize; 2700 2788 if (ArithProfile* arithProfile = mulIC->arithProfile()) 2701 2789 arithProfile->observeLHSAndRHS(JSValue::decode(encodedOp1), JSValue::decode(encodedOp2)); 2702 mulIC->generateOutOfLine( exec->codeBlock(), nonOptimizeVariant);2790 mulIC->generateOutOfLine(callFrame->codeBlock(), nonOptimizeVariant); 2703 2791 2704 2792 #if ENABLE(MATH_IC_STATS) 2705 exec->codeBlock()->dumpMathICStats();2793 callFrame->codeBlock()->dumpMathICStats(); 2706 2794 #endif 2707 2795 2708 return unprofiledMul(exec, encodedOp1, encodedOp2); 2709 } 2710 2711 EncodedJSValue JIT_OPERATION operationValueMulProfiled(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile* arithProfile) 2712 { 2713 VM& vm = exec->vm(); 2714 NativeCallFrameTracer tracer(vm, exec); 2796 return unprofiledMul(globalObject, encodedOp1, encodedOp2); 2797 } 2798 2799 EncodedJSValue JIT_OPERATION operationValueMulProfiled(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile* arithProfile) 2800 { 2801 VM& vm = globalObject->vm(); 2802 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2803 NativeCallFrameTracer tracer(vm, callFrame); 2715 2804 2716 2805 ASSERT(arithProfile); 2717 return profiledMul(exec, encodedOp1, encodedOp2, *arithProfile); 2718 } 2719 2720 EncodedJSValue JIT_OPERATION operationValueMulProfiledOptimize(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITMulIC* mulIC) 2721 { 2722 VM& vm = exec->vm(); 2723 NativeCallFrameTracer tracer(vm, exec); 2806 return profiledMul(globalObject, encodedOp1, encodedOp2, *arithProfile); 2807 } 2808 2809 EncodedJSValue JIT_OPERATION operationValueMulProfiledOptimize(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITMulIC* mulIC) 2810 { 2811 VM& vm = globalObject->vm(); 2812 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2813 NativeCallFrameTracer tracer(vm, callFrame); 2724 2814 2725 2815 ArithProfile* arithProfile = mulIC->arithProfile(); … … 2727 2817 arithProfile->observeLHSAndRHS(JSValue::decode(encodedOp1), JSValue::decode(encodedOp2)); 2728 2818 auto nonOptimizeVariant = operationValueMulProfiledNoOptimize; 2729 mulIC->generateOutOfLine( exec->codeBlock(), nonOptimizeVariant);2819 mulIC->generateOutOfLine(callFrame->codeBlock(), nonOptimizeVariant); 2730 2820 2731 2821 #if ENABLE(MATH_IC_STATS) 2732 exec->codeBlock()->dumpMathICStats();2822 callFrame->codeBlock()->dumpMathICStats(); 2733 2823 #endif 2734 2824 2735 return profiledMul(exec, encodedOp1, encodedOp2, *arithProfile, false); 2736 } 2737 2738 EncodedJSValue JIT_OPERATION operationValueMulProfiledNoOptimize(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITMulIC* mulIC) 2739 { 2740 VM& vm = exec->vm(); 2741 NativeCallFrameTracer tracer(vm, exec); 2825 return profiledMul(globalObject, encodedOp1, encodedOp2, *arithProfile, false); 2826 } 2827 2828 EncodedJSValue JIT_OPERATION operationValueMulProfiledNoOptimize(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITMulIC* mulIC) 2829 { 2830 VM& vm = globalObject->vm(); 2831 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2832 NativeCallFrameTracer tracer(vm, callFrame); 2742 2833 2743 2834 ArithProfile* arithProfile = mulIC->arithProfile(); 2744 2835 ASSERT(arithProfile); 2745 return profiledMul(exec, encodedOp1, encodedOp2, *arithProfile); 2746 } 2747 2748 ALWAYS_INLINE static EncodedJSValue unprofiledNegate(ExecState* exec, EncodedJSValue encodedOperand) 2749 { 2750 VM& vm = exec->vm(); 2751 auto scope = DECLARE_THROW_SCOPE(vm); 2752 NativeCallFrameTracer tracer(vm, exec); 2753 2836 return profiledMul(globalObject, encodedOp1, encodedOp2, *arithProfile); 2837 } 2838 2839 EncodedJSValue JIT_OPERATION operationArithNegate(JSGlobalObject* globalObject, EncodedJSValue encodedOperand) 2840 { 2841 VM& vm = globalObject->vm(); 2842 auto scope = DECLARE_THROW_SCOPE(vm); 2843 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2844 NativeCallFrameTracer tracer(vm, callFrame); 2845 2754 2846 JSValue operand = JSValue::decode(encodedOperand); 2755 2756 JSValue primValue = operand.toPrimitive( exec, PreferNumber);2847 2848 JSValue primValue = operand.toPrimitive(globalObject, PreferNumber); 2757 2849 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2758 2850 2759 2851 if (primValue.isBigInt()) 2760 2852 return JSValue::encode(JSBigInt::unaryMinus(vm, asBigInt(primValue))); 2761 2762 double number = primValue.toNumber( exec);2853 2854 double number = primValue.toNumber(globalObject); 2763 2855 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2764 2856 return JSValue::encode(jsNumber(-number)); 2765 } 2766 2767 ALWAYS_INLINE static EncodedJSValue profiledNegate(ExecState* exec, EncodedJSValue encodedOperand, ArithProfile& arithProfile) 2768 { 2769 VM& vm = exec->vm(); 2770 auto scope = DECLARE_THROW_SCOPE(vm); 2771 NativeCallFrameTracer tracer(vm, exec); 2857 2858 } 2859 2860 EncodedJSValue JIT_OPERATION operationArithNegateProfiled(JSGlobalObject* globalObject, EncodedJSValue encodedOperand, ArithProfile* arithProfile) 2861 { 2862 ASSERT(arithProfile); 2863 VM& vm = globalObject->vm(); 2864 auto scope = DECLARE_THROW_SCOPE(vm); 2865 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2866 NativeCallFrameTracer tracer(vm, callFrame); 2772 2867 2773 2868 JSValue operand = JSValue::decode(encodedOperand); 2774 arithProfile .observeLHS(operand);2775 2776 JSValue primValue = operand.toPrimitive( exec);2869 arithProfile->observeLHS(operand); 2870 2871 JSValue primValue = operand.toPrimitive(globalObject); 2777 2872 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2778 2873 2779 2874 if (primValue.isBigInt()) { 2780 2875 JSBigInt* result = JSBigInt::unaryMinus(vm, asBigInt(primValue)); 2781 arithProfile .observeResult(result);2876 arithProfile->observeResult(result); 2782 2877 2783 2878 return JSValue::encode(result); 2784 2879 } 2785 2880 2786 double number = primValue.toNumber( exec);2881 double number = primValue.toNumber(globalObject); 2787 2882 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2788 2883 JSValue result = jsNumber(-number); 2789 arithProfile .observeResult(result);2884 arithProfile->observeResult(result); 2790 2885 return JSValue::encode(result); 2791 2886 } 2792 2887 2793 EncodedJSValue JIT_OPERATION operationArithNegate(ExecState* exec, EncodedJSValue operand) 2794 { 2795 return unprofiledNegate(exec, operand); 2796 } 2797 2798 EncodedJSValue JIT_OPERATION operationArithNegateProfiled(ExecState* exec, EncodedJSValue operand, ArithProfile* arithProfile) 2799 { 2800 ASSERT(arithProfile); 2801 return profiledNegate(exec, operand, *arithProfile); 2802 } 2803 2804 EncodedJSValue JIT_OPERATION operationArithNegateProfiledOptimize(ExecState* exec, EncodedJSValue encodedOperand, JITNegIC* negIC) 2805 { 2806 VM& vm = exec->vm(); 2807 auto scope = DECLARE_THROW_SCOPE(vm); 2808 NativeCallFrameTracer tracer(vm, exec); 2888 EncodedJSValue JIT_OPERATION operationArithNegateProfiledOptimize(JSGlobalObject* globalObject, EncodedJSValue encodedOperand, JITNegIC* negIC) 2889 { 2890 VM& vm = globalObject->vm(); 2891 auto scope = DECLARE_THROW_SCOPE(vm); 2892 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2893 NativeCallFrameTracer tracer(vm, callFrame); 2809 2894 2810 2895 JSValue operand = JSValue::decode(encodedOperand); … … 2813 2898 ASSERT(arithProfile); 2814 2899 arithProfile->observeLHS(operand); 2815 negIC->generateOutOfLine( exec->codeBlock(), operationArithNegateProfiled);2900 negIC->generateOutOfLine(callFrame->codeBlock(), operationArithNegateProfiled); 2816 2901 2817 2902 #if ENABLE(MATH_IC_STATS) 2818 exec->codeBlock()->dumpMathICStats();2903 callFrame->codeBlock()->dumpMathICStats(); 2819 2904 #endif 2820 2905 2821 JSValue primValue = operand.toPrimitive( exec);2906 JSValue primValue = operand.toPrimitive(globalObject); 2822 2907 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2823 2908 … … 2828 2913 } 2829 2914 2830 double number = primValue.toNumber( exec);2915 double number = primValue.toNumber(globalObject); 2831 2916 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2832 2917 JSValue result = jsNumber(-number); … … 2835 2920 } 2836 2921 2837 EncodedJSValue JIT_OPERATION operationArithNegateOptimize(ExecState* exec, EncodedJSValue encodedOperand, JITNegIC* negIC) 2838 { 2839 VM& vm = exec->vm(); 2840 auto scope = DECLARE_THROW_SCOPE(vm); 2841 NativeCallFrameTracer tracer(vm, exec); 2922 EncodedJSValue JIT_OPERATION operationArithNegateOptimize(JSGlobalObject* globalObject, EncodedJSValue encodedOperand, JITNegIC* negIC) 2923 { 2924 VM& vm = globalObject->vm(); 2925 auto scope = DECLARE_THROW_SCOPE(vm); 2926 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2927 NativeCallFrameTracer tracer(vm, callFrame); 2842 2928 2843 2929 JSValue operand = JSValue::decode(encodedOperand); … … 2845 2931 if (ArithProfile* arithProfile = negIC->arithProfile()) 2846 2932 arithProfile->observeLHS(operand); 2847 negIC->generateOutOfLine( exec->codeBlock(), operationArithNegate);2933 negIC->generateOutOfLine(callFrame->codeBlock(), operationArithNegate); 2848 2934 2849 2935 #if ENABLE(MATH_IC_STATS) 2850 exec->codeBlock()->dumpMathICStats();2936 callFrame->codeBlock()->dumpMathICStats(); 2851 2937 #endif 2852 2938 2853 JSValue primValue = operand.toPrimitive( exec);2939 JSValue primValue = operand.toPrimitive(globalObject); 2854 2940 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2855 2941 … … 2857 2943 return JSValue::encode(JSBigInt::unaryMinus(vm, asBigInt(primValue))); 2858 2944 2859 double number = primValue.toNumber( exec);2945 double number = primValue.toNumber(globalObject); 2860 2946 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2861 2947 return JSValue::encode(jsNumber(-number)); 2862 2948 } 2863 2949 2864 ALWAYS_INLINE static EncodedJSValue unprofiledSub( ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2)2950 ALWAYS_INLINE static EncodedJSValue unprofiledSub(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 2865 2951 { 2866 2952 JSValue op1 = JSValue::decode(encodedOp1); 2867 2953 JSValue op2 = JSValue::decode(encodedOp2); 2868 2954 2869 return JSValue::encode(jsSub( exec, op1, op2));2870 } 2871 2872 ALWAYS_INLINE static EncodedJSValue profiledSub(VM& vm, ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile& arithProfile, bool shouldObserveLHSAndRHSTypes = true)2955 return JSValue::encode(jsSub(globalObject, op1, op2)); 2956 } 2957 2958 ALWAYS_INLINE static EncodedJSValue profiledSub(VM& vm, JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile& arithProfile, bool shouldObserveLHSAndRHSTypes = true) 2873 2959 { 2874 2960 auto scope = DECLARE_THROW_SCOPE(vm); … … 2880 2966 arithProfile.observeLHSAndRHS(op1, op2); 2881 2967 2882 JSValue result = jsSub( exec, op1, op2);2968 JSValue result = jsSub(globalObject, op1, op2); 2883 2969 RETURN_IF_EXCEPTION(scope, encodedJSValue()); 2884 2970 arithProfile.observeResult(result); … … 2886 2972 } 2887 2973 2888 EncodedJSValue JIT_OPERATION operationValueSub(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 2889 { 2890 VM& vm = exec->vm(); 2891 NativeCallFrameTracer tracer(vm, exec); 2892 return unprofiledSub(exec, encodedOp1, encodedOp2); 2893 } 2894 2895 EncodedJSValue JIT_OPERATION operationValueSubProfiled(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile* arithProfile) 2974 EncodedJSValue JIT_OPERATION operationValueSub(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2) 2975 { 2976 VM& vm = globalObject->vm(); 2977 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2978 NativeCallFrameTracer tracer(vm, callFrame); 2979 return unprofiledSub(globalObject, encodedOp1, encodedOp2); 2980 } 2981 2982 EncodedJSValue JIT_OPERATION operationValueSubProfiled(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile* arithProfile) 2896 2983 { 2897 2984 ASSERT(arithProfile); 2898 2985 2899 VM& vm = exec->vm(); 2900 NativeCallFrameTracer tracer(vm, exec); 2901 2902 return profiledSub(vm, exec, encodedOp1, encodedOp2, *arithProfile); 2903 } 2904 2905 EncodedJSValue JIT_OPERATION operationValueSubOptimize(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITSubIC* subIC) 2906 { 2907 VM& vm = exec->vm(); 2908 NativeCallFrameTracer tracer(vm, exec); 2986 VM& vm = globalObject->vm(); 2987 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2988 NativeCallFrameTracer tracer(vm, callFrame); 2989 2990 return profiledSub(vm, globalObject, encodedOp1, encodedOp2, *arithProfile); 2991 } 2992 2993 EncodedJSValue JIT_OPERATION operationValueSubOptimize(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITSubIC* subIC) 2994 { 2995 VM& vm = globalObject->vm(); 2996 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 2997 NativeCallFrameTracer tracer(vm, callFrame); 2909 2998 2910 2999 auto nonOptimizeVariant = operationValueSubNoOptimize; 2911 3000 if (ArithProfile* arithProfile = subIC->arithProfile()) 2912 3001 arithProfile->observeLHSAndRHS(JSValue::decode(encodedOp1), JSValue::decode(encodedOp2)); 2913 subIC->generateOutOfLine( exec->codeBlock(), nonOptimizeVariant);3002 subIC->generateOutOfLine(callFrame->codeBlock(), nonOptimizeVariant); 2914 3003 2915 3004 #if ENABLE(MATH_IC_STATS) 2916 exec->codeBlock()->dumpMathICStats();3005 callFrame->codeBlock()->dumpMathICStats(); 2917 3006 #endif 2918 3007 2919 return unprofiledSub(exec, encodedOp1, encodedOp2); 2920 } 2921 2922 EncodedJSValue JIT_OPERATION operationValueSubNoOptimize(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITSubIC*) 2923 { 2924 VM& vm = exec->vm(); 2925 NativeCallFrameTracer tracer(vm, exec); 2926 2927 return unprofiledSub(exec, encodedOp1, encodedOp2); 2928 } 2929 2930 EncodedJSValue JIT_OPERATION operationValueSubProfiledOptimize(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITSubIC* subIC) 2931 { 2932 VM& vm = exec->vm(); 2933 NativeCallFrameTracer tracer(vm, exec); 3008 return unprofiledSub(globalObject, encodedOp1, encodedOp2); 3009 } 3010 3011 EncodedJSValue JIT_OPERATION operationValueSubNoOptimize(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITSubIC*) 3012 { 3013 VM& vm = globalObject->vm(); 3014 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 3015 NativeCallFrameTracer tracer(vm, callFrame); 3016 3017 return unprofiledSub(globalObject, encodedOp1, encodedOp2); 3018 } 3019 3020 EncodedJSValue JIT_OPERATION operationValueSubProfiledOptimize(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITSubIC* subIC) 3021 { 3022 VM& vm = globalObject->vm(); 3023 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 3024 NativeCallFrameTracer tracer(vm, callFrame); 2934 3025 2935 3026 ArithProfile* arithProfile = subIC->arithProfile(); … … 2937 3028 arithProfile->observeLHSAndRHS(JSValue::decode(encodedOp1), JSValue::decode(encodedOp2)); 2938 3029 auto nonOptimizeVariant = operationValueSubProfiledNoOptimize; 2939 subIC->generateOutOfLine( exec->codeBlock(), nonOptimizeVariant);3030 subIC->generateOutOfLine(callFrame->codeBlock(), nonOptimizeVariant); 2940 3031 2941 3032 #if ENABLE(MATH_IC_STATS) 2942 exec->codeBlock()->dumpMathICStats();3033 callFrame->codeBlock()->dumpMathICStats(); 2943 3034 #endif 2944 3035 2945 return profiledSub(vm, exec, encodedOp1, encodedOp2, *arithProfile, false); 2946 } 2947 2948 EncodedJSValue JIT_OPERATION operationValueSubProfiledNoOptimize(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITSubIC* subIC) 2949 { 2950 VM& vm = exec->vm(); 2951 NativeCallFrameTracer tracer(vm, exec); 3036 return profiledSub(vm, globalObject, encodedOp1, encodedOp2, *arithProfile, false); 3037 } 3038 3039 EncodedJSValue JIT_OPERATION operationValueSubProfiledNoOptimize(JSGlobalObject* globalObject, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITSubIC* subIC) 3040 { 3041 VM& vm = globalObject->vm(); 3042 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 3043 NativeCallFrameTracer tracer(vm, callFrame); 2952 3044 2953 3045 ArithProfile* arithProfile = subIC->arithProfile(); 2954 3046 ASSERT(arithProfile); 2955 return profiledSub(vm, exec, encodedOp1, encodedOp2, *arithProfile); 2956 } 2957 2958 void JIT_OPERATION operationProcessTypeProfilerLog(ExecState* exec) 2959 { 2960 VM& vm = exec->vm(); 2961 NativeCallFrameTracer tracer(vm, exec); 3047 return profiledSub(vm, globalObject, encodedOp1, encodedOp2, *arithProfile); 3048 } 3049 3050 void JIT_OPERATION operationProcessTypeProfilerLog(VM* vmPointer) 3051 { 3052 VM& vm = *vmPointer; 3053 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 3054 NativeCallFrameTracer tracer(vm, callFrame); 2962 3055 vm.typeProfilerLog()->processLogEntries(vm, "Log Full, called from inside baseline JIT"_s); 2963 3056 } 2964 3057 2965 void JIT_OPERATION operationProcessShadowChickenLog(ExecState* exec) 2966 { 2967 VM& vm = exec->vm(); 2968 NativeCallFrameTracer tracer(vm, exec); 3058 void JIT_OPERATION operationProcessShadowChickenLog(VM* vmPointer) 3059 { 3060 VM& vm = *vmPointer; 3061 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 3062 NativeCallFrameTracer tracer(vm, callFrame); 2969 3063 RELEASE_ASSERT(vm.shadowChicken()); 2970 vm.shadowChicken()->update(vm, exec); 2971 } 2972 2973 int32_t JIT_OPERATION operationCheckIfExceptionIsUncatchableAndNotifyProfiler(ExecState* exec) 2974 { 2975 VM& vm = exec->vm(); 2976 NativeCallFrameTracer tracer(vm, exec); 3064 vm.shadowChicken()->update(vm, callFrame); 3065 } 3066 3067 int32_t JIT_OPERATION operationCheckIfExceptionIsUncatchableAndNotifyProfiler(VM* vmPointer) 3068 { 3069 VM& vm = *vmPointer; 3070 CallFrame* callFrame = DECLARE_CALL_FRAME(vm); 3071 NativeCallFrameTracer tracer(vm, callFrame); 2977 3072 auto scope = DECLARE_THROW_SCOPE(vm); 2978 3073 RELEASE_ASSERT(!!scope.exception()); 2979 3074 2980 3075 if (isTerminatedExecutionException(vm, scope.exception())) { 2981 genericUnwind(vm, exec);3076 genericUnwind(vm, callFrame); 2982 3077 return 1; 2983 3078 } … … 2989 3084 } // namespace JSC 2990 3085 3086 IGNORE_WARNINGS_END 3087 2991 3088 #endif // ENABLE(JIT)
Note:
See TracChangeset
for help on using the changeset viewer.