Changeset 128096 in webkit for trunk/Source/JavaScriptCore/bytecompiler
- Timestamp:
- Sep 10, 2012, 1:23:50 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore/bytecompiler
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r127987 r128096 273 273 , m_codeBlock(codeBlock) 274 274 , m_thisRegister(CallFrame::thisArgumentOffset()) 275 , m_emptyValueRegister(0) 275 276 , m_finallyDepth(0) 276 277 , m_dynamicScopeDepth(0) … … 354 355 , m_codeBlock(codeBlock) 355 356 , m_activationRegister(0) 357 , m_emptyValueRegister(0) 356 358 , m_finallyDepth(0) 357 359 , m_dynamicScopeDepth(0) … … 387 389 } 388 390 389 // Both op_tear_off_activation and op_tear_off_arguments tear off the 'arguments'390 // object, if created.391 391 if (m_codeBlock->needsFullScopeChain() || functionBody->usesArguments()) { 392 392 RegisterID* unmodifiedArgumentsRegister = addVar(); // Anonymous, so it can't be modified by user code. … … 527 527 , m_codeBlock(codeBlock) 528 528 , m_thisRegister(CallFrame::thisArgumentOffset()) 529 , m_emptyValueRegister(0) 529 530 , m_finallyDepth(0) 530 531 , m_dynamicScopeDepth(0) … … 1112 1113 } 1113 1114 1115 // We can't hash JSValue(), so we use a dedicated data member to cache it. 1116 RegisterID* BytecodeGenerator::addConstantEmptyValue() 1117 { 1118 if (!m_emptyValueRegister) { 1119 int index = m_nextConstantOffset; 1120 m_constantPoolRegisters.append(FirstConstantRegisterIndex + m_nextConstantOffset); 1121 ++m_nextConstantOffset; 1122 m_codeBlock->addConstant(JSValue()); 1123 m_emptyValueRegister = &m_constantPoolRegisters[index]; 1124 } 1125 1126 return m_emptyValueRegister; 1127 } 1128 1114 1129 RegisterID* BytecodeGenerator::addConstantValue(JSValue v) 1115 1130 { 1131 if (!v) 1132 return addConstantEmptyValue(); 1133 1116 1134 int index = m_nextConstantOffset; 1117 1118 1135 JSValueMap::AddResult result = m_jsValueMap.add(JSValue::encode(v), m_nextConstantOffset); 1119 1136 if (result.isNewEntry) { 1120 1137 m_constantPoolRegisters.append(FirstConstantRegisterIndex + m_nextConstantOffset); 1121 1138 ++m_nextConstantOffset; 1122 m_codeBlock->addConstant( JSValue(v));1139 m_codeBlock->addConstant(v); 1123 1140 } else 1124 1141 index = result.iterator->second; 1125 1126 1142 return &m_constantPoolRegisters[index]; 1127 1143 } … … 2047 2063 emitOpcode(op_tear_off_activation); 2048 2064 instructions().append(m_activationRegister->index()); 2049 instructions().append(m_codeBlock->argumentsRegister()); 2050 } else if (m_codeBlock->usesArguments() && m_codeBlock->numParameters() != 1 && !m_codeBlock->isStrictMode()) { 2065 } 2066 2067 if (m_codeBlock->usesArguments() && m_codeBlock->numParameters() != 1 && !m_codeBlock->isStrictMode()) { 2051 2068 emitOpcode(op_tear_off_arguments); 2052 2069 instructions().append(m_codeBlock->argumentsRegister()); 2070 instructions().append(m_activationRegister ? m_activationRegister->index() : emitLoad(0, JSValue())->index()); 2053 2071 } 2054 2072 -
trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r127987 r128096 638 638 unsigned addConstant(const Identifier&); 639 639 RegisterID* addConstantValue(JSValue); 640 RegisterID* addConstantEmptyValue(); 640 641 unsigned addRegExp(RegExp*); 641 642 … … 714 715 RegisterID m_calleeRegister; 715 716 RegisterID* m_activationRegister; 717 RegisterID* m_emptyValueRegister; 716 718 SegmentedVector<RegisterID, 32> m_constantPoolRegisters; 717 719 SegmentedVector<RegisterID, 32> m_calleeRegisters;
Note:
See TracChangeset
for help on using the changeset viewer.