34 using namespace ::v8::internal;
40 : Thread(
"SocketListenerThread"),
42 data_size_(data_size),
46 data_ =
new char[data_size_];
57 char*
data() {
return data_; }
74 server_->SetReuseAddress(
true);
76 ok = server_->Bind(port_);
80 ok = server_->Listen(1);
85 client_ = server_->Accept();
90 while (bytes_read < data_size_) {
91 bytes_read += client_->Receive(data_ + bytes_read, data_size_ - bytes_read);
96 static bool SendAll(Socket* socket,
const char* data,
int len) {
98 while (sent_len < len) {
99 int status = socket->Send(data, len);
109 static void SendAndReceive(
int port,
char *data,
int len) {
110 static const char* kLocalhost =
"localhost";
115 const int kPortBuferLen = 6;
116 char port_str[kPortBuferLen];
117 OS::SNPrintF(Vector<char>(port_str, kPortBuferLen),
"%d", port);
125 Socket* client =
new Socket;
127 ok = client->Connect(kLocalhost, port_str);
131 ok = SendAll(client, data, len);
138 for (
int i = 0; i < len; i++) {
152 static const int kPort = 5859 + FlagDependentPortOffset();
155 static const int kBufferSizeSmall = 20;
156 char small_data[kBufferSizeSmall + 1] =
"1234567890abcdefghij";
157 SendAndReceive(kPort, small_data, kBufferSizeSmall);
160 static const int kBufferSizeMedium = 10000;
161 char* medium_data =
new char[kBufferSizeMedium];
162 for (
int i = 0; i < kBufferSizeMedium; i++) {
163 medium_data[i] = i % 256;
165 SendAndReceive(kPort, medium_data, kBufferSizeMedium);
166 delete[] medium_data;
169 static const int kBufferSizeLarge = 1000000;
170 char* large_data =
new char[kBufferSizeLarge];
171 for (
int i = 0; i < kBufferSizeLarge; i++) {
172 large_data[i] = i % 256;
174 SendAndReceive(kPort, large_data, kBufferSizeLarge);
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
SocketListenerThread(int port, int data_size)