Changeset 55564 in webkit for trunk/JavaScriptCore/interpreter/Interpreter.cpp
- Timestamp:
- Mar 4, 2010, 5:33:54 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/interpreter/Interpreter.cpp
r55181 r55564 1031 1031 1032 1032 if (slot.slotBase() == baseValue) { 1033 vPC[0] = slot.isGetter() ? getOpcode(op_get_by_id_getter_self) : getOpcode(op_get_by_id_self); 1034 vPC[5] = slot.cachedOffset(); 1033 switch (slot.cachedPropertyType()) { 1034 case PropertySlot::Getter: 1035 vPC[0] = getOpcode(op_get_by_id_getter_self); 1036 vPC[5] = slot.cachedOffset(); 1037 break; 1038 case PropertySlot::Custom: 1039 vPC[0] = getOpcode(op_get_by_id_custom_self); 1040 vPC[5] = slot.customGetter(); 1041 break; 1042 default: 1043 vPC[0] = getOpcode(op_get_by_id_self); 1044 vPC[5] = slot.cachedOffset(); 1045 break; 1046 } 1035 1047 1036 1048 codeBlock->refStructures(vPC); … … 1057 1069 1058 1070 ASSERT(!baseObject->structure()->isUncacheableDictionary()); 1059 1060 vPC[0] = slot.isGetter() ? getOpcode(op_get_by_id_getter_proto) : getOpcode(op_get_by_id_proto); 1071 1072 switch (slot.cachedPropertyType()) { 1073 case PropertySlot::Getter: 1074 vPC[0] = getOpcode(op_get_by_id_getter_proto); 1075 vPC[6] = offset; 1076 break; 1077 case PropertySlot::Custom: 1078 vPC[0] = getOpcode(op_get_by_id_custom_proto); 1079 vPC[6] = slot.customGetter(); 1080 break; 1081 default: 1082 vPC[0] = getOpcode(op_get_by_id_proto); 1083 vPC[6] = offset; 1084 break; 1085 } 1061 1086 vPC[5] = baseObject->structure(); 1062 vPC[6] = offset;1063 1087 1064 1088 codeBlock->refStructures(vPC); … … 1073 1097 } 1074 1098 1075 vPC[0] = slot.isGetter() ? getOpcode(op_get_by_id_getter_chain) : getOpcode(op_get_by_id_chain); 1099 1100 switch (slot.cachedPropertyType()) { 1101 case PropertySlot::Getter: 1102 vPC[0] = getOpcode(op_get_by_id_getter_chain); 1103 vPC[7] = offset; 1104 break; 1105 case PropertySlot::Custom: 1106 vPC[0] = getOpcode(op_get_by_id_custom_chain); 1107 vPC[7] = slot.customGetter(); 1108 break; 1109 default: 1110 vPC[0] = getOpcode(op_get_by_id_chain); 1111 vPC[7] = offset; 1112 break; 1113 } 1076 1114 vPC[4] = structure; 1077 1115 vPC[5] = structure->prototypeChain(callFrame); 1078 1116 vPC[6] = count; 1079 vPC[7] = offset;1080 1117 codeBlock->refStructures(vPC); 1081 1118 } … … 2208 2245 skip_id_getter_proto: 2209 2246 #endif 2247 #if HAVE(COMPUTED_GOTO) 2248 goto *(&&skip_id_custom_proto); 2249 #endif 2250 DEFINE_OPCODE(op_get_by_id_custom_proto) { 2251 /* op_get_by_id_custom_proto dst(r) base(r) property(id) structure(sID) prototypeStructure(sID) offset(n) nop(n) 2252 2253 Cached property access: Attempts to use a cached named property getter 2254 from the value base's prototype. If the cache misses, op_get_by_id_custom_proto 2255 reverts to op_get_by_id. 2256 */ 2257 int base = vPC[2].u.operand; 2258 JSValue baseValue = callFrame->r(base).jsValue(); 2259 2260 if (LIKELY(baseValue.isCell())) { 2261 JSCell* baseCell = asCell(baseValue); 2262 Structure* structure = vPC[4].u.structure; 2263 2264 if (LIKELY(baseCell->structure() == structure)) { 2265 ASSERT(structure->prototypeForLookup(callFrame).isObject()); 2266 JSObject* protoObject = asObject(structure->prototypeForLookup(callFrame)); 2267 Structure* prototypeStructure = vPC[5].u.structure; 2268 2269 if (LIKELY(protoObject->structure() == prototypeStructure)) { 2270 int dst = vPC[1].u.operand; 2271 int property = vPC[3].u.operand; 2272 Identifier& ident = callFrame->codeBlock()->identifier(property); 2273 2274 PropertySlot::GetValueFunc getter = vPC[6].u.getterFunc; 2275 JSValue result = getter(callFrame, protoObject, ident); 2276 CHECK_FOR_EXCEPTION(); 2277 callFrame->r(dst) = result; 2278 vPC += OPCODE_LENGTH(op_get_by_id_custom_proto); 2279 NEXT_INSTRUCTION(); 2280 } 2281 } 2282 } 2283 uncacheGetByID(callFrame->codeBlock(), vPC); 2284 NEXT_INSTRUCTION(); 2285 } 2286 #if HAVE(COMPUTED_GOTO) 2287 skip_id_custom_proto: 2288 #endif 2210 2289 DEFINE_OPCODE(op_get_by_id_self_list) { 2211 2290 // Polymorphic self access caching currently only supported when JITting. … … 2230 2309 } 2231 2310 DEFINE_OPCODE(op_get_by_id_getter_proto_list) { 2311 // Polymorphic prototype access caching currently only supported when JITting. 2312 ASSERT_NOT_REACHED(); 2313 // This case of the switch must not be empty, else (op_get_by_id_proto_list == op_get_by_id_chain)! 2314 vPC += OPCODE_LENGTH(op_get_by_id_proto_list); 2315 NEXT_INSTRUCTION(); 2316 } 2317 DEFINE_OPCODE(op_get_by_id_custom_self_list) { 2318 // Polymorphic self access caching currently only supported when JITting. 2319 ASSERT_NOT_REACHED(); 2320 // This case of the switch must not be empty, else (op_get_by_id_self_list == op_get_by_id_chain)! 2321 vPC += OPCODE_LENGTH(op_get_by_id_custom_self_list); 2322 NEXT_INSTRUCTION(); 2323 } 2324 DEFINE_OPCODE(op_get_by_id_custom_proto_list) { 2232 2325 // Polymorphic prototype access caching currently only supported when JITting. 2233 2326 ASSERT_NOT_REACHED(); … … 2324 2417 #if HAVE(COMPUTED_GOTO) 2325 2418 skip_id_getter_self: 2419 #endif 2420 #if HAVE(COMPUTED_GOTO) 2421 goto *(&&skip_id_custom_self); 2422 #endif 2423 DEFINE_OPCODE(op_get_by_id_custom_self) { 2424 /* op_get_by_id_custom_self dst(r) base(r) property(id) structure(sID) offset(n) nop(n) nop(n) 2425 2426 Cached property access: Attempts to use a cached named property getter 2427 from the value base. If the cache misses, op_get_by_id_custom_self reverts to 2428 op_get_by_id. 2429 */ 2430 int base = vPC[2].u.operand; 2431 JSValue baseValue = callFrame->r(base).jsValue(); 2432 2433 if (LIKELY(baseValue.isCell())) { 2434 JSCell* baseCell = asCell(baseValue); 2435 Structure* structure = vPC[4].u.structure; 2436 2437 if (LIKELY(baseCell->structure() == structure)) { 2438 ASSERT(baseCell->isObject()); 2439 int dst = vPC[1].u.operand; 2440 int property = vPC[3].u.operand; 2441 Identifier& ident = callFrame->codeBlock()->identifier(property); 2442 2443 PropertySlot::GetValueFunc getter = vPC[5].u.getterFunc; 2444 JSValue result = getter(callFrame, baseValue, ident); 2445 CHECK_FOR_EXCEPTION(); 2446 callFrame->r(dst) = result; 2447 vPC += OPCODE_LENGTH(op_get_by_id_custom_self); 2448 NEXT_INSTRUCTION(); 2449 } 2450 } 2451 uncacheGetByID(callFrame->codeBlock(), vPC); 2452 NEXT_INSTRUCTION(); 2453 } 2454 #if HAVE(COMPUTED_GOTO) 2455 skip_id_custom_self: 2326 2456 #endif 2327 2457 DEFINE_OPCODE(op_get_by_id_generic) { … … 2399 2529 #if HAVE(COMPUTED_GOTO) 2400 2530 skip_id_getter_chain: 2531 #endif 2532 #if HAVE(COMPUTED_GOTO) 2533 goto *(&&skip_id_custom_chain); 2534 #endif 2535 DEFINE_OPCODE(op_get_by_id_custom_chain) { 2536 /* op_get_by_id_custom_chain dst(r) base(r) property(id) structure(sID) structureChain(chain) count(n) offset(n) 2537 2538 Cached property access: Attempts to use a cached named property getter on the 2539 value base's prototype chain. If the cache misses, op_get_by_id_custom_chain 2540 reverts to op_get_by_id. 2541 */ 2542 int base = vPC[2].u.operand; 2543 JSValue baseValue = callFrame->r(base).jsValue(); 2544 2545 if (LIKELY(baseValue.isCell())) { 2546 JSCell* baseCell = asCell(baseValue); 2547 Structure* structure = vPC[4].u.structure; 2548 2549 if (LIKELY(baseCell->structure() == structure)) { 2550 RefPtr<Structure>* it = vPC[5].u.structureChain->head(); 2551 size_t count = vPC[6].u.operand; 2552 RefPtr<Structure>* end = it + count; 2553 2554 while (true) { 2555 JSObject* baseObject = asObject(baseCell->structure()->prototypeForLookup(callFrame)); 2556 2557 if (UNLIKELY(baseObject->structure() != (*it).get())) 2558 break; 2559 2560 if (++it == end) { 2561 int dst = vPC[1].u.operand; 2562 int property = vPC[3].u.operand; 2563 Identifier& ident = callFrame->codeBlock()->identifier(property); 2564 2565 PropertySlot::GetValueFunc getter = vPC[7].u.getterFunc; 2566 JSValue result = getter(callFrame, baseObject, ident); 2567 CHECK_FOR_EXCEPTION(); 2568 callFrame->r(dst) = result; 2569 vPC += OPCODE_LENGTH(op_get_by_id_custom_chain); 2570 NEXT_INSTRUCTION(); 2571 } 2572 2573 // Update baseCell, so that next time around the loop we'll pick up the prototype's prototype. 2574 baseCell = baseObject; 2575 } 2576 } 2577 } 2578 uncacheGetByID(callFrame->codeBlock(), vPC); 2579 NEXT_INSTRUCTION(); 2580 } 2581 #if HAVE(COMPUTED_GOTO) 2582 skip_id_custom_chain: 2401 2583 #endif 2402 2584 DEFINE_OPCODE(op_get_array_length) {
Note:
See TracChangeset
for help on using the changeset viewer.