Changeset 49734 in webkit for trunk/JavaScriptCore/interpreter/Interpreter.cpp
- Timestamp:
- Oct 16, 2009, 10:52:20 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/interpreter/Interpreter.cpp
r49726 r49734 939 939 } 940 940 941 StructureChain* protoChain = structure->prototypeChain(callFrame);942 if (!protoChain->isCacheable()) {943 vPC[0] = getOpcode(op_put_by_id_generic);944 return;945 }946 947 941 // Structure transition, cache transition info 948 942 if (slot.type() == PutPropertySlot::NewProperty) { … … 951 945 return; 952 946 } 947 948 // put_by_id_transition checks the prototype chain for setters. 949 normalizePrototypeChain(callFrame, baseCell); 950 953 951 vPC[0] = getOpcode(op_put_by_id_transition); 954 952 vPC[4] = structure->previousID(); 955 953 vPC[5] = structure; 956 vPC[6] = protoChain;954 vPC[6] = structure->prototypeChain(callFrame); 957 955 vPC[7] = slot.cachedOffset(); 958 956 codeBlock->refStructures(vPC); … … 1050 1048 } 1051 1049 1052 size_t count = countPrototypeChainEntriesAndCheckForProxies(callFrame, baseValue, slot);1050 size_t count = normalizePrototypeChain(callFrame, baseValue, slot.slotBase()); 1053 1051 if (!count) { 1054 1052 vPC[0] = getOpcode(op_get_by_id_generic); … … 1056 1054 } 1057 1055 1058 StructureChain* protoChain = structure->prototypeChain(callFrame);1059 if (!protoChain->isCacheable()) {1060 vPC[0] = getOpcode(op_get_by_id_generic);1061 return;1062 }1063 1064 1056 vPC[0] = getOpcode(op_get_by_id_chain); 1065 1057 vPC[4] = structure; 1066 vPC[5] = protoChain;1058 vPC[5] = structure->prototypeChain(callFrame); 1067 1059 vPC[6] = count; 1068 1060 vPC[7] = slot.cachedOffset(); … … 3503 3495 } 3504 3496 DEFINE_OPCODE(op_get_pnames) { 3505 /* get_pnames dst(r) base(r) 3497 /* get_pnames dst(r) base(r) i(n) size(n) breakTarget(offset) 3506 3498 3507 3499 Creates a property name list for register base and puts it 3508 in register dst. This is not a true JavaScript value, just 3509 a synthetic value used to keep the iteration state in a 3510 register. 3500 in register dst, initializing i and size for iteration. If 3501 base is undefined or null, jumps to breakTarget. 3511 3502 */ 3512 3503 int dst = vPC[1].u.operand; 3513 3504 int base = vPC[2].u.operand; 3514 3515 callFrame->r(dst) = JSPropertyNameIterator::create(callFrame, callFrame->r(base).jsValue()); 3505 int i = vPC[3].u.operand; 3506 int size = vPC[4].u.operand; 3507 int breakTarget = vPC[5].u.operand; 3508 3509 JSValue v = callFrame->r(base).jsValue(); 3510 if (v.isUndefinedOrNull()) { 3511 vPC += breakTarget; 3512 NEXT_INSTRUCTION(); 3513 } 3514 3515 JSObject* o = v.toObject(callFrame); 3516 Structure* structure = o->structure(); 3517 JSPropertyNameIterator* jsPropertyNameIterator = structure->enumerationCache(); 3518 if (!jsPropertyNameIterator || jsPropertyNameIterator->cachedPrototypeChain() != structure->prototypeChain(callFrame)) 3519 jsPropertyNameIterator = JSPropertyNameIterator::create(callFrame, o); 3520 3521 callFrame->r(dst) = jsPropertyNameIterator; 3522 callFrame->r(base) = JSValue(o); 3523 callFrame->r(i) = Register::withInt(0); 3524 callFrame->r(size) = Register::withInt(jsPropertyNameIterator->size()); 3516 3525 vPC += OPCODE_LENGTH(op_get_pnames); 3517 3526 NEXT_INSTRUCTION(); 3518 3527 } 3519 3528 DEFINE_OPCODE(op_next_pname) { 3520 /* next_pname dst(r) iter(r) target(offset) 3521 3522 Tries to copies the next name from property name list in 3523 register iter. If there are names left, then copies one to 3524 register dst, and jumps to offset target. If there are none 3525 left, invalidates the iterator and continues to the next 3529 /* next_pname dst(r) base(r) i(n) size(n) iter(r) target(offset) 3530 3531 Copies the next name from the property name list in 3532 register iter to dst, then jumps to offset target. If there are no 3533 names left, invalidates the iterator and continues to the next 3526 3534 instruction. 3527 3535 */ 3528 3536 int dst = vPC[1].u.operand; 3529 int iter = vPC[2].u.operand; 3530 int target = vPC[3].u.operand; 3537 int base = vPC[2].u.operand; 3538 int i = vPC[3].u.operand; 3539 int size = vPC[4].u.operand; 3540 int iter = vPC[5].u.operand; 3541 int target = vPC[6].u.operand; 3531 3542 3532 3543 JSPropertyNameIterator* it = callFrame->r(iter).propertyNameIterator(); 3533 if (JSValue temp = it->next(callFrame)) { 3534 CHECK_FOR_TIMEOUT(); 3535 callFrame->r(dst) = JSValue(temp); 3536 vPC += target; 3537 NEXT_INSTRUCTION(); 3538 } 3539 it->invalidate(); 3544 while (callFrame->r(i).i() != callFrame->r(size).i()) { 3545 JSValue key = it->get(callFrame, asObject(callFrame->r(base).jsValue()), callFrame->r(i).i()); 3546 callFrame->r(i) = Register::withInt(callFrame->r(i).i() + 1); 3547 if (key) { 3548 CHECK_FOR_TIMEOUT(); 3549 callFrame->r(dst) = key; 3550 vPC += target; 3551 NEXT_INSTRUCTION(); 3552 } 3553 } 3540 3554 3541 3555 vPC += OPCODE_LENGTH(op_next_pname);
Note:
See TracChangeset
for help on using the changeset viewer.