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 24465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
24476 RandomLengthOneByteResource* r = | 24476 RandomLengthOneByteResource* r = |
24477 new RandomLengthOneByteResource(i::String::kMaxLength); | 24477 new RandomLengthOneByteResource(i::String::kMaxLength); |
24478 v8::Local<v8::String> str = v8::String::NewExternal(CcTest::isolate(), r); | 24478 v8::Local<v8::String> str = v8::String::NewExternal(CcTest::isolate(), r); |
24479 CHECK(!str.IsEmpty()); | 24479 CHECK(!str.IsEmpty()); |
24480 v8::TryCatch try_catch; | 24480 v8::TryCatch try_catch; |
24481 v8::Local<v8::String> result = v8::String::Concat(str, str); | 24481 v8::Local<v8::String> result = v8::String::Concat(str, str); |
24482 CHECK(result.IsEmpty()); | 24482 CHECK(result.IsEmpty()); |
24483 CHECK(!try_catch.HasCaught()); | 24483 CHECK(!try_catch.HasCaught()); |
24484 } | 24484 } |
24485 | 24485 |
24486 #if V8_TURBOFAN_TARGET | |
24486 | 24487 |
24487 TEST(TurboAsmDisablesNeuter) { | 24488 TEST(TurboAsmDisablesNeuter) { |
24488 v8::V8::Initialize(); | 24489 v8::V8::Initialize(); |
24489 v8::HandleScope scope(CcTest::isolate()); | 24490 v8::HandleScope scope(CcTest::isolate()); |
24490 LocalContext context; | 24491 LocalContext context; |
24491 bool should_be_neuterable = !i::FLAG_turbo_asm; | 24492 bool should_be_neuterable = !i::FLAG_turbo_asm; |
dcarney
2014/12/08 10:21:58
please just make this
#if V8_TURBOFAN_TARGET
bool
| |
24492 | 24493 |
24493 const char* load = | 24494 const char* load = |
24494 "function Module(stdlib, foreign, heap) {" | 24495 "function Module(stdlib, foreign, heap) {" |
24495 " 'use asm';" | 24496 " 'use asm';" |
24496 " var MEM32 = new stdlib.Int32Array(heap);" | 24497 " var MEM32 = new stdlib.Int32Array(heap);" |
24497 " function load() { return MEM32[0]; }" | 24498 " function load() { return MEM32[0]; }" |
24498 " return { load: load };" | 24499 " return { load: load };" |
24499 "}" | 24500 "}" |
24500 "var buffer = new ArrayBuffer(4);" | 24501 "var buffer = new ArrayBuffer(4);" |
24501 "Module(this, {}, buffer).load();" | 24502 "Module(this, {}, buffer).load();" |
(...skipping 10 matching lines...) Expand all Loading... | |
24512 " return { store: store };" | 24513 " return { store: store };" |
24513 "}" | 24514 "}" |
24514 "var buffer = new ArrayBuffer(4);" | 24515 "var buffer = new ArrayBuffer(4);" |
24515 "Module(this, {}, buffer).store();" | 24516 "Module(this, {}, buffer).store();" |
24516 "buffer"; | 24517 "buffer"; |
24517 | 24518 |
24518 result = CompileRun(store).As<v8::ArrayBuffer>(); | 24519 result = CompileRun(store).As<v8::ArrayBuffer>(); |
24519 CHECK_EQ(should_be_neuterable, result->IsNeuterable()); | 24520 CHECK_EQ(should_be_neuterable, result->IsNeuterable()); |
24520 } | 24521 } |
24521 | 24522 |
24523 #endif | |
24522 | 24524 |
24523 TEST(GetPrototypeAccessControl) { | 24525 TEST(GetPrototypeAccessControl) { |
24524 i::FLAG_allow_natives_syntax = true; | 24526 i::FLAG_allow_natives_syntax = true; |
24525 v8::Isolate* isolate = CcTest::isolate(); | 24527 v8::Isolate* isolate = CcTest::isolate(); |
24526 v8::HandleScope handle_scope(isolate); | 24528 v8::HandleScope handle_scope(isolate); |
24527 LocalContext env; | 24529 LocalContext env; |
24528 | 24530 |
24529 v8::Handle<v8::ObjectTemplate> obj_template = | 24531 v8::Handle<v8::ObjectTemplate> obj_template = |
24530 v8::ObjectTemplate::New(isolate); | 24532 v8::ObjectTemplate::New(isolate); |
24531 obj_template->SetAccessCheckCallbacks(BlockEverythingNamed, | 24533 obj_template->SetAccessCheckCallbacks(BlockEverythingNamed, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
24564 | 24566 |
24565 v8::Handle<v8::Value> result = CompileRun("%_GetPrototype(object)"); | 24567 v8::Handle<v8::Value> result = CompileRun("%_GetPrototype(object)"); |
24566 CHECK(result->Equals(proto2)); | 24568 CHECK(result->Equals(proto2)); |
24567 | 24569 |
24568 result = CompileRun( | 24570 result = CompileRun( |
24569 "function f() { return %_GetPrototype(object); }" | 24571 "function f() { return %_GetPrototype(object); }" |
24570 "%OptimizeFunctionOnNextCall(f);" | 24572 "%OptimizeFunctionOnNextCall(f);" |
24571 "f()"); | 24573 "f()"); |
24572 CHECK(result->Equals(proto2)); | 24574 CHECK(result->Equals(proto2)); |
24573 } | 24575 } |
OLD | NEW |