|
Lines 32-38
a/Source/JavaScriptCore/testWASM.cpp_sec1
|
| 32 |
#include "LLIntThunks.h" |
32 |
#include "LLIntThunks.h" |
| 33 |
#include "ProtoCallFrame.h" |
33 |
#include "ProtoCallFrame.h" |
| 34 |
#include "VM.h" |
34 |
#include "VM.h" |
|
|
35 |
#include "WASMMemory.h" |
| 35 |
#include "WASMPlan.h" |
36 |
#include "WASMPlan.h" |
|
|
37 |
|
| 36 |
#include <wtf/DataLog.h> |
38 |
#include <wtf/DataLog.h> |
| 37 |
#include <wtf/LEBDecoder.h> |
39 |
#include <wtf/LEBDecoder.h> |
| 38 |
|
40 |
|
|
Lines 242-249
static void runWASMTests()
a/Source/JavaScriptCore/testWASM.cpp_sec2
|
| 242 |
{ |
244 |
{ |
| 243 |
{ |
245 |
{ |
| 244 |
// Generated from: |
246 |
// Generated from: |
|
|
247 |
// (module |
| 248 |
// (memory 1) |
| 249 |
// (func (export "i32_load8_s") (param $i i32) (param $ptr i32) (result i32) |
| 250 |
// (i32.store (get_local $ptr) (get_local $i)) |
| 251 |
// (return (i32.load (get_local $ptr))) |
| 252 |
// ) |
| 253 |
// ) |
| 254 |
Vector<uint8_t> vector = { |
| 255 |
0x00, 0x61, 0x73, 0x6d, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x87, 0x80, 0x80, 0x80, 0x00, 0x01, 0x40, |
| 256 |
0x02, 0x02, 0x01, 0x01, 0x02, 0x03, 0x82, 0x80, 0x80, 0x80, 0x00, 0x01, 0x00, 0x05, 0x83, 0x80, |
| 257 |
0x80, 0x80, 0x00, 0x01, 0x01, 0x01, 0x07, 0x8f, 0x80, 0x80, 0x80, 0x00, 0x01, 0x0b, 0x69, 0x33, |
| 258 |
0x32, 0x5f, 0x6c, 0x6f, 0x61, 0x64, 0x38, 0x5f, 0x73, 0x00, 0x00, 0x0a, 0x95, 0x80, 0x80, 0x80, |
| 259 |
0x00, 0x01, 0x8f, 0x80, 0x80, 0x80, 0x00, 0x00, 0x14, 0x01, 0x14, 0x00, 0x34, 0x03, 0x00, 0x14, |
| 260 |
0x01, 0x2b, 0x03, 0x00, 0x09, 0x0f |
| 261 |
}; |
| 262 |
|
| 263 |
Plan plan(*vm, vector); |
| 264 |
if (plan.result.size() != 1 || !plan.result[0]) { |
| 265 |
dataLogLn("Module failed to compile correctly."); |
| 266 |
CRASH(); |
| 267 |
} |
| 268 |
|
| 269 |
// Test this doesn't crash. |
| 270 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(0), box(10) }), 0); |
| 271 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(100), box(2) }), 100); |
| 272 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(1), box(100) }), 1); |
| 273 |
} |
| 274 |
|
| 275 |
{ |
| 276 |
// Generated from: |
| 277 |
// (module |
| 278 |
// (memory 1) |
| 279 |
// (func (export "i32_load8_s") (param $i i32) (param $ptr i32) (result i32) |
| 280 |
// (i32.store (get_local $ptr) (get_local $i)) |
| 281 |
// (return (i32.load (get_local $ptr))) |
| 282 |
// ) |
| 283 |
// ) |
| 284 |
Vector<uint8_t> vector = { |
| 285 |
0x00, 0x61, 0x73, 0x6d, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x87, 0x80, 0x80, 0x80, 0x00, 0x01, 0x40, |
| 286 |
0x02, 0x01, 0x01, 0x01, 0x01, 0x03, 0x82, 0x80, 0x80, 0x80, 0x00, 0x01, 0x00, 0x05, 0x83, 0x80, |
| 287 |
0x80, 0x80, 0x00, 0x01, 0x01, 0x01, 0x07, 0x8f, 0x80, 0x80, 0x80, 0x00, 0x01, 0x0b, 0x69, 0x33, |
| 288 |
0x32, 0x5f, 0x6c, 0x6f, 0x61, 0x64, 0x38, 0x5f, 0x73, 0x00, 0x00, 0x0a, 0x95, 0x80, 0x80, 0x80, |
| 289 |
0x00, 0x01, 0x8f, 0x80, 0x80, 0x80, 0x00, 0x00, 0x14, 0x01, 0x14, 0x00, 0x33, 0x02, 0x00, 0x14, |
| 290 |
0x01, 0x2a, 0x02, 0x00, 0x09, 0x0f |
| 291 |
}; |
| 292 |
|
| 293 |
Plan plan(*vm, vector); |
| 294 |
if (plan.result.size() != 1 || !plan.result[0]) { |
| 295 |
dataLogLn("Module failed to compile correctly."); |
| 296 |
CRASH(); |
| 297 |
} |
| 298 |
|
| 299 |
// Test this doesn't crash. |
| 300 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(0), box(10) }), 0); |
| 301 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(100), box(2) }), 100); |
| 302 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(1), box(100) }), 1); |
| 303 |
} |
| 304 |
|
| 305 |
{ |
| 306 |
// Generated from: |
| 307 |
// (module |
| 308 |
// (memory 1) |
| 309 |
// (func (export "write_array") (param $x i32) (param $p i32) (param $length i32) (local $i i32) |
| 310 |
// (set_local $i (i32.const 0)) |
| 311 |
// (block |
| 312 |
// (loop |
| 313 |
// (br_if 1 (i32.ge_u (get_local $i) (get_local $length))) |
| 314 |
// (i32.store (i32.add (get_local $p) (i32.mul (get_local $i) (i32.const 4))) (get_local $x)) |
| 315 |
// (set_local $i (i32.add (i32.const 1) (get_local $i))) |
| 316 |
// (br 0) |
| 317 |
// ) |
| 318 |
// ) |
| 319 |
// (return) |
| 320 |
// ) |
| 321 |
// ) |
| 322 |
Vector<uint8_t> vector = { |
| 323 |
0x00, 0x61, 0x73, 0x6d, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x87, 0x80, 0x80, 0x80, 0x00, 0x01, 0x40, |
| 324 |
0x03, 0x01, 0x01, 0x01, 0x00, 0x03, 0x82, 0x80, 0x80, 0x80, 0x00, 0x01, 0x00, 0x05, 0x83, 0x80, |
| 325 |
0x80, 0x80, 0x00, 0x01, 0x01, 0x01, 0x07, 0x8f, 0x80, 0x80, 0x80, 0x00, 0x01, 0x0b, 0x77, 0x72, |
| 326 |
0x69, 0x74, 0x65, 0x5f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x00, 0x00, 0x0a, 0xb2, 0x80, 0x80, 0x80, |
| 327 |
0x00, 0x01, 0xac, 0x80, 0x80, 0x80, 0x00, 0x01, 0x01, 0x01, 0x10, 0x00, 0x15, 0x03, 0x01, 0x00, |
| 328 |
0x02, 0x00, 0x14, 0x03, 0x14, 0x02, 0x56, 0x07, 0x01, 0x14, 0x01, 0x14, 0x03, 0x10, 0x04, 0x42, |
| 329 |
0x40, 0x14, 0x00, 0x33, 0x02, 0x00, 0x10, 0x01, 0x14, 0x03, 0x40, 0x15, 0x03, 0x06, 0x00, 0x0f, |
| 330 |
0x0f, 0x09, 0x0f |
| 331 |
}; |
| 332 |
|
| 333 |
Plan plan(*vm, vector); |
| 334 |
if (plan.result.size() != 1 || !plan.result[0]) { |
| 335 |
dataLogLn("Module failed to compile correctly."); |
| 336 |
CRASH(); |
| 337 |
} |
| 338 |
ASSERT(plan.memory->size()); |
| 339 |
|
| 340 |
// Test this doesn't crash. |
| 341 |
unsigned length = 5; |
| 342 |
unsigned offset = sizeof(uint32_t); |
| 343 |
uint32_t* memory = static_cast<uint32_t*>(plan.memory->memory()); |
| 344 |
invoke<void>(*plan.result[0]->jsEntryPoint, { box(100), box(offset), box(length) }); |
| 345 |
offset /= sizeof(uint32_t); |
| 346 |
CHECK_EQ(memory[offset - 1], 0u); |
| 347 |
CHECK_EQ(memory[offset + length], 0u); |
| 348 |
for (unsigned i = 0; i < length; ++i) |
| 349 |
CHECK_EQ(memory[i + offset], 100u); |
| 350 |
|
| 351 |
length = 10; |
| 352 |
offset = 5 * sizeof(uint32_t); |
| 353 |
invoke<void>(*plan.result[0]->jsEntryPoint, { box(5), box(offset), box(length) }); |
| 354 |
offset /= sizeof(uint32_t); |
| 355 |
CHECK_EQ(memory[offset - 1], 100u); |
| 356 |
CHECK_EQ(memory[offset + length], 0u); |
| 357 |
for (unsigned i = 0; i < length; ++i) |
| 358 |
CHECK_EQ(memory[i + offset], 5u); |
| 359 |
} |
| 360 |
|
| 361 |
{ |
| 362 |
// Generated from: |
| 363 |
// (module |
| 364 |
// (memory 1) |
| 365 |
// (func (export "write_array") (param $x i32) (param $p i32) (param $length i32) (local $i i32) |
| 366 |
// (set_local $i (i32.const 0)) |
| 367 |
// (block |
| 368 |
// (loop |
| 369 |
// (br_if 1 (i32.ge_u (get_local $i) (get_local $length))) |
| 370 |
// (i32.store8 (i32.add (get_local $p) (get_local $i)) (get_local $x)) |
| 371 |
// (set_local $i (i32.add (i32.const 1) (get_local $i))) |
| 372 |
// (br 0) |
| 373 |
// ) |
| 374 |
// ) |
| 375 |
// (return) |
| 376 |
// ) |
| 377 |
// ) |
| 378 |
Vector<uint8_t> vector = { |
| 379 |
0x00, 0x61, 0x73, 0x6d, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x87, 0x80, 0x80, 0x80, 0x00, 0x01, 0x40, |
| 380 |
0x03, 0x01, 0x01, 0x01, 0x00, 0x03, 0x82, 0x80, 0x80, 0x80, 0x00, 0x01, 0x00, 0x05, 0x83, 0x80, |
| 381 |
0x80, 0x80, 0x00, 0x01, 0x01, 0x01, 0x07, 0x8f, 0x80, 0x80, 0x80, 0x00, 0x01, 0x0b, 0x77, 0x72, |
| 382 |
0x69, 0x74, 0x65, 0x5f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x00, 0x00, 0x0a, 0xaf, 0x80, 0x80, 0x80, |
| 383 |
0x00, 0x01, 0xa9, 0x80, 0x80, 0x80, 0x00, 0x01, 0x01, 0x01, 0x10, 0x00, 0x15, 0x03, 0x01, 0x00, |
| 384 |
0x02, 0x00, 0x14, 0x03, 0x14, 0x02, 0x56, 0x07, 0x01, 0x14, 0x01, 0x14, 0x03, 0x40, 0x14, 0x00, |
| 385 |
0x2e, 0x00, 0x00, 0x10, 0x01, 0x14, 0x03, 0x40, 0x15, 0x03, 0x06, 0x00, 0x0f, 0x0f, 0x09, 0x0f |
| 386 |
}; |
| 387 |
|
| 388 |
Plan plan(*vm, vector); |
| 389 |
if (plan.result.size() != 1 || !plan.result[0]) { |
| 390 |
dataLogLn("Module failed to compile correctly."); |
| 391 |
CRASH(); |
| 392 |
} |
| 393 |
ASSERT(plan.memory->size()); |
| 394 |
|
| 395 |
// Test this doesn't crash. |
| 396 |
unsigned length = 5; |
| 397 |
unsigned offset = 1; |
| 398 |
uint8_t* memory = static_cast<uint8_t*>(plan.memory->memory()); |
| 399 |
invoke<void>(*plan.result[0]->jsEntryPoint, { box(100), box(offset), box(length) }); |
| 400 |
CHECK_EQ(memory[offset - 1], 0u); |
| 401 |
CHECK_EQ(memory[offset + length], 0u); |
| 402 |
for (unsigned i = 0; i < length; ++i) |
| 403 |
CHECK_EQ(memory[i + offset], 100u); |
| 404 |
|
| 405 |
length = 10; |
| 406 |
offset = 5; |
| 407 |
invoke<void>(*plan.result[0]->jsEntryPoint, { box(5), box(offset), box(length) }); |
| 408 |
CHECK_EQ(memory[offset - 1], 100u); |
| 409 |
CHECK_EQ(memory[offset + length], 0u); |
| 410 |
for (unsigned i = 0; i < length; ++i) |
| 411 |
CHECK_EQ(memory[i + offset], 5u); |
| 412 |
} |
| 413 |
|
| 414 |
{ |
| 415 |
// Generated from: |
| 416 |
// (module |
| 417 |
// (memory 1) |
| 418 |
// (func (export "i32_load8_s") (param $i i32) (param $ptr i32) (result i32) |
| 419 |
// (i32.store8 (get_local $ptr) (get_local $i)) |
| 420 |
// (return (i32.load8_s (get_local $ptr))) |
| 421 |
// ) |
| 422 |
// ) |
| 423 |
Vector<uint8_t> vector = { |
| 424 |
0x00, 0x61, 0x73, 0x6d, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x87, 0x80, 0x80, 0x80, 0x00, 0x01, 0x40, |
| 425 |
0x02, 0x01, 0x01, 0x01, 0x01, 0x03, 0x82, 0x80, 0x80, 0x80, 0x00, 0x01, 0x00, 0x05, 0x83, 0x80, |
| 426 |
0x80, 0x80, 0x00, 0x01, 0x01, 0x01, 0x07, 0x8f, 0x80, 0x80, 0x80, 0x00, 0x01, 0x0b, 0x69, 0x33, |
| 427 |
0x32, 0x5f, 0x6c, 0x6f, 0x61, 0x64, 0x38, 0x5f, 0x73, 0x00, 0x00, 0x0a, 0x95, 0x80, 0x80, 0x80, |
| 428 |
0x00, 0x01, 0x8f, 0x80, 0x80, 0x80, 0x00, 0x00, 0x14, 0x01, 0x14, 0x00, 0x2e, 0x00, 0x00, 0x14, |
| 429 |
0x01, 0x20, 0x00, 0x00, 0x09, 0x0f |
| 430 |
}; |
| 431 |
|
| 432 |
Plan plan(*vm, vector); |
| 433 |
if (plan.result.size() != 1 || !plan.result[0]) { |
| 434 |
dataLogLn("Module failed to compile correctly."); |
| 435 |
CRASH(); |
| 436 |
} |
| 437 |
ASSERT(plan.memory->size()); |
| 438 |
|
| 439 |
// Test this doesn't crash. |
| 440 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(0), box(10) }), 0); |
| 441 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(100), box(2) }), 100); |
| 442 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(1), box(100) }), 1); |
| 443 |
} |
| 444 |
|
| 445 |
{ |
| 446 |
// Generated from: |
| 447 |
// (module |
| 448 |
// (memory 1) |
| 449 |
// (func (export "i32_load8_s") (param $i i32) (result i32) |
| 450 |
// (i32.store8 (i32.const 8) (get_local $i)) |
| 451 |
// (return (i32.load8_s (i32.const 8))) |
| 452 |
// ) |
| 453 |
// ) |
| 454 |
Vector<uint8_t> vector = { |
| 455 |
0x00, 0x61, 0x73, 0x6d, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x86, 0x80, 0x80, 0x80, 0x00, 0x01, 0x40, |
| 456 |
0x01, 0x01, 0x01, 0x01, 0x03, 0x82, 0x80, 0x80, 0x80, 0x00, 0x01, 0x00, 0x05, 0x83, 0x80, 0x80, |
| 457 |
0x80, 0x00, 0x01, 0x01, 0x01, 0x07, 0x8f, 0x80, 0x80, 0x80, 0x00, 0x01, 0x0b, 0x69, 0x33, 0x32, |
| 458 |
0x5f, 0x6c, 0x6f, 0x61, 0x64, 0x38, 0x5f, 0x73, 0x00, 0x00, 0x0a, 0x95, 0x80, 0x80, 0x80, 0x00, |
| 459 |
0x01, 0x8f, 0x80, 0x80, 0x80, 0x00, 0x00, 0x10, 0x08, 0x14, 0x00, 0x2e, 0x00, 0x00, 0x10, 0x08, |
| 460 |
0x20, 0x00, 0x00, 0x09, 0x0f |
| 461 |
}; |
| 462 |
|
| 463 |
Plan plan(*vm, vector); |
| 464 |
if (plan.result.size() != 1 || !plan.result[0]) { |
| 465 |
dataLogLn("Module failed to compile correctly."); |
| 466 |
CRASH(); |
| 467 |
} |
| 468 |
|
| 469 |
// Test this doesn't crash. |
| 470 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(0) }), 0); |
| 471 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(100) }), 100); |
| 472 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(1) }), 1); |
| 473 |
} |
| 474 |
|
| 475 |
{ |
| 476 |
// Generated from: |
| 477 |
// (module |
| 478 |
// (memory 1) |
| 479 |
// (func (export "i32_load8_s") (param $i i32) (param $ptr i32) (result i32) |
| 480 |
// (i32.store (get_local $ptr) (get_local $i)) |
| 481 |
// (return (i32.load (get_local $ptr))) |
| 482 |
// ) |
| 483 |
// ) |
| 484 |
Vector<uint8_t> vector = { |
| 485 |
0x00, 0x61, 0x73, 0x6d, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x87, 0x80, 0x80, 0x80, 0x00, 0x01, 0x40, |
| 486 |
0x02, 0x02, 0x01, 0x01, 0x02, 0x03, 0x82, 0x80, 0x80, 0x80, 0x00, 0x01, 0x00, 0x05, 0x83, 0x80, |
| 487 |
0x80, 0x80, 0x00, 0x01, 0x01, 0x01, 0x07, 0x8f, 0x80, 0x80, 0x80, 0x00, 0x01, 0x0b, 0x69, 0x33, |
| 488 |
0x32, 0x5f, 0x6c, 0x6f, 0x61, 0x64, 0x38, 0x5f, 0x73, 0x00, 0x00, 0x0a, 0x95, 0x80, 0x80, 0x80, |
| 489 |
0x00, 0x01, 0x8f, 0x80, 0x80, 0x80, 0x00, 0x00, 0x14, 0x01, 0x14, 0x00, 0x34, 0x03, 0x00, 0x14, |
| 490 |
0x01, 0x2b, 0x03, 0x00, 0x09, 0x0f |
| 491 |
}; |
| 492 |
|
| 493 |
Plan plan(*vm, vector); |
| 494 |
if (plan.result.size() != 1 || !plan.result[0]) { |
| 495 |
dataLogLn("Module failed to compile correctly."); |
| 496 |
CRASH(); |
| 497 |
} |
| 498 |
|
| 499 |
// Test this doesn't crash. |
| 500 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(0), box(10) }), 0); |
| 501 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(100), box(2) }), 100); |
| 502 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(1), box(100) }), 1); |
| 503 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(-12), box(plan.memory->size() - sizeof(uint64_t)) }), -12); |
| 504 |
} |
| 505 |
|
| 506 |
{ |
| 507 |
// Generated from: |
| 508 |
// (module |
| 509 |
// (memory 1) |
| 510 |
// (func (export "i32_load8_s") (param $i i32) (param $ptr i32) (result i32) |
| 511 |
// (i32.store (get_local $ptr) (get_local $i)) |
| 512 |
// (return (i32.load (get_local $ptr))) |
| 513 |
// ) |
| 514 |
// ) |
| 515 |
Vector<uint8_t> vector = { |
| 516 |
0x00, 0x61, 0x73, 0x6d, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x87, 0x80, 0x80, 0x80, 0x00, 0x01, 0x40, |
| 517 |
0x02, 0x01, 0x01, 0x01, 0x01, 0x03, 0x82, 0x80, 0x80, 0x80, 0x00, 0x01, 0x00, 0x05, 0x83, 0x80, |
| 518 |
0x80, 0x80, 0x00, 0x01, 0x01, 0x01, 0x07, 0x8f, 0x80, 0x80, 0x80, 0x00, 0x01, 0x0b, 0x69, 0x33, |
| 519 |
0x32, 0x5f, 0x6c, 0x6f, 0x61, 0x64, 0x38, 0x5f, 0x73, 0x00, 0x00, 0x0a, 0x95, 0x80, 0x80, 0x80, |
| 520 |
0x00, 0x01, 0x8f, 0x80, 0x80, 0x80, 0x00, 0x00, 0x14, 0x01, 0x14, 0x00, 0x33, 0x02, 0x00, 0x14, |
| 521 |
0x01, 0x2a, 0x02, 0x00, 0x09, 0x0f |
| 522 |
}; |
| 523 |
|
| 524 |
Plan plan(*vm, vector); |
| 525 |
if (plan.result.size() != 1 || !plan.result[0]) { |
| 526 |
dataLogLn("Module failed to compile correctly."); |
| 527 |
CRASH(); |
| 528 |
} |
| 529 |
|
| 530 |
// Test this doesn't crash. |
| 531 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(0), box(10) }), 0); |
| 532 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(100), box(2) }), 100); |
| 533 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(1), box(100) }), 1); |
| 534 |
} |
| 535 |
|
| 536 |
{ |
| 537 |
// Generated from: |
| 245 |
// (module |
538 |
// (module |
| 246 |
// (func (export "dumb-eq") (param $x i32) (param $y i32) (result i32) |
539 |
// (memory 1) |
|
|
540 |
// (func (export "write_array") (param $x i32) (param $p i32) (param $length i32) (local $i i32) |
| 541 |
// (set_local $i (i32.const 0)) |
| 542 |
// (block |
| 543 |
// (loop |
| 544 |
// (br_if 1 (i32.ge_u (get_local $i) (get_local $length))) |
| 545 |
// (i32.store (i32.add (get_local $p) (i32.mul (get_local $i) (i32.const 4))) (get_local $x)) |
| 546 |
// (set_local $i (i32.add (i32.const 1) (get_local $i))) |
| 547 |
// (br 0) |
| 548 |
// ) |
| 549 |
// ) |
| 550 |
// (return) |
| 551 |
// ) |
| 552 |
// ) |
| 553 |
Vector<uint8_t> vector = { |
| 554 |
0x00, 0x61, 0x73, 0x6d, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x87, 0x80, 0x80, 0x80, 0x00, 0x01, 0x40, |
| 555 |
0x03, 0x01, 0x01, 0x01, 0x00, 0x03, 0x82, 0x80, 0x80, 0x80, 0x00, 0x01, 0x00, 0x05, 0x83, 0x80, |
| 556 |
0x80, 0x80, 0x00, 0x01, 0x01, 0x01, 0x07, 0x8f, 0x80, 0x80, 0x80, 0x00, 0x01, 0x0b, 0x77, 0x72, |
| 557 |
0x69, 0x74, 0x65, 0x5f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x00, 0x00, 0x0a, 0xb2, 0x80, 0x80, 0x80, |
| 558 |
0x00, 0x01, 0xac, 0x80, 0x80, 0x80, 0x00, 0x01, 0x01, 0x01, 0x10, 0x00, 0x15, 0x03, 0x01, 0x00, |
| 559 |
0x02, 0x00, 0x14, 0x03, 0x14, 0x02, 0x56, 0x07, 0x01, 0x14, 0x01, 0x14, 0x03, 0x10, 0x04, 0x42, |
| 560 |
0x40, 0x14, 0x00, 0x33, 0x02, 0x00, 0x10, 0x01, 0x14, 0x03, 0x40, 0x15, 0x03, 0x06, 0x00, 0x0f, |
| 561 |
0x0f, 0x09, 0x0f |
| 562 |
}; |
| 563 |
|
| 564 |
Plan plan(*vm, vector); |
| 565 |
if (plan.result.size() != 1 || !plan.result[0]) { |
| 566 |
dataLogLn("Module failed to compile correctly."); |
| 567 |
CRASH(); |
| 568 |
} |
| 569 |
ASSERT(plan.memory->size()); |
| 570 |
|
| 571 |
// Test this doesn't crash. |
| 572 |
unsigned length = 5; |
| 573 |
unsigned offset = sizeof(uint32_t); |
| 574 |
uint32_t* memory = static_cast<uint32_t*>(plan.memory->memory()); |
| 575 |
invoke<void>(*plan.result[0]->jsEntryPoint, { box(100), box(offset), box(length) }); |
| 576 |
offset /= sizeof(uint32_t); |
| 577 |
CHECK_EQ(memory[offset - 1], 0u); |
| 578 |
CHECK_EQ(memory[offset + length], 0u); |
| 579 |
for (unsigned i = 0; i < length; ++i) |
| 580 |
CHECK_EQ(memory[i + offset], 100u); |
| 581 |
|
| 582 |
length = 10; |
| 583 |
offset = 5 * sizeof(uint32_t); |
| 584 |
invoke<void>(*plan.result[0]->jsEntryPoint, { box(5), box(offset), box(length) }); |
| 585 |
offset /= sizeof(uint32_t); |
| 586 |
CHECK_EQ(memory[offset - 1], 100u); |
| 587 |
CHECK_EQ(memory[offset + length], 0u); |
| 588 |
for (unsigned i = 0; i < length; ++i) |
| 589 |
CHECK_EQ(memory[i + offset], 5u); |
| 590 |
} |
| 591 |
|
| 592 |
{ |
| 593 |
// Generated from: |
| 594 |
// (module |
| 595 |
// (memory 1) |
| 596 |
// (func (export "write_array") (param $x i32) (param $p i32) (param $length i32) (local $i i32) |
| 597 |
// (set_local $i (i32.const 0)) |
| 598 |
// (block |
| 599 |
// (loop |
| 600 |
// (br_if 1 (i32.ge_u (get_local $i) (get_local $length))) |
| 601 |
// (i32.store8 (i32.add (get_local $p) (get_local $i)) (get_local $x)) |
| 602 |
// (set_local $i (i32.add (i32.const 1) (get_local $i))) |
| 603 |
// (br 0) |
| 604 |
// ) |
| 605 |
// ) |
| 606 |
// (return) |
| 607 |
// ) |
| 608 |
// ) |
| 609 |
Vector<uint8_t> vector = { |
| 610 |
0x00, 0x61, 0x73, 0x6d, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x87, 0x80, 0x80, 0x80, 0x00, 0x01, 0x40, |
| 611 |
0x03, 0x01, 0x01, 0x01, 0x00, 0x03, 0x82, 0x80, 0x80, 0x80, 0x00, 0x01, 0x00, 0x05, 0x83, 0x80, |
| 612 |
0x80, 0x80, 0x00, 0x01, 0x01, 0x01, 0x07, 0x8f, 0x80, 0x80, 0x80, 0x00, 0x01, 0x0b, 0x77, 0x72, |
| 613 |
0x69, 0x74, 0x65, 0x5f, 0x61, 0x72, 0x72, 0x61, 0x79, 0x00, 0x00, 0x0a, 0xaf, 0x80, 0x80, 0x80, |
| 614 |
0x00, 0x01, 0xa9, 0x80, 0x80, 0x80, 0x00, 0x01, 0x01, 0x01, 0x10, 0x00, 0x15, 0x03, 0x01, 0x00, |
| 615 |
0x02, 0x00, 0x14, 0x03, 0x14, 0x02, 0x56, 0x07, 0x01, 0x14, 0x01, 0x14, 0x03, 0x40, 0x14, 0x00, |
| 616 |
0x2e, 0x00, 0x00, 0x10, 0x01, 0x14, 0x03, 0x40, 0x15, 0x03, 0x06, 0x00, 0x0f, 0x0f, 0x09, 0x0f |
| 617 |
}; |
| 618 |
|
| 619 |
Plan plan(*vm, vector); |
| 620 |
if (plan.result.size() != 1 || !plan.result[0]) { |
| 621 |
dataLogLn("Module failed to compile correctly."); |
| 622 |
CRASH(); |
| 623 |
} |
| 624 |
ASSERT(plan.memory->size()); |
| 625 |
|
| 626 |
// Test this doesn't crash. |
| 627 |
unsigned length = 5; |
| 628 |
unsigned offset = 1; |
| 629 |
uint8_t* memory = static_cast<uint8_t*>(plan.memory->memory()); |
| 630 |
invoke<void>(*plan.result[0]->jsEntryPoint, { box(100), box(offset), box(length) }); |
| 631 |
CHECK_EQ(memory[offset - 1], 0u); |
| 632 |
CHECK_EQ(memory[offset + length], 0u); |
| 633 |
for (unsigned i = 0; i < length; ++i) |
| 634 |
CHECK_EQ(memory[i + offset], 100u); |
| 635 |
|
| 636 |
length = 10; |
| 637 |
offset = 5; |
| 638 |
invoke<void>(*plan.result[0]->jsEntryPoint, { box(5), box(offset), box(length) }); |
| 639 |
CHECK_EQ(memory[offset - 1], 100u); |
| 640 |
CHECK_EQ(memory[offset + length], 0u); |
| 641 |
for (unsigned i = 0; i < length; ++i) |
| 642 |
CHECK_EQ(memory[i + offset], 5u); |
| 643 |
} |
| 644 |
|
| 645 |
{ |
| 646 |
// Generated from: |
| 647 |
// (module |
| 648 |
// (memory 1) |
| 649 |
// (func (export "i32_load8_s") (param $i i32) (param $ptr i32) (result i32) |
| 650 |
// (i32.store8 (get_local $ptr) (get_local $i)) |
| 651 |
// (return (i32.load8_s (get_local $ptr))) |
| 652 |
// ) |
| 653 |
// ) |
| 654 |
Vector<uint8_t> vector = { |
| 655 |
0x00, 0x61, 0x73, 0x6d, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x87, 0x80, 0x80, 0x80, 0x00, 0x01, 0x40, |
| 656 |
0x02, 0x01, 0x01, 0x01, 0x01, 0x03, 0x82, 0x80, 0x80, 0x80, 0x00, 0x01, 0x00, 0x05, 0x83, 0x80, |
| 657 |
0x80, 0x80, 0x00, 0x01, 0x01, 0x01, 0x07, 0x8f, 0x80, 0x80, 0x80, 0x00, 0x01, 0x0b, 0x69, 0x33, |
| 658 |
0x32, 0x5f, 0x6c, 0x6f, 0x61, 0x64, 0x38, 0x5f, 0x73, 0x00, 0x00, 0x0a, 0x95, 0x80, 0x80, 0x80, |
| 659 |
0x00, 0x01, 0x8f, 0x80, 0x80, 0x80, 0x00, 0x00, 0x14, 0x01, 0x14, 0x00, 0x2e, 0x00, 0x00, 0x14, |
| 660 |
0x01, 0x20, 0x00, 0x00, 0x09, 0x0f |
| 661 |
}; |
| 662 |
|
| 663 |
Plan plan(*vm, vector); |
| 664 |
if (plan.result.size() != 1 || !plan.result[0]) { |
| 665 |
dataLogLn("Module failed to compile correctly."); |
| 666 |
CRASH(); |
| 667 |
} |
| 668 |
ASSERT(plan.memory->size()); |
| 669 |
|
| 670 |
// Test this doesn't crash. |
| 671 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(0), box(10) }), 0); |
| 672 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(100), box(2) }), 100); |
| 673 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(1), box(100) }), 1); |
| 674 |
} |
| 675 |
|
| 676 |
{ |
| 677 |
// Generated from: |
| 678 |
// (module |
| 679 |
// (memory 1) |
| 680 |
// (func (export "i32_load8_s") (param $i i32) (result i32) |
| 681 |
// (i32.store8 (i32.const 8) (get_local $i)) |
| 682 |
// (return (i32.load8_s (i32.const 8))) |
| 683 |
// ) |
| 684 |
// ) |
| 685 |
Vector<uint8_t> vector = { |
| 686 |
0x00, 0x61, 0x73, 0x6d, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x86, 0x80, 0x80, 0x80, 0x00, 0x01, 0x40, |
| 687 |
0x01, 0x01, 0x01, 0x01, 0x03, 0x82, 0x80, 0x80, 0x80, 0x00, 0x01, 0x00, 0x05, 0x83, 0x80, 0x80, |
| 688 |
0x80, 0x00, 0x01, 0x01, 0x01, 0x07, 0x8f, 0x80, 0x80, 0x80, 0x00, 0x01, 0x0b, 0x69, 0x33, 0x32, |
| 689 |
0x5f, 0x6c, 0x6f, 0x61, 0x64, 0x38, 0x5f, 0x73, 0x00, 0x00, 0x0a, 0x95, 0x80, 0x80, 0x80, 0x00, |
| 690 |
0x01, 0x8f, 0x80, 0x80, 0x80, 0x00, 0x00, 0x10, 0x08, 0x14, 0x00, 0x2e, 0x00, 0x00, 0x10, 0x08, |
| 691 |
0x20, 0x00, 0x00, 0x09, 0x0f |
| 692 |
}; |
| 693 |
|
| 694 |
Plan plan(*vm, vector); |
| 695 |
if (plan.result.size() != 1 || !plan.result[0]) { |
| 696 |
dataLogLn("Module failed to compile correctly."); |
| 697 |
CRASH(); |
| 698 |
} |
| 699 |
|
| 700 |
// Test this doesn't crash. |
| 701 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(0) }), 0); |
| 702 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(100) }), 100); |
| 703 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(1) }), 1); |
| 704 |
} |
| 705 |
|
| 706 |
{ |
| 707 |
// Generated from: |
| 708 |
// (module |
| 709 |
// (func "dumb-eq" (param $x i32) (param $y i32) (result i32) |
| 247 |
// (if (i32.eq (get_local $x) (get_local $y)) |
710 |
// (if (i32.eq (get_local $x) (get_local $y)) |
| 248 |
// (then (br 0)) |
711 |
// (then (br 0)) |
| 249 |
// (else (return (i32.const 1)))) |
712 |
// (else (return (i32.const 1)))) |
|
Lines 265-278
static void runWASMTests()
a/Source/JavaScriptCore/testWASM.cpp_sec3
|
| 265 |
} |
728 |
} |
| 266 |
|
729 |
|
| 267 |
// Test this doesn't crash. |
730 |
// Test this doesn't crash. |
| 268 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(0), box(1) }), 1); |
731 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(0), box(1) }), 1); |
| 269 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(1), box(0) }), 1); |
732 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(1), box(0) }), 1); |
| 270 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(2), box(1) }), 1); |
733 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(2), box(1) }), 1); |
| 271 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(1), box(2) }), 1); |
734 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(1), box(2) }), 1); |
| 272 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(2), box(2) }), 0); |
735 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(2), box(2) }), 0); |
| 273 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(1), box(1) }), 0); |
736 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(1), box(1) }), 0); |
| 274 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(2), box(6) }), 1); |
737 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(2), box(6) }), 1); |
| 275 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(100), box(6) }), 1); |
738 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(100), box(6) }), 1); |
| 276 |
} |
739 |
} |
| 277 |
|
740 |
|
| 278 |
{ |
741 |
{ |
|
Lines 306-319
static void runWASMTests()
a/Source/JavaScriptCore/testWASM.cpp_sec4
|
| 306 |
} |
769 |
} |
| 307 |
|
770 |
|
| 308 |
// Test this doesn't crash. |
771 |
// Test this doesn't crash. |
| 309 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(0), box(1) }), 1); |
772 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(0), box(1) }), 1); |
| 310 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(1), box(0) }), 0); |
773 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(1), box(0) }), 0); |
| 311 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(2), box(1) }), 0); |
774 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(2), box(1) }), 0); |
| 312 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(1), box(2) }), 1); |
775 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(1), box(2) }), 1); |
| 313 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(2), box(2) }), 0); |
776 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(2), box(2) }), 0); |
| 314 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(1), box(1) }), 0); |
777 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(1), box(1) }), 0); |
| 315 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(2), box(6) }), 1); |
778 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(2), box(6) }), 1); |
| 316 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(100), box(6) }), 0); |
779 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(100), box(6) }), 0); |
| 317 |
} |
780 |
} |
| 318 |
|
781 |
|
| 319 |
|
782 |
|
|
Lines 333-339
static void runWASMTests()
a/Source/JavaScriptCore/testWASM.cpp_sec5
|
| 333 |
} |
796 |
} |
| 334 |
|
797 |
|
| 335 |
// Test this doesn't crash. |
798 |
// Test this doesn't crash. |
| 336 |
CHECK_EQ(invoke<int>(*plan.result[0], { }), 5); |
799 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { }), 5); |
| 337 |
} |
800 |
} |
| 338 |
|
801 |
|
| 339 |
|
802 |
|
|
Lines 354-360
static void runWASMTests()
a/Source/JavaScriptCore/testWASM.cpp_sec6
|
| 354 |
} |
817 |
} |
| 355 |
|
818 |
|
| 356 |
// Test this doesn't crash. |
819 |
// Test this doesn't crash. |
| 357 |
CHECK_EQ(invoke<int>(*plan.result[0], { }), 11); |
820 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { }), 11); |
| 358 |
} |
821 |
} |
| 359 |
|
822 |
|
| 360 |
{ |
823 |
{ |
|
Lines 374-380
static void runWASMTests()
a/Source/JavaScriptCore/testWASM.cpp_sec7
|
| 374 |
} |
837 |
} |
| 375 |
|
838 |
|
| 376 |
// Test this doesn't crash. |
839 |
// Test this doesn't crash. |
| 377 |
CHECK_EQ(invoke<int>(*plan.result[0], { }), 11); |
840 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { }), 11); |
| 378 |
} |
841 |
} |
| 379 |
|
842 |
|
| 380 |
{ |
843 |
{ |
|
Lines 394-400
static void runWASMTests()
a/Source/JavaScriptCore/testWASM.cpp_sec8
|
| 394 |
} |
857 |
} |
| 395 |
|
858 |
|
| 396 |
// Test this doesn't crash. |
859 |
// Test this doesn't crash. |
| 397 |
CHECK_EQ(invoke<int>(*plan.result[0], { }), 11); |
860 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { }), 11); |
| 398 |
} |
861 |
} |
| 399 |
|
862 |
|
| 400 |
{ |
863 |
{ |
|
Lines 413-422
static void runWASMTests()
a/Source/JavaScriptCore/testWASM.cpp_sec9
|
| 413 |
} |
876 |
} |
| 414 |
|
877 |
|
| 415 |
// Test this doesn't crash. |
878 |
// Test this doesn't crash. |
| 416 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(0), box(1) }), 1); |
879 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(0), box(1) }), 1); |
| 417 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(100), box(1) }), 101); |
880 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(100), box(1) }), 101); |
| 418 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(-1), box(1)}), 0); |
881 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(-1), box(1)}), 0); |
| 419 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(std::numeric_limits<int>::max()), box(1) }), std::numeric_limits<int>::min()); |
882 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(std::numeric_limits<int>::max()), box(1) }), std::numeric_limits<int>::min()); |
| 420 |
} |
883 |
} |
| 421 |
|
884 |
|
| 422 |
{ |
885 |
{ |
|
Lines 442-449
static void runWASMTests()
a/Source/JavaScriptCore/testWASM.cpp_sec10
|
| 442 |
} |
905 |
} |
| 443 |
|
906 |
|
| 444 |
// Test this doesn't crash. |
907 |
// Test this doesn't crash. |
| 445 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(0) }), 0); |
908 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(0) }), 0); |
| 446 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(10) }), 10); |
909 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(10) }), 10); |
| 447 |
} |
910 |
} |
| 448 |
|
911 |
|
| 449 |
{ |
912 |
{ |
|
Lines 478-487
static void runWASMTests()
a/Source/JavaScriptCore/testWASM.cpp_sec11
|
| 478 |
} |
941 |
} |
| 479 |
|
942 |
|
| 480 |
// Test this doesn't crash. |
943 |
// Test this doesn't crash. |
| 481 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(0) }), 0); |
944 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(0) }), 0); |
| 482 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(1) }), 1); |
945 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(1) }), 1); |
| 483 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(2)}), 3); |
946 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(2)}), 3); |
| 484 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(100) }), 5050); |
947 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(100) }), 5050); |
| 485 |
} |
948 |
} |
| 486 |
|
949 |
|
| 487 |
{ |
950 |
{ |
|
Lines 522-535
static void runWASMTests()
a/Source/JavaScriptCore/testWASM.cpp_sec12
|
| 522 |
} |
985 |
} |
| 523 |
|
986 |
|
| 524 |
// Test this doesn't crash. |
987 |
// Test this doesn't crash. |
| 525 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(0), box(1) }), 0); |
988 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(0), box(1) }), 0); |
| 526 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(1), box(0) }), 0); |
989 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(1), box(0) }), 0); |
| 527 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(2), box(1) }), 2); |
990 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(2), box(1) }), 2); |
| 528 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(1), box(2) }), 2); |
991 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(1), box(2) }), 2); |
| 529 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(2), box(2) }), 4); |
992 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(2), box(2) }), 4); |
| 530 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(2), box(6) }), 12); |
993 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(2), box(6) }), 12); |
| 531 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(100), box(6) }), 600); |
994 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(100), box(6) }), 600); |
| 532 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(100), box(100) }), 10000); |
995 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(100), box(100) }), 10000); |
| 533 |
} |
996 |
} |
| 534 |
|
997 |
|
| 535 |
{ |
998 |
{ |
|
Lines 575-588
static void runWASMTests()
a/Source/JavaScriptCore/testWASM.cpp_sec13
|
| 575 |
} |
1038 |
} |
| 576 |
|
1039 |
|
| 577 |
// Test this doesn't crash. |
1040 |
// Test this doesn't crash. |
| 578 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(0), box(1) }), 1); |
1041 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(0), box(1) }), 1); |
| 579 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(1), box(0) }), 0); |
1042 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(1), box(0) }), 0); |
| 580 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(2), box(1) }), 0); |
1043 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(2), box(1) }), 0); |
| 581 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(1), box(2) }), 1); |
1044 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(1), box(2) }), 1); |
| 582 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(2), box(2) }), 0); |
1045 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(2), box(2) }), 0); |
| 583 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(1), box(1) }), 0); |
1046 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(1), box(1) }), 0); |
| 584 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(2), box(6) }), 1); |
1047 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(2), box(6) }), 1); |
| 585 |
CHECK_EQ(invoke<int>(*plan.result[0], { box(100), box(6) }), 0); |
1048 |
CHECK_EQ(invoke<int>(*plan.result[0]->jsEntryPoint, { box(100), box(6) }), 0); |
| 586 |
} |
1049 |
} |
| 587 |
|
1050 |
|
| 588 |
} |
1051 |
} |
|
Lines 596-602
int main(int argc, char** argv)
a/Source/JavaScriptCore/testWASM.cpp_sec14
|
| 596 |
if (options.m_runLEBTests) |
1059 |
if (options.m_runLEBTests) |
| 597 |
runLEBTests(); |
1060 |
runLEBTests(); |
| 598 |
|
1061 |
|
| 599 |
|
|
|
| 600 |
if (options.m_runWASMTests) { |
1062 |
if (options.m_runWASMTests) { |
| 601 |
#if ENABLE(WEBASSEMBLY) |
1063 |
#if ENABLE(WEBASSEMBLY) |
| 602 |
JSC::initializeThreading(); |
1064 |
JSC::initializeThreading(); |