| 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 3275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3286 CHECK_EQ(100, result->Int32Value()); | 3286 CHECK_EQ(100, result->Int32Value()); |
| 3287 CHECK_EQ(0xBB, my_data[0]); | 3287 CHECK_EQ(0xBB, my_data[0]); |
| 3288 CHECK_EQ(0xCC, my_data[1]); | 3288 CHECK_EQ(0xCC, my_data[1]); |
| 3289 my_data[0] = 0xCC; | 3289 my_data[0] = 0xCC; |
| 3290 my_data[1] = 0x11; | 3290 my_data[1] = 0x11; |
| 3291 result = CompileRun("u8_b[0] + u8_b[1]"); | 3291 result = CompileRun("u8_b[0] + u8_b[1]"); |
| 3292 CHECK_EQ(0xDD, result->Int32Value()); | 3292 CHECK_EQ(0xDD, result->Int32Value()); |
| 3293 } | 3293 } |
| 3294 | 3294 |
| 3295 | 3295 |
| 3296 THREADED_TEST(ArrayBuffer_DisableNeuter) { |
| 3297 LocalContext env; |
| 3298 v8::Isolate* isolate = env->GetIsolate(); |
| 3299 v8::HandleScope handle_scope(isolate); |
| 3300 |
| 3301 i::ScopedVector<uint8_t> my_data(100); |
| 3302 memset(my_data.start(), 0, 100); |
| 3303 Local<v8::ArrayBuffer> ab = |
| 3304 v8::ArrayBuffer::New(isolate, my_data.start(), 100); |
| 3305 CHECK(ab->IsNeuterable()); |
| 3306 |
| 3307 i::Handle<i::JSArrayBuffer> buf = v8::Utils::OpenHandle(*ab); |
| 3308 buf->set_is_neuterable(false); |
| 3309 |
| 3310 CHECK(!ab->IsNeuterable()); |
| 3311 } |
| 3312 |
| 3313 |
| 3296 static void CheckDataViewIsNeutered(v8::Handle<v8::DataView> dv) { | 3314 static void CheckDataViewIsNeutered(v8::Handle<v8::DataView> dv) { |
| 3297 CHECK_EQ(0, static_cast<int>(dv->ByteLength())); | 3315 CHECK_EQ(0, static_cast<int>(dv->ByteLength())); |
| 3298 CHECK_EQ(0, static_cast<int>(dv->ByteOffset())); | 3316 CHECK_EQ(0, static_cast<int>(dv->ByteOffset())); |
| 3299 } | 3317 } |
| 3300 | 3318 |
| 3301 | 3319 |
| 3302 static void CheckIsNeutered(v8::Handle<v8::TypedArray> ta) { | 3320 static void CheckIsNeutered(v8::Handle<v8::TypedArray> ta) { |
| 3303 CHECK_EQ(0, static_cast<int>(ta->ByteLength())); | 3321 CHECK_EQ(0, static_cast<int>(ta->ByteLength())); |
| 3304 CHECK_EQ(0, static_cast<int>(ta->Length())); | 3322 CHECK_EQ(0, static_cast<int>(ta->Length())); |
| 3305 CHECK_EQ(0, static_cast<int>(ta->ByteOffset())); | 3323 CHECK_EQ(0, static_cast<int>(ta->ByteOffset())); |
| (...skipping 20712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 24018 char chunk2[] = | 24036 char chunk2[] = |
| 24019 "XX\xec\x92\x81r = 13;\n" | 24037 "XX\xec\x92\x81r = 13;\n" |
| 24020 " return foob\xec\x92\x81\xec\x92\x81r;\n" | 24038 " return foob\xec\x92\x81\xec\x92\x81r;\n" |
| 24021 "}\n"; | 24039 "}\n"; |
| 24022 chunk1[strlen(chunk1) - 1] = reference[0]; | 24040 chunk1[strlen(chunk1) - 1] = reference[0]; |
| 24023 chunk2[0] = reference[1]; | 24041 chunk2[0] = reference[1]; |
| 24024 chunk2[1] = reference[2]; | 24042 chunk2[1] = reference[2]; |
| 24025 const char* chunks[] = {chunk1, chunk2, "foo();", NULL}; | 24043 const char* chunks[] = {chunk1, chunk2, "foo();", NULL}; |
| 24026 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8); | 24044 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8); |
| 24027 } | 24045 } |
| OLD | NEW |