int DLargestCommonSubSequence::getLElem(int gi, int gj) { int** chunk = L_[getCPair(gi / chunkLength_, gj / chunkLength_)]; assert(NULL != chunk); assert(NULL != chunk[getLocal(gi)]); return chunk[getLocal(gi)][getLocal(gj)]; }
void DLargestCommonSubSequence::setLElem(int gi, int gj, int value) { int** chunk = L_[getCPair(gi / chunkLength_, gj / chunkLength_)]; //std::cout << "gi="<< gi << " gj="<<gj << " And chunk is [" // << gi / chunkLength_ << ", " // << gj / chunkLength_ << "] with local coords {" // << getLocal(gi) << ", " // << getLocal(gj) << "} And val=" << value <<std::endl <<std::flush; assert(NULL != chunk); assert(NULL != chunk[getLocal(gi)]); chunk[getLocal(gi)][getLocal(gj)] = value; }
/* * push命令 * スタックフレーム + 現在のスタックポインタ + プッシュ回数分だけずらした位置にメモリを配置する。 */ void VMDriver::_push(){ size_t stackFrame = currentAssembly()->stackFrame(); Memory& m = this->createOrGetMemory(); Memory& set = getLocal( stackFrame + m_push + m_localAddr ); m_push++; setMemory( set , m ); }
ValuePtr getValue(Token t) { if (t.type == Token::T_ConstValue) return t.value; std::string vname = t.value->toString(); ValuePtr v = getLocal(vname); if (v != NULL) return v; return getGlobal(vname); }
Socket::Error UDPSocket::disconnect(void) { if(so == INVALID_SOCKET) return errSuccess; Socket::state = BOUND; return connect(getLocal()); }
Variant SharedMap::get(CVarRef k, int64 prehash /* = -1 */, bool error /* = false */) const { SharedVariant *sv = m_arr->get(k); if (sv) return getLocal(sv); if (error) { raise_notice("Undefined index: %s", k.toString().data()); } return null; }
void VMDriver::_push_ptr(){ size_t stackFrame = currentAssembly()->stackFrame(); Memory& m = this->createOrGetMemory(); Memory& set = getLocal( stackFrame + m_push + m_localAddr ); m_push++; int addr = m.address; int location = m.location; this->setMemory( set , addr , location ); }
void* begingrab(void *) { char dev[10]; strcpy(dev, "wlan0"); //本机测试使用无线网 char errbuf[PCAP_ERRBUF_SIZE]; //出错信息 cout << "DEV: " << dev << endl; bpf_u_int32 mask; //网络掩码 bpf_u_int32 net; //网络号 if (pcap_lookupnet(dev, &net, &mask, errbuf) == -1) { //获取网卡的网络号和掩码 cout << "can't get netmask for device" << dev << endl; strcpy(dev, "eth0"); cout << "trying device eth0" << endl; cout << "DEV: " << dev << endl; if (pcap_lookupnet(dev, &net, &mask, errbuf) == -1) { cout << "can't get netmask for device" << dev << endl; exit(0); } } pcap_t* handle; handle = pcap_open_live(dev, BUFSIZ, 0, -1, errbuf); //打开网络设备 if (handle == NULL) { cout << "can't open device " << dev << endl; exit(0); } getLocal(dev); //获取本机ip char filter[100]; sprintf(filter, "host %s", local_addrs->string); //构造过滤器,只考虑本机ip bpf_program fp; // if (pcap_compile(handle, &fp, filter, 0, net) == -1) // { //编译过滤器 // cout << "compile filter error ! " << endl; // exit(0); // } // if (pcap_setfilter(handle, &fp) == -1) // { //应用过滤器 // cout << "set filter error ! " << endl; // exit(0); // } while (1) { bool get_a_packet = false; int ret = pcap_dispatch(handle, -1, got_packet, NULL); if (ret == -1 || ret == -2) { cout << "error occur when grab a packet!" << endl; } else if (ret != 0) get_a_packet = true; if (!get_a_packet) //降低CPU利用率 >_< usleep(100); } pcap_close(handle); return NULL; }
/*** * Returns a shallow copy */ StateVector* StateVector::clone() { StateVector *clone = new (gc) StateVector(currentReferences->size(), gc); for (int32_t i = 0; i < getNumberOfLocals(); i++) { TessaInstruction* currentReference = getLocal(i); clone->setLocal(i, currentReference); } return clone; }
static void AntiSVN(char *targetDir) { targetDir = makeFullPath(targetDir); if(!ForceMode) { cout("%s\n", targetDir); cout("ANTI-SVN PROCEED? [Any/ESC]\n"); if(clearGetKey() == 0x1b) termination(1); cout("GO!\n"); } for(; ; ) { autoList_t *dirs = lssDirs(targetDir); char *dir; uint index; int found = 0; foreach(dirs, dir, index) { if( !_stricmp(".svn", getLocal(dir)) || !_stricmp("_svn", getLocal(dir)) ) { coExecute_x(xcout("RD /S /Q \"%s\"", dir)); found = 1; } } releaseDim(dirs, 1); if(!found) break; coSleep(1000); } memFree(targetDir); }
void DLargestCommonSubSequence::calculateChunk(int i, int j) { for(int k = i*chunkLength_; k < (i+1)*chunkLength_; ++k) { for(int l = j*chunkLength_; l < (j+1)*chunkLength_; ++l) { if( 0 == k || 0 == l ) { setLElem(k, l, 0); } else { char iSymbol = a_[getLocal(k)]; char jSymbol = b_[getLocal(l)]; if(iSymbol == jSymbol) { setLElem(k,l, getLElem(k-1, l-1) + 1); } else { setLElem(k, l, std::max<int>(getLElem(k-1, l), getLElem(k, l-1))); } } } } }
IPV6Host Socket::getIPV6Local(in_port_t *port) const { const sockaddr_in6* from = getLocal(); if (from == NULL) { if (port) *port = 0; return IPV6Host(in6addr_any); } if (port) *port = ntohs(from->sin6_port); return IPV6Host(from->sin6_addr); }
IPV4Host Socket::getIPV4Local(tpport_t *port) const { sockaddr_in* from = getLocal(); if (from == NULL) { if (port) port = 0; return IPV4Host(INADDR_ANY); } if (port) *port = ntohs(from->sin_port); return IPV4Host(from->sin_addr); }
nsHtml5AttributeName* nsHtml5ReleasableAttributeName::cloneAttributeName(nsHtml5AtomTable* aInterner) { nsIAtom* l = getLocal(0); if (aInterner) { if (!l->IsStaticAtom()) { nsAutoString str; l->ToString(str); l = aInterner->GetAtom(str); } } return new nsHtml5ReleasableAttributeName(nsHtml5AttributeName::ALL_NO_NS, nsHtml5AttributeName::SAME_LOCAL(l), nsHtml5AttributeName::ALL_NO_PREFIX); }
IPV4Host Socket::getIPV4Local(in_port_t *port) const { const sockaddr_in* from = getLocal(); struct in_addr any; any.s_addr = INADDR_ANY; if (from == NULL) { if (port) *port = 0; return IPV4Host(any); } if (port) *port = ntohs(from->sin_port); return IPV4Host(from->sin_addr); }
int main(int argc, char **argv) { autoList_t *paths = readLines(FOUNDLISTFILE); char *path; uint index; char *outDir = makeFreeDir(); foreach(paths, path, index) { char *outPath = toCreatablePath(combine(outDir, getLocal(path)), getCount(paths) + 10); cout("< %s\n", path); cout("> %s\n", outPath); copyPath(path, outPath); memFree(outPath); }
void DLargestCommonSubSequence::printString(const char* name, const char * data) { bsp_sync(); if(0 == id_) std::cout << name << std::endl; bsp_sync(); for(int i = 0; i < length_; ++i) { if(id_ == (i / chunkLength_) % n_) { std::cout << data[getLocal(i)]; } bsp_sync(); } if(0 == id_) std::cout << std::endl; bsp_sync(); }
gint advanceTime(gpointer data) { statsLocal * sl; std::list<change *> changes; for(int i=0;i<(ROW_LENGTH*ROW_LENGTH);i++) { sl = getLocal(i); if(commerceGrowth(sl,i)) { if(sl->nearRoad){ change *c; c = new change; c->location = i; c->structure = rand()%2+5; changes.push_back(c); } } if(residentialGrowth(sl,i)) { change *c; c = new change; c->location = i; c->structure = rand()%5; changes.push_back(c); } delete sl; } if(!changes.empty()) { while(!changes.empty()) { changeTileTo(changes.front()->location,changes.front()->structure); changes.pop_front(); } drawTiles(); updateStats(); } return 1; }
jobjectArray getAllLocals(JNIEnv *env, jthread thread, jint depth, jlocation location, jint count, jvmtiLocalVariableEntry *locals) { jint i; jint highSlot; jobject local; jobjectArray result; highSlot = 0; for (i = 0; i < count; i++) { if (locals[i].start_location <= location && locals[i].start_location + locals[i].length >= location) { if (locals[i].slot > highSlot) highSlot = locals[i].slot; } } result = (*env)->NewObjectArray(env, highSlot+1, agent->Object, NULL); if ((*env)->ExceptionCheck(env)) { return NULL; } for (i = 0; i < count; i++) { if (locals[i].start_location <= location && locals[i].start_location + locals[i].length >= location) { local = getLocal(env, thread, locals[i].signature[0], 0, locals[i].slot); if ((*env)->ExceptionCheck(env)) { return NULL; } (*env)->SetObjectArrayElement(env, result, locals[i].slot, local); (*env)->DeleteLocalRef(env, local); if ((*env)->ExceptionCheck(env)) { return NULL; } } } return result; }
void BlockManager::get(string blockId){ getLocal(blockId); }
int main (int argc, char** argv) { process_init(); device * devices = NULL; //dp_link_type linktype = dp_link_ethernet; int promisc = 0; int opt; while ((opt = getopt(argc, argv, "Vhbtpd:v:c:s")) != -1) { switch(opt) { case 'V': versiondisplay(); exit(0); case 'h': help(false); exit(0); case 'b': bughuntmode = true; tracemode = true; break; case 't': tracemode = true; break; case 'p': promisc = 1; break; case 's': sortRecv = false; break; case 'd': refreshdelay = atoi(optarg); break; case 'v': viewMode = atoi(optarg) % VIEWMODE_COUNT; break; case 'c': refreshlimit = atoi(optarg); break; /* case 'f': argv++; if (strcmp (optarg, "ppp") == 0) linktype = dp_link_ppp; else if (strcmp (optarg, "eth") == 0) linktype = dp_link_ethernet; } break; */ default: help(true); exit(EXIT_FAILURE); } } while (optind < argc) { devices = new device (strdup(argv[optind++]), devices); } if (devices == NULL) { devices = get_default_devices(); if ( devices == NULL ) { std::cerr << "Not devices to monitor" << std::endl; return 0; } } if ((!tracemode) && (!DEBUG)){ init_ui(); } if (NEEDROOT && (geteuid() != 0)) forceExit(false, "You need to be root to run NetHogs!"); //use the Self-Pipe trick to interrupt the select() in the main loop self_pipe = create_self_pipe(); if( self_pipe.first == -1 || self_pipe.second == -1 ) { forceExit(false, "Error creating pipe file descriptors\n"); } else { //add the self-pipe to allow interrupting select() pc_loop_fd_list.push_back(self_pipe.first); } char errbuf[PCAP_ERRBUF_SIZE]; handle * handles = NULL; device * current_dev = devices; while (current_dev != NULL) { getLocal(current_dev->name, tracemode); dp_handle * newhandle = dp_open_live(current_dev->name, BUFSIZ, promisc, 100, errbuf); if (newhandle != NULL) { dp_addcb (newhandle, dp_packet_ip, process_ip); dp_addcb (newhandle, dp_packet_ip6, process_ip6); dp_addcb (newhandle, dp_packet_tcp, process_tcp); dp_addcb (newhandle, dp_packet_udp, process_udp); /* The following code solves sf.net bug 1019381, but is only available * in newer versions (from 0.8 it seems) of libpcap * * update: version 0.7.2, which is in debian stable now, should be ok * also. */ if (dp_setnonblock (newhandle, 1, errbuf) == -1) { fprintf(stderr, "Error putting libpcap in nonblocking mode\n"); } handles = new handle (newhandle, current_dev->name, handles); if( pc_loop_use_select ) { //some devices may not support pcap_get_selectable_fd int const fd = pcap_get_selectable_fd(newhandle->pcap_handle); if( fd != -1 ) { pc_loop_fd_list.push_back(fd); } else { pc_loop_use_select = false; pc_loop_fd_list.clear(); fprintf(stderr, "failed to get selectable_fd for %s\n", current_dev->name); } } } else { fprintf(stderr, "Error opening handler for device %s\n", current_dev->name); } current_dev = current_dev->next; } signal (SIGINT, &quit_cb); fprintf(stderr, "Waiting for first packet to arrive (see sourceforge.net bug 1019381)\n"); struct dpargs * userdata = (dpargs *) malloc (sizeof (struct dpargs)); // Main loop: // // Walks though the 'handles' list, which contains handles opened in non-blocking mode. // This causes the CPU utilisation to go up to 100%. This is tricky: while (1) { bool packets_read = false; handle * current_handle = handles; while (current_handle != NULL) { userdata->device = current_handle->devicename; userdata->sa_family = AF_UNSPEC; int retval = dp_dispatch (current_handle->content, -1, (u_char *)userdata, sizeof (struct dpargs)); if (retval < 0) { std::cerr << "Error dispatching: " << retval << std::endl; } else if (retval != 0) { packets_read = true; } current_handle = current_handle->next; } time_t const now = ::time(NULL); if( last_refresh_time + refreshdelay <= now ) { last_refresh_time = now; if ((!DEBUG)&&(!tracemode)) { // handle user input ui_tick(); } do_refresh(); } //if not packets, do a select() until next packet if (!packets_read) { if( !wait_for_next_trigger() ) { //Exit the loop break; } } } //clean up clean_up(); }
static int nethogsmonitor_init() { process_init(); device *devices = get_default_devices(); if (devices == NULL) { std::cerr << "No devices to monitor" << std::endl; return NETHOGS_STATUS_NO_DEVICE; } device *current_dev = devices; bool promiscuous = false; int nb_devices = 0; int nb_failed_devices = 0; while (current_dev != NULL) { ++nb_devices; if (!getLocal(current_dev->name, false)) { std::cerr << "getifaddrs failed while establishing local IP." << std::endl; ++nb_failed_devices; continue; } char errbuf[PCAP_ERRBUF_SIZE]; dp_handle *newhandle = dp_open_live(current_dev->name, BUFSIZ, promiscuous, 100, errbuf); if (newhandle != NULL) { dp_addcb(newhandle, dp_packet_ip, process_ip); dp_addcb(newhandle, dp_packet_ip6, process_ip6); dp_addcb(newhandle, dp_packet_tcp, process_tcp); dp_addcb(newhandle, dp_packet_udp, process_udp); /* The following code solves sf.net bug 1019381, but is only available * in newer versions (from 0.8 it seems) of libpcap * * update: version 0.7.2, which is in debian stable now, should be ok * also. */ if (dp_setnonblock(newhandle, 1, errbuf) == -1) { fprintf(stderr, "Error putting libpcap in nonblocking mode\n"); } handles = new handle(newhandle, current_dev->name, handles); if (pc_loop_use_select) { // some devices may not support pcap_get_selectable_fd int const fd = pcap_get_selectable_fd(newhandle->pcap_handle); if (fd != -1) { pc_loop_fd_list.push_back(fd); } else { pc_loop_use_select = false; pc_loop_fd_list.clear(); fprintf(stderr, "failed to get selectable_fd for %s\n", current_dev->name); } } } else { fprintf(stderr, "ERROR: opening handler for device %s: %s\n", current_dev->name, strerror(errno)); ++nb_failed_devices; } current_dev = current_dev->next; } if (nb_devices == nb_failed_devices) { return NETHOGS_STATUS_FAILURE; } // use the Self-Pipe trick to interrupt the select() in the main loop if (pc_loop_use_select) { self_pipe = create_self_pipe(); if (self_pipe.first == -1 || self_pipe.second == -1) { std::cerr << "Error creating pipe file descriptors\n"; pc_loop_use_select = false; } else { pc_loop_fd_list.push_back(self_pipe.first); } } return NETHOGS_STATUS_OK; }
bool run() { for (unsigned i = m_graph.m_variableAccessData.size(); i--;) { VariableAccessData* variable = &m_graph.m_variableAccessData[i]; if (!variable->isRoot()) continue; variable->clearVotes(); } // Identify the set of variables that are always subject to the same structure // checks. For now, only consider monomorphic structure checks (one structure). for (BlockIndex blockIndex = 0; blockIndex < m_graph.m_blocks.size(); ++blockIndex) { BasicBlock* block = m_graph.m_blocks[blockIndex].get(); if (!block) continue; for (unsigned indexInBlock = 0; indexInBlock < block->size(); ++indexInBlock) { NodeIndex nodeIndex = block->at(indexInBlock); Node& node = m_graph[nodeIndex]; if (!node.shouldGenerate()) continue; switch (node.op()) { case CheckStructure: { Node& child = m_graph[node.child1()]; if (child.op() != GetLocal) break; VariableAccessData* variable = child.variableAccessData(); variable->vote(VoteStructureCheck); if (variable->isCaptured() || variable->structureCheckHoistingFailed()) break; if (!isCellSpeculation(variable->prediction())) break; noticeStructureCheck(variable, node.structureSet()); break; } case ForwardCheckStructure: case ForwardStructureTransitionWatchpoint: // We currently rely on the fact that we're the only ones who would // insert this node. ASSERT_NOT_REACHED(); break; case GetByOffset: case PutByOffset: case PutStructure: case StructureTransitionWatchpoint: case AllocatePropertyStorage: case ReallocatePropertyStorage: case GetPropertyStorage: case GetByVal: case PutByVal: case PutByValAlias: case GetArrayLength: case CheckArray: case GetIndexedPropertyStorage: case Phantom: // Don't count these uses. break; default: m_graph.vote(node, VoteOther); break; } } } // Disable structure hoisting on variables that appear to mostly be used in // contexts where it doesn't make sense. for (unsigned i = m_graph.m_variableAccessData.size(); i--;) { VariableAccessData* variable = &m_graph.m_variableAccessData[i]; if (!variable->isRoot()) continue; if (variable->voteRatio() >= Options::structureCheckVoteRatioForHoisting()) continue; HashMap<VariableAccessData*, CheckData>::iterator iter = m_map.find(variable); if (iter == m_map.end()) continue; #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) dataLog("Zeroing the structure to hoist for %s because the ratio is %lf.\n", m_graph.nameOfVariableAccessData(variable), variable->voteRatio()); #endif iter->second.m_structure = 0; } // Identify the set of variables that are live across a structure clobber. Operands<VariableAccessData*> live( m_graph.m_blocks[0]->variablesAtTail.numberOfArguments(), m_graph.m_blocks[0]->variablesAtTail.numberOfLocals()); for (BlockIndex blockIndex = 0; blockIndex < m_graph.m_blocks.size(); ++blockIndex) { BasicBlock* block = m_graph.m_blocks[blockIndex].get(); if (!block) continue; ASSERT(live.numberOfArguments() == block->variablesAtTail.numberOfArguments()); ASSERT(live.numberOfLocals() == block->variablesAtTail.numberOfLocals()); for (unsigned i = live.size(); i--;) { NodeIndex indexAtTail = block->variablesAtTail[i]; VariableAccessData* variable; if (indexAtTail == NoNode) variable = 0; else variable = m_graph[indexAtTail].variableAccessData(); live[i] = variable; } for (unsigned indexInBlock = block->size(); indexInBlock--;) { NodeIndex nodeIndex = block->at(indexInBlock); Node& node = m_graph[nodeIndex]; if (!node.shouldGenerate()) continue; switch (node.op()) { case GetLocal: case Flush: // This is a birth. live.operand(node.local()) = node.variableAccessData(); break; case SetLocal: case SetArgument: ASSERT(live.operand(node.local())); // Must be live. ASSERT(live.operand(node.local()) == node.variableAccessData()); // Must have the variable we expected. // This is a death. live.operand(node.local()) = 0; break; // Use the CFA's notion of what clobbers the world. case ValueAdd: if (m_graph.addShouldSpeculateInteger(node)) break; if (Node::shouldSpeculateNumber(m_graph[node.child1()], m_graph[node.child2()])) break; clobber(live); break; case CompareLess: case CompareLessEq: case CompareGreater: case CompareGreaterEq: case CompareEq: { Node& left = m_graph[node.child1()]; Node& right = m_graph[node.child2()]; if (Node::shouldSpeculateInteger(left, right)) break; if (Node::shouldSpeculateNumber(left, right)) break; if (node.op() == CompareEq) { if ((m_graph.isConstant(node.child1().index()) && m_graph.valueOfJSConstant(node.child1().index()).isNull()) || (m_graph.isConstant(node.child2().index()) && m_graph.valueOfJSConstant(node.child2().index()).isNull())) break; if (Node::shouldSpeculateFinalObject(left, right)) break; if (Node::shouldSpeculateArray(left, right)) break; if (left.shouldSpeculateFinalObject() && right.shouldSpeculateFinalObjectOrOther()) break; if (right.shouldSpeculateFinalObject() && left.shouldSpeculateFinalObjectOrOther()) break; if (left.shouldSpeculateArray() && right.shouldSpeculateArrayOrOther()) break; if (right.shouldSpeculateArray() && left.shouldSpeculateArrayOrOther()) break; } clobber(live); break; } case GetByVal: case PutByVal: case PutByValAlias: if (m_graph.byValIsPure(node)) break; clobber(live); break; case GetMyArgumentsLengthSafe: case GetMyArgumentByValSafe: case GetById: case GetByIdFlush: case PutStructure: case PhantomPutStructure: case PutById: case PutByIdDirect: case Call: case Construct: case Resolve: case ResolveBase: case ResolveBaseStrictPut: case ResolveGlobal: clobber(live); break; default: ASSERT(node.op() != Phi); break; } } } bool changed = false; #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) for (HashMap<VariableAccessData*, CheckData>::iterator it = m_map.begin(); it != m_map.end(); ++it) { if (!it->second.m_structure) { dataLog("Not hoisting checks for %s because of heuristics.\n", m_graph.nameOfVariableAccessData(it->first)); continue; } if (it->second.m_isClobbered && !it->second.m_structure->transitionWatchpointSetIsStillValid()) { dataLog("Not hoisting checks for %s because the structure is clobbered and has an invalid watchpoint set.\n", m_graph.nameOfVariableAccessData(it->first)); continue; } dataLog("Hoisting checks for %s\n", m_graph.nameOfVariableAccessData(it->first)); } #endif // DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) // Make changes: // 1) If a variable's live range does not span a clobber, then inject structure // checks before the SetLocal. // 2) If a variable's live range spans a clobber but is watchpointable, then // inject structure checks before the SetLocal and replace all other structure // checks on that variable with structure transition watchpoints. InsertionSet<NodeIndex> insertionSet; for (BlockIndex blockIndex = 0; blockIndex < m_graph.m_blocks.size(); ++blockIndex) { BasicBlock* block = m_graph.m_blocks[blockIndex].get(); if (!block) continue; for (unsigned indexInBlock = 0; indexInBlock < block->size(); ++indexInBlock) { NodeIndex nodeIndex = block->at(indexInBlock); Node& node = m_graph[nodeIndex]; // Be careful not to use 'node' after appending to the graph. In those switch // cases where we need to append, we first carefully extract everything we need // from the node, before doing any appending. if (!node.shouldGenerate()) continue; switch (node.op()) { case SetArgument: { ASSERT(!blockIndex); // Insert a GetLocal and a CheckStructure immediately following this // SetArgument, if the variable was a candidate for structure hoisting. // If the basic block previously only had the SetArgument as its // variable-at-tail, then replace it with this GetLocal. VariableAccessData* variable = node.variableAccessData(); HashMap<VariableAccessData*, CheckData>::iterator iter = m_map.find(variable); if (iter == m_map.end()) break; if (!iter->second.m_structure) break; if (iter->second.m_isClobbered && !iter->second.m_structure->transitionWatchpointSetIsStillValid()) break; node.ref(); CodeOrigin codeOrigin = node.codeOrigin; Node getLocal(GetLocal, codeOrigin, OpInfo(variable), nodeIndex); getLocal.predict(variable->prediction()); getLocal.ref(); NodeIndex getLocalIndex = m_graph.size(); m_graph.append(getLocal); insertionSet.append(indexInBlock + 1, getLocalIndex); Node checkStructure(CheckStructure, codeOrigin, OpInfo(m_graph.addStructureSet(iter->second.m_structure)), getLocalIndex); checkStructure.ref(); NodeIndex checkStructureIndex = m_graph.size(); m_graph.append(checkStructure); insertionSet.append(indexInBlock + 1, checkStructureIndex); if (block->variablesAtTail.operand(variable->local()) == nodeIndex) block->variablesAtTail.operand(variable->local()) = getLocalIndex; m_graph.substituteGetLocal(*block, indexInBlock, variable, getLocalIndex); changed = true; break; } case SetLocal: { VariableAccessData* variable = node.variableAccessData(); HashMap<VariableAccessData*, CheckData>::iterator iter = m_map.find(variable); if (iter == m_map.end()) break; if (!iter->second.m_structure) break; if (iter->second.m_isClobbered && !iter->second.m_structure->transitionWatchpointSetIsStillValid()) break; // First insert a dead SetLocal to tell OSR that the child's value should // be dropped into this bytecode variable if the CheckStructure decides // to exit. CodeOrigin codeOrigin = node.codeOrigin; NodeIndex child1 = node.child1().index(); Node setLocal(SetLocal, codeOrigin, OpInfo(variable), child1); NodeIndex setLocalIndex = m_graph.size(); m_graph.append(setLocal); insertionSet.append(indexInBlock, setLocalIndex); m_graph[child1].ref(); // Use a ForwardCheckStructure to indicate that we should exit to the // next bytecode instruction rather than reexecuting the current one. Node checkStructure(ForwardCheckStructure, codeOrigin, OpInfo(m_graph.addStructureSet(iter->second.m_structure)), child1); checkStructure.ref(); NodeIndex checkStructureIndex = m_graph.size(); m_graph.append(checkStructure); insertionSet.append(indexInBlock, checkStructureIndex); changed = true; break; } case CheckStructure: { Node& child = m_graph[node.child1()]; if (child.op() != GetLocal) break; HashMap<VariableAccessData*, CheckData>::iterator iter = m_map.find(child.variableAccessData()); if (iter == m_map.end()) break; if (!iter->second.m_structure) break; if (!iter->second.m_isClobbered) { node.setOpAndDefaultFlags(Phantom); ASSERT(node.refCount() == 1); break; } if (!iter->second.m_structure->transitionWatchpointSetIsStillValid()) break; ASSERT(iter->second.m_structure == node.structureSet().singletonStructure()); node.convertToStructureTransitionWatchpoint(); changed = true; break; } default: break; } } insertionSet.execute(*block); } return changed; }