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 24095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
24106 v8::String::NewExternalOneByte(CcTest::isolate(), r).ToLocalChecked(); | 24106 v8::String::NewExternalOneByte(CcTest::isolate(), r).ToLocalChecked(); |
24107 CHECK(!str.IsEmpty()); | 24107 CHECK(!str.IsEmpty()); |
24108 v8::TryCatch try_catch(CcTest::isolate()); | 24108 v8::TryCatch try_catch(CcTest::isolate()); |
24109 v8::Local<v8::String> result = v8::String::Concat(str, str); | 24109 v8::Local<v8::String> result = v8::String::Concat(str, str); |
24110 CHECK(result.IsEmpty()); | 24110 CHECK(result.IsEmpty()); |
24111 CHECK(!try_catch.HasCaught()); | 24111 CHECK(!try_catch.HasCaught()); |
24112 } | 24112 } |
24113 | 24113 |
24114 | 24114 |
24115 TEST(TurboAsmDisablesNeuter) { | 24115 TEST(TurboAsmDisablesNeuter) { |
| 24116 i::FLAG_allow_natives_syntax = true; |
24116 v8::V8::Initialize(); | 24117 v8::V8::Initialize(); |
24117 v8::HandleScope scope(CcTest::isolate()); | 24118 v8::HandleScope scope(CcTest::isolate()); |
24118 LocalContext context; | 24119 LocalContext context; |
24119 bool should_be_neuterable = !i::FLAG_turbo_asm; | 24120 bool should_be_neuterable = !i::FLAG_turbo_asm; |
24120 const char* load = | 24121 const char* load = |
24121 "function Module(stdlib, foreign, heap) {" | 24122 "function Module(stdlib, foreign, heap) {" |
24122 " 'use asm';" | 24123 " 'use asm';" |
24123 " var MEM32 = new stdlib.Int32Array(heap);" | 24124 " var MEM32 = new stdlib.Int32Array(heap);" |
24124 " function load() { return MEM32[0]; }" | 24125 " function load() { return MEM32[0]; }" |
24125 " return { load: load };" | 24126 " return { load: load };" |
24126 "}" | 24127 "}" |
24127 "var buffer = new ArrayBuffer(4);" | 24128 "var buffer = new ArrayBuffer(4);" |
24128 "Module(this, {}, buffer).load();" | 24129 "var module = Module(this, {}, buffer);" |
| 24130 "%OptimizeFunctionOnNextCall(module.load);" |
| 24131 "module.load();" |
24129 "buffer"; | 24132 "buffer"; |
24130 | 24133 |
24131 i::FLAG_turbo_osr = false; // TODO(titzer): test requires eager TF. | |
24132 v8::Local<v8::ArrayBuffer> result = CompileRun(load).As<v8::ArrayBuffer>(); | 24134 v8::Local<v8::ArrayBuffer> result = CompileRun(load).As<v8::ArrayBuffer>(); |
24133 CHECK_EQ(should_be_neuterable, result->IsNeuterable()); | 24135 CHECK_EQ(should_be_neuterable, result->IsNeuterable()); |
24134 | 24136 |
24135 const char* store = | 24137 const char* store = |
24136 "function Module(stdlib, foreign, heap) {" | 24138 "function Module(stdlib, foreign, heap) {" |
24137 " 'use asm';" | 24139 " 'use asm';" |
24138 " var MEM32 = new stdlib.Int32Array(heap);" | 24140 " var MEM32 = new stdlib.Int32Array(heap);" |
24139 " function store() { MEM32[0] = 0; }" | 24141 " function store() { MEM32[0] = 0; }" |
24140 " return { store: store };" | 24142 " return { store: store };" |
24141 "}" | 24143 "}" |
24142 "var buffer = new ArrayBuffer(4);" | 24144 "var buffer = new ArrayBuffer(4);" |
24143 "Module(this, {}, buffer).store();" | 24145 "var module = Module(this, {}, buffer);" |
| 24146 "%OptimizeFunctionOnNextCall(module.store);" |
| 24147 "module.store();" |
24144 "buffer"; | 24148 "buffer"; |
24145 | 24149 |
24146 i::FLAG_turbo_osr = false; // TODO(titzer): test requires eager TF. | |
24147 result = CompileRun(store).As<v8::ArrayBuffer>(); | 24150 result = CompileRun(store).As<v8::ArrayBuffer>(); |
24148 CHECK_EQ(should_be_neuterable, result->IsNeuterable()); | 24151 CHECK_EQ(should_be_neuterable, result->IsNeuterable()); |
24149 } | 24152 } |
24150 | 24153 |
24151 | 24154 |
24152 TEST(GetPrototypeAccessControl) { | 24155 TEST(GetPrototypeAccessControl) { |
24153 i::FLAG_allow_natives_syntax = true; | 24156 i::FLAG_allow_natives_syntax = true; |
24154 v8::Isolate* isolate = CcTest::isolate(); | 24157 v8::Isolate* isolate = CcTest::isolate(); |
24155 v8::HandleScope handle_scope(isolate); | 24158 v8::HandleScope handle_scope(isolate); |
24156 LocalContext env; | 24159 LocalContext env; |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
24989 } | 24992 } |
24990 | 24993 |
24991 TEST(PrivateForApiIsNumber) { | 24994 TEST(PrivateForApiIsNumber) { |
24992 LocalContext context; | 24995 LocalContext context; |
24993 v8::Isolate* isolate = CcTest::isolate(); | 24996 v8::Isolate* isolate = CcTest::isolate(); |
24994 v8::HandleScope scope(isolate); | 24997 v8::HandleScope scope(isolate); |
24995 | 24998 |
24996 // Shouldn't crash. | 24999 // Shouldn't crash. |
24997 v8::Private::ForApi(isolate, v8_str("42")); | 25000 v8::Private::ForApi(isolate, v8_str("42")); |
24998 } | 25001 } |
OLD | NEW |