Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Side by Side Diff: test/cctest/test-api.cc

Issue 14392013: Win64 build (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2245 matching lines...) Expand 10 before | Expand all | Expand 10 after
2256 THREADED_TEST(ArrayBuffer) { 2256 THREADED_TEST(ArrayBuffer) {
2257 i::FLAG_harmony_typed_arrays = true; 2257 i::FLAG_harmony_typed_arrays = true;
2258 2258
2259 LocalContext env; 2259 LocalContext env;
2260 v8::Isolate* isolate = env->GetIsolate(); 2260 v8::Isolate* isolate = env->GetIsolate();
2261 v8::HandleScope handle_scope(isolate); 2261 v8::HandleScope handle_scope(isolate);
2262 2262
2263 Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(1024); 2263 Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(1024);
2264 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); 2264 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
2265 2265
2266 CHECK_EQ(1024, ab->ByteLength()); 2266 CHECK_EQ(1024, static_cast<int>(ab->ByteLength()));
2267 uint8_t* data = static_cast<uint8_t*>(ab->Data()); 2267 uint8_t* data = static_cast<uint8_t*>(ab->Data());
2268 ASSERT(data != NULL); 2268 ASSERT(data != NULL);
2269 env->Global()->Set(v8_str("ab"), ab); 2269 env->Global()->Set(v8_str("ab"), ab);
2270 2270
2271 v8::Handle<v8::Value> result = CompileRun("ab.byteLength"); 2271 v8::Handle<v8::Value> result = CompileRun("ab.byteLength");
2272 CHECK_EQ(1024, result->Int32Value()); 2272 CHECK_EQ(1024, result->Int32Value());
2273 2273
2274 result = CompileRun("var u8 = new __Uint8Array(ab);" 2274 result = CompileRun("var u8 = new __Uint8Array(ab);"
2275 "u8[0] = 0xFF;" 2275 "u8[0] = 0xFF;"
2276 "u8[1] = 0xAA;" 2276 "u8[1] = 0xAA;"
2277 "u8.length"); 2277 "u8.length");
2278 CHECK_EQ(1024, result->Int32Value()); 2278 CHECK_EQ(1024, result->Int32Value());
2279 CHECK_EQ(0xFF, data[0]); 2279 CHECK_EQ(0xFF, data[0]);
2280 CHECK_EQ(0xAA, data[1]); 2280 CHECK_EQ(0xAA, data[1]);
2281 data[0] = 0xCC; 2281 data[0] = 0xCC;
2282 data[1] = 0x11; 2282 data[1] = 0x11;
2283 result = CompileRun("u8[0] + u8[1]"); 2283 result = CompileRun("u8[0] + u8[1]");
2284 CHECK_EQ(0xDD, result->Int32Value()); 2284 CHECK_EQ(0xDD, result->Int32Value());
2285 2285
2286 result = CompileRun("var ab1 = new __ArrayBuffer(2);" 2286 result = CompileRun("var ab1 = new __ArrayBuffer(2);"
2287 "var u8_a = new __Uint8Array(ab1);" 2287 "var u8_a = new __Uint8Array(ab1);"
2288 "u8_a[0] = 0xAA;" 2288 "u8_a[0] = 0xAA;"
2289 "u8_a[1] = 0xFF; u8_a.buffer"); 2289 "u8_a[1] = 0xFF; u8_a.buffer");
2290 Local<v8::ArrayBuffer> ab1 = v8::ArrayBuffer::Cast(*result); 2290 Local<v8::ArrayBuffer> ab1 = v8::ArrayBuffer::Cast(*result);
2291 CHECK_EQ(2, ab1->ByteLength()); 2291 CHECK_EQ(2, static_cast<int>(ab1->ByteLength()));
2292 uint8_t* ab1_data = static_cast<uint8_t*>(ab1->Data()); 2292 uint8_t* ab1_data = static_cast<uint8_t*>(ab1->Data());
2293 CHECK_EQ(0xAA, ab1_data[0]); 2293 CHECK_EQ(0xAA, ab1_data[0]);
2294 CHECK_EQ(0xFF, ab1_data[1]); 2294 CHECK_EQ(0xFF, ab1_data[1]);
2295 ab1_data[0] = 0xCC; 2295 ab1_data[0] = 0xCC;
2296 ab1_data[1] = 0x11; 2296 ab1_data[1] = 0x11;
2297 result = CompileRun("u8_a[0] + u8_a[1]"); 2297 result = CompileRun("u8_a[0] + u8_a[1]");
2298 CHECK_EQ(0xDD, result->Int32Value()); 2298 CHECK_EQ(0xDD, result->Int32Value());
2299 2299
2300 uint8_t* my_data = new uint8_t[100]; 2300 uint8_t* my_data = new uint8_t[100];
2301 memset(my_data, 0, 100); 2301 memset(my_data, 0, 100);
2302 Local<v8::ArrayBuffer> ab3 = v8::ArrayBuffer::New(my_data, 100); 2302 Local<v8::ArrayBuffer> ab3 = v8::ArrayBuffer::New(my_data, 100);
2303 CHECK_EQ(100, ab3->ByteLength()); 2303 CHECK_EQ(100, static_cast<int>(ab3->ByteLength()));
2304 CHECK_EQ(my_data, ab3->Data()); 2304 CHECK_EQ(my_data, ab3->Data());
2305 env->Global()->Set(v8_str("ab3"), ab3); 2305 env->Global()->Set(v8_str("ab3"), ab3);
2306 result = CompileRun("var u8_b = new __Uint8Array(ab3);" 2306 result = CompileRun("var u8_b = new __Uint8Array(ab3);"
2307 "u8_b[0] = 0xBB;" 2307 "u8_b[0] = 0xBB;"
2308 "u8_b[1] = 0xCC;" 2308 "u8_b[1] = 0xCC;"
2309 "u8_b.length"); 2309 "u8_b.length");
2310 CHECK_EQ(100, result->Int32Value()); 2310 CHECK_EQ(100, result->Int32Value());
2311 CHECK_EQ(0xBB, my_data[0]); 2311 CHECK_EQ(0xBB, my_data[0]);
2312 CHECK_EQ(0xCC, my_data[1]); 2312 CHECK_EQ(0xCC, my_data[1]);
2313 my_data[0] = 0xCC; 2313 my_data[0] = 0xCC;
(...skipping 16443 matching lines...) Expand 10 before | Expand all | Expand 10 after
18757 i::Semaphore* sem_; 18757 i::Semaphore* sem_;
18758 volatile int sem_value_; 18758 volatile int sem_value_;
18759 }; 18759 };
18760 18760
18761 18761
18762 THREADED_TEST(SemaphoreInterruption) { 18762 THREADED_TEST(SemaphoreInterruption) {
18763 ThreadInterruptTest().RunTest(); 18763 ThreadInterruptTest().RunTest();
18764 } 18764 }
18765 18765
18766 #endif // WIN32 18766 #endif // WIN32
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698