Changeset 251584 in webkit for trunk/Source/JavaScriptCore/interpreter
- Timestamp:
- Oct 24, 2019, 11:59:36 PM (6 years ago)
- Location:
- trunk/Source/JavaScriptCore/interpreter
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/interpreter/CallFrame.h
r251529 r251584 2 2 * Copyright (C) 1999-2001 Harri Porten ([email protected]) 3 3 * Copyright (C) 2001 Peter Kelly ([email protected]) 4 * Copyright (C) 2003-201 8Apple Inc. All rights reserved.4 * Copyright (C) 2003-2019 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 105 105 // to be a cell, however, there is a brief window where we need to check 106 106 // to see if it's a cell, and if it's not, we throw an exception. 107 JSValue guaranteedJSValueCallee() const 108 { 109 ASSERT(!callee().isWasm()); 110 return this[CallFrameSlot::callee].jsValue(); 111 } 112 JSObject* jsCallee() const 113 { 114 ASSERT(!callee().isWasm()); 115 return this[CallFrameSlot::callee].object(); 116 } 107 inline JSValue guaranteedJSValueCallee() const; 108 inline JSObject* jsCallee() const; 117 109 CalleeBits callee() const { return CalleeBits(this[CallFrameSlot::callee].pointer()); } 118 110 SUPPRESS_ASAN CalleeBits unsafeCallee() const { return CalleeBits(this[CallFrameSlot::callee].asanUnsafePointer()); } 119 CodeBlock* codeBlock() const { return this[CallFrameSlot::codeBlock].Register::codeBlock(); }111 CodeBlock* codeBlock() const; 120 112 CodeBlock** addressOfCodeBlock() const { return bitwise_cast<CodeBlock**>(this + CallFrameSlot::codeBlock); } 121 SUPPRESS_ASAN CodeBlock* unsafeCodeBlock() const { return this[CallFrameSlot::codeBlock].Register::asanUnsafeCodeBlock(); } 122 JSScope* scope(int scopeRegisterOffset) const 123 { 124 ASSERT(this[scopeRegisterOffset].Register::scope()); 125 return this[scopeRegisterOffset].Register::scope(); 126 } 113 inline SUPPRESS_ASAN CodeBlock* unsafeCodeBlock() const; 114 inline JSScope* scope(int scopeRegisterOffset) const; 127 115 128 116 JS_EXPORT_PRIVATE bool isAnyWasmCallee(); … … 184 172 JS_EXPORT_PRIVATE CodeOrigin codeOrigin(); 185 173 186 Register* topOfFrame() 187 { 188 if (!codeBlock()) 189 return registers(); 190 return topOfFrameInternal(); 191 } 174 inline Register* topOfFrame(); 192 175 193 176 const Instruction* currentVPC() const; // This only makes sense in the LLInt and baseline. … … 195 178 196 179 void setCallerFrame(CallFrame* frame) { callerFrameAndPC().callerFrame = frame; } 197 void setScope(int scopeRegisterOffset, JSScope* scope) { static_cast<Register*>(this)[scopeRegisterOffset] = scope; }180 inline void setScope(int scopeRegisterOffset, JSScope*); 198 181 199 182 static void initDeprecatedCallFrameForDebugger(CallFrame* globalExec, JSCallee* globalCallee); … … 270 253 271 254 void setArgumentCountIncludingThis(int count) { static_cast<Register*>(this)[CallFrameSlot::argumentCount].payload() = count; } 272 void setCallee(JSObject* callee) { static_cast<Register*>(this)[CallFrameSlot::callee] = callee; }273 void setCodeBlock(CodeBlock* codeBlock) { static_cast<Register*>(this)[CallFrameSlot::codeBlock] = codeBlock; }255 inline void setCallee(JSObject*); 256 inline void setCodeBlock(CodeBlock*); 274 257 void setReturnPC(void* value) { callerFrameAndPC().returnPC = reinterpret_cast<const Instruction*>(value); } 275 258 … … 324 307 }; 325 308 326 // Helper function to get VM& from JSGlobalObject* if JSGlobalObject.h is not included.327 VM& getVM(JSGlobalObject*);328 309 JS_EXPORT_PRIVATE bool isFromJSCode(void* returnAddress); 329 310 -
trunk/Source/JavaScriptCore/interpreter/CallFrameInlines.h
r243925 r251584 1 1 /* 2 * Copyright (C) 2018 Apple Inc. All rights reserved.2 * Copyright (C) 2018-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 #include "JSCallee.h" 30 30 #include "JSGlobalObject.h" 31 #include "RegisterInlines.h" 31 32 32 33 namespace JSC { 34 35 inline Register& CallFrame::r(int index) 36 { 37 CodeBlock* codeBlock = this->codeBlock(); 38 if (codeBlock->isConstantRegisterIndex(index)) 39 return *reinterpret_cast<Register*>(&codeBlock->constantRegister(index)); 40 return this[index]; 41 } 42 43 inline Register& CallFrame::r(VirtualRegister reg) 44 { 45 return r(reg.offset()); 46 } 47 48 inline Register& CallFrame::uncheckedR(int index) 49 { 50 RELEASE_ASSERT(index < FirstConstantRegisterIndex); 51 return this[index]; 52 } 53 54 inline Register& CallFrame::uncheckedR(VirtualRegister reg) 55 { 56 return uncheckedR(reg.offset()); 57 } 58 59 inline JSValue CallFrame::guaranteedJSValueCallee() const 60 { 61 ASSERT(!callee().isWasm()); 62 return this[CallFrameSlot::callee].jsValue(); 63 } 64 65 inline JSObject* CallFrame::jsCallee() const 66 { 67 ASSERT(!callee().isWasm()); 68 return this[CallFrameSlot::callee].object(); 69 } 70 71 inline CodeBlock* CallFrame::codeBlock() const 72 { 73 return this[CallFrameSlot::codeBlock].Register::codeBlock(); 74 } 75 76 inline SUPPRESS_ASAN CodeBlock* CallFrame::unsafeCodeBlock() const 77 { 78 return this[CallFrameSlot::codeBlock].Register::asanUnsafeCodeBlock(); 79 } 80 81 inline JSGlobalObject* CallFrame::lexicalGlobalObject(VM& vm) const 82 { 83 UNUSED_PARAM(vm); 84 #if ENABLE(WEBASSEMBLY) 85 if (callee().isWasm()) 86 return lexicalGlobalObjectFromWasmCallee(vm); 87 #endif 88 return jsCallee()->globalObject(); 89 } 33 90 34 91 inline bool CallFrame::isStackOverflowFrame() const … … 44 101 } 45 102 103 inline void CallFrame::setCallee(JSObject* callee) 104 { 105 static_cast<Register*>(this)[CallFrameSlot::callee] = callee; 106 } 107 108 inline void CallFrame::setCodeBlock(CodeBlock* codeBlock) 109 { 110 static_cast<Register*>(this)[CallFrameSlot::codeBlock] = codeBlock; 111 } 112 113 inline void CallFrame::setScope(int scopeRegisterOffset, JSScope* scope) 114 { 115 static_cast<Register*>(this)[scopeRegisterOffset] = scope; 116 } 117 118 inline JSScope* CallFrame::scope(int scopeRegisterOffset) const 119 { 120 ASSERT(this[scopeRegisterOffset].Register::scope()); 121 return this[scopeRegisterOffset].Register::scope(); 122 } 123 124 inline Register* CallFrame::topOfFrame() 125 { 126 if (!codeBlock()) 127 return registers(); 128 return topOfFrameInternal(); 129 } 130 46 131 } // namespace JSC -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r251529 r251584 67 67 #include "Parser.h" 68 68 #include "ProgramCodeBlock.h" 69 #include "ProtoCallFrame .h"69 #include "ProtoCallFrameInlines.h" 70 70 #include "RegExpObject.h" 71 71 #include "Register.h" -
trunk/Source/JavaScriptCore/interpreter/ProtoCallFrame.h
r250803 r251584 1 1 /* 2 * Copyright (C) 2013-201 8Apple Inc. All Rights Reserved.2 * Copyright (C) 2013-2019 Apple Inc. All Rights Reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 48 48 JSGlobalObject* globalObject; 49 49 50 void init(CodeBlock*, JSGlobalObject*, JSObject*, JSValue, int, JSValue* otherArgs = 0);50 inline void init(CodeBlock*, JSGlobalObject*, JSObject*, JSValue, int, JSValue* otherArgs = 0); 51 51 52 CodeBlock* codeBlock() const { return codeBlockValue.Register::codeBlock(); }53 void setCodeBlock(CodeBlock* codeBlock) { codeBlockValue = codeBlock; }52 inline CodeBlock* codeBlock() const; 53 inline void setCodeBlock(CodeBlock*); 54 54 55 JSObject* callee() const { return calleeValue.Register::object(); } 56 void setCallee(JSObject* callee) 57 { 58 calleeValue = callee; 59 } 55 inline JSObject* callee() const; 56 inline void setCallee(JSObject*); 60 57 void setGlobalObject(JSGlobalObject* object) 61 58 { … … 87 84 }; 88 85 89 inline void ProtoCallFrame::init(CodeBlock* codeBlock, JSGlobalObject* globalObject, JSObject* callee, JSValue thisValue, int argCountIncludingThis, JSValue* otherArgs)90 {91 this->args = otherArgs;92 this->setCodeBlock(codeBlock);93 this->setCallee(callee);94 this->setGlobalObject(globalObject);95 this->setArgumentCountIncludingThis(argCountIncludingThis);96 if (codeBlock && argCountIncludingThis < codeBlock->numParameters())97 this->hasArityMismatch = true;98 else99 this->hasArityMismatch = false;100 101 // Round up argCountIncludingThis to keep the stack frame size aligned.102 size_t paddedArgsCount = roundArgumentCountToAlignFrame(argCountIncludingThis);103 this->setPaddedArgCount(paddedArgsCount);104 this->clearCurrentVPC();105 this->setThisValue(thisValue);106 }107 108 86 } // namespace JSC -
trunk/Source/JavaScriptCore/interpreter/Register.h
r251425 r251584 1 1 /* 2 * Copyright (C) 2008-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2008-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 52 52 EncodedJSValue encodedJSValue() const; 53 53 54 Register& operator=(CallFrame*);55 Register& operator=(CodeBlock*);56 Register& operator=(JSScope*);57 Register& operator=(JSObject*);54 ALWAYS_INLINE Register& operator=(CallFrame*); 55 ALWAYS_INLINE Register& operator=(CodeBlock*); 56 ALWAYS_INLINE Register& operator=(JSScope*); 57 ALWAYS_INLINE Register& operator=(JSObject*); 58 58 59 59 int32_t i() const; 60 CallFrame* callFrame() const;61 CodeBlock* codeBlock() const;62 CodeBlock* asanUnsafeCodeBlock() const;63 JSObject* object() const;64 JSScope* scope() const;60 ALWAYS_INLINE CallFrame* callFrame() const; 61 ALWAYS_INLINE CodeBlock* codeBlock() const; 62 ALWAYS_INLINE CodeBlock* asanUnsafeCodeBlock() const; 63 ALWAYS_INLINE JSObject* object() const; 64 ALWAYS_INLINE JSScope* scope() const; 65 65 int32_t unboxedInt32() const; 66 66 int32_t asanUnsafeUnboxedInt32() const; … … 137 137 // Interpreter functions 138 138 139 ALWAYS_INLINE Register& Register::operator=(CallFrame* callFrame)140 {141 u.callFrame = callFrame;142 return *this;143 }144 145 ALWAYS_INLINE Register& Register::operator=(CodeBlock* codeBlock)146 {147 u.codeBlock = codeBlock;148 return *this;149 }150 151 139 ALWAYS_INLINE int32_t Register::i() const 152 140 { … … 154 142 } 155 143 156 ALWAYS_INLINE CallFrame* Register::callFrame() const157 {158 return u.callFrame;159 }160 161 ALWAYS_INLINE CodeBlock* Register::codeBlock() const162 {163 return u.codeBlock;164 }165 166 SUPPRESS_ASAN ALWAYS_INLINE CodeBlock* Register::asanUnsafeCodeBlock() const167 {168 return u.codeBlock;169 }170 171 144 ALWAYS_INLINE int32_t Register::unboxedInt32() const 172 145 { -
trunk/Source/JavaScriptCore/interpreter/StackVisitor.cpp
r251529 r251584 27 27 #include "StackVisitor.h" 28 28 29 #include "CallFrameInlines.h"30 29 #include "ClonedArguments.h" 31 30 #include "DebuggerPrimitives.h"
Note:
See TracChangeset
for help on using the changeset viewer.