OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 24459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
24470 v8::HandleScope scope(CcTest::isolate()); | 24470 v8::HandleScope scope(CcTest::isolate()); |
24471 RandomLengthOneByteResource* r = | 24471 RandomLengthOneByteResource* r = |
24472 new RandomLengthOneByteResource(i::String::kMaxLength); | 24472 new RandomLengthOneByteResource(i::String::kMaxLength); |
24473 v8::Local<v8::String> str = v8::String::NewExternal(CcTest::isolate(), r); | 24473 v8::Local<v8::String> str = v8::String::NewExternal(CcTest::isolate(), r); |
24474 CHECK(!str.IsEmpty()); | 24474 CHECK(!str.IsEmpty()); |
24475 v8::TryCatch try_catch; | 24475 v8::TryCatch try_catch; |
24476 v8::Local<v8::String> result = v8::String::Concat(str, str); | 24476 v8::Local<v8::String> result = v8::String::Concat(str, str); |
24477 CHECK(result.IsEmpty()); | 24477 CHECK(result.IsEmpty()); |
24478 CHECK(!try_catch.HasCaught()); | 24478 CHECK(!try_catch.HasCaught()); |
24479 } | 24479 } |
| 24480 |
| 24481 |
| 24482 TEST(TurboAsmDisablesNeuter) { |
| 24483 v8::V8::Initialize(); |
| 24484 v8::HandleScope scope(CcTest::isolate()); |
| 24485 LocalContext context; |
| 24486 bool should_be_neuterable = !i::FLAG_turbo_asm; |
| 24487 |
| 24488 const char* load = |
| 24489 "function Module(stdlib, foreign, heap) {" |
| 24490 " 'use asm';" |
| 24491 " var MEM32 = new stdlib.Int32Array(heap);" |
| 24492 " function load() { return MEM32[0]; }" |
| 24493 " return { load: load };" |
| 24494 "}" |
| 24495 "var buffer = new ArrayBuffer(4);" |
| 24496 "Module(this, {}, buffer).load();" |
| 24497 "buffer"; |
| 24498 |
| 24499 v8::Local<v8::ArrayBuffer> result = CompileRun(load).As<v8::ArrayBuffer>(); |
| 24500 CHECK_EQ(should_be_neuterable, result->IsNeuterable()); |
| 24501 |
| 24502 const char* store = |
| 24503 "function Module(stdlib, foreign, heap) {" |
| 24504 " 'use asm';" |
| 24505 " var MEM32 = new stdlib.Int32Array(heap);" |
| 24506 " function store() { MEM32[0] = 0; }" |
| 24507 " return { store: store };" |
| 24508 "}" |
| 24509 "var buffer = new ArrayBuffer(4);" |
| 24510 "Module(this, {}, buffer).store();" |
| 24511 "buffer"; |
| 24512 |
| 24513 result = CompileRun(store).As<v8::ArrayBuffer>(); |
| 24514 CHECK_EQ(should_be_neuterable, result->IsNeuterable()); |
| 24515 } |
OLD | NEW |