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

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

Issue 52004: Fixed windows build. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 9 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 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 LocalContext env; 1334 LocalContext env;
1335 env->Global()->Set(v8_str("ext"), ext); 1335 env->Global()->Set(v8_str("ext"), ext);
1336 Local<Value> reext_obj = Script::Compile(v8_str("this.ext"))->Run(); 1336 Local<Value> reext_obj = Script::Compile(v8_str("this.ext"))->Run();
1337 v8::Handle<v8::External> reext = v8::Handle<v8::External>::Cast(reext_obj); 1337 v8::Handle<v8::External> reext = v8::Handle<v8::External>::Cast(reext_obj);
1338 int* ptr = static_cast<int*>(reext->Value()); 1338 int* ptr = static_cast<int*>(reext->Value());
1339 CHECK_EQ(x, 3); 1339 CHECK_EQ(x, 3);
1340 *ptr = 10; 1340 *ptr = 10;
1341 CHECK_EQ(x, 10); 1341 CHECK_EQ(x, 10);
1342 1342
1343 // Make sure unaligned pointers are wrapped properly. 1343 // Make sure unaligned pointers are wrapped properly.
1344 char* data = strdup("0123456789"); 1344 char* data = i::StrDup("0123456789");
1345 Local<v8::External> zero = v8::External::New(&data[0]); 1345 Local<v8::External> zero = v8::External::New(&data[0]);
1346 Local<v8::External> one = v8::External::New(&data[1]); 1346 Local<v8::External> one = v8::External::New(&data[1]);
1347 Local<v8::External> two = v8::External::New(&data[2]); 1347 Local<v8::External> two = v8::External::New(&data[2]);
1348 Local<v8::External> three = v8::External::New(&data[3]); 1348 Local<v8::External> three = v8::External::New(&data[3]);
1349 1349
1350 char* char_ptr = reinterpret_cast<char*>(zero->Value()); 1350 char* char_ptr = reinterpret_cast<char*>(zero->Value());
1351 CHECK_EQ('0', *char_ptr); 1351 CHECK_EQ('0', *char_ptr);
1352 char_ptr = reinterpret_cast<char*>(one->Value()); 1352 char_ptr = reinterpret_cast<char*>(one->Value());
1353 CHECK_EQ('1', *char_ptr); 1353 CHECK_EQ('1', *char_ptr);
1354 char_ptr = reinterpret_cast<char*>(two->Value()); 1354 char_ptr = reinterpret_cast<char*>(two->Value());
1355 CHECK_EQ('2', *char_ptr); 1355 CHECK_EQ('2', *char_ptr);
1356 char_ptr = reinterpret_cast<char*>(three->Value()); 1356 char_ptr = reinterpret_cast<char*>(three->Value());
1357 CHECK_EQ('3', *char_ptr); 1357 CHECK_EQ('3', *char_ptr);
1358 free(data); 1358 i::DeleteArray(data);
1359 } 1359 }
1360 1360
1361 1361
1362 THREADED_TEST(GlobalHandle) { 1362 THREADED_TEST(GlobalHandle) {
1363 v8::Persistent<String> global; 1363 v8::Persistent<String> global;
1364 { 1364 {
1365 v8::HandleScope scope; 1365 v8::HandleScope scope;
1366 Local<String> str = v8_str("str"); 1366 Local<String> str = v8_str("str");
1367 global = v8::Persistent<String>::New(str); 1367 global = v8::Persistent<String>::New(str);
1368 } 1368 }
(...skipping 4719 matching lines...) Expand 10 before | Expand all | Expand 10 after
6088 6088
6089 // Local context should still be live. 6089 // Local context should still be live.
6090 CHECK(!local_env.IsEmpty()); 6090 CHECK(!local_env.IsEmpty());
6091 local_env->Enter(); 6091 local_env->Enter();
6092 6092
6093 // Should complete without problems. 6093 // Should complete without problems.
6094 RegExpStringModificationTest().RunTest(); 6094 RegExpStringModificationTest().RunTest();
6095 6095
6096 local_env->Exit(); 6096 local_env->Exit();
6097 } 6097 }
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