Changeset 39070 in webkit for trunk/JavaScriptCore
- Timestamp:
- Dec 6, 2008, 2:01:05 PM (16 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r39063 r39070 1 2008-12-05 Sam Weinig <[email protected]> 2 3 Reviewed by Cameron Zwarich. 4 5 Fix for https://bugs.webkit.org/show_bug.cgi?id=22715 6 Encapsulate more CodeBlock members in preparation 7 of moving some of them to a rare data structure. 8 9 * bytecode/CodeBlock.cpp: 10 (JSC::locationForOffset): 11 (JSC::printConditionalJump): 12 (JSC::printGetByIdOp): 13 (JSC::printPutByIdOp): 14 (JSC::CodeBlock::printStructure): 15 (JSC::CodeBlock::printStructures): 16 (JSC::CodeBlock::dump): 17 (JSC::CodeBlock::~CodeBlock): 18 (JSC::CodeBlock::unlinkCallers): 19 (JSC::CodeBlock::derefStructures): 20 (JSC::CodeBlock::refStructures): 21 (JSC::CodeBlock::mark): 22 (JSC::CodeBlock::getHandlerForVPC): 23 (JSC::CodeBlock::nativeExceptionCodeForHandlerVPC): 24 (JSC::CodeBlock::lineNumberForVPC): 25 (JSC::CodeBlock::expressionRangeForVPC): 26 (JSC::CodeBlock::shrinkToFit): 27 * bytecode/CodeBlock.h: 28 (JSC::CodeBlock::CodeBlock): 29 (JSC::CodeBlock::addCaller): 30 (JSC::CodeBlock::removeCaller): 31 (JSC::CodeBlock::isKnownNotImmediate): 32 (JSC::CodeBlock::isConstantRegisterIndex): 33 (JSC::CodeBlock::getConstant): 34 (JSC::CodeBlock::isTemporaryRegisterIndex): 35 (JSC::CodeBlock::getStubInfo): 36 (JSC::CodeBlock::getCallLinkInfo): 37 (JSC::CodeBlock::instructions): 38 (JSC::CodeBlock::setJITCode): 39 (JSC::CodeBlock::jitCode): 40 (JSC::CodeBlock::ownerNode): 41 (JSC::CodeBlock::setGlobalData): 42 (JSC::CodeBlock::setThisRegister): 43 (JSC::CodeBlock::thisRegister): 44 (JSC::CodeBlock::setNeedsFullScopeChain): 45 (JSC::CodeBlock::needsFullScopeChain): 46 (JSC::CodeBlock::setUsesEval): 47 (JSC::CodeBlock::usesEval): 48 (JSC::CodeBlock::setUsesArguments): 49 (JSC::CodeBlock::usesArguments): 50 (JSC::CodeBlock::codeType): 51 (JSC::CodeBlock::source): 52 (JSC::CodeBlock::sourceOffset): 53 (JSC::CodeBlock::addGlobalResolveInstruction): 54 (JSC::CodeBlock::numberOfPropertyAccessInstructions): 55 (JSC::CodeBlock::addPropertyAccessInstruction): 56 (JSC::CodeBlock::propertyAccessInstruction): 57 (JSC::CodeBlock::numberOfCallLinkInfos): 58 (JSC::CodeBlock::addCallLinkInfo): 59 (JSC::CodeBlock::callLinkInfo): 60 (JSC::CodeBlock::numberOfJumpTargets): 61 (JSC::CodeBlock::addJumpTarget): 62 (JSC::CodeBlock::jumpTarget): 63 (JSC::CodeBlock::lastJumpTarget): 64 (JSC::CodeBlock::numberOfExceptionHandlers): 65 (JSC::CodeBlock::addExceptionHandler): 66 (JSC::CodeBlock::exceptionHandler): 67 (JSC::CodeBlock::addExpressionInfo): 68 (JSC::CodeBlock::numberOfLineInfos): 69 (JSC::CodeBlock::addLineInfo): 70 (JSC::CodeBlock::lastLineInfo): 71 (JSC::CodeBlock::jitReturnAddressVPCMap): 72 (JSC::CodeBlock::numberOfIdentifiers): 73 (JSC::CodeBlock::addIdentifier): 74 (JSC::CodeBlock::identifier): 75 (JSC::CodeBlock::numberOfConstantRegisters): 76 (JSC::CodeBlock::addConstantRegister): 77 (JSC::CodeBlock::constantRegister): 78 (JSC::CodeBlock::addFunction): 79 (JSC::CodeBlock::function): 80 (JSC::CodeBlock::addFunctionExpression): 81 (JSC::CodeBlock::functionExpression): 82 (JSC::CodeBlock::addUnexpectedConstant): 83 (JSC::CodeBlock::unexpectedConstant): 84 (JSC::CodeBlock::addRegExp): 85 (JSC::CodeBlock::regexp): 86 (JSC::CodeBlock::symbolTable): 87 (JSC::CodeBlock::evalCodeCache): 88 New inline setters/getters. 89 90 (JSC::ProgramCodeBlock::ProgramCodeBlock): 91 (JSC::ProgramCodeBlock::~ProgramCodeBlock): 92 (JSC::ProgramCodeBlock::clearGlobalObject): 93 * bytecode/SamplingTool.cpp: 94 (JSC::ScopeSampleRecord::sample): 95 (JSC::SamplingTool::dump): 96 * bytecompiler/BytecodeGenerator.cpp: 97 * bytecompiler/BytecodeGenerator.h: 98 * bytecompiler/Label.h: 99 * interpreter/CallFrame.cpp: 100 * interpreter/Interpreter.cpp: 101 * jit/JIT.cpp: 102 * jit/JITCall.cpp: 103 * jit/JITInlineMethods.h: 104 * jit/JITPropertyAccess.cpp: 105 * parser/Nodes.cpp: 106 * runtime/Arguments.h: 107 * runtime/ExceptionHelpers.cpp: 108 * runtime/JSActivation.cpp: 109 * runtime/JSActivation.h: 110 * runtime/JSGlobalObject.cpp: 111 Change direct access to use new getter/setters. 112 1 113 2008-12-05 Gavin Barraclough <[email protected]> 2 114 -
trunk/JavaScriptCore/bytecode/CodeBlock.cpp
r39038 r39070 128 128 } 129 129 130 static int jumpTarget(const Vector<Instruction>::const_iterator& begin, Vector<Instruction>::const_iterator& it, int offset)130 static int locationForOffset(const Vector<Instruction>::const_iterator& begin, Vector<Instruction>::const_iterator& it, int offset) 131 131 { 132 132 return it - begin + offset; … … 153 153 int r0 = (++it)->u.operand; 154 154 int offset = (++it)->u.operand; 155 printf("[%4d] %s\t\t %s, %d(->%d)\n", location, op, registerName(r0).c_str(), offset, jumpTarget(begin, it, offset));156 } 157 158 static void printGetByIdOp(int location, Vector<Instruction>::const_iterator& it, const Vector<Identifier>& identifiers, const char* op)155 printf("[%4d] %s\t\t %s, %d(->%d)\n", location, op, registerName(r0).c_str(), offset, locationForOffset(begin, it, offset)); 156 } 157 158 static void printGetByIdOp(int location, Vector<Instruction>::const_iterator& it, const Vector<Identifier>& m_identifiers, const char* op) 159 159 { 160 160 int r0 = (++it)->u.operand; 161 161 int r1 = (++it)->u.operand; 162 162 int id0 = (++it)->u.operand; 163 printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, identifiers[id0]).c_str());163 printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); 164 164 it += 4; 165 165 } 166 166 167 static void printPutByIdOp(int location, Vector<Instruction>::const_iterator& it, const Vector<Identifier>& identifiers, const char* op)167 static void printPutByIdOp(int location, Vector<Instruction>::const_iterator& it, const Vector<Identifier>& m_identifiers, const char* op) 168 168 { 169 169 int r0 = (++it)->u.operand; 170 170 int id0 = (++it)->u.operand; 171 171 int r1 = (++it)->u.operand; 172 printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), registerName(r1).c_str());172 printf("[%4d] %s\t %s, %s, %s\n", location, op, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(r1).c_str()); 173 173 it += 4; 174 174 } … … 176 176 void CodeBlock::printStructure(const char* name, const Instruction* vPC, int operand) const 177 177 { 178 unsigned instructionOffset = vPC - instructions.begin();178 unsigned instructionOffset = vPC - m_instructions.begin(); 179 179 printf(" [%4d] %s: %s\n", instructionOffset, name, pointerToSourceString(vPC[operand].u.structure).UTF8String().c_str()); 180 180 } … … 182 182 void CodeBlock::printStructures(const Instruction* vPC) const 183 183 { 184 Interpreter* interpreter = globalData->interpreter;185 unsigned instructionOffset = vPC - instructions.begin();184 Interpreter* interpreter = m_globalData->interpreter; 185 unsigned instructionOffset = vPC - m_instructions.begin(); 186 186 187 187 if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id)) { … … 218 218 } 219 219 220 // These instructions doesn't ref Structures.220 // These m_instructions doesn't ref Structures. 221 221 ASSERT(vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_generic) || vPC[0].u.opcode == interpreter->getOpcode(op_call) || vPC[0].u.opcode == interpreter->getOpcode(op_call_eval) || vPC[0].u.opcode == interpreter->getOpcode(op_construct)); 222 222 } … … 224 224 void CodeBlock::dump(ExecState* exec) const 225 225 { 226 Vector<Instruction>::const_iterator begin = instructions.begin();227 Vector<Instruction>::const_iterator end = instructions.end();226 Vector<Instruction>::const_iterator begin = m_instructions.begin(); 227 Vector<Instruction>::const_iterator end = m_instructions.end(); 228 228 229 229 size_t instructionCount = 0; … … 232 232 ++instructionCount; 233 233 234 printf("%lu instructions; %lu bytes at %p; %d parameter(s); %d callee register(s)\n\n",234 printf("%lu m_instructions; %lu bytes at %p; %d parameter(s); %d callee register(s)\n\n", 235 235 static_cast<unsigned long>(instructionCount), 236 static_cast<unsigned long>( instructions.size() * sizeof(Instruction)),237 this, numParameters,numCalleeRegisters);236 static_cast<unsigned long>(m_instructions.size() * sizeof(Instruction)), 237 this, m_numParameters, m_numCalleeRegisters); 238 238 239 239 for (Vector<Instruction>::const_iterator it = begin; it != end; ++it) 240 240 dump(exec, begin, it); 241 241 242 if ( identifiers.size()) {242 if (!m_identifiers.isEmpty()) { 243 243 printf("\nIdentifiers:\n"); 244 244 size_t i = 0; 245 245 do { 246 printf(" id%u = %s\n", static_cast<unsigned>(i), identifiers[i].ascii());246 printf(" id%u = %s\n", static_cast<unsigned>(i), m_identifiers[i].ascii()); 247 247 ++i; 248 } while (i != identifiers.size());249 } 250 251 if ( constantRegisters.size()) {248 } while (i != m_identifiers.size()); 249 } 250 251 if (!m_constantRegisters.isEmpty()) { 252 252 printf("\nConstants:\n"); 253 unsigned registerIndex = numVars;253 unsigned registerIndex = m_numVars; 254 254 size_t i = 0; 255 255 do { 256 printf(" r%u = %s\n", registerIndex, valueToSourceString(exec, constantRegisters[i].jsValue(exec)).ascii());256 printf(" r%u = %s\n", registerIndex, valueToSourceString(exec, m_constantRegisters[i].jsValue(exec)).ascii()); 257 257 ++i; 258 258 ++registerIndex; 259 } while (i < constantRegisters.size());260 } 261 262 if ( unexpectedConstants.size()) {259 } while (i < m_constantRegisters.size()); 260 } 261 262 if (!m_unexpectedConstants.isEmpty()) { 263 263 printf("\nUnexpected Constants:\n"); 264 264 size_t i = 0; 265 265 do { 266 printf(" k%u = %s\n", static_cast<unsigned>(i), valueToSourceString(exec, unexpectedConstants[i]).ascii());266 printf(" k%u = %s\n", static_cast<unsigned>(i), valueToSourceString(exec, m_unexpectedConstants[i]).ascii()); 267 267 ++i; 268 } while (i < unexpectedConstants.size());268 } while (i < m_unexpectedConstants.size()); 269 269 } 270 270 271 if ( regexps.size()) {272 printf("\n RegExps:\n");271 if (!m_regexps.isEmpty()) { 272 printf("\nm_regexps:\n"); 273 273 size_t i = 0; 274 274 do { 275 printf(" re%u = %s\n", static_cast<unsigned>(i), regexpToSourceString( regexps[i].get()).ascii());275 printf(" re%u = %s\n", static_cast<unsigned>(i), regexpToSourceString(m_regexps[i].get()).ascii()); 276 276 ++i; 277 } while (i < regexps.size());278 } 279 280 if ( globalResolveInstructions.size() || propertyAccessInstructions.size())277 } while (i < m_regexps.size()); 278 } 279 280 if (!m_globalResolveInstructions.isEmpty() || !m_propertyAccessInstructions.isEmpty()) 281 281 printf("\nStructures:\n"); 282 282 283 if ( globalResolveInstructions.size()) {283 if (!m_globalResolveInstructions.isEmpty()) { 284 284 size_t i = 0; 285 285 do { 286 printStructures(& instructions[globalResolveInstructions[i]]);286 printStructures(&m_instructions[m_globalResolveInstructions[i]]); 287 287 ++i; 288 } while (i < globalResolveInstructions.size());289 } 290 if ( propertyAccessInstructions.size()) {288 } while (i < m_globalResolveInstructions.size()); 289 } 290 if (!m_propertyAccessInstructions.isEmpty()) { 291 291 size_t i = 0; 292 292 do { 293 printStructures(& instructions[propertyAccessInstructions[i].bytecodeIndex]);293 printStructures(&m_instructions[m_propertyAccessInstructions[i].bytecodeIndex]); 294 294 ++i; 295 } while (i < propertyAccessInstructions.size());295 } while (i < m_propertyAccessInstructions.size()); 296 296 } 297 297 298 if ( exceptionHandlers.size()) {298 if (!m_exceptionHandlers.isEmpty()) { 299 299 printf("\nException Handlers:\n"); 300 300 unsigned i = 0; 301 301 do { 302 printf("\t %d: { start: [%4d] end: [%4d] target: [%4d] }\n", i + 1, exceptionHandlers[i].start, exceptionHandlers[i].end,exceptionHandlers[i].target);302 printf("\t %d: { start: [%4d] end: [%4d] target: [%4d] }\n", i + 1, m_exceptionHandlers[i].start, m_exceptionHandlers[i].end, m_exceptionHandlers[i].target); 303 303 ++i; 304 } while (i < exceptionHandlers.size());304 } while (i < m_exceptionHandlers.size()); 305 305 } 306 306 … … 382 382 int r0 = (++it)->u.operand; 383 383 int k0 = (++it)->u.operand; 384 printf("[%4d] unexpected_load\t %s, %s\n", location, registerName(r0).c_str(), constantName(exec, k0, unexpectedConstants[k0]).c_str());384 printf("[%4d] unexpected_load\t %s, %s\n", location, registerName(r0).c_str(), constantName(exec, k0, m_unexpectedConstants[k0]).c_str()); 385 385 break; 386 386 } … … 400 400 int r0 = (++it)->u.operand; 401 401 int re0 = (++it)->u.operand; 402 printf("[%4d] new_regexp\t %s, %s\n", location, registerName(r0).c_str(), regexpName(re0, regexps[re0].get()).c_str());402 printf("[%4d] new_regexp\t %s, %s\n", location, registerName(r0).c_str(), regexpName(re0, m_regexps[re0].get()).c_str()); 403 403 break; 404 404 } … … 568 568 int r0 = (++it)->u.operand; 569 569 int id0 = (++it)->u.operand; 570 printf("[%4d] resolve\t\t %s, %s\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str());570 printf("[%4d] resolve\t\t %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str()); 571 571 break; 572 572 } … … 575 575 int id0 = (++it)->u.operand; 576 576 int skipLevels = (++it)->u.operand; 577 printf("[%4d] resolve_skip\t %s, %s, %d\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), skipLevels);577 printf("[%4d] resolve_skip\t %s, %s, %d\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), skipLevels); 578 578 break; 579 579 } … … 582 582 JSValue* scope = static_cast<JSValue*>((++it)->u.jsCell); 583 583 int id0 = (++it)->u.operand; 584 printf("[%4d] resolve_global\t %s, %s, %s\n", location, registerName(r0).c_str(), valueToSourceString(exec, scope).ascii(), idName(id0, identifiers[id0]).c_str());584 printf("[%4d] resolve_global\t %s, %s, %s\n", location, registerName(r0).c_str(), valueToSourceString(exec, scope).ascii(), idName(id0, m_identifiers[id0]).c_str()); 585 585 it += 2; 586 586 break; … … 617 617 int r0 = (++it)->u.operand; 618 618 int id0 = (++it)->u.operand; 619 printf("[%4d] resolve_base\t %s, %s\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str());619 printf("[%4d] resolve_base\t %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str()); 620 620 break; 621 621 } … … 624 624 int r1 = (++it)->u.operand; 625 625 int id0 = (++it)->u.operand; 626 printf("[%4d] resolve_with_base %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, identifiers[id0]).c_str());626 printf("[%4d] resolve_with_base %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); 627 627 break; 628 628 } … … 631 631 int r1 = (++it)->u.operand; 632 632 int id0 = (++it)->u.operand; 633 printf("[%4d] resolve_func\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, identifiers[id0]).c_str());633 printf("[%4d] resolve_func\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); 634 634 break; 635 635 } 636 636 case op_get_by_id: { 637 printGetByIdOp(location, it, identifiers, "get_by_id");637 printGetByIdOp(location, it, m_identifiers, "get_by_id"); 638 638 break; 639 639 } 640 640 case op_get_by_id_self: { 641 printGetByIdOp(location, it, identifiers, "get_by_id_self");641 printGetByIdOp(location, it, m_identifiers, "get_by_id_self"); 642 642 break; 643 643 } 644 644 case op_get_by_id_self_list: { 645 printGetByIdOp(location, it, identifiers, "get_by_id_self_list");645 printGetByIdOp(location, it, m_identifiers, "get_by_id_self_list"); 646 646 break; 647 647 } 648 648 case op_get_by_id_proto: { 649 printGetByIdOp(location, it, identifiers, "get_by_id_proto");649 printGetByIdOp(location, it, m_identifiers, "get_by_id_proto"); 650 650 break; 651 651 } 652 652 case op_get_by_id_proto_list: { 653 printGetByIdOp(location, it, identifiers, "op_get_by_id_proto_list");653 printGetByIdOp(location, it, m_identifiers, "op_get_by_id_proto_list"); 654 654 break; 655 655 } 656 656 case op_get_by_id_chain: { 657 printGetByIdOp(location, it, identifiers, "get_by_id_chain");657 printGetByIdOp(location, it, m_identifiers, "get_by_id_chain"); 658 658 break; 659 659 } 660 660 case op_get_by_id_generic: { 661 printGetByIdOp(location, it, identifiers, "get_by_id_generic");661 printGetByIdOp(location, it, m_identifiers, "get_by_id_generic"); 662 662 break; 663 663 } 664 664 case op_get_array_length: { 665 printGetByIdOp(location, it, identifiers, "get_array_length");665 printGetByIdOp(location, it, m_identifiers, "get_array_length"); 666 666 break; 667 667 } 668 668 case op_get_string_length: { 669 printGetByIdOp(location, it, identifiers, "get_string_length");669 printGetByIdOp(location, it, m_identifiers, "get_string_length"); 670 670 break; 671 671 } 672 672 case op_put_by_id: { 673 printPutByIdOp(location, it, identifiers, "put_by_id");673 printPutByIdOp(location, it, m_identifiers, "put_by_id"); 674 674 break; 675 675 } 676 676 case op_put_by_id_replace: { 677 printPutByIdOp(location, it, identifiers, "put_by_id_replace");677 printPutByIdOp(location, it, m_identifiers, "put_by_id_replace"); 678 678 break; 679 679 } 680 680 case op_put_by_id_transition: { 681 printPutByIdOp(location, it, identifiers, "put_by_id_transition");681 printPutByIdOp(location, it, m_identifiers, "put_by_id_transition"); 682 682 break; 683 683 } 684 684 case op_put_by_id_generic: { 685 printPutByIdOp(location, it, identifiers, "put_by_id_generic");685 printPutByIdOp(location, it, m_identifiers, "put_by_id_generic"); 686 686 break; 687 687 } … … 690 690 int id0 = (++it)->u.operand; 691 691 int r1 = (++it)->u.operand; 692 printf("[%4d] put_getter\t %s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), registerName(r1).c_str());692 printf("[%4d] put_getter\t %s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(r1).c_str()); 693 693 break; 694 694 } … … 697 697 int id0 = (++it)->u.operand; 698 698 int r1 = (++it)->u.operand; 699 printf("[%4d] put_setter\t %s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), registerName(r1).c_str());699 printf("[%4d] put_setter\t %s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(r1).c_str()); 700 700 break; 701 701 } … … 704 704 int r1 = (++it)->u.operand; 705 705 int id0 = (++it)->u.operand; 706 printf("[%4d] del_by_id\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, identifiers[id0]).c_str());706 printf("[%4d] del_by_id\t %s, %s, %s\n", location, registerName(r0).c_str(), registerName(r1).c_str(), idName(id0, m_identifiers[id0]).c_str()); 707 707 break; 708 708 } … … 737 737 case op_jmp: { 738 738 int offset = (++it)->u.operand; 739 printf("[%4d] jmp\t\t %d(->%d)\n", location, offset, jumpTarget(begin, it, offset));739 printf("[%4d] jmp\t\t %d(->%d)\n", location, offset, locationForOffset(begin, it, offset)); 740 740 break; 741 741 } 742 742 case op_loop: { 743 743 int offset = (++it)->u.operand; 744 printf("[%4d] loop\t\t %d(->%d)\n", location, offset, jumpTarget(begin, it, offset));744 printf("[%4d] loop\t\t %d(->%d)\n", location, offset, locationForOffset(begin, it, offset)); 745 745 break; 746 746 } … … 769 769 int r1 = (++it)->u.operand; 770 770 int offset = (++it)->u.operand; 771 printf("[%4d] jnless\t\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, jumpTarget(begin, it, offset));771 printf("[%4d] jnless\t\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, locationForOffset(begin, it, offset)); 772 772 break; 773 773 } … … 776 776 int r1 = (++it)->u.operand; 777 777 int offset = (++it)->u.operand; 778 printf("[%4d] loop_if_less\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, jumpTarget(begin, it, offset));778 printf("[%4d] loop_if_less\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, locationForOffset(begin, it, offset)); 779 779 break; 780 780 } … … 783 783 int r1 = (++it)->u.operand; 784 784 int offset = (++it)->u.operand; 785 printf("[%4d] loop_if_lesseq\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, jumpTarget(begin, it, offset));785 printf("[%4d] loop_if_lesseq\t %s, %s, %d(->%d)\n", location, registerName(r0).c_str(), registerName(r1).c_str(), offset, locationForOffset(begin, it, offset)); 786 786 break; 787 787 } … … 790 790 int defaultTarget = (++it)->u.operand; 791 791 int scrutineeRegister = (++it)->u.operand; 792 printf("[%4d] switch_imm\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, jumpTarget(begin, it, defaultTarget), registerName(scrutineeRegister).c_str());792 printf("[%4d] switch_imm\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, locationForOffset(begin, it, defaultTarget), registerName(scrutineeRegister).c_str()); 793 793 break; 794 794 } … … 797 797 int defaultTarget = (++it)->u.operand; 798 798 int scrutineeRegister = (++it)->u.operand; 799 printf("[%4d] switch_char\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, jumpTarget(begin, it, defaultTarget), registerName(scrutineeRegister).c_str());799 printf("[%4d] switch_char\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, locationForOffset(begin, it, defaultTarget), registerName(scrutineeRegister).c_str()); 800 800 break; 801 801 } … … 804 804 int defaultTarget = (++it)->u.operand; 805 805 int scrutineeRegister = (++it)->u.operand; 806 printf("[%4d] switch_string\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, jumpTarget(begin, it, defaultTarget), registerName(scrutineeRegister).c_str());806 printf("[%4d] switch_string\t %d, %d(->%d), %s\n", location, tableIndex, defaultTarget, locationForOffset(begin, it, defaultTarget), registerName(scrutineeRegister).c_str()); 807 807 break; 808 808 } … … 875 875 int iter = (++it)->u.operand; 876 876 int offset = (++it)->u.operand; 877 printf("[%4d] next_pname\t %s, %s, %d(->%d)\n", location, registerName(dest).c_str(), registerName(iter).c_str(), offset, jumpTarget(begin, it, offset));877 printf("[%4d] next_pname\t %s, %s, %d(->%d)\n", location, registerName(dest).c_str(), registerName(iter).c_str(), offset, locationForOffset(begin, it, offset)); 878 878 break; 879 879 } … … 891 891 int id0 = (++it)->u.operand; 892 892 int r1 = (++it)->u.operand; 893 printf("[%4d] push_new_scope \t%s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, identifiers[id0]).c_str(), registerName(r1).c_str());893 printf("[%4d] push_new_scope \t%s, %s, %s\n", location, registerName(r0).c_str(), idName(id0, m_identifiers[id0]).c_str(), registerName(r1).c_str()); 894 894 break; 895 895 } … … 897 897 int scopeDelta = (++it)->u.operand; 898 898 int offset = (++it)->u.operand; 899 printf("[%4d] jmp_scopes\t^%d, %d(->%d)\n", location, scopeDelta, offset, jumpTarget(begin, it, offset));899 printf("[%4d] jmp_scopes\t^%d, %d(->%d)\n", location, scopeDelta, offset, locationForOffset(begin, it, offset)); 900 900 break; 901 901 } … … 914 914 int errorType = (++it)->u.operand; 915 915 int k0 = (++it)->u.operand; 916 printf("[%4d] new_error\t %s, %d, %s\n", location, registerName(r0).c_str(), errorType, constantName(exec, k0, unexpectedConstants[k0]).c_str());916 printf("[%4d] new_error\t %s, %d, %s\n", location, registerName(r0).c_str(), errorType, constantName(exec, k0, m_unexpectedConstants[k0]).c_str()); 917 917 break; 918 918 } … … 920 920 int retAddrDst = (++it)->u.operand; 921 921 int offset = (++it)->u.operand; 922 printf("[%4d] jsr\t\t %s, %d(->%d)\n", location, registerName(retAddrDst).c_str(), offset, jumpTarget(begin, it, offset));922 printf("[%4d] jsr\t\t %s, %d(->%d)\n", location, registerName(retAddrDst).c_str(), offset, locationForOffset(begin, it, offset)); 923 923 break; 924 924 } … … 957 957 CodeBlock::~CodeBlock() 958 958 { 959 for (size_t size = globalResolveInstructions.size(), i = 0; i < size; ++i) { 960 derefStructures(&instructions[globalResolveInstructions[i]]); 961 } 962 963 for (size_t size = propertyAccessInstructions.size(), i = 0; i < size; ++i) { 964 derefStructures(&instructions[propertyAccessInstructions[i].bytecodeIndex]); 965 if (propertyAccessInstructions[i].stubRoutine) 966 WTF::fastFreeExecutable(propertyAccessInstructions[i].stubRoutine); 967 } 968 969 for (size_t size = callLinkInfos.size(), i = 0; i < size; ++i) { 970 CallLinkInfo* callLinkInfo = &callLinkInfos[i]; 959 for (size_t size = m_globalResolveInstructions.size(), i = 0; i < size; ++i) 960 derefStructures(&m_instructions[m_globalResolveInstructions[i]]); 961 962 for (size_t size = m_propertyAccessInstructions.size(), i = 0; i < size; ++i) { 963 derefStructures(&m_instructions[m_propertyAccessInstructions[i].bytecodeIndex]); 964 if (m_propertyAccessInstructions[i].stubRoutine) 965 WTF::fastFreeExecutable(m_propertyAccessInstructions[i].stubRoutine); 966 } 967 968 for (size_t size = m_callLinkInfos.size(), i = 0; i < size; ++i) { 969 CallLinkInfo* callLinkInfo = &m_callLinkInfos[i]; 971 970 if (callLinkInfo->isLinked()) 972 971 callLinkInfo->callee->removeCaller(callLinkInfo); … … 976 975 unlinkCallers(); 977 976 978 if ( ctiCode)979 WTF::fastFreeExecutable( ctiCode);977 if (m_jitCode) 978 WTF::fastFreeExecutable(m_jitCode); 980 979 #endif 981 980 } … … 984 983 void CodeBlock::unlinkCallers() 985 984 { 986 size_t size = linkedCallerList.size();985 size_t size = m_linkedCallerList.size(); 987 986 for (size_t i = 0; i < size; ++i) { 988 CallLinkInfo* currentCaller = linkedCallerList[i];987 CallLinkInfo* currentCaller = m_linkedCallerList[i]; 989 988 JIT::unlinkCall(currentCaller); 990 989 currentCaller->setUnlinked(); 991 990 } 992 linkedCallerList.clear();991 m_linkedCallerList.clear(); 993 992 } 994 993 #endif … … 996 995 void CodeBlock::derefStructures(Instruction* vPC) const 997 996 { 998 Interpreter* interpreter = globalData->interpreter;997 Interpreter* interpreter = m_globalData->interpreter; 999 998 1000 999 if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) { … … 1041 1040 void CodeBlock::refStructures(Instruction* vPC) const 1042 1041 { 1043 Interpreter* interpreter = globalData->interpreter;1042 Interpreter* interpreter = m_globalData->interpreter; 1044 1043 1045 1044 if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self)) { … … 1074 1073 void CodeBlock::mark() 1075 1074 { 1076 for (size_t i = 0; i < constantRegisters.size(); ++i)1077 if (! constantRegisters[i].marked())1078 constantRegisters[i].mark();1079 1080 for (size_t i = 0; i < unexpectedConstants.size(); ++i)1081 if (! unexpectedConstants[i]->marked())1082 unexpectedConstants[i]->mark();1083 1084 for (size_t i = 0; i < functions.size(); ++i)1085 functions[i]->body()->mark();1086 1087 for (size_t i = 0; i < functionExpressions.size(); ++i)1088 functionExpressions[i]->body()->mark();1075 for (size_t i = 0; i < m_constantRegisters.size(); ++i) 1076 if (!m_constantRegisters[i].marked()) 1077 m_constantRegisters[i].mark(); 1078 1079 for (size_t i = 0; i < m_unexpectedConstants.size(); ++i) 1080 if (!m_unexpectedConstants[i]->marked()) 1081 m_unexpectedConstants[i]->mark(); 1082 1083 for (size_t i = 0; i < m_functions.size(); ++i) 1084 m_functions[i]->body()->mark(); 1085 1086 for (size_t i = 0; i < m_functionExpressions.size(); ++i) 1087 m_functionExpressions[i]->body()->mark(); 1089 1088 } 1090 1089 1091 1090 bool CodeBlock::getHandlerForVPC(const Instruction* vPC, Instruction*& target, int& scopeDepth) 1092 1091 { 1093 Vector<HandlerInfo>::iterator ptr = exceptionHandlers.begin();1094 Vector<HandlerInfo>::iterator end = exceptionHandlers.end();1095 unsigned addressOffset = vPC - instructions.begin();1096 ASSERT(addressOffset < instructions.size());1092 Vector<HandlerInfo>::iterator ptr = m_exceptionHandlers.begin(); 1093 Vector<HandlerInfo>::iterator end = m_exceptionHandlers.end(); 1094 unsigned addressOffset = vPC - m_instructions.begin(); 1095 ASSERT(addressOffset < m_instructions.size()); 1097 1096 1098 1097 for (; ptr != end; ++ptr) { … … 1101 1100 if (ptr->start <= addressOffset && ptr->end >= addressOffset) { 1102 1101 scopeDepth = ptr->scopeDepth; 1103 target = instructions.begin() + ptr->target;1102 target = m_instructions.begin() + ptr->target; 1104 1103 return true; 1105 1104 } … … 1110 1109 void* CodeBlock::nativeExceptionCodeForHandlerVPC(const Instruction* handlerVPC) 1111 1110 { 1112 Vector<HandlerInfo>::iterator ptr = exceptionHandlers.begin();1113 Vector<HandlerInfo>::iterator end = exceptionHandlers.end();1111 Vector<HandlerInfo>::iterator ptr = m_exceptionHandlers.begin(); 1112 Vector<HandlerInfo>::iterator end = m_exceptionHandlers.end(); 1114 1113 1115 1114 for (; ptr != end; ++ptr) { 1116 Instruction*target = instructions.begin() + ptr->target;1115 Instruction*target = m_instructions.begin() + ptr->target; 1117 1116 if (handlerVPC == target) 1118 1117 return ptr->nativeCode; … … 1124 1123 int CodeBlock::lineNumberForVPC(const Instruction* vPC) 1125 1124 { 1126 unsigned instructionOffset = vPC - instructions.begin();1127 ASSERT(instructionOffset < instructions.size());1128 1129 if (! lineInfo.size())1130 return ownerNode->source().firstLine(); // Empty function1125 unsigned instructionOffset = vPC - m_instructions.begin(); 1126 ASSERT(instructionOffset < m_instructions.size()); 1127 1128 if (!m_lineInfo.size()) 1129 return m_ownerNode->source().firstLine(); // Empty function 1131 1130 1132 1131 int low = 0; 1133 int high = lineInfo.size();1132 int high = m_lineInfo.size(); 1134 1133 while (low < high) { 1135 1134 int mid = low + (high - low) / 2; 1136 if ( lineInfo[mid].instructionOffset <= instructionOffset)1135 if (m_lineInfo[mid].instructionOffset <= instructionOffset) 1137 1136 low = mid + 1; 1138 1137 else … … 1141 1140 1142 1141 if (!low) 1143 return ownerNode->source().firstLine();1144 return lineInfo[low - 1].lineNumber;1142 return m_ownerNode->source().firstLine(); 1143 return m_lineInfo[low - 1].lineNumber; 1145 1144 } 1146 1145 1147 1146 int CodeBlock::expressionRangeForVPC(const Instruction* vPC, int& divot, int& startOffset, int& endOffset) 1148 1147 { 1149 unsigned instructionOffset = vPC - instructions.begin();1150 ASSERT(instructionOffset < instructions.size());1151 1152 if (! expressionInfo.size()) {1148 unsigned instructionOffset = vPC - m_instructions.begin(); 1149 ASSERT(instructionOffset < m_instructions.size()); 1150 1151 if (!m_expressionInfo.size()) { 1153 1152 // We didn't think anything could throw. Apparently we were wrong. 1154 1153 startOffset = 0; … … 1159 1158 1160 1159 int low = 0; 1161 int high = expressionInfo.size();1160 int high = m_expressionInfo.size(); 1162 1161 while (low < high) { 1163 1162 int mid = low + (high - low) / 2; 1164 if ( expressionInfo[mid].instructionOffset <= instructionOffset)1163 if (m_expressionInfo[mid].instructionOffset <= instructionOffset) 1165 1164 low = mid + 1; 1166 1165 else … … 1176 1175 } 1177 1176 1178 startOffset = expressionInfo[low - 1].startOffset;1179 endOffset = expressionInfo[low - 1].endOffset;1180 divot = expressionInfo[low - 1].divotPoint +sourceOffset;1177 startOffset = m_expressionInfo[low - 1].startOffset; 1178 endOffset = m_expressionInfo[low - 1].endOffset; 1179 divot = m_expressionInfo[low - 1].divotPoint + m_sourceOffset; 1181 1180 return lineNumberForVPC(vPC); 1182 1181 } … … 1184 1183 void CodeBlock::shrinkToFit() 1185 1184 { 1186 instructions.shrinkToFit(); 1187 globalResolveInstructions.shrinkToFit(); 1188 propertyAccessInstructions.shrinkToFit(); 1189 callLinkInfos.shrinkToFit(); 1190 linkedCallerList.shrinkToFit(); 1191 identifiers.shrinkToFit(); 1192 functions.shrinkToFit(); 1193 functionExpressions.shrinkToFit(); 1194 constantRegisters.shrinkToFit(); 1195 unexpectedConstants.shrinkToFit(); 1196 regexps.shrinkToFit(); 1197 exceptionHandlers.shrinkToFit(); 1198 expressionInfo.shrinkToFit(); 1199 lineInfo.shrinkToFit(); 1185 m_instructions.shrinkToFit(); 1186 1187 m_globalResolveInstructions.shrinkToFit(); 1188 m_propertyAccessInstructions.shrinkToFit(); 1189 m_callLinkInfos.shrinkToFit(); 1190 m_linkedCallerList.shrinkToFit(); 1191 1192 m_exceptionHandlers.shrinkToFit(); 1193 m_expressionInfo.shrinkToFit(); 1194 m_lineInfo.shrinkToFit(); 1195 1196 m_identifiers.shrinkToFit(); 1197 m_functions.shrinkToFit(); 1198 m_functionExpressions.shrinkToFit(); 1199 m_constantRegisters.shrinkToFit(); 1200 m_unexpectedConstants.shrinkToFit(); 1201 m_regexps.shrinkToFit(); 1202 1200 1203 m_immediateSwitchJumpTables.shrinkToFit(); 1201 1204 m_characterSwitchJumpTables.shrinkToFit(); -
trunk/JavaScriptCore/bytecode/CodeBlock.h
r39038 r39070 216 216 }; 217 217 218 struct CodeBlock { 218 class CodeBlock { 219 friend class JIT; 220 public: 219 221 CodeBlock(ScopeNode* ownerNode, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset) 220 : ownerNode(ownerNode)221 , globalData(0)222 #if ENABLE(JIT)223 , ctiCode(0)224 #endif 225 , numCalleeRegisters(0)226 , numConstants(0)227 , numVars(0)228 , numParameters(0) 229 , needsFullScopeChain(ownerNode->needsActivation())230 , usesEval(ownerNode->usesEval())231 , codeType(codeType)232 , source(sourceProvider)233 , sourceOffset(sourceOffset)234 { 235 ASSERT( source);222 : m_numCalleeRegisters(0) 223 , m_numConstants(0) 224 , m_numVars(0) 225 , m_numParameters(0) 226 , m_ownerNode(ownerNode) 227 , m_globalData(0) 228 #if ENABLE(JIT) 229 , m_jitCode(0) 230 #endif 231 , m_needsFullScopeChain(ownerNode->needsActivation()) 232 , m_usesEval(ownerNode->usesEval()) 233 , m_codeType(codeType) 234 , m_source(sourceProvider) 235 , m_sourceOffset(sourceOffset) 236 { 237 ASSERT(m_source); 236 238 } 237 239 … … 245 247 { 246 248 caller->callee = this; 247 caller->position = linkedCallerList.size();248 linkedCallerList.append(caller);249 caller->position = m_linkedCallerList.size(); 250 m_linkedCallerList.append(caller); 249 251 } 250 252 … … 252 254 { 253 255 unsigned pos = caller->position; 254 unsigned lastPos = linkedCallerList.size() - 1;256 unsigned lastPos = m_linkedCallerList.size() - 1; 255 257 256 258 if (pos != lastPos) { 257 linkedCallerList[pos] =linkedCallerList[lastPos];258 linkedCallerList[pos]->position = pos;259 m_linkedCallerList[pos] = m_linkedCallerList[lastPos]; 260 m_linkedCallerList[pos]->position = pos; 259 261 } 260 linkedCallerList.shrink(lastPos);262 m_linkedCallerList.shrink(lastPos); 261 263 } 262 264 263 265 inline bool isKnownNotImmediate(int index) 264 266 { 265 if (index == thisRegister)267 if (index == m_thisRegister) 266 268 return true; 267 269 … … 274 276 ALWAYS_INLINE bool isConstantRegisterIndex(int index) 275 277 { 276 return index >= numVars && index < numVars +numConstants;278 return index >= m_numVars && index < m_numVars + m_numConstants; 277 279 } 278 280 279 281 ALWAYS_INLINE JSValue* getConstant(int index) 280 282 { 281 return constantRegisters[index -numVars].getJSValue();283 return m_constantRegisters[index - m_numVars].getJSValue(); 282 284 } 283 285 284 286 ALWAYS_INLINE bool isTemporaryRegisterIndex(int index) 285 287 { 286 return index >= numVars +numConstants;288 return index >= m_numVars + m_numConstants; 287 289 } 288 290 … … 303 305 StructureStubInfo& getStubInfo(void* returnAddress) 304 306 { 305 return *(binaryChop<StructureStubInfo, void*, getStructureStubInfoReturnLocation>( propertyAccessInstructions.begin(),propertyAccessInstructions.size(), returnAddress));307 return *(binaryChop<StructureStubInfo, void*, getStructureStubInfoReturnLocation>(m_propertyAccessInstructions.begin(), m_propertyAccessInstructions.size(), returnAddress)); 306 308 } 307 309 308 310 CallLinkInfo& getCallLinkInfo(void* returnAddress) 309 311 { 310 return *(binaryChop<CallLinkInfo, void*, getCallLinkInfoReturnLocation>(callLinkInfos.begin(), callLinkInfos.size(), returnAddress)); 311 } 312 313 void shrinkToFit(); 312 return *(binaryChop<CallLinkInfo, void*, getCallLinkInfoReturnLocation>(m_callLinkInfos.begin(), m_callLinkInfos.size(), returnAddress)); 313 } 314 315 316 Vector<Instruction>& instructions() { return m_instructions; } 317 #if ENABLE(JIT) 318 void setJITCode(void* jitCode) { m_jitCode = jitCode; } 319 void* jitCode() { return m_jitCode; } 320 #endif 321 322 ScopeNode* ownerNode() const { return m_ownerNode; } 323 324 void setGlobalData(JSGlobalData* globalData) { m_globalData = globalData; } 325 326 void setThisRegister(int thisRegister) { m_thisRegister = thisRegister; } 327 int thisRegister() const { return m_thisRegister; } 328 329 void setNeedsFullScopeChain(bool needsFullScopeChain) { m_needsFullScopeChain = needsFullScopeChain; } 330 bool needsFullScopeChain() const { return m_needsFullScopeChain; } 331 void setUsesEval(bool usesEval) { m_usesEval = usesEval; } 332 bool usesEval() const { return m_usesEval; } 333 void setUsesArguments(bool usesArguments) { m_usesArguments = usesArguments; } 334 bool usesArguments() const { return m_usesArguments; } 335 336 CodeType codeType() const { return m_codeType; } 337 338 SourceProvider* source() const { return m_source.get(); } 339 unsigned sourceOffset() const { return m_sourceOffset; } 340 341 void addGlobalResolveInstruction(unsigned globalResolveInstructions) { m_globalResolveInstructions.append(globalResolveInstructions); } 342 343 size_t numberOfPropertyAccessInstructions() const { return m_propertyAccessInstructions.size(); } 344 void addPropertyAccessInstruction(unsigned propertyAccessInstructions) { m_propertyAccessInstructions.append(StructureStubInfo(propertyAccessInstructions)); } 345 StructureStubInfo& propertyAccessInstruction(int index) { return m_propertyAccessInstructions[index]; } 346 347 size_t numberOfCallLinkInfos() const { return m_callLinkInfos.size(); } 348 void addCallLinkInfo() { m_callLinkInfos.append(CallLinkInfo()); } 349 CallLinkInfo& callLinkInfo(int index) { return m_callLinkInfos[index]; } 350 351 size_t numberOfJumpTargets() const { return m_jumpTargets.size(); } 352 void addJumpTarget(unsigned jumpTarget) { m_jumpTargets.append(jumpTarget); } 353 unsigned jumpTarget(int index) const { return m_jumpTargets[index]; } 354 unsigned lastJumpTarget() const { return m_jumpTargets.last(); } 355 356 size_t numberOfExceptionHandlers() const { return m_exceptionHandlers.size(); } 357 void addExceptionHandler(const HandlerInfo& hanler) { return m_exceptionHandlers.append(hanler); } 358 HandlerInfo& exceptionHandler(int index) { return m_exceptionHandlers[index]; } 359 360 void addExpressionInfo(const ExpressionRangeInfo& expressionInfo) { return m_expressionInfo.append(expressionInfo); } 361 362 size_t numberOfLineInfos() const { return m_lineInfo.size(); } 363 void addLineInfo(const LineInfo& lineInfo) { return m_lineInfo.append(lineInfo); } 364 LineInfo& lastLineInfo() { return m_lineInfo.last(); } 365 366 #if ENABLE(JIT) 367 HashMap<void*, unsigned>& jitReturnAddressVPCMap() { return m_jitReturnAddressVPCMap; } 368 #endif 369 370 // Constant Pool 371 372 size_t numberOfIdentifiers() const { return m_identifiers.size(); } 373 void addIdentifier(const Identifier& i) { return m_identifiers.append(i); } 374 Identifier& identifier(int index) { return m_identifiers[index]; } 375 376 size_t numberOfConstantRegisters() const { return m_constantRegisters.size(); } 377 void addConstantRegister(const Register& r) { return m_constantRegisters.append(r); } 378 Register& constantRegister(int index) { return m_constantRegisters[index]; } 379 380 unsigned addFunction(FuncDeclNode* n) { unsigned size = m_functions.size(); m_functions.append(n); return size; } 381 FuncDeclNode* function(int index) const { return m_functions[index].get(); } 382 383 unsigned addFunctionExpression(FuncExprNode* n) { unsigned size = m_functionExpressions.size(); m_functionExpressions.append(n); return size; } 384 FuncExprNode* functionExpression(int index) const { return m_functionExpressions[index].get(); } 385 386 unsigned addUnexpectedConstant(JSValue* v) { unsigned size = m_unexpectedConstants.size(); m_unexpectedConstants.append(v); return size; } 387 JSValue* unexpectedConstant(int index) const { return m_unexpectedConstants[index]; } 388 389 unsigned addRegExp(RegExp* r) { unsigned size = m_regexps.size(); m_regexps.append(r); return size; } 390 RegExp* regexp(int index) const { return m_regexps[index].get(); } 391 392 // Jump Tables 314 393 315 394 size_t numberOfImmediateSwitchJumpTables() const { return m_immediateSwitchJumpTables.size(); } … … 325 404 StringJumpTable& stringSwitchJumpTable(int tableIndex) { return m_stringSwitchJumpTables[tableIndex]; } 326 405 327 ScopeNode* ownerNode; 328 JSGlobalData* globalData; 329 #if ENABLE(JIT) 330 void* ctiCode; 331 #endif 332 333 int numCalleeRegisters; 334 406 407 SymbolTable& symbolTable() { return m_symbolTable; } 408 EvalCodeCache& evalCodeCache() { return m_evalCodeCache; } 409 410 void shrinkToFit(); 411 412 // FIXME: Make these remaining members private. 413 414 int m_numCalleeRegisters; 335 415 // NOTE: numConstants holds the number of constant registers allocated 336 416 // by the code generator, not the number of constant registers used. 337 417 // (Duplicate constants are uniqued during code generation, and spare 338 418 // constant registers may be allocated.) 339 int numConstants; 340 int numVars; 341 int numParameters; 342 int thisRegister; 343 bool needsFullScopeChain; 344 bool usesEval; 345 bool usesArguments; 346 CodeType codeType; 347 RefPtr<SourceProvider> source; 348 unsigned sourceOffset; 349 350 Vector<Instruction> instructions; 351 Vector<unsigned> globalResolveInstructions; 352 Vector<StructureStubInfo> propertyAccessInstructions; 353 Vector<CallLinkInfo> callLinkInfos; 354 Vector<CallLinkInfo*> linkedCallerList; 355 356 // Constant pool 357 Vector<Identifier> identifiers; 358 Vector<RefPtr<FuncDeclNode> > functions; 359 Vector<RefPtr<FuncExprNode> > functionExpressions; 360 Vector<Register> constantRegisters; 361 Vector<JSValue*> unexpectedConstants; 362 Vector<RefPtr<RegExp> > regexps; 363 Vector<HandlerInfo> exceptionHandlers; 364 Vector<ExpressionRangeInfo> expressionInfo; 365 Vector<LineInfo> lineInfo; 366 367 #if ENABLE(JIT) 368 HashMap<void*, unsigned> ctiReturnAddressVPCMap; 369 #endif 370 371 Vector<unsigned> jumpTargets; 372 373 EvalCodeCache evalCodeCache; 374 375 SymbolTable symbolTable; 419 int m_numConstants; 420 int m_numVars; 421 int m_numParameters; 422 376 423 private: 377 424 #if !defined(NDEBUG) || ENABLE(OPCODE_SAMPLING) … … 379 426 #endif 380 427 428 ScopeNode* m_ownerNode; 429 JSGlobalData* m_globalData; 430 431 Vector<Instruction> m_instructions; 432 #if ENABLE(JIT) 433 void* m_jitCode; 434 #endif 435 436 int m_thisRegister; 437 438 bool m_needsFullScopeChain; 439 bool m_usesEval; 440 bool m_usesArguments; 441 442 CodeType m_codeType; 443 444 RefPtr<SourceProvider> m_source; 445 unsigned m_sourceOffset; 446 447 Vector<unsigned> m_globalResolveInstructions; 448 Vector<StructureStubInfo> m_propertyAccessInstructions; 449 Vector<CallLinkInfo> m_callLinkInfos; 450 Vector<CallLinkInfo*> m_linkedCallerList; 451 452 Vector<unsigned> m_jumpTargets; 453 454 Vector<HandlerInfo> m_exceptionHandlers; 455 Vector<ExpressionRangeInfo> m_expressionInfo; 456 Vector<LineInfo> m_lineInfo; 457 458 #if ENABLE(JIT) 459 HashMap<void*, unsigned> m_jitReturnAddressVPCMap; 460 #endif 461 462 // Constant Pool 463 Vector<Identifier> m_identifiers; 464 Vector<Register> m_constantRegisters; 465 Vector<RefPtr<FuncDeclNode> > m_functions; 466 Vector<RefPtr<FuncExprNode> > m_functionExpressions; 467 Vector<JSValue*> m_unexpectedConstants; 468 Vector<RefPtr<RegExp> > m_regexps; 469 470 // Jump Tables 381 471 Vector<SimpleJumpTable> m_immediateSwitchJumpTables; 382 472 Vector<SimpleJumpTable> m_characterSwitchJumpTables; 383 473 Vector<StringJumpTable> m_stringSwitchJumpTables; 474 475 SymbolTable m_symbolTable; 476 477 EvalCodeCache m_evalCodeCache; 384 478 }; 385 479 … … 387 481 // responsible for marking it. 388 482 389 struct ProgramCodeBlock : public CodeBlock { 483 class ProgramCodeBlock : public CodeBlock { 484 public: 390 485 ProgramCodeBlock(ScopeNode* ownerNode, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider) 391 486 : CodeBlock(ownerNode, codeType, sourceProvider, 0) 392 , globalObject(globalObject)393 { 394 globalObject->codeBlocks().add(this);487 , m_globalObject(globalObject) 488 { 489 m_globalObject->codeBlocks().add(this); 395 490 } 396 491 397 492 ~ProgramCodeBlock() 398 493 { 399 if (globalObject) 400 globalObject->codeBlocks().remove(this); 401 } 402 403 JSGlobalObject* globalObject; // For program and eval nodes, the global object that marks the constant pool. 404 }; 405 406 struct EvalCodeBlock : public ProgramCodeBlock { 494 if (m_globalObject) 495 m_globalObject->codeBlocks().remove(this); 496 } 497 498 void clearGlobalObject() { m_globalObject = 0; } 499 500 private: 501 JSGlobalObject* m_globalObject; // For program and eval nodes, the global object that marks the constant pool. 502 }; 503 504 class EvalCodeBlock : public ProgramCodeBlock { 505 public: 407 506 EvalCodeBlock(ScopeNode* ownerNode, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider) 408 507 : ProgramCodeBlock(ownerNode, EvalCode, globalObject, sourceProvider) -
trunk/JavaScriptCore/bytecode/SamplingTool.cpp
r38523 r39070 43 43 { 44 44 if (!m_samples) { 45 m_size = codeBlock->instructions .size();45 m_size = codeBlock->instructions().size(); 46 46 m_samples = static_cast<int*>(calloc(m_size, sizeof(int))); 47 47 m_codeBlock = codeBlock; … … 50 50 ++m_sampleCount; 51 51 52 unsigned offest = vPC - codeBlock->instructions .begin();52 unsigned offest = vPC - codeBlock->instructions().begin(); 53 53 // Since we don't read and write codeBlock and vPC atomically, this check 54 54 // can fail if we sample mid op_call / op_ret. … … 249 249 250 250 if (blockPercent >= 1) { 251 Instruction* code = codeBlock->instructions .begin();251 Instruction* code = codeBlock->instructions().begin(); 252 252 printf("#%d: %s:%d: %d / %lld (%.3f%%)\n", i + 1, record->m_scope->sourceURL().UTF8String().c_str(), codeBlock->lineNumberForVPC(code), record->m_sampleCount, m_sampleCount, blockPercent); 253 253 if (i < 10) { -
trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
r39038 r39070 130 130 void BytecodeGenerator::generate() 131 131 { 132 m_codeBlock-> thisRegister = m_thisRegister.index();132 m_codeBlock->setThisRegister(m_thisRegister.index()); 133 133 134 134 m_scopeNode->emitBytecode(*this); … … 155 155 } 156 156 157 ++m_codeBlock-> numVars;157 ++m_codeBlock->m_numVars; 158 158 r0 = newRegister(); 159 159 return true; … … 179 179 void BytecodeGenerator::allocateConstants(size_t count) 180 180 { 181 m_codeBlock-> numConstants = count;181 m_codeBlock->m_numConstants = count; 182 182 if (!count) 183 183 return; … … 207 207 { 208 208 if (m_shouldEmitDebugHooks) 209 m_codeBlock-> needsFullScopeChain = true;209 m_codeBlock->setNeedsFullScopeChain(true); 210 210 211 211 emitOpcode(op_enter); 212 codeBlock-> globalData = m_globalData;212 codeBlock->setGlobalData(m_globalData); 213 213 214 214 // FIXME: Move code that modifies the global object to Interpreter::execute. 215 215 216 m_codeBlock-> numParameters = 1; // Allocate space for "this"216 m_codeBlock->m_numParameters = 1; // Allocate space for "this" 217 217 218 218 JSGlobalObject* globalObject = scopeChain.globalObject(); … … 221 221 222 222 // Shift register indexes in generated code to elide registers allocated by intermediate stack frames. 223 m_globalVarStorageOffset = -RegisterFile::CallFrameHeaderSize - m_codeBlock-> numParameters - registerFile->size();223 m_globalVarStorageOffset = -RegisterFile::CallFrameHeaderSize - m_codeBlock->m_numParameters - registerFile->size(); 224 224 225 225 // Add previously defined symbols to bookkeeping. … … 286 286 { 287 287 if (m_shouldEmitDebugHooks) 288 m_codeBlock-> needsFullScopeChain = true;289 290 codeBlock-> globalData = m_globalData;288 m_codeBlock->setNeedsFullScopeChain(true); 289 290 codeBlock->setGlobalData(m_globalData); 291 291 292 292 bool usesArguments = functionBody->usesArguments(); 293 codeBlock-> usesArguments = usesArguments;293 codeBlock->setUsesArguments(usesArguments); 294 294 if (usesArguments) { 295 295 m_argumentsRegister.setIndex(RegisterFile::OptionalCalleeArguments); … … 297 297 } 298 298 299 if (m_codeBlock->needsFullScopeChain ) {300 ++m_codeBlock-> numVars;299 if (m_codeBlock->needsFullScopeChain()) { 300 ++m_codeBlock->m_numVars; 301 301 m_activationRegisterIndex = newRegister()->index(); 302 302 emitOpcode(op_enter_with_activation); … … 328 328 m_thisRegister.setIndex(m_nextParameterIndex); 329 329 ++m_nextParameterIndex; 330 ++m_codeBlock-> numParameters;330 ++m_codeBlock->m_numParameters; 331 331 332 332 if (functionBody->usesThis()) { … … 357 357 { 358 358 if (m_shouldEmitDebugHooks) 359 m_codeBlock-> needsFullScopeChain = true;359 m_codeBlock->setNeedsFullScopeChain(true); 360 360 361 361 emitOpcode(op_enter); 362 codeBlock-> globalData = m_globalData;363 m_codeBlock-> numParameters = 1; // Allocate space for "this"362 codeBlock->setGlobalData(m_globalData); 363 m_codeBlock->m_numParameters = 1; // Allocate space for "this" 364 364 365 365 allocateConstants(evalNode->neededConstants()); … … 381 381 // each parameter, even if the parameter doesn't make it into the symbol table. 382 382 ++m_nextParameterIndex; 383 ++m_codeBlock-> numParameters;383 ++m_codeBlock->m_numParameters; 384 384 return result; 385 385 } … … 427 427 { 428 428 m_calleeRegisters.append(m_calleeRegisters.size()); 429 m_codeBlock-> numCalleeRegisters = max<int>(m_codeBlock->numCalleeRegisters, m_calleeRegisters.size());429 m_codeBlock->m_numCalleeRegisters = max<int>(m_codeBlock->m_numCalleeRegisters, m_calleeRegisters.size()); 430 430 return &m_calleeRegisters.last(); 431 431 } … … 444 444 RegisterID* BytecodeGenerator::highestUsedRegister() 445 445 { 446 size_t count = m_codeBlock-> numCalleeRegisters;446 size_t count = m_codeBlock->m_numCalleeRegisters; 447 447 while (m_calleeRegisters.size() < count) 448 448 newRegister(); … … 478 478 l0->setLocation(newLabelIndex); 479 479 480 if (m_codeBlock-> jumpTargets.size() != 0) {481 unsigned lastLabelIndex = m_codeBlock-> jumpTargets.last();480 if (m_codeBlock->numberOfJumpTargets()) { 481 unsigned lastLabelIndex = m_codeBlock->lastJumpTarget(); 482 482 ASSERT(lastLabelIndex <= newLabelIndex); 483 483 if (newLabelIndex == lastLabelIndex) { 484 484 // Peephole optimizations have already been disabled by emitting the last label 485 return l0; 486 } 487 } 488 489 m_codeBlock-> jumpTargets.append(newLabelIndex);485 return l0; 486 } 487 } 488 489 m_codeBlock->addJumpTarget(newLabelIndex); 490 490 491 491 // This disables peephole optimizations when an instruction is a jump target … … 671 671 { 672 672 // No need to explicitly unique function body nodes -- they're unique already. 673 int index = m_codeBlock->functions.size(); 674 m_codeBlock->functions.append(n); 675 return index; 673 return m_codeBlock->addFunction(n); 676 674 } 677 675 … … 679 677 { 680 678 // No need to explicitly unique function expression nodes -- they're unique already. 681 int index = m_codeBlock->functionExpressions.size(); 682 m_codeBlock->functionExpressions.append(n); 683 return index; 679 return m_codeBlock->addFunctionExpression(n); 684 680 } 685 681 … … 687 683 { 688 684 UString::Rep* rep = ident.ustring().rep(); 689 pair<IdentifierMap::iterator, bool> result = m_identifierMap.add(rep, m_codeBlock-> identifiers.size());685 pair<IdentifierMap::iterator, bool> result = m_identifierMap.add(rep, m_codeBlock->numberOfIdentifiers()); 690 686 if (result.second) // new entry 691 m_codeBlock-> identifiers.append(Identifier(m_globalData, rep));687 m_codeBlock->addIdentifier(Identifier(m_globalData, rep)); 692 688 693 689 return result.first->second; … … 702 698 ++m_nextConstantIndex; 703 699 704 m_codeBlock-> constantRegisters.append(v);700 m_codeBlock->addConstantRegister(v); 705 701 return &constant; 706 702 } … … 711 707 unsigned BytecodeGenerator::addUnexpectedConstant(JSValue* v) 712 708 { 713 int index = m_codeBlock->unexpectedConstants.size(); 714 m_codeBlock->unexpectedConstants.append(v); 715 return index; 709 return m_codeBlock->addUnexpectedConstant(v); 716 710 } 717 711 718 712 unsigned BytecodeGenerator::addRegExp(RegExp* r) 719 713 { 720 int index = m_codeBlock->regexps.size(); 721 m_codeBlock->regexps.append(r); 722 return index; 714 return m_codeBlock->addRegExp(r); 723 715 } 724 716 … … 795 787 && src1->isTemporary() 796 788 && m_codeBlock->isConstantRegisterIndex(src2->index()) 797 && m_codeBlock->constantRegister s[src2->index() - m_codeBlock->numVars].jsValue(m_scopeChain->globalObject()->globalExec())->isString()) {798 const UString& value = asString(m_codeBlock->constantRegister s[src2->index() - m_codeBlock->numVars].jsValue(m_scopeChain->globalObject()->globalExec()))->value();789 && m_codeBlock->constantRegister(src2->index() - m_codeBlock->m_numVars).jsValue(m_scopeChain->globalObject()->globalExec())->isString()) { 790 const UString& value = asString(m_codeBlock->constantRegister(src2->index() - m_codeBlock->m_numVars).jsValue(m_scopeChain->globalObject()->globalExec()))->value(); 799 791 if (value == "undefined") { 800 792 rewindUnaryOp(); … … 987 979 988 980 if (globalObject) { 989 m_codeBlock-> globalResolveInstructions.append(instructions().size());981 m_codeBlock->addGlobalResolveInstruction(instructions().size()); 990 982 emitOpcode(op_resolve_global); 991 983 instructions().append(dst->index()); … … 1067 1059 RegisterID* BytecodeGenerator::emitGetById(RegisterID* dst, RegisterID* base, const Identifier& property) 1068 1060 { 1069 m_codeBlock-> propertyAccessInstructions.append(instructions().size());1061 m_codeBlock->addPropertyAccessInstruction(instructions().size()); 1070 1062 1071 1063 emitOpcode(op_get_by_id); … … 1082 1074 RegisterID* BytecodeGenerator::emitPutById(RegisterID* base, const Identifier& property, RegisterID* value) 1083 1075 { 1084 m_codeBlock-> propertyAccessInstructions.append(instructions().size());1076 m_codeBlock->addPropertyAccessInstruction(instructions().size()); 1085 1077 1086 1078 emitOpcode(op_put_by_id); … … 1254 1246 1255 1247 emitExpressionInfo(divot, startOffset, endOffset); 1256 m_codeBlock-> callLinkInfos.append(CallLinkInfo());1248 m_codeBlock->addCallLinkInfo(); 1257 1249 1258 1250 // Emit call. … … 1278 1270 RegisterID* BytecodeGenerator::emitReturn(RegisterID* src) 1279 1271 { 1280 if (m_codeBlock->needsFullScopeChain ) {1272 if (m_codeBlock->needsFullScopeChain()) { 1281 1273 emitOpcode(op_tear_off_activation); 1282 1274 instructions().append(m_activationRegisterIndex); 1283 } else if (m_codeBlock->usesArguments && m_codeBlock->numParameters > 1)1275 } else if (m_codeBlock->usesArguments() && m_codeBlock->m_numParameters > 1) 1284 1276 emitOpcode(op_tear_off_arguments); 1285 1277 … … 1333 1325 1334 1326 emitExpressionInfo(divot, startOffset, endOffset); 1335 m_codeBlock-> callLinkInfos.append(CallLinkInfo());1327 m_codeBlock->addCallLinkInfo(); 1336 1328 1337 1329 emitOpcode(op_construct); … … 1552 1544 { 1553 1545 HandlerInfo info = { start->offsetFrom(0), end->offsetFrom(0), instructions().size(), m_dynamicScopeDepth, 0 }; 1554 exceptionHandlers().append(info);1546 m_codeBlock->addExceptionHandler(info); 1555 1547 emitOpcode(op_catch); 1556 1548 instructions().append(targetRegister->index()); -
trunk/JavaScriptCore/bytecompiler/BytecodeGenerator.h
r38930 r39070 141 141 RegisterID* destinationForAssignResult(RegisterID* dst) 142 142 { 143 if (dst && dst != ignoredResult() && m_codeBlock->needsFullScopeChain )143 if (dst && dst != ignoredResult() && m_codeBlock->needsFullScopeChain()) 144 144 return dst->isTemporary() ? dst : newTemporary(); 145 145 return 0; … … 164 164 // Node::emitCode assumes that dst, if provided, is either a local or a referenced temporary. 165 165 ASSERT(!dst || dst == ignoredResult() || !dst->isTemporary() || dst->refCount()); 166 if (!m_codeBlock-> lineInfo.size() || m_codeBlock->lineInfo.last().lineNumber != n->lineNo()) {166 if (!m_codeBlock->numberOfLineInfos() || m_codeBlock->lastLineInfo().lineNumber != n->lineNo()) { 167 167 LineInfo info = { instructions().size(), n->lineNo() }; 168 m_codeBlock-> lineInfo.append(info);168 m_codeBlock->addLineInfo(info); 169 169 } 170 170 if (m_emitNodeDepth >= s_maxEmitNodeDepth) … … 183 183 void emitExpressionInfo(unsigned divot, unsigned startOffset, unsigned endOffset) 184 184 { 185 divot -= m_codeBlock->sourceOffset ;185 divot -= m_codeBlock->sourceOffset(); 186 186 if (divot > ExpressionRangeInfo::MaxDivot) { 187 187 // Overflow has occurred, we can only give line number info for errors for this region … … 207 207 info.startOffset = startOffset; 208 208 info.endOffset = endOffset; 209 m_codeBlock-> expressionInfo.append(info);209 m_codeBlock->addExpressionInfo(info); 210 210 } 211 211 212 212 ALWAYS_INLINE bool leftHandSideNeedsCopy(bool rightHasAssignments, bool rightIsPure) 213 213 { 214 return (m_codeType != FunctionCode || m_codeBlock->needsFullScopeChain || rightHasAssignments) && !rightIsPure;214 return (m_codeType != FunctionCode || m_codeBlock->needsFullScopeChain() || rightHasAssignments) && !rightIsPure; 215 215 } 216 216 … … 399 399 unsigned addRegExp(RegExp*); 400 400 401 Vector<Instruction>& instructions() { return m_codeBlock->instructions ; }401 Vector<Instruction>& instructions() { return m_codeBlock->instructions(); } 402 402 SymbolTable& symbolTable() { return *m_symbolTable; } 403 Vector<HandlerInfo>& exceptionHandlers() { return m_codeBlock->exceptionHandlers; }404 403 405 404 bool shouldOptimizeLocals() { return (m_codeType != EvalCode) && !m_dynamicScopeDepth; } 406 bool canOptimizeNonLocals() { return (m_codeType == FunctionCode) && !m_dynamicScopeDepth && !m_codeBlock->usesEval ; }405 bool canOptimizeNonLocals() { return (m_codeType == FunctionCode) && !m_dynamicScopeDepth && !m_codeBlock->usesEval(); } 407 406 408 407 RegisterID* emitThrowExpressionTooDeepException(); -
trunk/JavaScriptCore/bytecompiler/Label.h
r38494 r39070 54 54 for (unsigned i = 0; i < size; ++i) { 55 55 unsigned j = m_unresolvedJumps[i]; 56 m_codeBlock->instructions [j].u.operand = m_location - j;56 m_codeBlock->instructions()[j].u.operand = m_location - j; 57 57 } 58 58 } -
trunk/JavaScriptCore/interpreter/CallFrame.cpp
r38528 r39070 33 33 JSValue* CallFrame::thisValue() 34 34 { 35 return this[codeBlock()->thisRegister ].jsValue(this);35 return this[codeBlock()->thisRegister()].jsValue(this); 36 36 } 37 37 -
trunk/JavaScriptCore/interpreter/Interpreter.cpp
r39039 r39070 93 93 static ALWAYS_INLINE Instruction* vPCForPC(CodeBlock* codeBlock, void* pc) 94 94 { 95 if (pc >= codeBlock->instructions .begin() && pc < codeBlock->instructions.end())95 if (pc >= codeBlock->instructions().begin() && pc < codeBlock->instructions().end()) 96 96 return static_cast<Instruction*>(pc); 97 97 98 ASSERT(codeBlock-> ctiReturnAddressVPCMap.contains(pc));99 unsigned vPCIndex = codeBlock-> ctiReturnAddressVPCMap.get(pc);100 return codeBlock->instructions .begin() + vPCIndex;98 ASSERT(codeBlock->jitReturnAddressVPCMap().contains(pc)); 99 unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(pc); 100 return codeBlock->instructions().begin() + vPCIndex; 101 101 } 102 102 … … 113 113 static int depth(CodeBlock* codeBlock, ScopeChain& sc) 114 114 { 115 if (!codeBlock->needsFullScopeChain )115 if (!codeBlock->needsFullScopeChain()) 116 116 return 0; 117 117 int scopeDepth = 0; … … 334 334 335 335 CodeBlock* codeBlock = callFrame->codeBlock(); 336 Identifier& ident = codeBlock->identifier s[property];336 Identifier& ident = codeBlock->identifier(property); 337 337 do { 338 338 JSObject* o = *iter; … … 357 357 int dst = (vPC + 1)->u.operand; 358 358 int property = (vPC + 2)->u.operand; 359 int skip = (vPC + 3)->u.operand + codeBlock->needsFullScopeChain ;359 int skip = (vPC + 3)->u.operand + codeBlock->needsFullScopeChain(); 360 360 361 361 ScopeChainNode* scopeChain = callFrame->scopeChain(); … … 367 367 ASSERT(iter != end); 368 368 } 369 Identifier& ident = codeBlock->identifier s[property];369 Identifier& ident = codeBlock->identifier(property); 370 370 do { 371 371 JSObject* o = *iter; … … 399 399 400 400 CodeBlock* codeBlock = callFrame->codeBlock(); 401 Identifier& ident = codeBlock->identifier s[property];401 Identifier& ident = codeBlock->identifier(property); 402 402 PropertySlot slot(globalObject); 403 403 if (globalObject->getPropertySlot(callFrame, ident, slot)) { … … 451 451 int dst = (vPC + 1)->u.operand; 452 452 int property = (vPC + 2)->u.operand; 453 callFrame[dst] = inlineResolveBase(callFrame, callFrame->codeBlock()->identifier s[property], callFrame->scopeChain());453 callFrame[dst] = inlineResolveBase(callFrame, callFrame->codeBlock()->identifier(property), callFrame->scopeChain()); 454 454 } 455 455 … … 469 469 470 470 CodeBlock* codeBlock = callFrame->codeBlock(); 471 Identifier& ident = codeBlock->identifier s[property];471 Identifier& ident = codeBlock->identifier(property); 472 472 JSObject* base; 473 473 do { … … 505 505 506 506 CodeBlock* codeBlock = callFrame->codeBlock(); 507 Identifier& ident = codeBlock->identifier s[property];507 Identifier& ident = codeBlock->identifier(property); 508 508 JSObject* base; 509 509 do { … … 538 538 { 539 539 Register* r = callFrame->registers(); 540 Register* newEnd = r + registerOffset + newCodeBlock-> numCalleeRegisters;541 542 if (LIKELY(argc == newCodeBlock-> numParameters)) { // correct number of arguments540 Register* newEnd = r + registerOffset + newCodeBlock->m_numCalleeRegisters; 541 542 if (LIKELY(argc == newCodeBlock->m_numParameters)) { // correct number of arguments 543 543 if (UNLIKELY(!registerFile->grow(newEnd))) 544 544 return 0; 545 545 r += registerOffset; 546 } else if (argc < newCodeBlock-> numParameters) { // too few arguments -- fill in the blanks547 size_t omittedArgCount = newCodeBlock-> numParameters - argc;546 } else if (argc < newCodeBlock->m_numParameters) { // too few arguments -- fill in the blanks 547 size_t omittedArgCount = newCodeBlock->m_numParameters - argc; 548 548 registerOffset += omittedArgCount; 549 549 newEnd += omittedArgCount; … … 556 556 argv[i] = jsUndefined(); 557 557 } else { // too many arguments -- copy expected arguments, leaving the extra arguments behind 558 size_t numParameters = newCodeBlock-> numParameters;558 size_t numParameters = newCodeBlock->m_numParameters; 559 559 registerOffset += numParameters; 560 560 newEnd += numParameters; … … 594 594 ScopeChainNode* scopeChain = callFrame->scopeChain(); 595 595 CodeBlock* codeBlock = callFrame->codeBlock(); 596 RefPtr<EvalNode> evalNode = codeBlock->evalCodeCache .get(callFrame, programSource, scopeChain, exceptionValue);596 RefPtr<EvalNode> evalNode = codeBlock->evalCodeCache().get(callFrame, programSource, scopeChain, exceptionValue); 597 597 598 598 JSValue* result = jsUndefined(); … … 676 676 const Register* end; 677 677 678 if (codeBlock->codeType == GlobalCode) {678 if (codeBlock->codeType() == GlobalCode) { 679 679 it = registerFile->lastGlobal(); 680 680 end = it + registerFile->numGlobals(); … … 686 686 } 687 687 688 it = callFrame->registers() - RegisterFile::CallFrameHeaderSize - codeBlock-> numParameters;688 it = callFrame->registers() - RegisterFile::CallFrameHeaderSize - codeBlock->m_numParameters; 689 689 printf("[this] | %10p | %10p \n", it, (*it).v()); ++it; 690 end = it + max(codeBlock-> numParameters - 1, 0); // - 1 to skip "this"690 end = it + max(codeBlock->m_numParameters - 1, 0); // - 1 to skip "this" 691 691 if (it != end) { 692 692 do { … … 709 709 int registerCount = 0; 710 710 711 end = it + codeBlock-> numVars;711 end = it + codeBlock->m_numVars; 712 712 if (it != end) { 713 713 do { … … 719 719 printf("----------------------------------------------------\n"); 720 720 721 end = it + codeBlock-> numConstants;721 end = it + codeBlock->m_numConstants; 722 722 if (it != end) { 723 723 do { … … 729 729 printf("----------------------------------------------------\n"); 730 730 731 end = it + codeBlock-> numCalleeRegisters - codeBlock->numConstants - codeBlock->numVars;731 end = it + codeBlock->m_numCalleeRegisters - codeBlock->m_numConstants - codeBlock->m_numVars; 732 732 if (it != end) { 733 733 do { … … 761 761 DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue); 762 762 if (callFrame->callee()) 763 debugger->returnEvent(debuggerCallFrame, codeBlock->ownerNode ->sourceID(), codeBlock->ownerNode->lastLine());763 debugger->returnEvent(debuggerCallFrame, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->lastLine()); 764 764 else 765 debugger->didExecuteProgram(debuggerCallFrame, codeBlock->ownerNode ->sourceID(), codeBlock->ownerNode->lastLine());765 debugger->didExecuteProgram(debuggerCallFrame, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->lastLine()); 766 766 } 767 767 … … 770 770 profiler->didExecute(callFrame, callFrame->callee()); 771 771 else 772 profiler->didExecute(callFrame, codeBlock->ownerNode ->sourceURL(), codeBlock->ownerNode->lineNo());772 profiler->didExecute(callFrame, codeBlock->ownerNode()->sourceURL(), codeBlock->ownerNode()->lineNo()); 773 773 } 774 774 775 775 // If this call frame created an activation or an 'arguments' object, tear it off. 776 if (oldCodeBlock->codeType == FunctionCode && oldCodeBlock->needsFullScopeChain) {776 if (oldCodeBlock->codeType() == FunctionCode && oldCodeBlock->needsFullScopeChain()) { 777 777 while (!scopeChain->object->isObject(&JSActivation::info)) 778 778 scopeChain = scopeChain->pop(); … … 783 783 } 784 784 785 if (oldCodeBlock->needsFullScopeChain )785 if (oldCodeBlock->needsFullScopeChain()) 786 786 scopeChain->deref(); 787 787 … … 826 826 } else 827 827 exception->putWithAttributes(callFrame, Identifier(callFrame, "line"), jsNumber(callFrame, codeBlock->lineNumberForVPC(vPC)), ReadOnly | DontDelete); 828 exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceId"), jsNumber(callFrame, codeBlock->ownerNode ->sourceID()), ReadOnly | DontDelete);829 exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceURL"), jsOwnedString(callFrame, codeBlock->ownerNode ->sourceURL()), ReadOnly | DontDelete);828 exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceId"), jsNumber(callFrame, codeBlock->ownerNode()->sourceID()), ReadOnly | DontDelete); 829 exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceURL"), jsOwnedString(callFrame, codeBlock->ownerNode()->sourceURL()), ReadOnly | DontDelete); 830 830 } 831 831 … … 841 841 if (Debugger* debugger = callFrame->dynamicGlobalObject()->debugger()) { 842 842 DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue); 843 debugger->exception(debuggerCallFrame, codeBlock->ownerNode ->sourceID(), codeBlock->lineNumberForVPC(vPC));843 debugger->exception(debuggerCallFrame, codeBlock->ownerNode()->sourceID(), codeBlock->lineNumberForVPC(vPC)); 844 844 } 845 845 … … 907 907 908 908 Register* oldEnd = m_registerFile.end(); 909 Register* newEnd = oldEnd + codeBlock-> numParameters + RegisterFile::CallFrameHeaderSize + codeBlock->numCalleeRegisters;909 Register* newEnd = oldEnd + codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize + codeBlock->m_numCalleeRegisters; 910 910 if (!m_registerFile.grow(newEnd)) { 911 911 *exception = createStackOverflowError(callFrame); … … 919 919 globalObject->copyGlobalsTo(m_registerFile); 920 920 921 CallFrame* newCallFrame = CallFrame::create(oldEnd + codeBlock-> numParameters + RegisterFile::CallFrameHeaderSize);922 newCallFrame[codeBlock->thisRegister ] = thisObj;921 CallFrame* newCallFrame = CallFrame::create(oldEnd + codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize); 922 newCallFrame[codeBlock->thisRegister()] = thisObj; 923 923 newCallFrame->init(codeBlock, 0, scopeChain, CallFrame::noCaller(), 0, 0, 0); 924 924 925 if (codeBlock->needsFullScopeChain )925 if (codeBlock->needsFullScopeChain()) 926 926 scopeChain->ref(); 927 927 … … 936 936 m_reentryDepth++; 937 937 #if ENABLE(JIT) 938 if (!codeBlock-> ctiCode)938 if (!codeBlock->jitCode()) 939 939 JIT::compile(scopeChain->globalData, codeBlock); 940 result = JIT::execute(codeBlock-> ctiCode, &m_registerFile, newCallFrame, scopeChain->globalData, exception);940 result = JIT::execute(codeBlock->jitCode(), &m_registerFile, newCallFrame, scopeChain->globalData, exception); 941 941 #else 942 942 result = privateExecute(Normal, &m_registerFile, newCallFrame, exception); … … 1002 1002 m_reentryDepth++; 1003 1003 #if ENABLE(JIT) 1004 if (!codeBlock-> ctiCode)1004 if (!codeBlock->jitCode()) 1005 1005 JIT::compile(scopeChain->globalData, codeBlock); 1006 result = JIT::execute(codeBlock-> ctiCode, &m_registerFile, newCallFrame, scopeChain->globalData, exception);1006 result = JIT::execute(codeBlock->jitCode(), &m_registerFile, newCallFrame, scopeChain->globalData, exception); 1007 1007 #else 1008 1008 result = privateExecute(Normal, &m_registerFile, newCallFrame, exception); … … 1020 1020 JSValue* Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue** exception) 1021 1021 { 1022 return execute(evalNode, callFrame, thisObj, m_registerFile.size() + evalNode->bytecode(scopeChain). numParameters + RegisterFile::CallFrameHeaderSize, scopeChain, exception);1022 return execute(evalNode, callFrame, thisObj, m_registerFile.size() + evalNode->bytecode(scopeChain).m_numParameters + RegisterFile::CallFrameHeaderSize, scopeChain, exception); 1023 1023 } 1024 1024 … … 1049 1049 BatchedTransitionOptimizer optimizer(variableObject); 1050 1050 1051 const DeclarationStacks::VarStack& varStack = codeBlock->ownerNode ->varStack();1051 const DeclarationStacks::VarStack& varStack = codeBlock->ownerNode()->varStack(); 1052 1052 DeclarationStacks::VarStack::const_iterator varStackEnd = varStack.end(); 1053 1053 for (DeclarationStacks::VarStack::const_iterator it = varStack.begin(); it != varStackEnd; ++it) { … … 1059 1059 } 1060 1060 1061 const DeclarationStacks::FunctionStack& functionStack = codeBlock->ownerNode ->functionStack();1061 const DeclarationStacks::FunctionStack& functionStack = codeBlock->ownerNode()->functionStack(); 1062 1062 DeclarationStacks::FunctionStack::const_iterator functionStackEnd = functionStack.end(); 1063 1063 for (DeclarationStacks::FunctionStack::const_iterator it = functionStack.begin(); it != functionStackEnd; ++it) { … … 1069 1069 1070 1070 Register* oldEnd = m_registerFile.end(); 1071 Register* newEnd = m_registerFile.start() + globalRegisterOffset + codeBlock-> numCalleeRegisters;1071 Register* newEnd = m_registerFile.start() + globalRegisterOffset + codeBlock->m_numCalleeRegisters; 1072 1072 if (!m_registerFile.grow(newEnd)) { 1073 1073 *exception = createStackOverflowError(callFrame); … … 1078 1078 1079 1079 // a 0 codeBlock indicates a built-in caller 1080 newCallFrame[codeBlock->thisRegister ] = thisObj;1080 newCallFrame[codeBlock->thisRegister()] = thisObj; 1081 1081 newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), 0, 0, 0); 1082 1082 1083 if (codeBlock->needsFullScopeChain )1083 if (codeBlock->needsFullScopeChain()) 1084 1084 scopeChain->ref(); 1085 1085 … … 1094 1094 m_reentryDepth++; 1095 1095 #if ENABLE(JIT) 1096 if (!codeBlock-> ctiCode)1096 if (!codeBlock->jitCode()) 1097 1097 JIT::compile(scopeChain->globalData, codeBlock); 1098 result = JIT::execute(codeBlock-> ctiCode, &m_registerFile, newCallFrame, scopeChain->globalData, exception);1098 result = JIT::execute(codeBlock->jitCode(), &m_registerFile, newCallFrame, scopeChain->globalData, exception); 1099 1099 #else 1100 1100 result = privateExecute(Normal, &m_registerFile, newCallFrame, exception); … … 1118 1118 switch (debugHookID) { 1119 1119 case DidEnterCallFrame: 1120 debugger->callEvent(callFrame, callFrame->codeBlock()->ownerNode ->sourceID(), firstLine);1120 debugger->callEvent(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine); 1121 1121 return; 1122 1122 case WillLeaveCallFrame: 1123 debugger->returnEvent(callFrame, callFrame->codeBlock()->ownerNode ->sourceID(), lastLine);1123 debugger->returnEvent(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine); 1124 1124 return; 1125 1125 case WillExecuteStatement: 1126 debugger->atStatement(callFrame, callFrame->codeBlock()->ownerNode ->sourceID(), firstLine);1126 debugger->atStatement(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine); 1127 1127 return; 1128 1128 case WillExecuteProgram: 1129 debugger->willExecuteProgram(callFrame, callFrame->codeBlock()->ownerNode ->sourceID(), firstLine);1129 debugger->willExecuteProgram(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine); 1130 1130 return; 1131 1131 case DidExecuteProgram: 1132 debugger->didExecuteProgram(callFrame, callFrame->codeBlock()->ownerNode ->sourceID(), lastLine);1132 debugger->didExecuteProgram(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine); 1133 1133 return; 1134 1134 case DidReachBreakpoint: 1135 debugger->didReachBreakpoint(callFrame, callFrame->codeBlock()->ownerNode ->sourceID(), lastLine);1135 debugger->didReachBreakpoint(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine); 1136 1136 return; 1137 1137 } … … 1227 1227 int dst = (++vPC)->u.operand; 1228 1228 CodeBlock* codeBlock = callFrame->codeBlock(); 1229 Identifier& property = codeBlock->identifier s[(++vPC)->u.operand];1229 Identifier& property = codeBlock->identifier((++vPC)->u.operand); 1230 1230 JSValue* value = callFrame[(++vPC)->u.operand].jsValue(callFrame); 1231 1231 JSObject* scope = new (callFrame) JSStaticScopeObject(callFrame, property, value, DontDelete); … … 1486 1486 Instruction* handlerVPC = 0; 1487 1487 1488 Instruction* vPC = callFrame->codeBlock()->instructions .begin();1488 Instruction* vPC = callFrame->codeBlock()->instructions().begin(); 1489 1489 Profiler** enabledProfilerReference = Profiler::enabledProfilerReference(); 1490 1490 unsigned tickCount = m_ticksUntilNextTimeoutCheck + 1; … … 1575 1575 int dst = (++vPC)->u.operand; 1576 1576 int regExp = (++vPC)->u.operand; 1577 callFrame[dst] = new (globalData) RegExpObject(callFrame->scopeChain()->globalObject()->regExpStructure(), callFrame->codeBlock()->regexp s[regExp]);1577 callFrame[dst] = new (globalData) RegExpObject(callFrame->scopeChain()->globalObject()->regExpStructure(), callFrame->codeBlock()->regexp(regExp)); 1578 1578 1579 1579 ++vPC; … … 2413 2413 int dst = (++vPC)->u.operand; 2414 2414 int index = (++vPC)->u.operand; 2415 int skip = (++vPC)->u.operand + callFrame->codeBlock()->needsFullScopeChain ;2415 int skip = (++vPC)->u.operand + callFrame->codeBlock()->needsFullScopeChain(); 2416 2416 2417 2417 ScopeChainNode* scopeChain = callFrame->scopeChain(); … … 2435 2435 */ 2436 2436 int index = (++vPC)->u.operand; 2437 int skip = (++vPC)->u.operand + callFrame->codeBlock()->needsFullScopeChain ;2437 int skip = (++vPC)->u.operand + callFrame->codeBlock()->needsFullScopeChain(); 2438 2438 int value = (++vPC)->u.operand; 2439 2439 … … 2516 2516 2517 2517 CodeBlock* codeBlock = callFrame->codeBlock(); 2518 Identifier& ident = codeBlock->identifier s[property];2518 Identifier& ident = codeBlock->identifier(property); 2519 2519 JSValue* baseValue = callFrame[base].jsValue(callFrame); 2520 2520 PropertySlot slot(baseValue); … … 2548 2548 int offset = vPC[5].u.operand; 2549 2549 2550 ASSERT(baseObject->get(callFrame, callFrame->codeBlock()->identifier s[vPC[3].u.operand]) == baseObject->getDirectOffset(offset));2550 ASSERT(baseObject->get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset)); 2551 2551 callFrame[dst] = baseObject->getDirectOffset(offset); 2552 2552 … … 2582 2582 int offset = vPC[6].u.operand; 2583 2583 2584 ASSERT(protoObject->get(callFrame, callFrame->codeBlock()->identifier s[vPC[3].u.operand]) == protoObject->getDirectOffset(offset));2584 ASSERT(protoObject->get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == protoObject->getDirectOffset(offset)); 2585 2585 callFrame[dst] = protoObject->getDirectOffset(offset); 2586 2586 … … 2637 2637 int offset = vPC[7].u.operand; 2638 2638 2639 ASSERT(baseObject->get(callFrame, callFrame->codeBlock()->identifier s[vPC[3].u.operand]) == baseObject->getDirectOffset(offset));2639 ASSERT(baseObject->get(callFrame, callFrame->codeBlock()->identifier(vPC[3].u.operand)) == baseObject->getDirectOffset(offset)); 2640 2640 callFrame[dst] = baseObject->getDirectOffset(offset); 2641 2641 … … 2660 2660 int property = vPC[3].u.operand; 2661 2661 2662 Identifier& ident = callFrame->codeBlock()->identifier s[property];2662 Identifier& ident = callFrame->codeBlock()->identifier(property); 2663 2663 JSValue* baseValue = callFrame[base].jsValue(callFrame); 2664 2664 PropertySlot slot(baseValue); … … 2726 2726 CodeBlock* codeBlock = callFrame->codeBlock(); 2727 2727 JSValue* baseValue = callFrame[base].jsValue(callFrame); 2728 Identifier& ident = codeBlock->identifier s[property];2728 Identifier& ident = codeBlock->identifier(property); 2729 2729 PutPropertySlot slot; 2730 2730 baseValue->put(callFrame, ident, callFrame[value].jsValue(callFrame), slot); … … 2775 2775 int value = vPC[3].u.operand; 2776 2776 unsigned offset = vPC[7].u.operand; 2777 ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(callFrame->codeBlock()->identifier s[vPC[2].u.operand])) == offset);2777 ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(callFrame->codeBlock()->identifier(vPC[2].u.operand))) == offset); 2778 2778 baseObject->putDirectOffset(offset, callFrame[value].jsValue(callFrame)); 2779 2779 … … 2810 2810 unsigned offset = vPC[5].u.operand; 2811 2811 2812 ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(callFrame->codeBlock()->identifier s[vPC[2].u.operand])) == offset);2812 ASSERT(baseObject->offsetForLocation(baseObject->getDirectLocation(callFrame->codeBlock()->identifier(vPC[2].u.operand))) == offset); 2813 2813 baseObject->putDirectOffset(offset, callFrame[value].jsValue(callFrame)); 2814 2814 … … 2835 2835 2836 2836 JSValue* baseValue = callFrame[base].jsValue(callFrame); 2837 Identifier& ident = callFrame->codeBlock()->identifier s[property];2837 Identifier& ident = callFrame->codeBlock()->identifier(property); 2838 2838 PutPropertySlot slot; 2839 2839 baseValue->put(callFrame, ident, callFrame[value].jsValue(callFrame), slot); … … 2856 2856 2857 2857 JSObject* baseObj = callFrame[base].jsValue(callFrame)->toObject(callFrame); 2858 Identifier& ident = callFrame->codeBlock()->identifier s[property];2858 Identifier& ident = callFrame->codeBlock()->identifier(property); 2859 2859 JSValue* result = jsBoolean(baseObj->deleteProperty(callFrame, ident)); 2860 2860 CHECK_FOR_EXCEPTION(); … … 3265 3265 int func = (++vPC)->u.operand; 3266 3266 3267 callFrame[dst] = callFrame->codeBlock()->function s[func]->makeFunction(callFrame, callFrame->scopeChain());3267 callFrame[dst] = callFrame->codeBlock()->function(func)->makeFunction(callFrame, callFrame->scopeChain()); 3268 3268 3269 3269 ++vPC; … … 3281 3281 int func = (++vPC)->u.operand; 3282 3282 3283 callFrame[dst] = callFrame->codeBlock()->functionExpression s[func]->makeFunction(callFrame, callFrame->scopeChain());3283 callFrame[dst] = callFrame->codeBlock()->functionExpression(func)->makeFunction(callFrame, callFrame->scopeChain()); 3284 3284 3285 3285 ++vPC; … … 3360 3360 3361 3361 callFrame->init(newCodeBlock, vPC + 5, callDataScopeChain, previousCallFrame, dst, argCount, asFunction(v)); 3362 vPC = newCodeBlock->instructions .begin();3362 vPC = newCodeBlock->instructions().begin(); 3363 3363 3364 3364 #if ENABLE(OPCODE_STATS) … … 3414 3414 3415 3415 int src = (++vPC)->u.operand; 3416 ASSERT(callFrame->codeBlock()->needsFullScopeChain );3416 ASSERT(callFrame->codeBlock()->needsFullScopeChain()); 3417 3417 3418 3418 asActivation(callFrame[src].getJSValue())->copyRegisters(callFrame->optionalCalleeArguments()); … … 3434 3434 */ 3435 3435 3436 ASSERT(callFrame->codeBlock()->usesArguments && !callFrame->codeBlock()->needsFullScopeChain);3436 ASSERT(callFrame->codeBlock()->usesArguments() && !callFrame->codeBlock()->needsFullScopeChain()); 3437 3437 3438 3438 callFrame->optionalCalleeArguments()->copyRegisters(); … … 3453 3453 int result = (++vPC)->u.operand; 3454 3454 3455 if (callFrame->codeBlock()->needsFullScopeChain )3455 if (callFrame->codeBlock()->needsFullScopeChain()) 3456 3456 callFrame->scopeChain()->deref(); 3457 3457 … … 3483 3483 CodeBlock* codeBlock = callFrame->codeBlock(); 3484 3484 3485 for (size_t count = codeBlock-> numVars; i < count; ++i)3485 for (size_t count = codeBlock->m_numVars; i < count; ++i) 3486 3486 callFrame[i] = jsUndefined(); 3487 3487 3488 for (size_t count = codeBlock-> constantRegisters.size(), j = 0; j < count; ++i, ++j)3489 callFrame[i] = codeBlock->constantRegister s[j];3488 for (size_t count = codeBlock->numberOfConstantRegisters(), j = 0; j < count; ++i, ++j) 3489 callFrame[i] = codeBlock->constantRegister(j); 3490 3490 3491 3491 ++vPC; … … 3508 3508 CodeBlock* codeBlock = callFrame->codeBlock(); 3509 3509 3510 for (size_t count = codeBlock-> numVars; i < count; ++i)3510 for (size_t count = codeBlock->m_numVars; i < count; ++i) 3511 3511 callFrame[i] = jsUndefined(); 3512 3512 3513 for (size_t count = codeBlock-> constantRegisters.size(), j = 0; j < count; ++i, ++j)3514 callFrame[i] = codeBlock->constantRegister s[j];3513 for (size_t count = codeBlock->numberOfConstantRegisters(), j = 0; j < count; ++i, ++j) 3514 callFrame[i] = codeBlock->constantRegister(j); 3515 3515 3516 3516 int dst = (++vPC)->u.operand; 3517 JSActivation* activation = new (globalData) JSActivation(callFrame, static_cast<FunctionBodyNode*>(codeBlock->ownerNode ));3517 JSActivation* activation = new (globalData) JSActivation(callFrame, static_cast<FunctionBodyNode*>(codeBlock->ownerNode())); 3518 3518 callFrame[dst] = activation; 3519 3519 callFrame->setScopeChain(callFrame->scopeChain()->copy()->push(activation)); … … 3612 3612 3613 3613 callFrame->init(newCodeBlock, vPC + 7, callDataScopeChain, previousCallFrame, dst, argCount, asFunction(v)); 3614 vPC = newCodeBlock->instructions .begin();3614 vPC = newCodeBlock->instructions().begin(); 3615 3615 3616 3616 #if ENABLE(OPCODE_STATS) … … 3813 3813 int dst = (++vPC)->u.operand; 3814 3814 int src = (++vPC)->u.operand; 3815 callFrame[dst] = callFrame->codeBlock()->unexpectedConstant s[src];3815 callFrame[dst] = callFrame->codeBlock()->unexpectedConstant(src); 3816 3816 3817 3817 ++vPC; … … 3831 3831 3832 3832 CodeBlock* codeBlock = callFrame->codeBlock(); 3833 callFrame[dst] = Error::create(callFrame, (ErrorType)type, codeBlock->unexpectedConstant s[message]->toString(callFrame), codeBlock->lineNumberForVPC(vPC), codeBlock->ownerNode->sourceID(), codeBlock->ownerNode->sourceURL());3833 callFrame[dst] = Error::create(callFrame, (ErrorType)type, codeBlock->unexpectedConstant(message)->toString(callFrame), codeBlock->lineNumberForVPC(vPC), codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL()); 3834 3834 3835 3835 ++vPC; … … 3843 3843 */ 3844 3844 3845 if (callFrame->codeBlock()->needsFullScopeChain ) {3845 if (callFrame->codeBlock()->needsFullScopeChain()) { 3846 3846 ScopeChainNode* scopeChain = callFrame->scopeChain(); 3847 3847 ASSERT(scopeChain->refCount > 1); … … 3868 3868 ASSERT(callFrame[base].jsValue(callFrame)->isObject()); 3869 3869 JSObject* baseObj = asObject(callFrame[base].jsValue(callFrame)); 3870 Identifier& ident = callFrame->codeBlock()->identifier s[property];3870 Identifier& ident = callFrame->codeBlock()->identifier(property); 3871 3871 ASSERT(callFrame[function].jsValue(callFrame)->isObject()); 3872 3872 baseObj->defineGetter(callFrame, ident, asObject(callFrame[function].jsValue(callFrame))); … … 3892 3892 ASSERT(callFrame[base].jsValue(callFrame)->isObject()); 3893 3893 JSObject* baseObj = asObject(callFrame[base].jsValue(callFrame)); 3894 Identifier& ident = callFrame->codeBlock()->identifier s[property];3894 Identifier& ident = callFrame->codeBlock()->identifier(property); 3895 3895 ASSERT(callFrame[function].jsValue(callFrame)->isObject()); 3896 3896 baseObj->defineSetter(callFrame, ident, asObject(callFrame[function].jsValue(callFrame))); … … 3998 3998 3999 3999 CodeBlock* codeBlock = functionCallFrame->codeBlock(); 4000 if (codeBlock->usesArguments ) {4001 ASSERT(codeBlock->codeType == FunctionCode);4002 SymbolTable& symbolTable = codeBlock->symbolTable ;4000 if (codeBlock->usesArguments()) { 4001 ASSERT(codeBlock->codeType() == FunctionCode); 4002 SymbolTable& symbolTable = codeBlock->symbolTable(); 4003 4003 int argumentsIndex = symbolTable.get(functionCallFrame->propertyNames().arguments.ustring().rep()).getIndex(); 4004 4004 return functionCallFrame[argumentsIndex].jsValue(callFrame); … … 4048 4048 Instruction* vPC = vPCForPC(callerCodeBlock, callFrame->returnPC()); 4049 4049 lineNumber = callerCodeBlock->lineNumberForVPC(vPC - 1); 4050 sourceID = callerCodeBlock->ownerNode ->sourceID();4051 sourceURL = callerCodeBlock->ownerNode ->sourceURL();4050 sourceID = callerCodeBlock->ownerNode()->sourceID(); 4051 sourceURL = callerCodeBlock->ownerNode()->sourceURL(); 4052 4052 function = callerFrame->callee(); 4053 4053 } … … 4088 4088 // *_second method to achieve a similar (but not quite the same) effect. 4089 4089 4090 unsigned vPCIndex = codeBlock-> ctiReturnAddressVPCMap.get(returnAddress);4091 Instruction* vPC = codeBlock->instructions .begin() + vPCIndex;4090 unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(returnAddress); 4091 Instruction* vPC = codeBlock->instructions().begin() + vPCIndex; 4092 4092 4093 4093 // Cache hit: Specialize instruction and ref Structures. … … 4176 4176 // *_second method to achieve a similar (but not quite the same) effect. 4177 4177 4178 unsigned vPCIndex = codeBlock-> ctiReturnAddressVPCMap.get(returnAddress);4179 Instruction* vPC = codeBlock->instructions .begin() + vPCIndex;4178 unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(returnAddress); 4179 Instruction* vPC = codeBlock->instructions().begin() + vPCIndex; 4180 4180 4181 4181 // Cache hit: Specialize instruction and ref Structures. … … 4425 4425 CTI_STACK_HACK(); 4426 4426 4427 if (LIKELY(ARG_registerFile->grow(ARG_callFrame + ARG_callFrame->codeBlock()-> numCalleeRegisters)))4427 if (LIKELY(ARG_registerFile->grow(ARG_callFrame + ARG_callFrame->codeBlock()->m_numCalleeRegisters))) 4428 4428 return; 4429 4429 … … 4583 4583 4584 4584 CodeBlock* codeBlock = callFrame->codeBlock(); 4585 unsigned vPCIndex = codeBlock-> ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);4586 Instruction* vPC = codeBlock->instructions .begin() + vPCIndex;4585 unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS); 4586 Instruction* vPC = codeBlock->instructions().begin() + vPCIndex; 4587 4587 4588 4588 ASSERT(slot.slotBase()->isObject()); … … 4667 4667 Structure* structure = asCell(baseValue)->structure(); 4668 4668 CodeBlock* codeBlock = callFrame->codeBlock(); 4669 Instruction* vPC = codeBlock->instructions .begin() + codeBlock->ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);4669 Instruction* vPC = codeBlock->instructions().begin() + codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS); 4670 4670 4671 4671 ASSERT(slot.slotBase()->isObject()); … … 4776 4776 CallFrame* callFrame = ARG_callFrame; 4777 4777 CodeBlock* codeBlock = callFrame->codeBlock(); 4778 ASSERT(codeBlock-> ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));4779 unsigned vPCIndex = codeBlock-> ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);4780 ARG_globalData->exception = createInvalidParamError(callFrame, "instanceof", baseVal, codeBlock->instructions .begin() + vPCIndex, codeBlock);4778 ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS)); 4779 unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS); 4780 ARG_globalData->exception = createInvalidParamError(callFrame, "instanceof", baseVal, codeBlock->instructions().begin() + vPCIndex, codeBlock); 4781 4781 VM_THROW_EXCEPTION(); 4782 4782 } … … 4849 4849 CodeBlock* newCodeBlock = &asFunction(ARG_src1)->body()->bytecode(callDataScopeChain); 4850 4850 4851 if (!newCodeBlock-> ctiCode)4851 if (!newCodeBlock->jitCode()) 4852 4852 JIT::compile(ARG_globalData, newCodeBlock); 4853 4853 … … 4863 4863 int argCount = ARG_int3; 4864 4864 4865 ASSERT(argCount != newCodeBlock-> numParameters);4865 ASSERT(argCount != newCodeBlock->m_numParameters); 4866 4866 4867 4867 CallFrame* oldCallFrame = callFrame->callerFrame(); 4868 4868 4869 if (argCount > newCodeBlock-> numParameters) {4870 size_t numParameters = newCodeBlock-> numParameters;4869 if (argCount > newCodeBlock->m_numParameters) { 4870 size_t numParameters = newCodeBlock->m_numParameters; 4871 4871 Register* r = callFrame->registers() + numParameters; 4872 4872 … … 4878 4878 callFrame->setCallerFrame(oldCallFrame); 4879 4879 } else { 4880 size_t omittedArgCount = newCodeBlock-> numParameters - argCount;4880 size_t omittedArgCount = newCodeBlock->m_numParameters - argCount; 4881 4881 Register* r = callFrame->registers() + omittedArgCount; 4882 Register* newEnd = r + newCodeBlock-> numCalleeRegisters;4882 Register* newEnd = r + newCodeBlock->m_numCalleeRegisters; 4883 4883 if (!ARG_registerFile->grow(newEnd)) { 4884 4884 // Rewind to the previous call frame because op_call already optimistically … … 4908 4908 JSFunction* callee = asFunction(ARG_src1); 4909 4909 CodeBlock* codeBlock = &callee->body()->bytecode(callee->m_scopeChain.node()); 4910 if (!codeBlock-> ctiCode)4910 if (!codeBlock->jitCode()) 4911 4911 JIT::compile(ARG_globalData, codeBlock); 4912 4912 4913 4913 ctiRepatchCallByReturnAddress(ARG_returnAddress2, ARG_globalData->interpreter->m_ctiVirtualCallLink); 4914 4914 4915 return codeBlock-> ctiCode;4915 return codeBlock->jitCode(); 4916 4916 } 4917 4917 … … 4922 4922 JSFunction* callee = asFunction(ARG_src1); 4923 4923 CodeBlock* codeBlock = &callee->body()->bytecode(callee->m_scopeChain.node()); 4924 if (!codeBlock-> ctiCode)4924 if (!codeBlock->jitCode()) 4925 4925 JIT::compile(ARG_globalData, codeBlock); 4926 4926 4927 4927 CallLinkInfo* callLinkInfo = &ARG_callFrame->callerFrame()->codeBlock()->getCallLinkInfo(ARG_returnAddress2); 4928 JIT::linkCall(callee, codeBlock, codeBlock-> ctiCode, callLinkInfo, ARG_int3);4929 4930 return codeBlock-> ctiCode;4928 JIT::linkCall(callee, codeBlock, codeBlock->jitCode(), callLinkInfo, ARG_int3); 4929 4930 return codeBlock->jitCode(); 4931 4931 } 4932 4932 … … 4935 4935 CTI_STACK_HACK(); 4936 4936 4937 JSActivation* activation = new (ARG_globalData) JSActivation(ARG_callFrame, static_cast<FunctionBodyNode*>(ARG_callFrame->codeBlock()->ownerNode ));4937 JSActivation* activation = new (ARG_globalData) JSActivation(ARG_callFrame, static_cast<FunctionBodyNode*>(ARG_callFrame->codeBlock()->ownerNode())); 4938 4938 ARG_callFrame->setScopeChain(ARG_callFrame->scopeChain()->copy()->push(activation)); 4939 4939 return activation; … … 5008 5008 CTI_STACK_HACK(); 5009 5009 5010 ASSERT(ARG_callFrame->codeBlock()->needsFullScopeChain );5010 ASSERT(ARG_callFrame->codeBlock()->needsFullScopeChain()); 5011 5011 asActivation(ARG_src1)->copyRegisters(ARG_callFrame->optionalCalleeArguments()); 5012 5012 } … … 5016 5016 CTI_STACK_HACK(); 5017 5017 5018 ASSERT(ARG_callFrame->codeBlock()->usesArguments && !ARG_callFrame->codeBlock()->needsFullScopeChain);5018 ASSERT(ARG_callFrame->codeBlock()->usesArguments() && !ARG_callFrame->codeBlock()->needsFullScopeChain()); 5019 5019 ARG_callFrame->optionalCalleeArguments()->copyRegisters(); 5020 5020 } … … 5040 5040 CTI_STACK_HACK(); 5041 5041 5042 ASSERT(ARG_callFrame->codeBlock()->needsFullScopeChain );5042 ASSERT(ARG_callFrame->codeBlock()->needsFullScopeChain()); 5043 5043 ARG_callFrame->scopeChain()->deref(); 5044 5044 } … … 5075 5075 5076 5076 CodeBlock* codeBlock = callFrame->codeBlock(); 5077 ASSERT(codeBlock-> ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));5078 unsigned vPCIndex = codeBlock-> ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);5079 ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions .begin() + vPCIndex, codeBlock);5077 ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS)); 5078 unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS); 5079 ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions().begin() + vPCIndex, codeBlock); 5080 5080 VM_THROW_EXCEPTION(); 5081 5081 } … … 5202 5202 5203 5203 CodeBlock* codeBlock = callFrame->codeBlock(); 5204 ASSERT(codeBlock-> ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));5205 unsigned vPCIndex = codeBlock-> ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);5206 ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions .begin() + vPCIndex, codeBlock);5204 ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS)); 5205 unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS); 5206 ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions().begin() + vPCIndex, codeBlock); 5207 5207 VM_THROW_EXCEPTION_2(); 5208 5208 } … … 5360 5360 5361 5361 CodeBlock* codeBlock = callFrame->codeBlock(); 5362 ASSERT(codeBlock-> ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));5363 unsigned vPCIndex = codeBlock-> ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);5364 ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions .begin() + vPCIndex, codeBlock);5362 ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS)); 5363 unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS); 5364 ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions().begin() + vPCIndex, codeBlock); 5365 5365 VM_THROW_EXCEPTION(); 5366 5366 } … … 5599 5599 5600 5600 CodeBlock* codeBlock = callFrame->codeBlock(); 5601 ASSERT(codeBlock-> ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));5602 unsigned vPCIndex = codeBlock-> ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);5603 ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions .begin() + vPCIndex, codeBlock);5601 ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS)); 5602 unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS); 5603 ARG_globalData->exception = createUndefinedVariableError(callFrame, ident, codeBlock->instructions().begin() + vPCIndex, codeBlock); 5604 5604 VM_THROW_EXCEPTION_2(); 5605 5605 } … … 5757 5757 CodeBlock* codeBlock = callFrame->codeBlock(); 5758 5758 5759 ASSERT(codeBlock-> ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));5760 unsigned vPCIndex = codeBlock-> ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);5759 ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS)); 5760 unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS); 5761 5761 5762 5762 JSValue* exceptionValue = ARG_src1; 5763 5763 ASSERT(exceptionValue); 5764 5764 5765 Instruction* handlerVPC = ARG_globalData->interpreter->throwException(callFrame, exceptionValue, codeBlock->instructions .begin() + vPCIndex, true);5765 Instruction* handlerVPC = ARG_globalData->interpreter->throwException(callFrame, exceptionValue, codeBlock->instructions().begin() + vPCIndex, true); 5766 5766 5767 5767 if (!handlerVPC) { … … 5911 5911 CallFrame* callFrame = ARG_callFrame; 5912 5912 CodeBlock* codeBlock = callFrame->codeBlock(); 5913 ASSERT(codeBlock-> ctiReturnAddressVPCMap.contains(CTI_RETURN_ADDRESS));5914 unsigned vPCIndex = codeBlock-> ctiReturnAddressVPCMap.get(CTI_RETURN_ADDRESS);5915 ARG_globalData->exception = createInvalidParamError(callFrame, "in", baseVal, codeBlock->instructions .begin() + vPCIndex, codeBlock);5913 ASSERT(codeBlock->jitReturnAddressVPCMap().contains(CTI_RETURN_ADDRESS)); 5914 unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(CTI_RETURN_ADDRESS); 5915 ARG_globalData->exception = createInvalidParamError(callFrame, "in", baseVal, codeBlock->instructions().begin() + vPCIndex, codeBlock); 5916 5916 VM_THROW_EXCEPTION(); 5917 5917 } … … 6078 6078 unsigned lineNumber = ARG_int3; 6079 6079 6080 return Error::create(callFrame, static_cast<ErrorType>(type), message->toString(callFrame), lineNumber, codeBlock->ownerNode ->sourceID(), codeBlock->ownerNode->sourceURL());6080 return Error::create(callFrame, static_cast<ErrorType>(type), message->toString(callFrame), lineNumber, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL()); 6081 6081 } 6082 6082 … … 6102 6102 JSGlobalData* globalData = ARG_globalData; 6103 6103 6104 ASSERT(codeBlock-> ctiReturnAddressVPCMap.contains(globalData->exceptionLocation));6105 unsigned vPCIndex = codeBlock-> ctiReturnAddressVPCMap.get(globalData->exceptionLocation);6104 ASSERT(codeBlock->jitReturnAddressVPCMap().contains(globalData->exceptionLocation)); 6105 unsigned vPCIndex = codeBlock->jitReturnAddressVPCMap().get(globalData->exceptionLocation); 6106 6106 6107 6107 JSValue* exceptionValue = globalData->exception; … … 6109 6109 globalData->exception = noValue(); 6110 6110 6111 Instruction* handlerVPC = globalData->interpreter->throwException(callFrame, exceptionValue, codeBlock->instructions .begin() + vPCIndex, false);6111 Instruction* handlerVPC = globalData->interpreter->throwException(callFrame, exceptionValue, codeBlock->instructions().begin() + vPCIndex, false); 6112 6112 6113 6113 if (!handlerVPC) { -
trunk/JavaScriptCore/jit/JIT.cpp
r39061 r39070 185 185 , m_globalData(globalData) 186 186 , m_codeBlock(codeBlock) 187 , m_labels(codeBlock ? codeBlock->instructions .size() : 0)188 , m_propertyAccessCompilationInfo(codeBlock ? codeBlock-> propertyAccessInstructions.size() : 0)189 , m_callStructureStubCompilationInfo(codeBlock ? codeBlock-> callLinkInfos.size() : 0)187 , m_labels(codeBlock ? codeBlock->instructions().size() : 0) 188 , m_propertyAccessCompilationInfo(codeBlock ? codeBlock->numberOfPropertyAccessInstructions() : 0) 189 , m_callStructureStubCompilationInfo(codeBlock ? codeBlock->numberOfCallLinkInfos() : 0) 190 190 , m_lastResultBytecodeRegister(std::numeric_limits<int>::max()) 191 191 , m_jumpTargetsPosition(0) … … 266 266 void JIT::privateCompileMainPass() 267 267 { 268 Instruction* instruction = m_codeBlock->instructions .begin();269 unsigned instructionCount = m_codeBlock->instructions .size();268 Instruction* instruction = m_codeBlock->instructions().begin(); 269 unsigned instructionCount = m_codeBlock->instructions().size(); 270 270 271 271 unsigned propertyAccessInstructionIndex = 0; … … 320 320 } 321 321 case op_end: { 322 if (m_codeBlock->needsFullScopeChain )322 if (m_codeBlock->needsFullScopeChain()) 323 323 emitCTICall(i, Interpreter::cti_op_end); 324 324 emitGetVirtualRegister(instruction[i + 1].u.operand, X86::eax, i); … … 394 394 } 395 395 case op_put_by_id: { 396 compilePutByIdHotPath(instruction[i + 1].u.operand, &(m_codeBlock->identifier s[instruction[i + 2].u.operand]), instruction[i + 3].u.operand, i, propertyAccessInstructionIndex++);396 compilePutByIdHotPath(instruction[i + 1].u.operand, &(m_codeBlock->identifier(instruction[i + 2].u.operand)), instruction[i + 3].u.operand, i, propertyAccessInstructionIndex++); 397 397 i += 8; 398 398 break; 399 399 } 400 400 case op_get_by_id: { 401 compileGetByIdHotPath(instruction[i + 1].u.operand, instruction[i + 2].u.operand, &(m_codeBlock->identifier s[instruction[i + 3].u.operand]), i, propertyAccessInstructionIndex++);401 compileGetByIdHotPath(instruction[i + 1].u.operand, instruction[i + 2].u.operand, &(m_codeBlock->identifier(instruction[i + 3].u.operand)), i, propertyAccessInstructionIndex++); 402 402 i += 8; 403 403 break; … … 464 464 case op_del_by_id: { 465 465 emitPutCTIArgFromVirtualRegister(instruction[i + 2].u.operand, 0, X86::ecx); 466 Identifier* ident = &(m_codeBlock->identifier s[instruction[i + 3].u.operand]);466 Identifier* ident = &(m_codeBlock->identifier(instruction[i + 3].u.operand)); 467 467 emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 4); 468 468 emitCTICall(i, Interpreter::cti_op_del_by_id); … … 501 501 } 502 502 case op_new_func: { 503 FuncDeclNode* func = (m_codeBlock->functions[instruction[i + 2].u.operand]).get();503 FuncDeclNode* func = m_codeBlock->function(instruction[i + 2].u.operand); 504 504 emitPutCTIArgConstant(reinterpret_cast<unsigned>(func), 0); 505 505 emitCTICall(i, Interpreter::cti_op_new_func); … … 532 532 } 533 533 case op_get_scoped_var: { 534 int skip = instruction[i + 3].u.operand + m_codeBlock->needsFullScopeChain ;534 int skip = instruction[i + 3].u.operand + m_codeBlock->needsFullScopeChain(); 535 535 536 536 emitGetFromCallFrameHeader(RegisterFile::ScopeChain, X86::eax); … … 545 545 } 546 546 case op_put_scoped_var: { 547 int skip = instruction[i + 2].u.operand + m_codeBlock->needsFullScopeChain ;547 int skip = instruction[i + 2].u.operand + m_codeBlock->needsFullScopeChain(); 548 548 549 549 emitGetFromCallFrameHeader(RegisterFile::ScopeChain, X86::edx); … … 570 570 case op_ret: { 571 571 // We could JIT generate the deref, only calling out to C when the refcount hits zero. 572 if (m_codeBlock->needsFullScopeChain )572 if (m_codeBlock->needsFullScopeChain()) 573 573 emitCTICall(i, Interpreter::cti_op_ret_scopeChain); 574 574 … … 599 599 } 600 600 case op_resolve: { 601 Identifier* ident = &(m_codeBlock->identifier s[instruction[i + 2].u.operand]);601 Identifier* ident = &(m_codeBlock->identifier(instruction[i + 2].u.operand)); 602 602 emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 0); 603 603 emitCTICall(i, Interpreter::cti_op_resolve); … … 642 642 } 643 643 case op_resolve_func: { 644 Identifier* ident = &(m_codeBlock->identifier s[instruction[i + 3].u.operand]);644 Identifier* ident = &(m_codeBlock->identifier(instruction[i + 3].u.operand)); 645 645 emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 0); 646 646 emitCTICall(i, Interpreter::cti_op_resolve_func); … … 705 705 }; 706 706 case op_resolve_base: { 707 Identifier* ident = &(m_codeBlock->identifier s[instruction[i + 2].u.operand]);707 Identifier* ident = &(m_codeBlock->identifier(instruction[i + 2].u.operand)); 708 708 emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 0); 709 709 emitCTICall(i, Interpreter::cti_op_resolve_base); … … 720 720 } 721 721 case op_resolve_skip: { 722 Identifier* ident = &(m_codeBlock->identifier s[instruction[i + 2].u.operand]);722 Identifier* ident = &(m_codeBlock->identifier(instruction[i + 2].u.operand)); 723 723 emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 0); 724 emitPutCTIArgConstant(instruction[i + 3].u.operand + m_codeBlock->needsFullScopeChain , 4);724 emitPutCTIArgConstant(instruction[i + 3].u.operand + m_codeBlock->needsFullScopeChain(), 4); 725 725 emitCTICall(i, Interpreter::cti_op_resolve_skip); 726 726 emitPutVirtualRegister(instruction[i + 1].u.operand); … … 731 731 // Fast case 732 732 unsigned globalObject = asInteger(instruction[i + 2].u.jsCell); 733 Identifier* ident = &(m_codeBlock->identifier s[instruction[i + 3].u.operand]);733 Identifier* ident = &(m_codeBlock->identifier(instruction[i + 3].u.operand)); 734 734 void* structureAddress = reinterpret_cast<void*>(instruction + i + 4); 735 735 void* offsetAddr = reinterpret_cast<void*>(instruction + i + 5); … … 887 887 } 888 888 case op_unexpected_load: { 889 JSValue* v = m_codeBlock->unexpectedConstant s[instruction[i + 2].u.operand];889 JSValue* v = m_codeBlock->unexpectedConstant(instruction[i + 2].u.operand); 890 890 __ movl_i32r(asInteger(v), X86::eax); 891 891 emitPutVirtualRegister(instruction[i + 1].u.operand); … … 984 984 } 985 985 case op_resolve_with_base: { 986 Identifier* ident = &(m_codeBlock->identifier s[instruction[i + 3].u.operand]);986 Identifier* ident = &(m_codeBlock->identifier(instruction[i + 3].u.operand)); 987 987 emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 0); 988 988 emitCTICall(i, Interpreter::cti_op_resolve_with_base); … … 993 993 } 994 994 case op_new_func_exp: { 995 FuncExprNode* func = (m_codeBlock->functionExpressions[instruction[i + 2].u.operand]).get();995 FuncExprNode* func = m_codeBlock->functionExpression(instruction[i + 2].u.operand); 996 996 emitPutCTIArgConstant(reinterpret_cast<unsigned>(func), 0); 997 997 emitCTICall(i, Interpreter::cti_op_new_func_exp); … … 1070 1070 } 1071 1071 case op_new_regexp: { 1072 RegExp* regExp = m_codeBlock->regexp s[instruction[i + 2].u.operand].get();1072 RegExp* regExp = m_codeBlock->regexp(instruction[i + 2].u.operand); 1073 1073 emitPutCTIArgConstant(reinterpret_cast<unsigned>(regExp), 0); 1074 1074 emitCTICall(i, Interpreter::cti_op_new_regexp); … … 1172 1172 } 1173 1173 case op_push_new_scope: { 1174 Identifier* ident = &(m_codeBlock->identifier s[instruction[i + 2].u.operand]);1174 Identifier* ident = &(m_codeBlock->identifier(instruction[i + 2].u.operand)); 1175 1175 emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 0); 1176 1176 emitPutCTIArgFromVirtualRegister(instruction[i + 3].u.operand, 4, X86::ecx); … … 1263 1263 case op_put_getter: { 1264 1264 emitPutCTIArgFromVirtualRegister(instruction[i + 1].u.operand, 0, X86::ecx); 1265 Identifier* ident = &(m_codeBlock->identifier s[instruction[i + 2].u.operand]);1265 Identifier* ident = &(m_codeBlock->identifier(instruction[i + 2].u.operand)); 1266 1266 emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 4); 1267 1267 emitPutCTIArgFromVirtualRegister(instruction[i + 3].u.operand, 8, X86::ecx); … … 1272 1272 case op_put_setter: { 1273 1273 emitPutCTIArgFromVirtualRegister(instruction[i + 1].u.operand, 0, X86::ecx); 1274 Identifier* ident = &(m_codeBlock->identifier s[instruction[i + 2].u.operand]);1274 Identifier* ident = &(m_codeBlock->identifier(instruction[i + 2].u.operand)); 1275 1275 emitPutCTIArgConstant(reinterpret_cast<unsigned>(ident), 4); 1276 1276 emitPutCTIArgFromVirtualRegister(instruction[i + 3].u.operand, 8, X86::ecx); … … 1280 1280 } 1281 1281 case op_new_error: { 1282 JSValue* message = m_codeBlock->unexpectedConstant s[instruction[i + 3].u.operand];1282 JSValue* message = m_codeBlock->unexpectedConstant(instruction[i + 3].u.operand); 1283 1283 emitPutCTIArgConstant(instruction[i + 2].u.operand, 0); 1284 1284 emitPutCTIArgConstant(asInteger(message), 4); … … 1359 1359 // registers to zap stale pointers, to avoid unnecessarily prolonging 1360 1360 // object lifetime and increasing GC pressure. 1361 size_t count = m_codeBlock-> numVars + m_codeBlock->constantRegisters.size();1361 size_t count = m_codeBlock->m_numVars + m_codeBlock->numberOfConstantRegisters(); 1362 1362 for (size_t j = 0; j < count; ++j) 1363 1363 emitInitRegister(j); … … 1370 1370 // registers to zap stale pointers, to avoid unnecessarily prolonging 1371 1371 // object lifetime and increasing GC pressure. 1372 size_t count = m_codeBlock-> numVars + m_codeBlock->constantRegisters.size();1372 size_t count = m_codeBlock->m_numVars + m_codeBlock->numberOfConstantRegisters(); 1373 1373 for (size_t j = 0; j < count; ++j) 1374 1374 emitInitRegister(j); … … 1381 1381 } 1382 1382 case op_create_arguments: { 1383 emitCTICall(i, (m_codeBlock-> numParameters == 1) ? Interpreter::cti_op_create_arguments_no_params : Interpreter::cti_op_create_arguments);1383 emitCTICall(i, (m_codeBlock->m_numParameters == 1) ? Interpreter::cti_op_create_arguments_no_params : Interpreter::cti_op_create_arguments); 1384 1384 i += 1; 1385 1385 break; … … 1433 1433 } 1434 1434 1435 ASSERT(propertyAccessInstructionIndex == m_codeBlock-> propertyAccessInstructions.size());1436 ASSERT(callLinkInfoIndex == m_codeBlock-> callLinkInfos.size());1435 ASSERT(propertyAccessInstructionIndex == m_codeBlock->numberOfPropertyAccessInstructions()); 1436 ASSERT(callLinkInfoIndex == m_codeBlock->numberOfCallLinkInfos()); 1437 1437 } 1438 1438 … … 1462 1462 unsigned callLinkInfoIndex = 0; 1463 1463 1464 Instruction* instruction = m_codeBlock->instructions .begin();1464 Instruction* instruction = m_codeBlock->instructions().begin(); 1465 1465 for (Vector<SlowCaseEntry>::iterator iter = m_slowCases.begin(); iter != m_slowCases.end(); ++iter) { 1466 1466 // FIXME: enable peephole optimizations for slow cases when applicable … … 1605 1605 } 1606 1606 case op_put_by_id: { 1607 compilePutByIdSlowCase(instruction[i + 1].u.operand, &(m_codeBlock->identifier s[instruction[i + 2].u.operand]), instruction[i + 3].u.operand, i, iter, propertyAccessInstructionIndex++);1607 compilePutByIdSlowCase(instruction[i + 1].u.operand, &(m_codeBlock->identifier(instruction[i + 2].u.operand)), instruction[i + 3].u.operand, i, iter, propertyAccessInstructionIndex++); 1608 1608 i += 8; 1609 1609 break; 1610 1610 } 1611 1611 case op_get_by_id: { 1612 compileGetByIdSlowCase(instruction[i + 1].u.operand, instruction[i + 2].u.operand, &(m_codeBlock->identifier s[instruction[i + 3].u.operand]), i, iter, propertyAccessInstructionIndex++);1612 compileGetByIdSlowCase(instruction[i + 1].u.operand, instruction[i + 2].u.operand, &(m_codeBlock->identifier(instruction[i + 3].u.operand)), i, iter, propertyAccessInstructionIndex++); 1613 1613 i += 8; 1614 1614 break; … … 1948 1948 } 1949 1949 1950 ASSERT(propertyAccessInstructionIndex == m_codeBlock-> propertyAccessInstructions.size());1951 ASSERT(callLinkInfoIndex == m_codeBlock-> callLinkInfos.size());1950 ASSERT(propertyAccessInstructionIndex == m_codeBlock->numberOfPropertyAccessInstructions()); 1951 ASSERT(callLinkInfoIndex == m_codeBlock->numberOfCallLinkInfos()); 1952 1952 } 1953 1953 … … 1958 1958 #endif 1959 1959 #if ENABLE(OPCODE_SAMPLING) 1960 __ movl_i32m(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions .begin()), m_interpreter->sampler()->sampleSlot());1960 __ movl_i32m(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin()), m_interpreter->sampler()->sampleSlot()); 1961 1961 #endif 1962 1962 … … 1967 1967 JmpSrc slowRegisterFileCheck; 1968 1968 JmpDst afterRegisterFileCheck; 1969 if (m_codeBlock->codeType == FunctionCode) {1969 if (m_codeBlock->codeType() == FunctionCode) { 1970 1970 // In the case of a fast linked call, we do not set this up in the caller. 1971 1971 emitPutImmediateToCallFrameHeader(m_codeBlock, RegisterFile::CodeBlock); 1972 1972 1973 1973 emitGetCTIParam(CTI_ARGS_registerFile, X86::eax); 1974 __ leal_mr(m_codeBlock-> numCalleeRegisters * sizeof(Register), X86::edi, X86::edx);1974 __ leal_mr(m_codeBlock->m_numCalleeRegisters * sizeof(Register), X86::edi, X86::edx); 1975 1975 __ cmpl_mr(FIELD_OFFSET(RegisterFile, m_end), X86::eax, X86::edx); 1976 1976 slowRegisterFileCheck = __ jg(); … … 1982 1982 privateCompileSlowCases(); 1983 1983 1984 if (m_codeBlock->codeType == FunctionCode) {1984 if (m_codeBlock->codeType() == FunctionCode) { 1985 1985 __ link(slowRegisterFileCheck, __ label()); 1986 1986 emitCTICall(0, Interpreter::cti_register_file_check); … … 2021 2021 } 2022 2022 2023 for (Vector<HandlerInfo>::iterator iter = m_codeBlock->exceptionHandlers.begin(); iter != m_codeBlock->exceptionHandlers.end(); ++iter) 2024 iter->nativeCode = __ getRelocatedAddress(code, m_labels[iter->target]); 2023 for (size_t i = 0; i < m_codeBlock->numberOfExceptionHandlers(); ++i) { 2024 HandlerInfo& handler = m_codeBlock->exceptionHandler(i); 2025 handler.nativeCode = __ getRelocatedAddress(code, m_labels[handler.target]); 2026 } 2025 2027 2026 2028 for (Vector<CallRecord>::iterator iter = m_calls.begin(); iter != m_calls.end(); ++iter) { 2027 2029 if (iter->to) 2028 2030 X86Assembler::link(code, iter->from, iter->to); 2029 m_codeBlock-> ctiReturnAddressVPCMap.add(__ getRelocatedAddress(code, iter->from), iter->bytecodeIndex);2031 m_codeBlock->jitReturnAddressVPCMap().add(__ getRelocatedAddress(code, iter->from), iter->bytecodeIndex); 2030 2032 } 2031 2033 … … 2034 2036 X86Assembler::linkAbsoluteAddress(code, iter->addrPosition, iter->target); 2035 2037 2036 for (unsigned i = 0; i < m_codeBlock-> propertyAccessInstructions.size(); ++i) {2037 StructureStubInfo& info = m_codeBlock->propertyAccessInstruction s[i];2038 for (unsigned i = 0; i < m_codeBlock->numberOfPropertyAccessInstructions(); ++i) { 2039 StructureStubInfo& info = m_codeBlock->propertyAccessInstruction(i); 2038 2040 info.callReturnLocation = X86Assembler::getRelocatedAddress(code, m_propertyAccessCompilationInfo[i].callReturnLocation); 2039 2041 info.hotPathBegin = X86Assembler::getRelocatedAddress(code, m_propertyAccessCompilationInfo[i].hotPathBegin); 2040 2042 } 2041 for (unsigned i = 0; i < m_codeBlock-> callLinkInfos.size(); ++i) {2042 CallLinkInfo& info = m_codeBlock->callLinkInfo s[i];2043 for (unsigned i = 0; i < m_codeBlock->numberOfCallLinkInfos(); ++i) { 2044 CallLinkInfo& info = m_codeBlock->callLinkInfo(i); 2043 2045 info.callReturnLocation = X86Assembler::getRelocatedAddress(code, m_callStructureStubCompilationInfo[i].callReturnLocation); 2044 2046 info.hotPathBegin = X86Assembler::getRelocatedAddress(code, m_callStructureStubCompilationInfo[i].hotPathBegin); … … 2047 2049 } 2048 2050 2049 m_codeBlock-> ctiCode = code;2051 m_codeBlock->setJITCode(code); 2050 2052 } 2051 2053 … … 2111 2113 2112 2114 // Check argCount matches callee arity. 2113 __ cmpl_rm(X86::edx, FIELD_OFFSET(CodeBlock, numParameters), X86::eax);2115 __ cmpl_rm(X86::edx, FIELD_OFFSET(CodeBlock, m_numParameters), X86::eax); 2114 2116 JmpSrc arityCheckOkay1 = __ je(); 2115 2117 __ popl_r(X86::ebx); … … 2153 2155 2154 2156 // Check argCount matches callee arity. 2155 __ cmpl_rm(X86::edx, FIELD_OFFSET(CodeBlock, numParameters), X86::eax);2157 __ cmpl_rm(X86::edx, FIELD_OFFSET(CodeBlock, m_numParameters), X86::eax); 2156 2158 JmpSrc arityCheckOkay2 = __ je(); 2157 2159 __ popl_r(X86::ebx); … … 2195 2197 2196 2198 // Check argCount matches callee arity. 2197 __ cmpl_rm(X86::edx, FIELD_OFFSET(CodeBlock, numParameters), X86::eax);2199 __ cmpl_rm(X86::edx, FIELD_OFFSET(CodeBlock, m_numParameters), X86::eax); 2198 2200 JmpSrc arityCheckOkay3 = __ je(); 2199 2201 __ popl_r(X86::ebx); … … 2212 2214 2213 2215 // load ctiCode from the new codeBlock. 2214 __ movl_mr(FIELD_OFFSET(CodeBlock, ctiCode), X86::eax, X86::eax);2216 __ movl_mr(FIELD_OFFSET(CodeBlock, m_jitCode), X86::eax, X86::eax); 2215 2217 2216 2218 __ jmp_r(X86::eax); -
trunk/JavaScriptCore/jit/JITCall.cpp
r38984 r39070 56 56 { 57 57 // Currently we only link calls with the exact number of arguments. 58 if (callerArgCount == calleeCodeBlock-> numParameters) {58 if (callerArgCount == calleeCodeBlock->m_numParameters) { 59 59 ASSERT(!callLinkInfo->isLinked()); 60 60 -
trunk/JavaScriptCore/jit/JITInlineMethods.h
r39058 r39070 69 69 if (src == m_lastResultBytecodeRegister && m_codeBlock->isTemporaryRegisterIndex(src)) { 70 70 bool atJumpTarget = false; 71 while (m_jumpTargetsPosition < m_codeBlock-> jumpTargets.size() && m_codeBlock->jumpTargets[m_jumpTargetsPosition]<= currentInstructionIndex) {72 if (m_codeBlock->jumpTarget s[m_jumpTargetsPosition]== currentInstructionIndex)71 while (m_jumpTargetsPosition < m_codeBlock->numberOfJumpTargets() && m_codeBlock->jumpTarget(m_jumpTargetsPosition) <= currentInstructionIndex) { 72 if (m_codeBlock->jumpTarget(m_jumpTargetsPosition) == currentInstructionIndex) 73 73 atJumpTarget = true; 74 74 ++m_jumpTargetsPosition; … … 225 225 { 226 226 #if ENABLE(OPCODE_SAMPLING) 227 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions .begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());228 #endif 229 restoreArgumentReference(); 230 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame); 231 JmpSrc ctiCall = call(); 232 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex)); 233 #if ENABLE(OPCODE_SAMPLING) 234 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions .begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());227 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot()); 228 #endif 229 restoreArgumentReference(); 230 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame); 231 JmpSrc ctiCall = call(); 232 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex)); 233 #if ENABLE(OPCODE_SAMPLING) 234 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot()); 235 235 #endif 236 236 killLastResultRegister(); … … 242 242 { 243 243 #if ENABLE(OPCODE_SAMPLING) 244 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions .begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());245 #endif 246 restoreArgumentReference(); 247 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame); 248 JmpSrc ctiCall = call(); 249 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex)); 250 #if ENABLE(OPCODE_SAMPLING) 251 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions .begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());244 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot()); 245 #endif 246 restoreArgumentReference(); 247 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame); 248 JmpSrc ctiCall = call(); 249 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex)); 250 #if ENABLE(OPCODE_SAMPLING) 251 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot()); 252 252 #endif 253 253 killLastResultRegister(); … … 259 259 { 260 260 #if ENABLE(OPCODE_SAMPLING) 261 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions .begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());262 #endif 263 restoreArgumentReference(); 264 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame); 265 JmpSrc ctiCall = call(); 266 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex)); 267 #if ENABLE(OPCODE_SAMPLING) 268 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions .begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());261 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot()); 262 #endif 263 restoreArgumentReference(); 264 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame); 265 JmpSrc ctiCall = call(); 266 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex)); 267 #if ENABLE(OPCODE_SAMPLING) 268 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot()); 269 269 #endif 270 270 killLastResultRegister(); … … 276 276 { 277 277 #if ENABLE(OPCODE_SAMPLING) 278 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions .begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());279 #endif 280 restoreArgumentReference(); 281 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame); 282 JmpSrc ctiCall = call(); 283 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex)); 284 #if ENABLE(OPCODE_SAMPLING) 285 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions .begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());278 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot()); 279 #endif 280 restoreArgumentReference(); 281 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame); 282 JmpSrc ctiCall = call(); 283 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex)); 284 #if ENABLE(OPCODE_SAMPLING) 285 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot()); 286 286 #endif 287 287 killLastResultRegister(); … … 293 293 { 294 294 #if ENABLE(OPCODE_SAMPLING) 295 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions .begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());296 #endif 297 restoreArgumentReference(); 298 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame); 299 JmpSrc ctiCall = call(); 300 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex)); 301 #if ENABLE(OPCODE_SAMPLING) 302 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions .begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());295 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot()); 296 #endif 297 restoreArgumentReference(); 298 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame); 299 JmpSrc ctiCall = call(); 300 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex)); 301 #if ENABLE(OPCODE_SAMPLING) 302 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot()); 303 303 #endif 304 304 killLastResultRegister(); … … 310 310 { 311 311 #if ENABLE(OPCODE_SAMPLING) 312 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions .begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());313 #endif 314 restoreArgumentReference(); 315 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame); 316 JmpSrc ctiCall = call(); 317 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex)); 318 #if ENABLE(OPCODE_SAMPLING) 319 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions .begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());312 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot()); 313 #endif 314 restoreArgumentReference(); 315 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame); 316 JmpSrc ctiCall = call(); 317 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex)); 318 #if ENABLE(OPCODE_SAMPLING) 319 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot()); 320 320 #endif 321 321 killLastResultRegister(); … … 327 327 { 328 328 #if ENABLE(OPCODE_SAMPLING) 329 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions .begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot());330 #endif 331 restoreArgumentReference(); 332 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame); 333 JmpSrc ctiCall = call(); 334 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex)); 335 #if ENABLE(OPCODE_SAMPLING) 336 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions .begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot());329 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, true)), m_interpreter->sampler()->sampleSlot()); 330 #endif 331 restoreArgumentReference(); 332 emitPutCTIParam(callFrameRegister, CTI_ARGS_callFrame); 333 JmpSrc ctiCall = call(); 334 m_calls.append(CallRecord(ctiCall, helper, bytecodeIndex)); 335 #if ENABLE(OPCODE_SAMPLING) 336 store32(Imm32(m_interpreter->sampler()->encodeSample(m_codeBlock->instructions().begin() + bytecodeIndex, false)), m_interpreter->sampler()->sampleSlot()); 337 337 #endif 338 338 killLastResultRegister(); -
trunk/JavaScriptCore/jit/JITPropertyAccess.cpp
r39020 r39070 115 115 emitGetVirtualRegister(baseVReg, X86::eax, i); 116 116 117 ASSERT(m_codeBlock->propertyAccessInstruction s[propertyAccessInstructionIndex].bytecodeIndex == i);117 ASSERT(m_codeBlock->propertyAccessInstruction(propertyAccessInstructionIndex).bytecodeIndex == i); 118 118 119 119 emitJumpSlowCaseIfNotJSCell(X86::eax, i, baseVReg); … … 156 156 157 157 // Track the location of the call; this will be used to recover repatch information. 158 ASSERT(m_codeBlock->propertyAccessInstruction s[propertyAccessInstructionIndex].bytecodeIndex == i);158 ASSERT(m_codeBlock->propertyAccessInstruction(propertyAccessInstructionIndex).bytecodeIndex == i); 159 159 m_propertyAccessCompilationInfo[propertyAccessInstructionIndex].callReturnLocation = call; 160 160 } … … 168 168 emitGetVirtualRegisters(baseVReg, X86::eax, valueVReg, X86::edx, i); 169 169 170 ASSERT(m_codeBlock->propertyAccessInstruction s[propertyAccessInstructionIndex].bytecodeIndex == i);170 ASSERT(m_codeBlock->propertyAccessInstruction(propertyAccessInstructionIndex).bytecodeIndex == i); 171 171 172 172 // Jump to a slow case if either the base object is an immediate, or if the Structure does not match. … … 199 199 200 200 // Track the location of the call; this will be used to recover repatch information. 201 ASSERT(m_codeBlock->propertyAccessInstruction s[propertyAccessInstructionIndex].bytecodeIndex == i);201 ASSERT(m_codeBlock->propertyAccessInstruction(propertyAccessInstructionIndex).bytecodeIndex == i); 202 202 m_propertyAccessCompilationInfo[propertyAccessInstructionIndex].callReturnLocation = call; 203 203 } -
trunk/JavaScriptCore/parser/Nodes.cpp
r38975 r39070 2466 2466 m_code.set(new EvalCodeBlock(this, globalObject, source().provider())); 2467 2467 2468 BytecodeGenerator generator(this, globalObject->debugger(), scopeChain, &m_code->symbolTable , m_code.get());2468 BytecodeGenerator generator(this, globalObject->debugger(), scopeChain, &m_code->symbolTable(), m_code.get()); 2469 2469 generator.generate(); 2470 2470 … … 2550 2550 m_code.set(new CodeBlock(this, FunctionCode, source().provider(), source().startOffset())); 2551 2551 2552 BytecodeGenerator generator(this, globalObject->debugger(), scopeChain, &m_code->symbolTable , m_code.get());2552 BytecodeGenerator generator(this, globalObject->debugger(), scopeChain, &m_code->symbolTable(), m_code.get()); 2553 2553 generator.generate(); 2554 2554 -
trunk/JavaScriptCore/runtime/Arguments.h
r38825 r39070 108 108 109 109 CodeBlock* codeBlock = &function->body()->generatedBytecode(); 110 int numParameters = codeBlock-> numParameters;110 int numParameters = codeBlock->m_numParameters; 111 111 argc = callFrame->argumentCount(); 112 112 … … 207 207 ASSERT(!d()->registerArray); 208 208 209 size_t numParametersMinusThis = d()->functionBody->generatedBytecode(). numParameters - 1;210 size_t numVars = d()->functionBody->generatedBytecode(). numVars;209 size_t numParametersMinusThis = d()->functionBody->generatedBytecode().m_numParameters - 1; 210 size_t numVars = d()->functionBody->generatedBytecode().m_numVars; 211 211 size_t numLocals = numVars + numParametersMinusThis; 212 212 -
trunk/JavaScriptCore/runtime/ExceptionHelpers.cpp
r38528 r39070 96 96 UString message = "Can't find variable: "; 97 97 message.append(ident.ustring()); 98 JSObject* exception = Error::create(exec, ReferenceError, message, line, codeBlock->ownerNode ->sourceID(), codeBlock->ownerNode->sourceURL());98 JSObject* exception = Error::create(exec, ReferenceError, message, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL()); 99 99 exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete); 100 100 exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete); … … 107 107 static UString createErrorMessage(ExecState* exec, CodeBlock* codeBlock, int, int expressionStart, int expressionStop, JSValue* value, UString error) 108 108 { 109 if (!expressionStop || expressionStart > codeBlock->source ->length()) {109 if (!expressionStop || expressionStart > codeBlock->source()->length()) { 110 110 UString errorText = value->toString(exec); 111 111 errorText.append(" is "); … … 118 118 if (expressionStart < expressionStop) { 119 119 errorText.append('\''); 120 errorText.append(codeBlock->source ->getRange(expressionStart, expressionStop));120 errorText.append(codeBlock->source()->getRange(expressionStart, expressionStop)); 121 121 errorText.append("' ["); 122 122 errorText.append(value->toString(exec)); … … 124 124 } else { 125 125 // No range information, so give a few characters of context 126 const UChar* data = codeBlock->source ->data();127 int dataLength = codeBlock->source ->length();126 const UChar* data = codeBlock->source()->data(); 127 int dataLength = codeBlock->source()->length(); 128 128 int start = expressionStart; 129 129 int stop = expressionStart; … … 139 139 stop--; 140 140 errorText.append("near '..."); 141 errorText.append(codeBlock->source ->getRange(start, stop));141 errorText.append(codeBlock->source()->getRange(start, stop)); 142 142 errorText.append("...' ["); 143 143 errorText.append(value->toString(exec)); … … 160 160 int line = codeBlock->expressionRangeForVPC(vPC, divotPoint, startOffset, endOffset); 161 161 UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint, divotPoint + endOffset, value, message); 162 JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode ->sourceID(), codeBlock->ownerNode->sourceURL());162 JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL()); 163 163 exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete); 164 164 exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete); … … 176 176 // We're in a "new" expression, so we need to skip over the "new.." part 177 177 int startPoint = divotPoint - (startOffset ? startOffset - 4 : 0); // -4 for "new " 178 const UChar* data = codeBlock->source ->data();178 const UChar* data = codeBlock->source()->data(); 179 179 while (startPoint < divotPoint && isStrWhiteSpace(data[startPoint])) 180 180 startPoint++; 181 181 182 182 UString errorMessage = createErrorMessage(exec, codeBlock, line, startPoint, divotPoint, value, "not a constructor"); 183 JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode ->sourceID(), codeBlock->ownerNode->sourceURL());183 JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL()); 184 184 exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete); 185 185 exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete); … … 195 195 int line = codeBlock->expressionRangeForVPC(vPC, divotPoint, startOffset, endOffset); 196 196 UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint - startOffset, divotPoint, value, "not a function"); 197 JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode ->sourceID(), codeBlock->ownerNode->sourceURL());197 JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL()); 198 198 exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete); 199 199 exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete); … … 219 219 int line = codeBlock->expressionRangeForVPC(vPC, divotPoint, startOffset, endOffset); 220 220 UString errorMessage = createErrorMessage(exec, codeBlock, line, divotPoint - startOffset, divotPoint, error->isNull() ? jsNull() : jsUndefined(), "not an object"); 221 JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode ->sourceID(), codeBlock->ownerNode->sourceURL());221 JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL()); 222 222 exception->putWithAttributes(exec, Identifier(exec, expressionBeginOffsetPropertyName), jsNumber(exec, divotPoint - startOffset), ReadOnly | DontDelete); 223 223 exception->putWithAttributes(exec, Identifier(exec, expressionCaretOffsetPropertyName), jsNumber(exec, divotPoint), ReadOnly | DontDelete); -
trunk/JavaScriptCore/runtime/JSActivation.cpp
r38511 r39070 58 58 return; 59 59 60 size_t numParametersMinusThis = d()->functionBody->generatedBytecode(). numParameters - 1;60 size_t numParametersMinusThis = d()->functionBody->generatedBytecode().m_numParameters - 1; 61 61 62 62 size_t i = 0; … … 68 68 } 69 69 70 size_t numVars = d()->functionBody->generatedBytecode(). numVars;70 size_t numVars = d()->functionBody->generatedBytecode().m_numVars; 71 71 72 72 // Skip the call frame, which sits between the parameters and vars. -
trunk/JavaScriptCore/runtime/JSActivation.h
r38440 r39070 70 70 struct JSActivationData : public JSVariableObjectData { 71 71 JSActivationData(PassRefPtr<FunctionBodyNode> functionBody, Register* registers) 72 : JSVariableObjectData(&functionBody->generatedBytecode().symbolTable , registers)72 : JSVariableObjectData(&functionBody->generatedBytecode().symbolTable(), registers) 73 73 , functionBody(functionBody) 74 74 { -
trunk/JavaScriptCore/runtime/JSGlobalObject.cpp
r38511 r39070 113 113 HashSet<ProgramCodeBlock*>::const_iterator end = codeBlocks().end(); 114 114 for (HashSet<ProgramCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it) 115 (*it)-> globalObject = 0;115 (*it)->clearGlobalObject(); 116 116 117 117 RegisterFile& registerFile = globalData()->interpreter->registerFile();
Note:
See TracChangeset
for help on using the changeset viewer.